Fixed missing contents on media page

This commit is contained in:
Benjamin Barth committed 2015-08-21 15:08:56 +02:00
1 parent 6cf91f4725
commit 1081f9fa2f
2 files changed
+44 -1

No files matched your search

@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.ui.shared.media;
import java.util.Date;
import com.sap.sailing.gwt.ui.shared.general.EventReferenceDTO;
import com.sap.sse.gwt.client.media.AbstractMediaDTO;
import com.sap.sse.gwt.client.media.ImageDTO;
public class SailingImageDTO extends ImageDTO {
@@ -21,4 +22,25 @@ public class SailingImageDTO extends ImageDTO {
public EventReferenceDTO getEventRef() {
return eventRef;
}
// TODO Move to {@link AbstractMediaDTO} ---
@Override
public int compareTo(AbstractMediaDTO o) {
int createdAtDateComp = compareToByCreatedAtDate(o);
return createdAtDateComp == 0 ? getSourceRef().compareTo(o.getSourceRef()) : createdAtDateComp;
}
private int compareToByCreatedAtDate(AbstractMediaDTO o) {
if(getCreatedAtDate() == o.getCreatedAtDate()) {
return 0;
}
if(getCreatedAtDate() == null) {
return 1;
}
if(o.getCreatedAtDate() == null) {
return -1;
}
return -getCreatedAtDate().compareTo(o.getCreatedAtDate());
}
// TODO END ---
}
@@ -4,6 +4,7 @@ import java.util.Date;
import com.sap.sailing.gwt.ui.shared.general.EventReferenceDTO;
import com.sap.sse.common.media.MimeType;
import com.sap.sse.gwt.client.media.AbstractMediaDTO;
import com.sap.sse.gwt.client.media.VideoDTO;
public class SailingVideoDTO extends VideoDTO {
@@ -23,5 +24,25 @@ public class SailingVideoDTO extends VideoDTO {
public EventReferenceDTO getEventRef() {
return eventRef;
}
// TODO Move to {@link AbstractMediaDTO} ---
@Override
public int compareTo(AbstractMediaDTO o) {
int createdAtDateComp = compareToByCreatedAtDate(o);
return createdAtDateComp == 0 ? getSourceRef().compareTo(o.getSourceRef()) : createdAtDateComp;
}
private int compareToByCreatedAtDate(AbstractMediaDTO o) {
if(getCreatedAtDate() == o.getCreatedAtDate()) {
return 0;
}
if(getCreatedAtDate() == null) {
return 1;
}
if(o.getCreatedAtDate() == null) {
return -1;
}
return -getCreatedAtDate().compareTo(o.getCreatedAtDate());
}
// TODO END ---
}