public int orientation;
@ApiModelProperty
public String time_type;
public PhotoItem(final PhotoService.Photo photo) {
final AbstractPhotoFacetVO photoFacetVO = photo.getAbstractPhotoFacetVO();
this.id = photo.getConnector().prettyName() + "." + photo.getObjectType().getName() + "." + photoFacetVO.id;
this.description = photoFacetVO.description == null ? "" : photoFacetVO.description;
this.comment = photoFacetVO.comment == null ? "" : photoFacetVO.comment;
this.begin_d = photoFacetVO.start / 1000.0; // convert millis to seconds
this.begin = DATE_TIME_FORMATTER.print(photoFacetVO.start);
this.end_d = this.begin_d;
this.end = this.begin;
this.dev_id = photo.getConnector().getName();
this.dev_nickname = photo.getConnector().prettyName();
this.object_type_name = photo.getObjectType().getName();
this.time_type = photoFacetVO.timeType;
this.channel_name = PhotoService.DEFAULT_PHOTOS_CHANNEL_NAME; // photo channels are always named the same
final List<DimensionModel> thumbnailSizes = photoFacetVO.getThumbnailSizes();
if ((thumbnailSizes != null) && (!thumbnailSizes.isEmpty())) {
int i = 0;
for (final DimensionModel thumbnailDimension : thumbnailSizes) {
final String url = photoFacetVO.getThumbnail(i);
thumbnails.add(new PhotoItemThumbnail(url, thumbnailDimension.width, thumbnailDimension.height));
i++;
}
}
this.url = photoFacetVO.getPhotoUrl();
// copy the tags
final SortedSet<String> facetTags = photoFacetVO.getTags();
if ((facetTags != null) && (!facetTags.isEmpty())) {
this.tags.addAll(facetTags);
}
// get the image orientation, defaulting to upright portrait
final ImageOrientation tempOrientation = photoFacetVO.getOrientation();
this.orientation = (tempOrientation == null ? ImageOrientation.ORIENTATION_1 : tempOrientation).getId();
}