From fe444ad77cc2b612065b78d52663a2a0e7639ddc Mon Sep 17 00:00:00 2001 From: Rodica Sutu Date: Mon, 14 May 2018 09:27:43 +0300 Subject: [PATCH] replace spring social exception with InvalidArgumentException update the ElementInfo() according to REPO-2983 --- .../rm/rest/api/impl/FilePlanComponentsApiUtils.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java index f93e87ed2c..0c010b5020 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/impl/FilePlanComponentsApiUtils.java @@ -39,12 +39,14 @@ import java.io.Serializable; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; +import net.sf.acegisecurity.vote.AccessDecisionVoter; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; @@ -108,9 +110,6 @@ import org.alfresco.util.ParameterCheck; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.social.InternalServerErrorException; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; /** * Utility class that handles common api endpoint tasks @@ -611,7 +610,7 @@ public class FilePlanComponentsApiUtils else { // Throw internal error as this method should not be called for other types - throw new InternalServerErrorException("Creating relative path of type '" + nodesType + "' not suported for this endpoint"); + throw new InvalidArgumentException("Creating relative path of type '" + nodesType + "' not suported for this endpoint"); } return lastNodeRef; @@ -968,7 +967,10 @@ public class FilePlanComponentsApiUtils if (permissionService.hasPermission(childNodeRef, PermissionService.READ) == AccessStatus.ALLOWED) { Serializable nameProp = nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); - pathElements.add(0, new ElementInfo(childNodeRef.getId(), nameProp.toString())); + String type = nodeService.getType(childNodeRef).toPrefixString(); + Set < QName > aspects = nodeService.getAspects(childNodeRef); + List < String > aspectNames = nodes.mapFromNodeAspects(aspects, Collections.emptyList(), Collections.emptyList()); + pathElements.add(0, new ElementInfo(childNodeRef.getId(), nameProp.toString(),type, aspectNames)); } else {