diff --git a/src/main/java/org/alfresco/com/FilePlanComponentAlias.java b/src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentAlias.java similarity index 96% rename from src/main/java/org/alfresco/com/FilePlanComponentAlias.java rename to src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentAlias.java index 13dc3dbd68..45ada4d9ec 100644 --- a/src/main/java/org/alfresco/com/FilePlanComponentAlias.java +++ b/src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentAlias.java @@ -9,7 +9,7 @@ * agreement is prohibited. * #L% */ -package org.alfresco.com; +package org.alfresco.com.fileplancomponents; /** * File plan component alias enumeration diff --git a/src/main/java/org/alfresco/com/FilePlanComponentFields.java b/src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentFields.java similarity index 95% rename from src/main/java/org/alfresco/com/FilePlanComponentFields.java rename to src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentFields.java index 473fd396ed..71495ca033 100644 --- a/src/main/java/org/alfresco/com/FilePlanComponentFields.java +++ b/src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentFields.java @@ -9,7 +9,7 @@ * agreement is prohibited. * #L% */ -package org.alfresco.com; +package org.alfresco.com.fileplancomponents; /** * FIXME: Document me :) diff --git a/src/main/java/org/alfresco/com/FilePlanComponentType.java b/src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentType.java similarity index 97% rename from src/main/java/org/alfresco/com/FilePlanComponentType.java rename to src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentType.java index 432178c75e..ebf8cc070d 100644 --- a/src/main/java/org/alfresco/com/FilePlanComponentType.java +++ b/src/main/java/org/alfresco/com/fileplancomponents/FilePlanComponentType.java @@ -9,7 +9,7 @@ * agreement is prohibited. * #L% */ -package org.alfresco.com; +package org.alfresco.com.fileplancomponents; /** * File plan component type enumeration diff --git a/src/main/java/org/alfresco/com/site/RMSiteCompliance.java b/src/main/java/org/alfresco/com/site/RMSiteCompliance.java new file mode 100644 index 0000000000..76f0bf4926 --- /dev/null +++ b/src/main/java/org/alfresco/com/site/RMSiteCompliance.java @@ -0,0 +1,24 @@ +/* + * #%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.com.site; + +/** + * RM Site compliance + * + * @author Tuna Aksoy + * @since 1.0 + */ +public enum RMSiteCompliance +{ + STANDARD, + DOD5015 +} diff --git a/src/main/java/org/alfresco/com/site/RMSiteFields.java b/src/main/java/org/alfresco/com/site/RMSiteFields.java new file mode 100644 index 0000000000..c7c65f0d06 --- /dev/null +++ b/src/main/java/org/alfresco/com/site/RMSiteFields.java @@ -0,0 +1,37 @@ +/* + * #%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.com.site; + +/** + *RM Site properties from the RM Model Schema + *"entry": { + * "id": "string", + * "guid": "string", + * "title": "string", + * "description": "string", + * "visibility": "{@link org.springframework.social.alfresco.api.entities.Site.Visibility}", + * "compliance": "{@link RMSiteCompliance}", + * "role": "{@link org.alfresco.utility.constants.UserRole}" + *} + * @author Tuna Aksoy + * @author Rodica Sutu + * @since 1.0 + */ +public class RMSiteFields +{ + public static final String ID = "id"; + public static final String COMPLIANCE = "compliance"; + public static final String TITLE = "title"; + public static final String DESCRIPTION = "description"; + public static final String VISIBILITY ="visibility"; + public static final String ROLE = "role"; +} diff --git a/src/main/java/org/alfresco/rest/model/FilePlanComponentEntry.java b/src/main/java/org/alfresco/rest/model/FilePlanComponentEntry.java index c0c0d385f2..82ee037347 100644 --- a/src/main/java/org/alfresco/rest/model/FilePlanComponentEntry.java +++ b/src/main/java/org/alfresco/rest/model/FilePlanComponentEntry.java @@ -14,6 +14,7 @@ package org.alfresco.rest.model; import com.fasterxml.jackson.annotation.JsonProperty; import org.alfresco.rest.core.RestModels; +import org.alfresco.rest.model.fileplancomponents.FilePlanComponent; /** * POJO for file plan component entry diff --git a/src/main/java/org/alfresco/rest/model/FilePlanComponent.java b/src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponent.java similarity index 96% rename from src/main/java/org/alfresco/rest/model/FilePlanComponent.java rename to src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponent.java index 36b48489f9..14f33de343 100644 --- a/src/main/java/org/alfresco/rest/model/FilePlanComponent.java +++ b/src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponent.java @@ -9,9 +9,9 @@ * agreement is prohibited. * #L% */ -package org.alfresco.rest.model; +package org.alfresco.rest.model.fileplancomponents; -import static org.alfresco.com.FilePlanComponentFields.PROPERTIES; +import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES; import java.util.List; diff --git a/src/main/java/org/alfresco/rest/model/FilePlanComponentCreatedByUser.java b/src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponentCreatedByUser.java similarity index 95% rename from src/main/java/org/alfresco/rest/model/FilePlanComponentCreatedByUser.java rename to src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponentCreatedByUser.java index 37994c350e..a9a993b7f7 100644 --- a/src/main/java/org/alfresco/rest/model/FilePlanComponentCreatedByUser.java +++ b/src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponentCreatedByUser.java @@ -9,7 +9,7 @@ * agreement is prohibited. * #L% */ -package org.alfresco.rest.model; +package org.alfresco.rest.model.fileplancomponents; /** * POJO for file plan component created by object diff --git a/src/main/java/org/alfresco/rest/model/FilePlanComponentProperties.java b/src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponentProperties.java similarity index 83% rename from src/main/java/org/alfresco/rest/model/FilePlanComponentProperties.java rename to src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponentProperties.java index 89357f51a8..805b6dd68d 100644 --- a/src/main/java/org/alfresco/rest/model/FilePlanComponentProperties.java +++ b/src/main/java/org/alfresco/rest/model/fileplancomponents/FilePlanComponentProperties.java @@ -9,11 +9,11 @@ * agreement is prohibited. * #L% */ -package org.alfresco.rest.model; +package org.alfresco.rest.model.fileplancomponents; -import static org.alfresco.com.FilePlanComponentFields.PROPERTIES_HOLD_REASON; -import static org.alfresco.com.FilePlanComponentFields.PROPERTIES_TITLE; -import static org.alfresco.com.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR; +import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_HOLD_REASON; +import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; +import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/org/alfresco/rest/model/site/RMSite.java b/src/main/java/org/alfresco/rest/model/site/RMSite.java new file mode 100644 index 0000000000..960f518488 --- /dev/null +++ b/src/main/java/org/alfresco/rest/model/site/RMSite.java @@ -0,0 +1,47 @@ +/* + * #%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.model.site; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import org.alfresco.com.site.RMSiteCompliance; +import org.alfresco.rest.model.RestSiteModel; + +/** + * POJO for RM Site component + * + * @author Rodica Sutu + * @since 1.0 + */ +public class RMSite extends RestSiteModel +{ + @JsonProperty (required = true) + private RMSiteCompliance compliance; + + /** + * Helper method to set RM site compliance + * @param compliance {@link RMSiteCompliance} the compliance to set + */ + public void setCompliance(RMSiteCompliance compliance) + { + this.compliance = compliance; + } + + /** + * Helper method to get RM site compliance + * @return compliance the RM Site compliance to get + */ + public RMSiteCompliance getCompliance() + { + return compliance; + } +} diff --git a/src/main/java/org/alfresco/rest/requests/FilePlanComponentApi.java b/src/main/java/org/alfresco/rest/requests/FilePlanComponentApi.java index f2764539c6..bb3d82329d 100644 --- a/src/main/java/org/alfresco/rest/requests/FilePlanComponentApi.java +++ b/src/main/java/org/alfresco/rest/requests/FilePlanComponentApi.java @@ -23,8 +23,8 @@ import static org.springframework.http.HttpMethod.PUT; import com.google.gson.JsonObject; import org.alfresco.rest.core.RestAPI; -import org.alfresco.rest.model.FilePlanComponent; import org.alfresco.rest.model.FilePlanComponentsCollection; +import org.alfresco.rest.model.fileplancomponents.FilePlanComponent; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -84,7 +84,7 @@ public class FilePlanComponentApi extends RestAPI filePlanComponentId )); } - + /** * Creates a file plan component with the given properties under the parent node with the given id * diff --git a/src/main/java/org/alfresco/rest/requests/RMSiteAPI.java b/src/main/java/org/alfresco/rest/requests/RMSiteAPI.java new file mode 100644 index 0000000000..7cb99889cc --- /dev/null +++ b/src/main/java/org/alfresco/rest/requests/RMSiteAPI.java @@ -0,0 +1,123 @@ +/* + * #%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.requests; + +import static org.alfresco.rest.core.RestRequest.requestWithBody; +import static org.alfresco.rest.core.RestRequest.simpleRequest; +import static org.springframework.http.HttpMethod.DELETE; +import static org.springframework.http.HttpMethod.GET; +import static org.springframework.http.HttpMethod.POST; +import static org.springframework.http.HttpMethod.PUT; + +import com.google.gson.JsonObject; + +import org.alfresco.rest.core.RestAPI; +import org.alfresco.rest.model.site.RMSite; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +/** + * File plan component REST API Wrapper + * + * @author Tuna Aksoy + * @author Rodica Sutu + * @since 1.0 + */ +@Component +@Scope (value = "prototype") +public class RMSiteAPI extends RestAPI +{ + /** + * Get the RM site + * + * @return The {@link RMSite} for the given file plan component id + * @throws Exception for the following cases: + *
* Given that a record category exists @@ -224,10 +224,10 @@ public class RecordCategoryTest extends BaseRestTest // create root level category FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS.toString(), RandomData.getRandomAlphanumeric()); assertNotNull(rootCategory.getId()); - + // create subcategory as a child of rootCategory FilePlanComponent childCategory = createCategory(rootCategory.getId(), RandomData.getRandomAlphanumeric()); - + // child category created? assertNotNull(childCategory.getId()); @@ -238,7 +238,7 @@ public class RecordCategoryTest extends BaseRestTest assertFalse(childCategory.isIsRecordFolder()); assertEquals(childCategory.getNodeType(), RECORD_CATEGORY_TYPE.toString()); } - + /** ** Given that a record category exists @@ -256,25 +256,24 @@ public class RecordCategoryTest extends BaseRestTest // create root level category FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS.toString(), RandomData.getRandomAlphanumeric()); assertNotNull(rootCategory.getId()); - + // add child categories/folders ArrayListchildren = new ArrayList (); - for(int i=0; i < NUMBER_OF_CHILDREN; i++) + for (int i=0; i < NUMBER_OF_CHILDREN; i++) { // create a child - FilePlanComponent child = createComponent(rootCategory.getId(), + FilePlanComponent child = createComponent(rootCategory.getId(), RandomData.getRandomAlphanumeric(), // half of the children should be subcategories, the other subfolders (i <= NUMBER_OF_CHILDREN / 2) ? RECORD_CATEGORY_TYPE : RECORD_FOLDER_TYPE); assertNotNull(child.getId()); children.add(child); } - + // list children from API RestWrapper restWrapper = filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); FilePlanComponentsCollection apiChildren = filePlanComponentApi.listChildComponents(rootCategory.getId()); restWrapper.assertStatusCodeIs(OK); - logger.info("parent: " + rootCategory.getId()); // check listed children against created list @@ -291,7 +290,7 @@ public class RecordCategoryTest extends BaseRestTest .filter(child -> child.getId().equals(filePlanComponent.getId())) .findFirst() .get(); - + // created by assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); @@ -319,7 +318,6 @@ public class RecordCategoryTest extends BaseRestTest assertEquals(createdComponent.getNodeType(), filePlanComponent.getNodeType()); // verify properties - //assertEquals(createdComponent.getProperties().getTitle(), filePlanComponent.getProperties().getTitle()); } catch (NoSuchElementException e) { @@ -327,7 +325,7 @@ public class RecordCategoryTest extends BaseRestTest } }); } - + /** * Helper method to create child category * @param parentCategoryId @@ -338,7 +336,7 @@ public class RecordCategoryTest extends BaseRestTest { return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE); } - + /** * Helper method to create generic child component * @param parentComponentId