mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4396: Experiment using lombok to remove boiler plate code
This commit is contained in:
@@ -34,6 +34,11 @@ import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for file plan component
|
||||
*
|
||||
@@ -41,6 +46,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
* @author Rodica Sutu
|
||||
* @since 2.6
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FilePlanComponent
|
||||
{
|
||||
@JsonProperty (required = true)
|
||||
@@ -94,325 +103,4 @@ public class FilePlanComponent
|
||||
|
||||
@JsonProperty (required = true)
|
||||
private FilePlanComponentUserInfo modifiedByUser;
|
||||
|
||||
|
||||
/**Helper constructor for creating the file plan component using
|
||||
*
|
||||
* @param name File Plan Component name
|
||||
* @param nodeType File Plan Component node type
|
||||
* @param properties File Plan Component properties
|
||||
*/
|
||||
public FilePlanComponent(String name, String nodeType, FilePlanComponentProperties properties)
|
||||
{
|
||||
this.name = name;
|
||||
this.nodeType = nodeType;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper constructor to create empty file plan component
|
||||
*/
|
||||
public FilePlanComponent() { }
|
||||
|
||||
/**
|
||||
* Helper constructor for creating the file plan component using
|
||||
*
|
||||
* @param name File Plan Component name
|
||||
*/
|
||||
public FilePlanComponent(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper constructor for creating the file plan component using
|
||||
*
|
||||
* @param name File Plan Component name
|
||||
* @param properties File Plan Component properties
|
||||
*/
|
||||
public FilePlanComponent(String name, FilePlanComponentProperties properties)
|
||||
{
|
||||
this.name = name;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 parentId
|
||||
*/
|
||||
public String getParentId()
|
||||
{
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parentId the parentId to set
|
||||
*/
|
||||
public void setParentId(String parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 nodeType
|
||||
*/
|
||||
public String getNodeType()
|
||||
{
|
||||
return this.nodeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeType the nodeType to set
|
||||
*/
|
||||
public void setNodeType(String nodeType)
|
||||
{
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isCategory
|
||||
*/
|
||||
public Boolean isIsCategory()
|
||||
{
|
||||
return this.isCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isCategory the isCategory to set
|
||||
*/
|
||||
public void setCategory(Boolean isCategory)
|
||||
{
|
||||
this.isCategory = isCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isRecordFolder
|
||||
*/
|
||||
public Boolean isIsRecordFolder()
|
||||
{
|
||||
return this.isRecordFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isRecordFolder the isRecordFolder to set
|
||||
*/
|
||||
public void setRecordFolder(Boolean isRecordFolder)
|
||||
{
|
||||
this.isRecordFolder = isRecordFolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isFile
|
||||
*/
|
||||
public Boolean isIsFile()
|
||||
{
|
||||
return this.isFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isFile the isFile to set
|
||||
*/
|
||||
public void setFile(Boolean isFile)
|
||||
{
|
||||
this.isFile = isFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hasRetentionSchedule
|
||||
*/
|
||||
public Boolean isHasRetentionSchedule()
|
||||
{
|
||||
return this.hasRetentionSchedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hasRetentionSchedule the hasRetentionSchedule to set
|
||||
*/
|
||||
public void setHasRetentionSchedule(Boolean hasRetentionSchedule)
|
||||
{
|
||||
this.hasRetentionSchedule = hasRetentionSchedule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the properties
|
||||
*/
|
||||
public FilePlanComponentProperties getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param properties the properties to set
|
||||
*/
|
||||
public void setProperties(FilePlanComponentProperties properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the aspectNames
|
||||
*/
|
||||
public List<String> getAspectNames()
|
||||
{
|
||||
return this.aspectNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aspectNames the aspectNames to set
|
||||
*/
|
||||
public void setAspectNames(List<String> aspectNames)
|
||||
{
|
||||
this.aspectNames = aspectNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createdByUser
|
||||
*/
|
||||
public FilePlanComponentUserInfo getCreatedByUser()
|
||||
{
|
||||
return this.createdByUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createdByUser the createdByUser to set
|
||||
*/
|
||||
public void setCreatedByUser(FilePlanComponentUserInfo createdByUser)
|
||||
{
|
||||
this.createdByUser = createdByUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the allowableOperations
|
||||
*/
|
||||
public List<String> getAllowableOperations()
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -42,6 +42,11 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* POJO for file plan component properties
|
||||
*
|
||||
@@ -50,6 +55,10 @@ import org.alfresco.rest.rm.community.util.ReviewPeriodSerializer;
|
||||
*/
|
||||
//FIXME: Once the fields have been added the JsonIgnoreProperties annotation should be removed
|
||||
@JsonIgnoreProperties (ignoreUnknown = true)
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FilePlanComponentProperties
|
||||
{
|
||||
|
||||
@@ -74,133 +83,4 @@ public class FilePlanComponentProperties
|
||||
|
||||
@JsonProperty(PROPERTIES_LOCATION)
|
||||
private String location;
|
||||
|
||||
public FilePlanComponentProperties(String title, String description)
|
||||
{
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public FilePlanComponentProperties(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public FilePlanComponentProperties()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the vitalRecord
|
||||
*/
|
||||
public Boolean isVitalRecord()
|
||||
{
|
||||
return this.vitalRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vitalRecord the vitalRecord to set
|
||||
*/
|
||||
public void setVitalRecord(Boolean vitalRecord)
|
||||
{
|
||||
this.vitalRecord = vitalRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return this.title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param title the title to set
|
||||
*/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the holdReason
|
||||
*/
|
||||
public String getHoldReason()
|
||||
{
|
||||
return this.holdReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param holdReason the holdReason to set
|
||||
*/
|
||||
public void setHoldReason(String holdReason)
|
||||
{
|
||||
this.holdReason = holdReason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -182,7 +182,13 @@ public class BaseRestTest extends RestTest
|
||||
{
|
||||
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||
|
||||
FilePlanComponent filePlanComponent=new FilePlanComponent(componentName, componentType.toString(),new FilePlanComponentProperties(componentTitle));
|
||||
FilePlanComponent filePlanComponent = FilePlanComponent.builder()
|
||||
.name(componentName)
|
||||
.nodeType(componentType.toString())
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title(componentTitle)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(filePlanComponent, parentComponentId);
|
||||
restWrapper.assertStatusCodeIs(CREATED);
|
||||
|
@@ -199,9 +199,12 @@ public class FilePlanTests extends BaseRestTest
|
||||
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||
|
||||
// Build object for updating the filePlan
|
||||
FilePlanComponent filePlanComponent= new FilePlanComponent();
|
||||
FilePlanComponentProperties filePlanComponentProperties=new FilePlanComponentProperties(FILE_PLAN_TITLE, FILE_PLAN_DESCRIPTION);
|
||||
filePlanComponent.setProperties(filePlanComponentProperties);
|
||||
FilePlanComponent filePlanComponent = FilePlanComponent.builder()
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title(FILE_PLAN_TITLE)
|
||||
.description(FILE_PLAN_DESCRIPTION)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Update the record category
|
||||
FilePlanComponent renamedFilePlanComponent = filePlanComponentAPI.updateFilePlanComponent(filePlanComponent,FILE_PLAN_ALIAS.toString());
|
||||
@@ -301,7 +304,12 @@ public class FilePlanTests extends BaseRestTest
|
||||
String name = filePlanAlias + getRandomAlphanumeric();
|
||||
|
||||
// Build the file plan root properties
|
||||
FilePlanComponent filePlanComponent=new FilePlanComponent(name,rmType.toString(),new FilePlanComponentProperties());
|
||||
FilePlanComponent filePlanComponent = FilePlanComponent.builder()
|
||||
.name(name)
|
||||
.nodeType(rmType.toString())
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Authenticate with admin user
|
||||
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||
|
@@ -94,8 +94,15 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
||||
|
||||
// Build the record category properties
|
||||
FilePlanComponent recordCategory= new FilePlanComponent(categoryName,RECORD_CATEGORY_TYPE.toString(),
|
||||
new FilePlanComponentProperties(categoryTitle));
|
||||
FilePlanComponent recordCategory = FilePlanComponent.builder()
|
||||
.name(categoryName)
|
||||
.nodeType(RECORD_CATEGORY_TYPE.toString())
|
||||
.properties(
|
||||
FilePlanComponentProperties.builder()
|
||||
.title(categoryTitle)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Create the record category
|
||||
FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS.toString());
|
||||
|
||||
@@ -103,9 +110,9 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
restWrapper.assertStatusCodeIs(CREATED);
|
||||
|
||||
// Verify the returned file plan component
|
||||
assertTrue(filePlanComponent.isIsCategory());
|
||||
assertFalse(filePlanComponent.isIsFile());
|
||||
assertFalse(filePlanComponent.isIsRecordFolder());
|
||||
assertTrue(filePlanComponent.getIsCategory());
|
||||
assertFalse(filePlanComponent.getIsFile());
|
||||
assertFalse(filePlanComponent.getIsRecordFolder());
|
||||
|
||||
assertEquals(filePlanComponent.getName(), categoryName);
|
||||
assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE.toString());
|
||||
@@ -139,8 +146,14 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
||||
|
||||
// Build the record category properties
|
||||
FilePlanComponent recordCategory = new FilePlanComponent(categoryName, RECORD_CATEGORY_TYPE.toString(),
|
||||
new FilePlanComponentProperties(categoryTitle));
|
||||
FilePlanComponent recordCategory = FilePlanComponent.builder()
|
||||
.name(categoryName)
|
||||
.nodeType(RECORD_CATEGORY_TYPE.toString())
|
||||
.properties(
|
||||
FilePlanComponentProperties.builder()
|
||||
.title(categoryTitle)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Create the record category
|
||||
FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS.toString());
|
||||
@@ -148,7 +161,7 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
String newCategoryName = "Rename " + categoryName;
|
||||
|
||||
// Build the properties which will be updated
|
||||
FilePlanComponent recordCategoryUpdated = new FilePlanComponent(newCategoryName);
|
||||
FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build();
|
||||
|
||||
// Update the record category
|
||||
FilePlanComponent renamedFilePlanComponent = filePlanComponentAPI.updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
|
||||
@@ -186,8 +199,15 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
||||
|
||||
// Build the record category properties
|
||||
FilePlanComponent recordCategory = new FilePlanComponent(categoryName, RECORD_CATEGORY_TYPE.toString(),
|
||||
new FilePlanComponentProperties(categoryTitle));
|
||||
FilePlanComponent recordCategory = FilePlanComponent.builder()
|
||||
.name(categoryName)
|
||||
.nodeType(RECORD_CATEGORY_TYPE.toString())
|
||||
.properties(
|
||||
FilePlanComponentProperties.builder()
|
||||
.title(categoryTitle)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Create the record category
|
||||
FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS.toString());
|
||||
|
||||
@@ -226,9 +246,9 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
|
||||
// Verify child category
|
||||
assertEquals(childCategory.getParentId(), rootCategory.getId());
|
||||
assertTrue(childCategory.isIsCategory());
|
||||
assertFalse(childCategory.isIsFile());
|
||||
assertFalse(childCategory.isIsRecordFolder());
|
||||
assertTrue(childCategory.getIsCategory());
|
||||
assertFalse(childCategory.getIsFile());
|
||||
assertFalse(childCategory.getIsRecordFolder());
|
||||
assertEquals(childCategory.getNodeType(), RECORD_CATEGORY_TYPE.toString());
|
||||
}
|
||||
|
||||
@@ -295,19 +315,19 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
assertEquals(filePlanComponent.getParentId(), rootCategory.getId());
|
||||
|
||||
// Only categories or folders have been created
|
||||
assertFalse(filePlanComponent.isIsFile());
|
||||
assertFalse(filePlanComponent.getIsFile());
|
||||
|
||||
// Boolean properties related to node type
|
||||
// Only RECORD_CATEGORY_TYPE and RECORD_FOLDER_TYPE have been created
|
||||
if (filePlanComponent.getNodeType().equals(RECORD_CATEGORY_TYPE.toString()))
|
||||
{
|
||||
assertTrue(filePlanComponent.isIsCategory());
|
||||
assertFalse(filePlanComponent.isIsRecordFolder());
|
||||
assertTrue(filePlanComponent.getIsCategory());
|
||||
assertFalse(filePlanComponent.getIsRecordFolder());
|
||||
}
|
||||
else
|
||||
{
|
||||
assertTrue(filePlanComponent.isIsRecordFolder());
|
||||
assertFalse(filePlanComponent.isIsCategory());
|
||||
assertTrue(filePlanComponent.getIsRecordFolder());
|
||||
assertFalse(filePlanComponent.getIsCategory());
|
||||
}
|
||||
|
||||
// Does returned object have the same contents as the created one?
|
||||
@@ -348,8 +368,14 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS.toString(), COMPONENT_NAME);
|
||||
|
||||
//Build node properties
|
||||
FilePlanComponent recordCategory = new FilePlanComponent(COMPONENT_NAME,nodeType,
|
||||
new FilePlanComponentProperties("Title for " + COMPONENT_NAME));
|
||||
FilePlanComponent recordCategory = FilePlanComponent.builder()
|
||||
.name(COMPONENT_NAME)
|
||||
.nodeType(nodeType)
|
||||
.properties(
|
||||
FilePlanComponentProperties.builder()
|
||||
.title("Title for " + COMPONENT_NAME)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
//create the invalid node type
|
||||
filePlanComponentAPI.createFilePlanComponent(recordCategory, category.getId());
|
||||
@@ -383,8 +409,14 @@ public class RecordCategoryTest extends BaseRestTest
|
||||
{
|
||||
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||
//Build node properties
|
||||
FilePlanComponent component = new FilePlanComponent(componentName, componentType.toString(),
|
||||
new FilePlanComponentProperties("Title for " + componentName));
|
||||
FilePlanComponent component = FilePlanComponent.builder()
|
||||
.name(componentName)
|
||||
.nodeType(componentType.toString())
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title("Title for " + componentName)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(component, parentComponentId);
|
||||
restWrapper.assertStatusCodeIs(CREATED);
|
||||
return fpc;
|
||||
|
@@ -93,8 +93,13 @@ public class RecordFolderTests extends BaseRestTest
|
||||
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
|
||||
FilePlanComponent filePlanComponent=createCategory(FILE_PLAN_ALIAS.toString(), CATEGORY);
|
||||
|
||||
FilePlanComponentProperties filePlanComponentProperties = new FilePlanComponentProperties(FOLDER_TITLE);
|
||||
FilePlanComponent recordFolder = new FilePlanComponent(FOLDER_NAME,RECORD_FOLDER_TYPE.toString(), filePlanComponentProperties);
|
||||
FilePlanComponent recordFolder = FilePlanComponent.builder()
|
||||
.name(FOLDER_NAME)
|
||||
.nodeType(RECORD_FOLDER_TYPE.toString())
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title(FOLDER_TITLE)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Create the record folder
|
||||
FilePlanComponent folder = filePlanComponentAPI.createFilePlanComponent(recordFolder, filePlanComponent.getId());
|
||||
@@ -105,9 +110,9 @@ public class RecordFolderTests extends BaseRestTest
|
||||
// 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());
|
||||
assertFalse(folder.getIsCategory());
|
||||
assertFalse(folder.getIsFile());
|
||||
assertTrue(folder.getIsRecordFolder());
|
||||
|
||||
assertEquals(folder.getName(), FOLDER_NAME);
|
||||
assertEquals(folder.getNodeType(), RECORD_FOLDER_TYPE.toString());
|
||||
@@ -138,8 +143,14 @@ public class RecordFolderTests extends BaseRestTest
|
||||
String componentID = filePlanComponentAPI.getFilePlanComponent(filePlanComponent).getId();
|
||||
|
||||
// Build the record category properties
|
||||
FilePlanComponent recordFolder= new FilePlanComponent(FOLDER_NAME,RECORD_FOLDER_TYPE.toString(),
|
||||
new FilePlanComponentProperties(FOLDER_TITLE));
|
||||
FilePlanComponent recordFolder = FilePlanComponent.builder()
|
||||
.name(FOLDER_NAME)
|
||||
.nodeType(RECORD_FOLDER_TYPE.toString())
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title(FOLDER_TITLE)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Create a record folder
|
||||
filePlanComponentAPI.createFilePlanComponent(recordFolder, componentID);
|
||||
|
||||
@@ -168,10 +179,10 @@ public class RecordFolderTests extends BaseRestTest
|
||||
|
||||
// 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());
|
||||
assertTrue(folderDetails.getIsRecordFolder());
|
||||
assertFalse(folderDetails.getIsCategory());
|
||||
assertFalse(folderDetails.getIsFile());
|
||||
assertFalse(folderDetails.getIsClosed());
|
||||
|
||||
assertEquals(FOLDER_NAME,folderDetails.getName());
|
||||
assertEquals(dataUser.getAdminUser().getUsername(),folderDetails.getCreatedByUser().getId());
|
||||
@@ -210,11 +221,16 @@ public class RecordFolderTests extends BaseRestTest
|
||||
String location="Location"+getRandomAlphanumeric();
|
||||
|
||||
//Create the file plan component properties to update
|
||||
FilePlanComponentProperties filePlanComponentProperties= new FilePlanComponentProperties(folderTitle, folderDescription);
|
||||
filePlanComponentProperties.setVitalRecord(true);
|
||||
filePlanComponentProperties.setReviewPeriod( new ReviewPeriod("month","1"));
|
||||
filePlanComponentProperties.setLocation(location);
|
||||
FilePlanComponent recordFolder = new FilePlanComponent(folderName,filePlanComponentProperties);
|
||||
FilePlanComponent recordFolder = FilePlanComponent.builder()
|
||||
.name(folderName)
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title(folderTitle)
|
||||
.description(folderDescription)
|
||||
.vitalRecord(true)
|
||||
.reviewPeriod(new ReviewPeriod("month","1"))
|
||||
.location(location)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Update the record category
|
||||
FilePlanComponent folderUpdated = filePlanComponentAPI.updateFilePlanComponent(recordFolder, folder.getId());
|
||||
@@ -226,7 +242,7 @@ public class RecordFolderTests extends BaseRestTest
|
||||
assertEquals(folderName, folderUpdated.getName());
|
||||
assertEquals(folderDescription, folderUpdated.getProperties().getDescription());
|
||||
assertEquals(folderTitle, folderUpdated.getProperties().getTitle());
|
||||
assertTrue(folderUpdated.getProperties().isVitalRecord());
|
||||
assertTrue(folderUpdated.getProperties().getVitalRecord());
|
||||
assertEquals(location, folderUpdated.getProperties().getLocation());
|
||||
assertNotNull(folderUpdated.getProperties().getReviewPeriod().getPeriodType());
|
||||
assertNotNull(folderUpdated.getProperties().getReviewPeriod().getExpression());
|
||||
@@ -325,11 +341,11 @@ public class RecordFolderTests extends BaseRestTest
|
||||
|
||||
// Is parent Id set correctly
|
||||
assertEquals(filePlanComponent.getParentId(), category.getId());
|
||||
assertFalse(filePlanComponent.isIsFile());
|
||||
assertFalse(filePlanComponent.getIsFile());
|
||||
|
||||
// Boolean properties related to node type
|
||||
assertTrue(filePlanComponent.isIsRecordFolder());
|
||||
assertFalse(filePlanComponent.isIsCategory());
|
||||
assertTrue(filePlanComponent.getIsRecordFolder());
|
||||
assertFalse(filePlanComponent.getIsCategory());
|
||||
|
||||
assertEquals(createdComponent.getName(), filePlanComponent.getName());
|
||||
assertEquals(createdComponent.getNodeType(), filePlanComponent.getNodeType());
|
||||
|
@@ -107,8 +107,14 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
||||
String folderDescription = folderName + " Description";
|
||||
|
||||
// Build unfiled records folder properties
|
||||
FilePlanComponent unfiledFolder=new FilePlanComponent(folderName,UNFILED_RECORD_FOLDER_TYPE.toString(),
|
||||
new FilePlanComponentProperties(folderTitle,folderDescription));
|
||||
FilePlanComponent unfiledFolder = FilePlanComponent.builder()
|
||||
.name(folderName)
|
||||
.nodeType(UNFILED_RECORD_FOLDER_TYPE.toString())
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title(folderTitle)
|
||||
.description(folderDescription)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(unfiledFolder,
|
||||
UNFILED_RECORDS_CONTAINER_ALIAS.toString());
|
||||
@@ -117,9 +123,9 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
||||
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(CREATED);
|
||||
|
||||
// Verify the returned file plan component
|
||||
assertFalse(filePlanComponent.isIsCategory());
|
||||
assertFalse(filePlanComponent.isIsFile());
|
||||
assertFalse(filePlanComponent.isIsRecordFolder()); // it is not a _normal_ record folder!
|
||||
assertFalse(filePlanComponent.getIsCategory());
|
||||
assertFalse(filePlanComponent.getIsFile());
|
||||
assertFalse(filePlanComponent.getIsRecordFolder()); // it is not a _normal_ record folder!
|
||||
|
||||
assertEquals(filePlanComponent.getName(), folderName);
|
||||
assertEquals(filePlanComponent.getNodeType(), UNFILED_RECORD_FOLDER_TYPE.toString());
|
||||
@@ -151,8 +157,14 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
||||
logger.info("creating " + componentType.toString());
|
||||
|
||||
// Build unfiled records folder properties
|
||||
FilePlanComponent unfiledFolder = new FilePlanComponent(folderName, componentType.toString(),
|
||||
new FilePlanComponentProperties(folderTitle, folderDescription));
|
||||
FilePlanComponent unfiledFolder = FilePlanComponent.builder()
|
||||
.name(folderName)
|
||||
.nodeType(componentType.toString())
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title(folderTitle)
|
||||
.description(folderDescription)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -189,8 +201,14 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
||||
assertEquals(parentFolderName, parentFolder.getName());
|
||||
|
||||
// Build the unfiled records folder properties
|
||||
FilePlanComponent unfiledFolder = new FilePlanComponent(childFolderName, UNFILED_RECORD_FOLDER_TYPE.toString(),
|
||||
new FilePlanComponentProperties(childFolderTitle, childFolderDescription));
|
||||
FilePlanComponent unfiledFolder = FilePlanComponent.builder()
|
||||
.name(childFolderName)
|
||||
.nodeType(UNFILED_RECORD_FOLDER_TYPE.toString())
|
||||
.properties(FilePlanComponentProperties.builder()
|
||||
.title(childFolderTitle)
|
||||
.description(childFolderDescription)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Create it as a child of parentFolder
|
||||
FilePlanComponent childFolder = filePlanComponentAPI.createFilePlanComponent(unfiledFolder,
|
||||
@@ -200,9 +218,9 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
||||
restWrapper.assertStatusCodeIs(CREATED);
|
||||
|
||||
// Verify the returned file plan component
|
||||
assertFalse(childFolder.isIsCategory());
|
||||
assertFalse(childFolder.isIsFile());
|
||||
assertFalse(childFolder.isIsRecordFolder()); // it is not a _normal_ record folder!
|
||||
assertFalse(childFolder.getIsCategory());
|
||||
assertFalse(childFolder.getIsFile());
|
||||
assertFalse(childFolder.getIsRecordFolder()); // it is not a _normal_ record folder!
|
||||
|
||||
assertEquals(childFolder.getName(), childFolderName);
|
||||
assertEquals(childFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE.toString());
|
||||
@@ -251,9 +269,14 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
||||
assertEquals(folderName, folderToModify.getName());
|
||||
|
||||
// Build the properties which will be updated
|
||||
FilePlanComponent folderToUpdate=new FilePlanComponent(modified + folderToModify.getName(),
|
||||
new FilePlanComponentProperties(modified + folderToModify.getProperties().getTitle(),
|
||||
modified + folderToModify.getProperties().getDescription()));
|
||||
FilePlanComponent folderToUpdate = FilePlanComponent.builder()
|
||||
.name(modified + folderToModify.getName())
|
||||
.properties(FilePlanComponentProperties.builder().
|
||||
title(modified + folderToModify.getProperties().getTitle()).
|
||||
description(modified + folderToModify.getProperties().getDescription())
|
||||
.build())
|
||||
.build();
|
||||
|
||||
// Update the unfiled records folder
|
||||
filePlanComponentAPI.updateFilePlanComponent(folderToUpdate, folderToModify.getId());
|
||||
// Verify the status code
|
||||
|
Reference in New Issue
Block a user