RM-3964: enum to const

This commit is contained in:
Kristijan Conkas
2016-10-21 11:20:32 +01:00
parent d8f9f2bc3e
commit 9618b2a0a6
5 changed files with 12 additions and 47 deletions

View File

@@ -1,39 +0,0 @@
/*
* #%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;
/**
* Fileplan Component Types enum
*
* @author Kristijan Conkas
* @since 2.6
*/
public enum FileplanComponentType
{
FILE_PLAN("rma:filePlan"),
RECORD_CATEGORY("rma:recordCategory"),
RECORD_FOLDER("rma:recordFolder"),
HOLD("rma:hold"),
UNFILED_RECORD_FOLDER("rma:unfiledRecordFolder");
private String value;
FileplanComponentType (String value)
{
this.value = value;
}
public String toString()
{
return this.value;
}
}

View File

@@ -22,7 +22,6 @@ import java.util.Map;
import org.alfresco.rest.core.RestAPI;
import org.alfresco.rest.core.RestRequest;
import org.alfresco.rest.model.FileplanComponentType;
import org.alfresco.rest.model.RestFilePlanComponentModel;
import org.json.JSONObject;
import org.springframework.context.annotation.Scope;
@@ -61,14 +60,14 @@ public class RestFilePlanComponentApi extends RestAPI
* @throws Exception
*/
public RestFilePlanComponentModel createFilePlanComponent(String parentFilePlanComponentId, String componentName,
FileplanComponentType componentType, Map<String, String> properties) throws Exception
String componentType, Map<String, String> properties) throws Exception
{
if (componentName == null)
throw new IllegalArgumentException("Child component name missing");
JSONObject body = new JSONObject();
body.put("name", componentName);
body.put("nodeType", componentType.toString());
body.put("nodeType", componentType);
if (properties != null) body.put("properties", properties);
RestRequest request = requestWithBody(POST, body.toString(), "fileplan-components/{fileplanComponentId}/children", parentFilePlanComponentId);

View File

@@ -38,6 +38,13 @@ public class BaseIgRestTest extends RestTest
public static final String ALIAS_UNFILED_RECORDS_CONTAINER = "-unfiled-";
public static final String ALIAS_HOLDS = "-holds-";
/** Component types. */
public static final String FILE_PLAN = "rma:filePlan";
public static final String RECORD_CATEGORY = "rma:recordCategory";
public static final String RECORD_FOLDER = "rma:recordFolder";
public static final String HOLD = "rma:hold";
public static final String UNFILED_RECORD_FOLDER = "rma:unfiledRecordFolder";
@Value("${alfresco.rm.scheme}")
private String scheme;

View File

@@ -11,7 +11,6 @@
*/
package org.alfresco.rest.fileplancomponents;
import static org.alfresco.rest.model.FileplanComponentType.FILE_PLAN;
import static org.springframework.http.HttpStatus.OK;
import static org.testng.Assert.assertEquals;
@@ -29,7 +28,7 @@ import org.testng.annotations.Test;
* @author Tuna Aksoy
* @since 1.0
*/
public class FilePlanComponentsTest extends BaseIgRestTest
public class FilePlanTest extends BaseIgRestTest
{
@Autowired
private RestFilePlanComponentApi filePlanComponentApi;
@@ -44,6 +43,6 @@ public class FilePlanComponentsTest extends BaseIgRestTest
restWrapper.authenticateUser(dataUser.getAdminUser());
RestFilePlanComponentModel filePlanComponent = filePlanComponentApi.getFilePlanComponent(ALIAS_FILE_PLAN);
restWrapper.assertStatusCodeIs(OK);
assertEquals(filePlanComponent.getNodeType(), FILE_PLAN.toString());
assertEquals(filePlanComponent.getNodeType(), FILE_PLAN);
}
}

View File

@@ -24,7 +24,6 @@ import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertNotNull;
import static org.alfresco.rest.model.FileplanComponentType.RECORD_CATEGORY;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.HttpStatus.NO_CONTENT;
@@ -35,7 +34,7 @@ import static org.springframework.http.HttpStatus.NO_CONTENT;
* @author Kristijan Conkas
* @since
*/
public class RecordCategoryComponentsTest extends BaseIgRestTest
public class RecordCategoryTest extends BaseIgRestTest
{
@Autowired
private RestFilePlanComponentApi filePlanComponentApi;