diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java index 72a9dc2422..2fbbf3cc15 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentFields.java @@ -74,7 +74,9 @@ public class FilePlanComponentFields public static final String PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD = "rma:recordSearchVitalRecordReviewPeriod"; public static final String PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION = "rma:recordSearchVitalRecordReviewPeriodExpression"; - /** Record properties */ + /** + * Record properties + */ public static final String PROPERTIES_CLASSIFICATION = "sc:classification"; public static final String PROPERTIES_DATE_FILED = "rma:dateFiled"; public static final String PROPERTIES_ORIGINAL_NAME = "rma:origionalName"; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodeAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodeAPI.java new file mode 100644 index 0000000000..f0d4911db2 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/NodeAPI.java @@ -0,0 +1,74 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.v0; +import java.text.MessageFormat; + +import org.alfresco.dataprep.AlfrescoHttpClient; +import org.alfresco.dataprep.AlfrescoHttpClientFactory; +import org.alfresco.rest.core.v0.BaseAPI; +import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * The v0 REST API for nodes + * + * @author jcule + * @since 2.7EA1 + */ +@Component +public class NodeAPI extends BaseAPI +{ + /** Logger for the class. */ + private static final Logger LOGGER = LoggerFactory.getLogger(NodeAPI.class); + + /** The URI for the get node API. */ + private static final String GET_NODE_API = "{0}alfresco/s/slingshot/doclib2/node/{1}"; + + @Autowired + private AlfrescoHttpClientFactory alfrescoHttpClientFactory; + + /** + * Get the node metadata using the using the node data webscript: Document List v2 Component + * + * @param username + * @param password + * @param nodeId + * @return + */ + public JSONObject getNode(String username, String password, String nodeId) + { + String requestURL; + AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject(); + requestURL = MessageFormat.format(GET_NODE_API, client.getAlfrescoUrl(), NODE_PREFIX + nodeId); + client.close(); + return doGetRequest(username, password, requestURL); + } + +} diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index b4d241636b..963853cb37 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -668,17 +668,4 @@ public class BaseRMRestTest extends RestTest return documentLibrary; } - /** - * Helper method to create a Content Model - * - * @return ContentModel - * @throws Exception - */ - public ContentModel toContentModel(String nodeId) - { - ContentModel node = new ContentModel(); - node.setNodeRef(nodeId); - return node; - } - } diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java index e83ef765fb..534d3d1854 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/utils/CoreUtil.java @@ -27,6 +27,7 @@ package org.alfresco.rest.rm.community.utils; import org.alfresco.rest.model.RestNodeBodyMoveCopyModel; +import org.alfresco.utility.model.ContentModel; /** * Utility class for core components models @@ -53,4 +54,17 @@ public class CoreUtil moveDestinationInfo.setTargetParentId(nodeId); return moveDestinationInfo; } + + /** + * Helper method to create a Content Model + * + * @return ContentModel + * @throws Exception + */ + public static ContentModel toContentModel(String nodeId) + { + ContentModel node = new ContentModel(); + node.setNodeRef(nodeId); + return node; + } }