RM-6008 Highest child classification Rest API

This commit is contained in:
Sara Aspery
2018-02-02 10:52:28 +00:00
parent 72b4fc4011
commit 5c17f76656

View File

@@ -258,9 +258,30 @@ public class FilePlanComponentsApiUtils
ParameterCheck.mandatoryString("nodeId", nodeId); ParameterCheck.mandatoryString("nodeId", nodeId);
ParameterCheck.mandatory("expectedNodeType", expectedNodeType); ParameterCheck.mandatory("expectedNodeType", expectedNodeType);
/* NodeRef nodeRef = lookupByPlaceholder(nodeId);
* Lookup by placeholder
QName nodeType = nodeService.getType(nodeRef);
if (!nodeType.equals(expectedNodeType))
{
throw new InvalidArgumentException("The given id:'" + nodeId + "' (nodeType:" + nodeType.toString()
+ ") is not valid for this endpoint. Expected nodeType is:" + expectedNodeType.toString());
}
if(StringUtils.isNotBlank(relativePath))
{
nodeRef = lookupAndValidateRelativePath(nodeRef, relativePath, readOnlyRelativePath, expectedNodeType);
}
return nodeRef;
}
/**
* Lookup node by placeholder
*
* @param nodeId
* @return NodeRef for corresponding id
*/ */
public NodeRef lookupByPlaceholder(String nodeId)
{
NodeRef nodeRef; NodeRef nodeRef;
if (nodeId.equals(FILE_PLAN_ALIAS)) if (nodeId.equals(FILE_PLAN_ALIAS))
{ {
@@ -315,17 +336,6 @@ public class FilePlanComponentsApiUtils
nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId); nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, nodeId);
} }
QName nodeType = nodeService.getType(nodeRef);
if (!nodeType.equals(expectedNodeType))
{
throw new InvalidArgumentException("The given id:'" + nodeId + "' (nodeType:" + nodeType.toString()
+ ") is not valid for this endpoint. Expected nodeType is:" + expectedNodeType.toString());
}
if(StringUtils.isNotBlank(relativePath))
{
nodeRef = lookupAndValidateRelativePath(nodeRef, relativePath, readOnlyRelativePath, expectedNodeType);
}
return nodeRef; return nodeRef;
} }
@@ -584,7 +594,7 @@ public class FilePlanComponentsApiUtils
} }
/** /**
* Helper method that converts a map of String properties into a map of QName properties * Helper method that converts a map of String properties into a map of QName properties
* @param props * @param properties
* @return a map of properties * @return a map of properties
*/ */
public Map<QName, Serializable> mapToNodeProperties(Map<String, Object> properties) public Map<QName, Serializable> mapToNodeProperties(Map<String, Object> properties)