DS-4418 improve javadoc, cleanup dependencies

This commit is contained in:
Andrea Bollini
2020-02-20 19:48:38 +01:00
parent 10fbf2eae7
commit d64609df22
3 changed files with 57 additions and 11 deletions

View File

@@ -8,22 +8,59 @@
package org.dspace.submit.model;
/**
* This class rappresent an option avaiable in the submission upload section to
* set permission on a file. An option is defined by a name such as "open
* access", "embargo", "restricted access", etc. and some optional attributes to
* better clarify the constraints and input available to the user. For instance
* an embargo option could allow to set a start date not longer than 3 years,
* etc
*
* @author Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
*/
public class AccessConditionOption {
/** An unique name identifying the access contion option **/
private String name;
/**
* the name of the group that will be bound to the resource policy created if
* such option is used
*/
private String groupName;
/**
* this is in alternative to the {@link #groupName}. The sub-groups listed in
* the DSpace group identified by the name here specified will be available to
* the user to personalize the access condition. They can be for instance
* University Staff, University Students, etc. so that a "restricted access"
* option can be further specified without the need to create separate access
* condition options for each group
*/
private String selectGroupName;
/**
* set to <code>true</code> if this option requires a start date to be indicated
* for the underlying resource policy to create
*/
private Boolean hasStartDate;
/**
* set to <code>true</code> if this option requires an end date to be indicated
* for the underlying resource policy to create
*/
private Boolean hasEndDate;
/**
* It contains, if applicable, the maximum start date (i.e. when the "embargo
* expires") that can be selected. It accepts date math via joda library (such as
* +3years)
*/
private String startDateLimit;
/**
* It contains, if applicable, the maximum end date (i.e. when the "lease
* expires") that can be selected. It accepts date math via joda library (such as
* +3years)
*/
private String endDateLimit;
public String getName() {
@@ -81,6 +118,4 @@ public class AccessConditionOption {
public void setSelectGroupName(String selectGroupName) {
this.selectGroupName = selectGroupName;
}
}

View File

@@ -10,8 +10,19 @@ package org.dspace.app.rest.model;
import java.util.Date;
import java.util.UUID;
import org.dspace.app.rest.model.step.UploadBitstreamRest;
/**
* The UploadAccessCondition it is partial representation of the DSpace ResourcePolicy
* The UploadAccessConditionDTO is a partial representation of the DSpace
* {@link ResourcePolicyRest} as used in the patch payload for the upload
* submission section (see {@link UploadBitstreamRest}. The main reason for this
* class is to have a DTO to use serialize/deserialize the REST model, that
* include reference to the GroupRest and EPersonRest object, in the upload
* section data in a simpler way where such reference are just UUID. Indeed, due
* to the fact that the RestModel class are serialized according to the HAL
* format and the reference are only exposed in the _links section of the
* RestResource it was not possible to use the {@link ResourcePolicyRest} class
* directly in the upload section
*
* @author Mykhaylo Boychuk (mykhaylo.boychuk at 4science.it)
*/
@@ -19,7 +30,7 @@ public class UploadAccessConditionDTO {
private Integer id;
private UUID groupUUID;
private UUID groupUUID;
private UUID epersonUUID;

View File

@@ -9,7 +9,7 @@ package org.dspace.app.rest.submit.factory.impl;
import java.util.List;
import org.dspace.app.rest.model.ResourcePolicyRest;
import org.dspace.app.rest.model.UploadAccessConditionDTO;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.service.ResourcePolicyService;
import org.dspace.content.Bitstream;
@@ -28,7 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
*
* @author Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
*/
public class ResourcePolicyRemovePatchOperation extends RemovePatchOperation<ResourcePolicyRest> {
public class ResourcePolicyRemovePatchOperation extends RemovePatchOperation<UploadAccessConditionDTO> {
@Autowired
ItemService itemService;
@@ -83,12 +83,12 @@ public class ResourcePolicyRemovePatchOperation extends RemovePatchOperation<Res
}
@Override
protected Class<ResourcePolicyRest[]> getArrayClassForEvaluation() {
return ResourcePolicyRest[].class;
protected Class<UploadAccessConditionDTO[]> getArrayClassForEvaluation() {
return UploadAccessConditionDTO[].class;
}
@Override
protected Class<ResourcePolicyRest> getClassForEvaluation() {
return ResourcePolicyRest.class;
protected Class<UploadAccessConditionDTO> getClassForEvaluation() {
return UploadAccessConditionDTO.class;
}
}