Commit 29fb29f3 authored by Matija Obreza's avatar Matija Obreza
Browse files

ImageMetadata uses Integers instead of ints

parent 63a03859
......@@ -27,14 +27,14 @@ public interface ImageMetadata extends BaseMetadata {
*
* @return image width in pixels.
*/
int getWidth();
Integer getWidth();
/**
* Gets the height.
*
* @return image height in pixels.
*/
int getHeight();
Integer getHeight();
/**
* Get image orientation. Landscape = width is greater than height. Portrait = width is less or equal height;
......
......@@ -70,7 +70,7 @@ public class RepositoryImage extends RepositoryFile implements ImageMetadata {
* @see org.genesys2.server.filerepository.metadata.ImageMetadata#getWidth()
*/
@Override
public int getWidth() {
public Integer getWidth() {
return width;
}
......@@ -90,7 +90,7 @@ public class RepositoryImage extends RepositoryFile implements ImageMetadata {
* @see org.genesys2.server.filerepository.metadata.ImageMetadata#getHeight()
*/
@Override
public int getHeight() {
public Integer getHeight() {
return height;
}
......
......@@ -26,12 +26,12 @@ import org.genesys2.server.filerepository.metadata.ImageMetadata;
public class RepositoryImageData extends RepositoryFileData implements ImageMetadata, Serializable {
private static final long serialVersionUID = 1047696679600823747L;
private int width;
private int height;
private Integer width;
private Integer height;
private Orientation orientation;
@Override
public int getHeight() {
public Integer getHeight() {
return height;
}
......@@ -41,11 +41,11 @@ public class RepositoryImageData extends RepositoryFileData implements ImageMeta
}
@Override
public int getWidth() {
public Integer getWidth() {
return width;
}
public void setHeight(final int height) {
public void setHeight(final Integer height) {
this.height = height;
}
......@@ -53,15 +53,18 @@ public class RepositoryImageData extends RepositoryFileData implements ImageMeta
this.orientation = orientation;
}
public void setWidth(final int width) {
public void setWidth(final Integer width) {
this.width = width;
}
public void applyTo(final RepositoryImage repositoryImage) {
super.applyTo(repositoryImage);
repositoryImage.setWidth(width);
repositoryImage.setHeight(height);
repositoryImage.setOrientation(orientation);
if (width != null)
repositoryImage.setWidth(width);
if (height != null)
repositoryImage.setHeight(height);
if (orientation != null)
repositoryImage.setOrientation(orientation);
}
}
......@@ -286,16 +286,17 @@ public class RepositoryServiceImpl implements RepositoryService, InitializingBea
* @see org.genesys2.server.filerepository.service.RepositoryService#updateMetadata(org.genesys2.server.filerepository. model.RepositoryImage)
*/
@Override
@Transactional
public RepositoryImage updateMetadata(final UUID uuid, final RepositoryImageData imageData) throws NoSuchRepositoryFileException {
RepositoryImage repositoryImage = repositoryImagePersistence.findByUuid(uuid);
if (repositoryImage == null) {
throw new NoSuchRepositoryFileException();
}
LOG.debug("Applying metadata " + imageData);
imageData.applyTo(repositoryImage);
repositoryImage = repositoryImagePersistence.save(repositoryImage);
return repositoryImage;
LOG.debug("Image title: " + repositoryImage.getTitle());
return repositoryImagePersistence.save(repositoryImage);
}
/*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment