Commit 3c9b9077 authored by Matija Obreza's avatar Matija Obreza
Browse files

Source code cleanup

parent 9b22e4e6
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -24,8 +24,8 @@ public class InvalidRepositoryFileDataException extends FileRepositoryException ...@@ -24,8 +24,8 @@ public class InvalidRepositoryFileDataException extends FileRepositoryException
public InvalidRepositoryFileDataException() { public InvalidRepositoryFileDataException() {
} }
public InvalidRepositoryFileDataException(String message) { public InvalidRepositoryFileDataException(final String message) {
super(message); super(message);
} }
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
package org.genesys.filerepository; package org.genesys.filerepository;
/** /**
* The InvalidRepositoryPathException is thrown when Repository is not happy with your selected path. * The InvalidRepositoryPathException is thrown when Repository is not happy
* with your selected path.
*/ */
public class InvalidRepositoryPathException extends FileRepositoryException { public class InvalidRepositoryPathException extends FileRepositoryException {
/** The Constant serialVersionUID. */ /** The Constant serialVersionUID. */
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,7 +26,7 @@ public class NoSuchRepositoryFileException extends FileRepositoryException { ...@@ -26,7 +26,7 @@ public class NoSuchRepositoryFileException extends FileRepositoryException {
public NoSuchRepositoryFileException() { public NoSuchRepositoryFileException() {
} }
public NoSuchRepositoryFileException(String message) { public NoSuchRepositoryFileException(final String message) {
super(message); super(message);
} }
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -29,15 +29,17 @@ import java.util.Date; ...@@ -29,15 +29,17 @@ import java.util.Date;
public interface BaseMetadata extends Serializable { public interface BaseMetadata extends Serializable {
/** /**
* Get the permanent unique identifier of the resource. Commonly a Uniform Resource Locator (URL). * Get the permanent unique identifier of the resource. Commonly a Uniform
* Resource Locator (URL).
* *
* @return the identifier * @return the identifier
*/ */
String getIdentifier(); String getIdentifier();
/** /**
* Title is a property that refers to the name or names by which a resource is formally known. It may be qualified and repeated. Commonly used in conjunction with * Title is a property that refers to the name or names by which a resource is
* dc:alternative. * formally known. It may be qualified and repeated. Commonly used in
* conjunction with dc:alternative.
* *
* @return the title * @return the title
*/ */
...@@ -51,8 +53,9 @@ public interface BaseMetadata extends Serializable { ...@@ -51,8 +53,9 @@ public interface BaseMetadata extends Serializable {
String getSubject(); String getSubject();
/** /**
* This property refers to the description of the content of a resource. The description is a potentially rich source of indexable terms and assist the users in their selection * This property refers to the description of the content of a resource. The
* of an appropriate resource. * description is a potentially rich source of indexable terms and assist the
* users in their selection of an appropriate resource.
* *
* @return the description * @return the description
*/ */
...@@ -66,29 +69,34 @@ public interface BaseMetadata extends Serializable { ...@@ -66,29 +69,34 @@ public interface BaseMetadata extends Serializable {
String getCreator(); String getCreator();
/** /**
* A point or period of time when the resource was created by the {@link #getCreator()}. This is not a {@link Date} type to allow for text like "Jan - Feb 2016". * A point or period of time when the resource was created by the
* {@link #getCreator()}. This is not a {@link Date} type to allow for text like
* "Jan - Feb 2016".
* *
* @return the created * @return the created
*/ */
String getCreated(); String getCreated();
/** /**
* Relationship between the resource and a person or an organization owning or managing rights over this resource. * Relationship between the resource and a person or an organization owning or
* managing rights over this resource.
* *
* @return the rights holder * @return the rights holder
*/ */
String getRightsHolder(); String getRightsHolder();
/** /**
* Access rights provides information about restrictions to view, search or use a resource based on attributes of the resource itself or the category of user. E.g.: My * Access rights provides information about restrictions to view, search or use
* colleagues only * a resource based on attributes of the resource itself or the category of
* user. E.g.: My colleagues only
* *
* @return the access rights * @return the access rights
*/ */
String getAccessRights(); String getAccessRights();
/** /**
* Legal document giving official permission to do something with the resource. E.g. http://www.gnu.org/licenses/gpl.html * Legal document giving official permission to do something with the resource.
* E.g. http://www.gnu.org/licenses/gpl.html
* *
* @return the license * @return the license
*/ */
...@@ -102,7 +110,8 @@ public interface BaseMetadata extends Serializable { ...@@ -102,7 +110,8 @@ public interface BaseMetadata extends Serializable {
String getFormat(); String getFormat();
/** /**
* Size (e.g. bytes, pages, inches, etc.) or duration (e.g. hours, minutes, days, etc.) of a resource. * Size (e.g. bytes, pages, inches, etc.) or duration (e.g. hours, minutes,
* days, etc.) of a resource.
* *
* @return the extent * @return the extent
*/ */
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -23,7 +23,8 @@ package org.genesys.filerepository.metadata; ...@@ -23,7 +23,8 @@ package org.genesys.filerepository.metadata;
public interface DocumentMetadata extends BaseMetadata { public interface DocumentMetadata extends BaseMetadata {
/** /**
* The language of the intellectual content of the resource. Best practice would be to select a value from the three letter language tags of ISO639. * The language of the intellectual content of the resource. Best practice would
* be to select a value from the three letter language tags of ISO639.
* *
* @return the language * @return the language
*/ */
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -37,7 +37,8 @@ public interface ImageMetadata extends BaseMetadata { ...@@ -37,7 +37,8 @@ public interface ImageMetadata extends BaseMetadata {
Integer getHeight(); Integer getHeight();
/** /**
* Get image orientation. Landscape = width is greater than height. Portrait = width is less or equal height; * Get image orientation. Landscape = width is greater than height. Portrait =
* width is less or equal height;
* *
* @return the orientation * @return the orientation
*/ */
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -32,10 +32,13 @@ import org.genesys.blocks.model.AuditedVersionedModel; ...@@ -32,10 +32,13 @@ import org.genesys.blocks.model.AuditedVersionedModel;
import org.genesys.blocks.model.Copyable; import org.genesys.blocks.model.Copyable;
/** /**
* {@link ImageGallery} is a collection of ordered {@link RepositoryImage} instances. * {@link ImageGallery} is a collection of ordered {@link RepositoryImage}
* instances.
* *
* Gallery has a dedicated "path" in the file repository, where new images are posted. When an image is removed from the * Gallery has a dedicated "path" in the file repository, where new images are
* Gallery, it may be removed if it is hosted in the Gallery path, but must be kept as-is if it does not share the path. * posted. When an image is removed from the Gallery, it may be removed if it is
* hosted in the Gallery path, but must be kept as-is if it does not share the
* path.
* *
* @author mobreza * @author mobreza
*/ */
...@@ -45,7 +48,8 @@ public class ImageGallery extends AuditedVersionedModel implements Copyable<Imag ...@@ -45,7 +48,8 @@ public class ImageGallery extends AuditedVersionedModel implements Copyable<Imag
private static final long serialVersionUID = 6043583851401365284L; private static final long serialVersionUID = 6043583851401365284L;
/** /**
* Each Gallery has a dedicated "path" in the file repository. A gallery "owns" a unique path in the repository. * Each Gallery has a dedicated "path" in the file repository. A gallery "owns"
* a unique path in the repository.
*/ */
@Column(name = "path", nullable = false, unique = true) @Column(name = "path", nullable = false, unique = true)
private String path; private String path;
...@@ -141,7 +145,7 @@ public class ImageGallery extends AuditedVersionedModel implements Copyable<Imag ...@@ -141,7 +145,7 @@ public class ImageGallery extends AuditedVersionedModel implements Copyable<Imag
} }
@Override @Override
public ImageGallery apply(ImageGallery source) { public ImageGallery apply(final ImageGallery source) {
this.active = source.active; this.active = source.active;
this.description = source.description; this.description = source.description;
this.path = source.path; this.path = source.path;
...@@ -152,7 +156,7 @@ public class ImageGallery extends AuditedVersionedModel implements Copyable<Imag ...@@ -152,7 +156,7 @@ public class ImageGallery extends AuditedVersionedModel implements Copyable<Imag
@Override @Override
public ImageGallery copy() { public ImageGallery copy() {
ImageGallery copy = new ImageGallery(); final ImageGallery copy = new ImageGallery();
copy.apply(this); copy.apply(this);
copy.images = new ArrayList<>(this.images); copy.images = new ArrayList<>(this.images);
return copy; return copy;
......
/* /*
* Copyright 2016 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -26,8 +26,9 @@ import org.genesys.filerepository.metadata.ImageMetadata; ...@@ -26,8 +26,9 @@ import org.genesys.filerepository.metadata.ImageMetadata;
// TODO: Auto-generated Javadoc // TODO: Auto-generated Javadoc
/** /**
* An {@link RepositoryDocument} is an graphics file in one of the supported image formats (PNG and JPG). It extends the * An {@link RepositoryDocument} is an graphics file in one of the supported
* {@link RepositoryFile} by including image-specific metadata defined in {@link ImageMetadata}. * image formats (PNG and JPG). It extends the {@link RepositoryFile} by
* including image-specific metadata defined in {@link ImageMetadata}.
* *
* @author mobreza * @author mobreza
*/ */
...@@ -48,7 +49,6 @@ public class RepositoryDocument extends RepositoryFile implements DocumentMetada ...@@ -48,7 +49,6 @@ public class RepositoryDocument extends RepositoryFile implements DocumentMetada
/* /*
* (non-Javadoc) * (non-Javadoc)
*
* @see org.genesys.filerepository.model.RepositoryFile#prePersist() * @see org.genesys.filerepository.model.RepositoryFile#prePersist()
*/ */
@Override @Override
...@@ -60,7 +60,6 @@ public class RepositoryDocument extends RepositoryFile implements DocumentMetada ...@@ -60,7 +60,6 @@ public class RepositoryDocument extends RepositoryFile implements DocumentMetada
/* /*
* (non-Javadoc) * (non-Javadoc)
*
* @see org.genesys.filerepository.metadata.DocumentMetadata#getLanguage() * @see org.genesys.filerepository.metadata.DocumentMetadata#getLanguage()
*/ */
@Override @Override
...@@ -79,7 +78,6 @@ public class RepositoryDocument extends RepositoryFile implements DocumentMetada ...@@ -79,7 +78,6 @@ public class RepositoryDocument extends RepositoryFile implements DocumentMetada
/* /*
* (non-Javadoc) * (non-Javadoc)
*
* @see org.genesys.filerepository.metadata.DocumentMetadata#getAbstract() * @see org.genesys.filerepository.metadata.DocumentMetadata#getAbstract()
*/ */
@Override @Override
...@@ -96,7 +94,7 @@ public class RepositoryDocument extends RepositoryFile implements DocumentMetada ...@@ -96,7 +94,7 @@ public class RepositoryDocument extends RepositoryFile implements DocumentMetada
this.abstrct = abstrct; this.abstrct = abstrct;
} }
public RepositoryDocument apply(RepositoryDocument source) { public RepositoryDocument apply(final RepositoryDocument source) {
super.apply(source); super.apply(source);
this.abstrct = source.abstrct; this.abstrct = source.abstrct;
......
/* /*
* Copyright 2017 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -215,7 +215,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En ...@@ -215,7 +215,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En
/** /**
* Get the path of the file used by {@link BytesStorageService} * Get the path of the file used by {@link BytesStorageService}
* *
* @return * @return
*/ */
@Transient @Transient
...@@ -229,7 +229,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En ...@@ -229,7 +229,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En
/** /**
* Get the full path to the file as used by {@link BytesStorageService}. This is * Get the full path to the file as used by {@link BytesStorageService}. This is
* the concatenation of {@link #getStoragePath()} and {@link #getFilename()}. * the concatenation of {@link #getStoragePath()} and {@link #getFilename()}.
* *
* @return * @return
*/ */
@Transient @Transient
...@@ -630,12 +630,12 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En ...@@ -630,12 +630,12 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En
/** /**
* @param size the size to set * @param size the size to set
*/ */
public final void setSize(int size) { public final void setSize(final int size) {
this.size = size; this.size = size;
} }
@Override @Override
public RepositoryFile apply(RepositoryFile source) { public RepositoryFile apply(final RepositoryFile source) {
this.active = source.active; this.active = source.active;
this.accessRights = source.accessRights; this.accessRights = source.accessRights;
this.bibliographicCitation = source.bibliographicCitation; this.bibliographicCitation = source.bibliographicCitation;
...@@ -663,7 +663,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En ...@@ -663,7 +663,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En
@Override @Override
public RepositoryFile copy() { public RepositoryFile copy() {
RepositoryFile copy = new RepositoryFile(); final RepositoryFile copy = new RepositoryFile();
copy.apply(this); copy.apply(this);
return copy; return copy;
} }
...@@ -676,7 +676,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En ...@@ -676,7 +676,7 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + ((id == null) ? 0 : id.hashCode()); result = (prime * result) + ((id == null) ? 0 : id.hashCode());
return result; return result;
} }
...@@ -685,14 +685,14 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En ...@@ -685,14 +685,14 @@ public class RepositoryFile extends AuditedVersionedModelWithoutId implements En
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(final Object obj) {
if (this == obj) if (this == obj)
return true; return true;
if (!super.equals(obj)) if (!super.equals(obj))
return false; return false;
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
RepositoryFile other = (RepositoryFile) obj; final RepositoryFile other = (RepositoryFile) obj;
if (id == null) { if (id == null) {
if (other.id != null) if (other.id != null)
return false; return false;
......
/* /*
* Copyright 2017 Global Crop Diversity Trust, www.croptrust.org * Copyright 2017 Global Crop Diversity Trust
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -27,7 +27,8 @@ import javax.persistence.Transient; ...@@ -27,7 +27,8 @@ import javax.persistence.Transient;
import org.genesys.filerepository.metadata.ImageMetadata; import org.genesys.filerepository.metadata.ImageMetadata;
/** /**
* An {@link RepositoryImage} is an graphics file in one of the supported image formats (PNG and JPG). It extends the {@link RepositoryFile} by including * An {@link RepositoryImage} is an graphics file in one of the supported image
* formats (PNG and JPG). It extends the {@link RepositoryFile} by including
* image-specific metadata defined in {@link ImageMetadata}. * image-specific metadata defined in {@link ImageMetadata}.
* *
* @author mobreza * @author mobreza
...@@ -102,7 +103,8 @@ public class RepositoryImage extends RepositoryFile implements ImageMetadata { ...@@ -102,7 +103,8 @@ public class RepositoryImage extends RepositoryFile implements ImageMetadata {
} }
/** /**
* See {@link ImageMetadata#getOrientation()}: Landscape = width is greater than height. * See {@link ImageMetadata#getOrientation()}: Landscape = width is greater than
* height.
* *
* @return the orientation * @return the orientation
*/ */
...@@ -127,7 +129,7 @@ public class RepositoryImage extends RepositoryFile implements ImageMetadata { ...@@ -127,7 +129,7 @@ public class RepositoryImage extends RepositoryFile implements ImageMetadata {
orientation = width > height ? Orientation.LANDSCAPE : Orientation.PORTRAIT; orientation = width > height ? Orientation.LANDSCAPE : Orientation.PORTRAIT;
} }
public RepositoryImage apply(RepositoryImage source) { public RepositoryImage apply(final RepositoryImage source) {
super.apply(source); super.apply(source);