mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged remote tracking branch RM REST API Automation
This commit is contained in:
@@ -12,11 +12,11 @@
|
|||||||
package org.alfresco.rest.rm.model.fileplancomponents;
|
package org.alfresco.rest.rm.model.fileplancomponents;
|
||||||
|
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED;
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,24 +25,61 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
//FIXME: Once the fields have been added the JsonIgnoreProperties annotation should be removed
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
public class FilePlanComponent
|
public class FilePlanComponent
|
||||||
{
|
{
|
||||||
|
@JsonProperty (required = true)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
private String nodeType;
|
private String nodeType;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
private boolean isCategory;
|
private boolean isCategory;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
private boolean isRecordFolder;
|
private boolean isRecordFolder;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
private boolean isFile;
|
private boolean isFile;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
private boolean hasRetentionSchedule;
|
private boolean hasRetentionSchedule;
|
||||||
|
|
||||||
|
@JsonProperty(value = IS_CLOSED)
|
||||||
|
private boolean isClosed;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
private boolean isCompleted;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
private List<String> aspectNames;
|
private List<String> aspectNames;
|
||||||
private FilePlanComponentCreatedByUser createdByUser;
|
|
||||||
@JsonProperty(PROPERTIES)
|
@JsonProperty (required = true)
|
||||||
|
private FilePlanComponentUserInfo createdByUser;
|
||||||
|
|
||||||
|
@JsonProperty(value = PROPERTIES, required = true)
|
||||||
private FilePlanComponentProperties properties;
|
private FilePlanComponentProperties properties;
|
||||||
@JsonProperty (ALLOWABLE_OPERATIONS)
|
|
||||||
|
@JsonProperty (value = ALLOWABLE_OPERATIONS)
|
||||||
private List<String> allowableOperations;
|
private List<String> allowableOperations;
|
||||||
|
private FilePlanComponentPath path;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
|
private String modifiedAt;
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
|
private String createdAt;
|
||||||
|
|
||||||
|
@JsonProperty (required = true)
|
||||||
|
private FilePlanComponentUserInfo modifiedByUser;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the id
|
* @return the id
|
||||||
@@ -207,7 +244,7 @@ public class FilePlanComponent
|
|||||||
/**
|
/**
|
||||||
* @return the createdByUser
|
* @return the createdByUser
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentCreatedByUser getCreatedByUser()
|
public FilePlanComponentUserInfo getCreatedByUser()
|
||||||
{
|
{
|
||||||
return this.createdByUser;
|
return this.createdByUser;
|
||||||
}
|
}
|
||||||
@@ -215,7 +252,7 @@ public class FilePlanComponent
|
|||||||
/**
|
/**
|
||||||
* @param createdByUser the createdByUser to set
|
* @param createdByUser the createdByUser to set
|
||||||
*/
|
*/
|
||||||
public void setCreatedByUser(FilePlanComponentCreatedByUser createdByUser)
|
public void setCreatedByUser(FilePlanComponentUserInfo createdByUser)
|
||||||
{
|
{
|
||||||
this.createdByUser = createdByUser;
|
this.createdByUser = createdByUser;
|
||||||
}
|
}
|
||||||
@@ -227,4 +264,100 @@ public class FilePlanComponent
|
|||||||
{
|
{
|
||||||
return this.allowableOperations;
|
return this.allowableOperations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the path
|
||||||
|
*/
|
||||||
|
public FilePlanComponentPath getPath()
|
||||||
|
{
|
||||||
|
return this.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param path the path to set
|
||||||
|
*/
|
||||||
|
public void setPath(FilePlanComponentPath path)
|
||||||
|
{
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param modifiedAt the modifiedAt to set
|
||||||
|
*/
|
||||||
|
public void setModifiedAt(String modifiedAt)
|
||||||
|
{
|
||||||
|
this.modifiedAt = modifiedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param createdAt the createdAt to set
|
||||||
|
*/
|
||||||
|
public void setCreatedAt(String createdAt)
|
||||||
|
{
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param modifiedByUser the modifiedByUser to set
|
||||||
|
*/
|
||||||
|
public void setModifiedByUser(FilePlanComponentUserInfo modifiedByUser)
|
||||||
|
{
|
||||||
|
this.modifiedByUser = modifiedByUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the modifiedAt
|
||||||
|
*/
|
||||||
|
public String getModifiedAt()
|
||||||
|
{
|
||||||
|
return this.modifiedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the createdAt
|
||||||
|
*/
|
||||||
|
public String getCreatedAt()
|
||||||
|
{
|
||||||
|
return this.createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the modifiedByUser
|
||||||
|
*/
|
||||||
|
public FilePlanComponentUserInfo getModifiedByUser()
|
||||||
|
{
|
||||||
|
return this.modifiedByUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the isClosed
|
||||||
|
*/
|
||||||
|
public boolean isClosed()
|
||||||
|
{
|
||||||
|
return this.isClosed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param closed the isClosed to set
|
||||||
|
*/
|
||||||
|
public void setClosed(boolean closed)
|
||||||
|
{
|
||||||
|
this.isClosed = closed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the isCompleted
|
||||||
|
*/
|
||||||
|
public boolean isCompleted()
|
||||||
|
{
|
||||||
|
return this.isCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param completed the isCompleted to set
|
||||||
|
*/
|
||||||
|
public void setCompleted(boolean completed)
|
||||||
|
{
|
||||||
|
this.isCompleted = completed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,5 +28,9 @@ public class FilePlanComponentFields
|
|||||||
public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator";
|
public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator";
|
||||||
public static final String PROPERTIES_HOLD_REASON = "rma:holdReason";
|
public static final String PROPERTIES_HOLD_REASON = "rma:holdReason";
|
||||||
public static final String PROPERTIES_DESCRIPTION = "cm:description";
|
public static final String PROPERTIES_DESCRIPTION = "cm:description";
|
||||||
|
public static final String PROPERTIES_SUPPLEMENTAL_MARKING_LIST = "rmc:supplementalMarkingList";
|
||||||
public static final String ALLOWABLE_OPERATIONS = "allowableOperations";
|
public static final String ALLOWABLE_OPERATIONS = "allowableOperations";
|
||||||
|
public static final String IS_CLOSED="isclosed";
|
||||||
|
public static final String PROPERTIES_REVIEW_PERIOD="rma:reviewPeriod";
|
||||||
|
public static final String PROPERTIES_LOCATION="rma:location";
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||||
|
* pursuant to a written agreement and any use of this program without such an
|
||||||
|
* agreement is prohibited.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.rest.rm.model.fileplancomponents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POJO for id/name pair
|
||||||
|
*
|
||||||
|
* @author Kristijan Conkas
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class FilePlanComponentIdNamePair
|
||||||
|
{
|
||||||
|
public String id;
|
||||||
|
public String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
|
public String getId()
|
||||||
|
{
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id the id to set
|
||||||
|
*/
|
||||||
|
public void setId(String id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name the name to set
|
||||||
|
*/
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||||
|
* pursuant to a written agreement and any use of this program without such an
|
||||||
|
* agreement is prohibited.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.rest.rm.model.fileplancomponents;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POJO for FilePlanComponent path parameter
|
||||||
|
* <br>
|
||||||
|
* @author Kristijan Conkas
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class FilePlanComponentPath
|
||||||
|
{
|
||||||
|
private String name;
|
||||||
|
private boolean isComplete;
|
||||||
|
private List<FilePlanComponentIdNamePair> elements;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name the name to set
|
||||||
|
*/
|
||||||
|
public void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the isComplete
|
||||||
|
*/
|
||||||
|
public boolean isComplete()
|
||||||
|
{
|
||||||
|
return this.isComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isComplete the isComplete to set
|
||||||
|
*/
|
||||||
|
public void setComplete(boolean isComplete)
|
||||||
|
{
|
||||||
|
this.isComplete = isComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the elements
|
||||||
|
*/
|
||||||
|
public List<FilePlanComponentIdNamePair> getElements()
|
||||||
|
{
|
||||||
|
return this.elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param elements the elements to set
|
||||||
|
*/
|
||||||
|
public void setElements(List<FilePlanComponentIdNamePair> elements)
|
||||||
|
{
|
||||||
|
this.elements = elements;
|
||||||
|
}
|
||||||
|
}
|
@@ -13,9 +13,14 @@ package org.alfresco.rest.rm.model.fileplancomponents;
|
|||||||
|
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HOLD_REASON;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HOLD_REASON;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SUPPLEMENTAL_MARKING_LIST;
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
@@ -29,6 +34,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||||||
@JsonIgnoreProperties (ignoreUnknown = true)
|
@JsonIgnoreProperties (ignoreUnknown = true)
|
||||||
public class FilePlanComponentProperties
|
public class FilePlanComponentProperties
|
||||||
{
|
{
|
||||||
|
|
||||||
@JsonProperty(PROPERTIES_VITAL_RECORD_INDICATOR)
|
@JsonProperty(PROPERTIES_VITAL_RECORD_INDICATOR)
|
||||||
private boolean vitalRecord;
|
private boolean vitalRecord;
|
||||||
|
|
||||||
@@ -41,6 +47,16 @@ public class FilePlanComponentProperties
|
|||||||
@JsonProperty(PROPERTIES_DESCRIPTION)
|
@JsonProperty(PROPERTIES_DESCRIPTION)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@JsonProperty(PROPERTIES_SUPPLEMENTAL_MARKING_LIST)
|
||||||
|
private List<String> supplementalMarkingList;
|
||||||
|
|
||||||
|
@JsonProperty(PROPERTIES_REVIEW_PERIOD)
|
||||||
|
private ReviewPeriod reviewPeriod;
|
||||||
|
|
||||||
|
@JsonProperty(PROPERTIES_LOCATION)
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the vitalRecord
|
* @return the vitalRecord
|
||||||
*/
|
*/
|
||||||
@@ -104,4 +120,52 @@ public class FilePlanComponentProperties
|
|||||||
{
|
{
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the supplementalMarkingList
|
||||||
|
*/
|
||||||
|
public List<String> getSupplementalMarkingList()
|
||||||
|
{
|
||||||
|
return this.supplementalMarkingList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param supplementalMarkingList the supplementalMarkingList to set
|
||||||
|
*/
|
||||||
|
public void setSupplementalMarkingList(List<String> supplementalMarkingList)
|
||||||
|
{
|
||||||
|
this.supplementalMarkingList = supplementalMarkingList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the reviewPeriod
|
||||||
|
*/
|
||||||
|
public ReviewPeriod getReviewPeriod()
|
||||||
|
{
|
||||||
|
return reviewPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param reviewPeriod the reviewPeriod to set
|
||||||
|
*/
|
||||||
|
public void setReviewPeriod(ReviewPeriod reviewPeriod)
|
||||||
|
{
|
||||||
|
this.reviewPeriod = reviewPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the location
|
||||||
|
*/
|
||||||
|
public String getLocation()
|
||||||
|
{
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param location the location to set
|
||||||
|
*/
|
||||||
|
public void setLocation(String location)
|
||||||
|
{
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@ package org.alfresco.rest.rm.model.fileplancomponents;
|
|||||||
* @author Kristijan Conkas
|
* @author Kristijan Conkas
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class FilePlanComponentCreatedByUser
|
public class FilePlanComponentUserInfo
|
||||||
{
|
{
|
||||||
private String id;
|
private String id;
|
||||||
private String displayName;
|
private String displayName;
|
@@ -0,0 +1,45 @@
|
|||||||
|
package org.alfresco.rest.rm.model.fileplancomponents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POJO for the review period
|
||||||
|
*
|
||||||
|
* @author Rodica Sutu
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class ReviewPeriod
|
||||||
|
{
|
||||||
|
private String periodType;
|
||||||
|
private String expression;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the periodType
|
||||||
|
*/
|
||||||
|
public String getPeriodType()
|
||||||
|
{
|
||||||
|
return this.periodType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param periodType the periodType to set
|
||||||
|
*/
|
||||||
|
public void setPeriodType(String periodType)
|
||||||
|
{
|
||||||
|
this.periodType = periodType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the expression
|
||||||
|
*/
|
||||||
|
public String getExpression()
|
||||||
|
{
|
||||||
|
return this.expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param expression the expression to set
|
||||||
|
*/
|
||||||
|
public void setExpression(String expression)
|
||||||
|
{
|
||||||
|
this.expression = expression;
|
||||||
|
}
|
||||||
|
}
|
@@ -53,7 +53,7 @@ public class RMSiteAPI extends RestAPI<RMSiteAPI>
|
|||||||
{
|
{
|
||||||
return usingRestWrapper().processModel(RMSite.class, simpleRequest(
|
return usingRestWrapper().processModel(RMSite.class, simpleRequest(
|
||||||
GET,
|
GET,
|
||||||
"sites/rm"
|
"ig-sites/rm"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ public class RMSiteAPI extends RestAPI<RMSiteAPI>
|
|||||||
return usingRestWrapper().processModel(RMSite.class, requestWithBody(
|
return usingRestWrapper().processModel(RMSite.class, requestWithBody(
|
||||||
POST,
|
POST,
|
||||||
rmSiteProperties.toString(),
|
rmSiteProperties.toString(),
|
||||||
"sites"
|
"ig-sites"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class RMSiteAPI extends RestAPI<RMSiteAPI>
|
|||||||
{
|
{
|
||||||
usingRestWrapper().processEmptyModel(simpleRequest(
|
usingRestWrapper().processEmptyModel(simpleRequest(
|
||||||
DELETE,
|
DELETE,
|
||||||
"sites/rm"
|
"ig-sites/rm"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ public class RMSiteAPI extends RestAPI<RMSiteAPI>
|
|||||||
return usingRestWrapper().processModel(RMSite.class, requestWithBody(
|
return usingRestWrapper().processModel(RMSite.class, requestWithBody(
|
||||||
PUT,
|
PUT,
|
||||||
rmSiteProperties.toString(),
|
rmSiteProperties.toString(),
|
||||||
"sites/rm"
|
"ig-sites/rm"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,14 @@ package org.alfresco.rest.rm.base;
|
|||||||
|
|
||||||
import static java.lang.Integer.parseInt;
|
import static java.lang.Integer.parseInt;
|
||||||
|
|
||||||
|
import static org.alfresco.rest.rm.base.TestData.CATEGORY_TITLE;
|
||||||
|
import static org.alfresco.rest.rm.base.TestData.FOLDER_TITLE;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NAME;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
|
||||||
import static org.alfresco.rest.rm.model.site.RMSiteCompliance.STANDARD;
|
import static org.alfresco.rest.rm.model.site.RMSiteCompliance.STANDARD;
|
||||||
import static org.alfresco.rest.rm.model.site.RMSiteFields.COMPLIANCE;
|
import static org.alfresco.rest.rm.model.site.RMSiteFields.COMPLIANCE;
|
||||||
import static org.alfresco.rest.rm.model.site.RMSiteFields.DESCRIPTION;
|
import static org.alfresco.rest.rm.model.site.RMSiteFields.DESCRIPTION;
|
||||||
@@ -26,6 +34,9 @@ import com.jayway.restassured.RestAssured;
|
|||||||
|
|
||||||
import org.alfresco.rest.RestTest;
|
import org.alfresco.rest.RestTest;
|
||||||
import org.alfresco.rest.core.RestWrapper;
|
import org.alfresco.rest.core.RestWrapper;
|
||||||
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponent;
|
||||||
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType;
|
||||||
|
import org.alfresco.rest.rm.requests.FilePlanComponentAPI;
|
||||||
import org.alfresco.rest.rm.requests.RMSiteAPI;
|
import org.alfresco.rest.rm.requests.RMSiteAPI;
|
||||||
import org.alfresco.utility.data.DataUser;
|
import org.alfresco.utility.data.DataUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -58,12 +69,18 @@ public class BaseRestTest extends RestTest
|
|||||||
@Value ("${rest.rmPath}")
|
@Value ("${rest.rmPath}")
|
||||||
private String restRmPath;
|
private String restRmPath;
|
||||||
|
|
||||||
|
@Value ("${rest.basePath}")
|
||||||
|
private String restCorePath;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RMSiteAPI rmSiteAPI;
|
private RMSiteAPI rmSiteAPI;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataUser dataUser;
|
private DataUser dataUser;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public FilePlanComponentAPI filePlanComponentAPI;
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
public static final String RM_ID = "rm";
|
public static final String RM_ID = "rm";
|
||||||
public static final String RM_TITLE = "Records Management";
|
public static final String RM_TITLE = "Records Management";
|
||||||
@@ -119,4 +136,57 @@ public class BaseRestTest extends RestTest
|
|||||||
rmSiteAPI.getSite();
|
rmSiteAPI.getSite();
|
||||||
return restWrapper.getStatusCode().equals(OK.toString());
|
return restWrapper.getStatusCode().equals(OK.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to create child category
|
||||||
|
*
|
||||||
|
* @param parentCategoryId The id of the parent category
|
||||||
|
* @param categoryName The name of the category
|
||||||
|
* @return The created category
|
||||||
|
* @throws Exception on unsuccessful component creation
|
||||||
|
*/
|
||||||
|
public FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception
|
||||||
|
{
|
||||||
|
return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE, CATEGORY_TITLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to create child folder
|
||||||
|
*
|
||||||
|
* @param parentCategoryId The id of the parent category
|
||||||
|
* @param folderName The name of the category
|
||||||
|
* @return The created category
|
||||||
|
* @throws Exception on unsuccessful component creation
|
||||||
|
*/
|
||||||
|
public FilePlanComponent createFolder(String parentCategoryId, String folderName) throws Exception
|
||||||
|
{
|
||||||
|
return createComponent(parentCategoryId, folderName, RECORD_FOLDER_TYPE, FOLDER_TITLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to create generic child component
|
||||||
|
*
|
||||||
|
* @param parentComponentId The id of the parent file plan component
|
||||||
|
* @param componentName The name of the file plan component
|
||||||
|
* @param componentType The name of the file plan component
|
||||||
|
* @param componentTitle
|
||||||
|
* @return The created file plan component
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private FilePlanComponent createComponent(String parentComponentId, String componentName, FilePlanComponentType componentType, String componentTitle) throws Exception
|
||||||
|
{
|
||||||
|
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
|
||||||
|
JsonObject componentProperties = buildObject().add(NAME, componentName)
|
||||||
|
.add(NODE_TYPE, componentType.toString())
|
||||||
|
.addObject(PROPERTIES)
|
||||||
|
.add(PROPERTIES_TITLE, componentTitle)
|
||||||
|
.end()
|
||||||
|
.getJson();
|
||||||
|
|
||||||
|
FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(componentProperties, parentComponentId);
|
||||||
|
restWrapper.assertStatusCodeIs(CREATED);
|
||||||
|
return fpc;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -19,6 +19,7 @@ import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentTyp
|
|||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE;
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
|
||||||
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
|
||||||
|
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
||||||
|
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
|
|
||||||
@@ -77,4 +78,24 @@ public interface TestData
|
|||||||
{ UNFILED_RECORDS_CONTAINER_ALIAS, UNFILED_CONTAINER_TYPE },
|
{ UNFILED_RECORDS_CONTAINER_ALIAS, UNFILED_CONTAINER_TYPE },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default CATEGORY name used when creating categories
|
||||||
|
*/
|
||||||
|
public static String CATEGORY_NAME = "CATEGORY NAME"+ getRandomAlphanumeric();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default CATEGORY title used when creating categories
|
||||||
|
*/
|
||||||
|
public static String CATEGORY_TITLE = "CATEGORY TITLE" + getRandomAlphanumeric();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default FOLDER name used when creating categories
|
||||||
|
*/
|
||||||
|
public static String FOLDER_NAME = "FOLDER NAME" + getRandomAlphanumeric();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default FOLDER title used when creating categories
|
||||||
|
*/
|
||||||
|
public static String FOLDER_TITLE = "FOLDER TITLE" + getRandomAlphanumeric();
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@ import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
|
|||||||
import static org.springframework.http.HttpStatus.FORBIDDEN;
|
import static org.springframework.http.HttpStatus.FORBIDDEN;
|
||||||
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
@@ -254,15 +255,15 @@ public class FilePlanTests extends BaseRestTest
|
|||||||
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
// Create the special containers into RM site - parent folder
|
// Create the special containers into RM site - parent folder
|
||||||
filePlanComponentAPI.createFilePlanComponent(componentProperties, rmSiteId);
|
filePlanComponentAPI.createFilePlanComponent(componentProperties, rmSiteId);
|
||||||
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
||||||
|
|
||||||
// Create the special containers into RM site - parent folder
|
// Create the special containers into RM site - parent folder
|
||||||
filePlanComponentAPI.createFilePlanComponent(componentProperties, FILE_PLAN_ALIAS.toString());
|
filePlanComponentAPI.createFilePlanComponent(componentProperties, FILE_PLAN_ALIAS.toString());
|
||||||
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
||||||
|
|
||||||
// Create the special containers into the root of special containers containers
|
// Create the special containers into the root of special containers containers
|
||||||
filePlanComponentAPI.createFilePlanComponent(componentProperties, filePlanAlias.toString());
|
filePlanComponentAPI.createFilePlanComponent(componentProperties, filePlanAlias.toString());
|
||||||
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -35,8 +35,8 @@ import java.util.NoSuchElementException;
|
|||||||
|
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import org.alfresco.rest.core.RestWrapper;
|
|
||||||
import org.alfresco.rest.rm.base.BaseRestTest;
|
import org.alfresco.rest.rm.base.BaseRestTest;
|
||||||
|
import org.alfresco.rest.core.RestWrapper;
|
||||||
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponent;
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType;
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType;
|
||||||
@@ -341,7 +341,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
* @return The created category
|
* @return The created category
|
||||||
* @throws Exception on unsuccessful component creation
|
* @throws Exception on unsuccessful component creation
|
||||||
*/
|
*/
|
||||||
private FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception
|
public FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception
|
||||||
{
|
{
|
||||||
return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE);
|
return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,368 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||||
|
* pursuant to a written agreement and any use of this program without such an
|
||||||
|
* agreement is prohibited.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.rest.rm.fileplancomponents;
|
||||||
|
|
||||||
|
import static org.alfresco.rest.rm.base.TestData.CATEGORY_NAME;
|
||||||
|
import static org.alfresco.rest.rm.base.TestData.FOLDER_NAME;
|
||||||
|
import static org.alfresco.rest.rm.base.TestData.FOLDER_TITLE;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.IS_CLOSED;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NAME;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_PERIOD;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
|
||||||
|
import static org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
|
||||||
|
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
||||||
|
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
|
||||||
|
import static org.springframework.http.HttpStatus.CREATED;
|
||||||
|
import static org.springframework.http.HttpStatus.NOT_FOUND;
|
||||||
|
import static org.springframework.http.HttpStatus.NO_CONTENT;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.fail;
|
||||||
|
import static org.testng.AssertJUnit.assertTrue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import org.alfresco.rest.core.RestWrapper;
|
||||||
|
import org.alfresco.rest.rm.base.BaseRestTest;
|
||||||
|
import org.alfresco.rest.rm.base.TestData;
|
||||||
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponent;
|
||||||
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
|
import org.alfresco.rest.rm.model.fileplancomponents.FilePlanComponentsCollection;
|
||||||
|
import org.alfresco.rest.rm.requests.FilePlanComponentAPI;
|
||||||
|
import org.alfresco.utility.data.DataUser;
|
||||||
|
import org.alfresco.utility.report.Bug;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the tests for the
|
||||||
|
* the Record Folder CRUD API
|
||||||
|
*
|
||||||
|
* @author Rodica Sutu
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class RecordFolderTests extends BaseRestTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
public FilePlanComponentAPI filePlanComponentAPI;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public DataUser dataUser;
|
||||||
|
|
||||||
|
private static final int NUMBER_OF_FOLDERS= 5;
|
||||||
|
/**
|
||||||
|
* Given that a record category exists
|
||||||
|
* When I use the API to create a new record folder
|
||||||
|
* Then it is created within the record category
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
(
|
||||||
|
description = "Create a folder into a record category"
|
||||||
|
)
|
||||||
|
public void createFolderTest() throws Exception
|
||||||
|
{
|
||||||
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
// Authenticate with admin user
|
||||||
|
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
FilePlanComponent filePlanComponent=createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
|
||||||
|
|
||||||
|
// Build the record category properties
|
||||||
|
JsonObject recordFolderProperties = buildObject()
|
||||||
|
.add(NAME, FOLDER_NAME)
|
||||||
|
.add(NODE_TYPE, RECORD_FOLDER_TYPE.toString())
|
||||||
|
.addObject(PROPERTIES)
|
||||||
|
.add(PROPERTIES_TITLE, FOLDER_TITLE)
|
||||||
|
.end()
|
||||||
|
.getJson();
|
||||||
|
|
||||||
|
// Create the record folder
|
||||||
|
FilePlanComponent folder = filePlanComponentAPI.createFilePlanComponent(recordFolderProperties, filePlanComponent.getId());
|
||||||
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
|
||||||
|
// Check folder has been created within the category created
|
||||||
|
assertEquals(filePlanComponent.getId(),folder.getParentId());
|
||||||
|
// Verify the returned properties for the file plan component - record folder
|
||||||
|
assertFalse(folder.isIsCategory());
|
||||||
|
assertFalse(folder.isIsFile());
|
||||||
|
assertTrue(folder.isIsRecordFolder());
|
||||||
|
|
||||||
|
assertEquals(folder.getName(), FOLDER_NAME);
|
||||||
|
assertEquals(folder.getNodeType(), RECORD_FOLDER_TYPE.toString());
|
||||||
|
assertEquals(folder.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
|
||||||
|
|
||||||
|
// Verify the returned file plan component properties
|
||||||
|
FilePlanComponentProperties folderProperties = folder.getProperties();
|
||||||
|
assertEquals(folderProperties.getTitle(), FOLDER_TITLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that RM site is created
|
||||||
|
* When I use the API to create a new record folder into transfers container/holds container/unfiled
|
||||||
|
* Then the operation fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
(
|
||||||
|
description = "Create a folder into hold/transfers/unfiled/file plan container",
|
||||||
|
dataProviderClass = TestData.class,
|
||||||
|
dataProvider = "getContainers"
|
||||||
|
)
|
||||||
|
@Bug(id="RM-4327")
|
||||||
|
public void createFolderIntoSpecialContainers(String filePlanComponent) throws Exception
|
||||||
|
{
|
||||||
|
// Authenticate with admin user
|
||||||
|
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
|
||||||
|
String componentID = filePlanComponentAPI.getFilePlanComponent(filePlanComponent).getId();
|
||||||
|
|
||||||
|
// Build the record category properties
|
||||||
|
JsonObject recordFolderProperties = buildObject()
|
||||||
|
.add(NAME, FOLDER_NAME)
|
||||||
|
.add(NODE_TYPE, RECORD_FOLDER_TYPE.toString())
|
||||||
|
.addObject(PROPERTIES)
|
||||||
|
.add(PROPERTIES_TITLE, FOLDER_TITLE)
|
||||||
|
.end()
|
||||||
|
.getJson();
|
||||||
|
|
||||||
|
// Create a record folder
|
||||||
|
filePlanComponentAPI.createFilePlanComponent(recordFolderProperties, componentID);
|
||||||
|
|
||||||
|
// Check the API Response code
|
||||||
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(UNPROCESSABLE_ENTITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that a record folder exists
|
||||||
|
* When I ask for the details of a record folder
|
||||||
|
* Then I am given the details of a record folder
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
(
|
||||||
|
description = "Check the details returned for a record folder"
|
||||||
|
)
|
||||||
|
public void checkTheRecordFolderProperties() throws Exception
|
||||||
|
{
|
||||||
|
String CATEGORY=CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
// Authenticate with admin user
|
||||||
|
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
|
||||||
|
FilePlanComponent folder =createFolder(category.getId(),FOLDER_NAME);
|
||||||
|
|
||||||
|
FilePlanComponent folderDetails=filePlanComponentAPI.withParams("include="+IS_CLOSED).getFilePlanComponent(folder.getId());
|
||||||
|
|
||||||
|
// Verify the returned properties for the file plan component - record folder
|
||||||
|
assertEquals(RECORD_FOLDER_TYPE.toString(),folderDetails.getNodeType());
|
||||||
|
assertTrue(folderDetails.isIsRecordFolder());
|
||||||
|
assertFalse(folderDetails.isIsCategory());
|
||||||
|
assertFalse(folderDetails.isIsFile());
|
||||||
|
assertFalse(folderDetails.isClosed());
|
||||||
|
|
||||||
|
assertEquals(FOLDER_NAME,folderDetails.getName());
|
||||||
|
assertEquals(dataUser.getAdminUser().getUsername(),folderDetails.getCreatedByUser().getId());
|
||||||
|
assertEquals(dataUser.getAdminUser().getUsername(), folderDetails.getModifiedByUser().getId());
|
||||||
|
assertEquals(FOLDER_TITLE,folderDetails.getProperties().getTitle());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that a record folder exists
|
||||||
|
* When I use the API to update its details
|
||||||
|
* Then the details of the record folder are updated
|
||||||
|
* The above test does treat any custom metadata
|
||||||
|
* Note: the details of the record folder includes any custom meta-data
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
(
|
||||||
|
description = "Update the details returned for a record folder"
|
||||||
|
)
|
||||||
|
public void updateTheRecordFolderProperties() throws Exception
|
||||||
|
{
|
||||||
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
// Authenticate with admin user
|
||||||
|
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
|
||||||
|
FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
|
||||||
|
|
||||||
|
// Create record category first
|
||||||
|
String folderDescription = "The folder description is updated" + getRandomAlphanumeric();
|
||||||
|
String folderName= "The folder name is updated" + getRandomAlphanumeric();
|
||||||
|
String folderTitle = "Update title " + getRandomAlphanumeric();
|
||||||
|
String location="Location"+getRandomAlphanumeric();
|
||||||
|
String review_period="month|1";
|
||||||
|
|
||||||
|
// Build the file plan root properties
|
||||||
|
JsonObject folderProperties = buildObject()
|
||||||
|
.add(NAME, folderName)
|
||||||
|
.addObject(PROPERTIES)
|
||||||
|
.add(PROPERTIES_TITLE, folderTitle)
|
||||||
|
.add(PROPERTIES_DESCRIPTION, folderDescription)
|
||||||
|
.add(PROPERTIES_VITAL_RECORD_INDICATOR,true)
|
||||||
|
.add(PROPERTIES_REVIEW_PERIOD, review_period)
|
||||||
|
.add(PROPERTIES_LOCATION, location)
|
||||||
|
.end()
|
||||||
|
.getJson();
|
||||||
|
|
||||||
|
// Update the record category
|
||||||
|
FilePlanComponent folderUpdated = filePlanComponentAPI.updateFilePlanComponent(folderProperties, folder.getId());
|
||||||
|
|
||||||
|
// Check the Response Status Code
|
||||||
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK);
|
||||||
|
|
||||||
|
// Verify the returned properties for the file plan component - record folder
|
||||||
|
assertEquals(folderName, folderUpdated.getName());
|
||||||
|
assertEquals(folderDescription, folderUpdated.getProperties().getDescription());
|
||||||
|
assertEquals(folderTitle, folderUpdated.getProperties().getTitle());
|
||||||
|
assertTrue(folderUpdated.getProperties().isVitalRecord());
|
||||||
|
assertEquals(location, folderUpdated.getProperties().getLocation());
|
||||||
|
assertNotNull(folderUpdated.getProperties().getReviewPeriod().getPeriodType());
|
||||||
|
assertNotNull(folderUpdated.getProperties().getReviewPeriod().getExpression());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that a record folder exists
|
||||||
|
* When I use the API to delete the record folder
|
||||||
|
* Then it deleted according to the normal rules governing the deletion of record folders
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
(
|
||||||
|
description = "Delete record folder"
|
||||||
|
)
|
||||||
|
public void deleteRecordFolder() throws Exception
|
||||||
|
{
|
||||||
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
|
||||||
|
// Authenticate with admin user
|
||||||
|
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
|
||||||
|
FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
|
||||||
|
// Delete the Record folder
|
||||||
|
filePlanComponentAPI.deleteFilePlanComponent(folder.getId());
|
||||||
|
// Check the Response Status Code
|
||||||
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(NO_CONTENT);
|
||||||
|
// Check the File Plan Component is not found
|
||||||
|
filePlanComponentAPI.getFilePlanComponent(folder.getId());
|
||||||
|
// Check the Response Status Code
|
||||||
|
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that a record category exists
|
||||||
|
* And contains several record folders
|
||||||
|
* When I use the APi to get the file plan component children for the existing category
|
||||||
|
* Then I am provided with a list of the contained record folders
|
||||||
|
* And their details
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
(
|
||||||
|
description = "List children of a category"
|
||||||
|
)
|
||||||
|
public void listFolders() throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
|
||||||
|
// Authenticate with admin user
|
||||||
|
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
|
||||||
|
|
||||||
|
// Add child olders
|
||||||
|
ArrayList<FilePlanComponent> children = new ArrayList<FilePlanComponent>();
|
||||||
|
for (int i = 0; i < NUMBER_OF_FOLDERS; i++)
|
||||||
|
{
|
||||||
|
// Create a child
|
||||||
|
FilePlanComponent child = createFolder(category.getId(),
|
||||||
|
getRandomAlphanumeric());
|
||||||
|
assertNotNull(child.getId());
|
||||||
|
children.add(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authenticate with admin user
|
||||||
|
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
|
||||||
|
// List children from API
|
||||||
|
FilePlanComponentsCollection apiChildren = filePlanComponentAPI.listChildComponents(category.getId());
|
||||||
|
|
||||||
|
// Check status code
|
||||||
|
restWrapper.assertStatusCodeIs(OK);
|
||||||
|
|
||||||
|
// Check listed children against created list
|
||||||
|
apiChildren.getEntries().forEach(c ->
|
||||||
|
{
|
||||||
|
FilePlanComponent filePlanComponent = c.getFilePlanComponent();
|
||||||
|
assertNotNull(filePlanComponent.getId());
|
||||||
|
logger.info("Checking child " + filePlanComponent.getId());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Find this child in created children list
|
||||||
|
FilePlanComponent createdComponent = children.stream()
|
||||||
|
.filter(child -> child.getId().equals(filePlanComponent.getId()))
|
||||||
|
.findFirst()
|
||||||
|
.get();
|
||||||
|
|
||||||
|
// Created by
|
||||||
|
assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
|
||||||
|
|
||||||
|
// Is parent Id set correctly
|
||||||
|
assertEquals(filePlanComponent.getParentId(), category.getId());
|
||||||
|
assertFalse(filePlanComponent.isIsFile());
|
||||||
|
|
||||||
|
// Boolean properties related to node type
|
||||||
|
assertTrue(filePlanComponent.isIsRecordFolder());
|
||||||
|
assertFalse(filePlanComponent.isIsCategory());
|
||||||
|
|
||||||
|
assertEquals(createdComponent.getName(), filePlanComponent.getName());
|
||||||
|
assertEquals(createdComponent.getNodeType(), filePlanComponent.getNodeType());
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (NoSuchElementException e)
|
||||||
|
{
|
||||||
|
fail("No child element for " + filePlanComponent.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
@AfterClass (alwaysRun = true)
|
||||||
|
public void tearDown() throws Exception
|
||||||
|
{
|
||||||
|
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||||
|
filePlanComponentAPI.listChildComponents(FILE_PLAN_ALIAS.toString()).getEntries().forEach(filePlanComponentEntry ->
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
filePlanComponentAPI.deleteFilePlanComponent(filePlanComponentEntry.getFilePlanComponent().getId());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -34,8 +34,8 @@ import static org.testng.Assert.assertNotNull;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import org.alfresco.dataprep.UserService;
|
import org.alfresco.dataprep.UserService;
|
||||||
import org.alfresco.rest.core.RestWrapper;
|
|
||||||
import org.alfresco.rest.rm.base.BaseRestTest;
|
import org.alfresco.rest.rm.base.BaseRestTest;
|
||||||
|
import org.alfresco.rest.core.RestWrapper;
|
||||||
import org.alfresco.rest.rm.model.site.RMSite;
|
import org.alfresco.rest.rm.model.site.RMSite;
|
||||||
import org.alfresco.rest.rm.requests.RMSiteAPI;
|
import org.alfresco.rest.rm.requests.RMSiteAPI;
|
||||||
import org.alfresco.utility.constants.UserRole;
|
import org.alfresco.utility.constants.UserRole;
|
||||||
|
Reference in New Issue
Block a user