From 19e02d402cc213dc85427ae7c154ebe9cff3145f Mon Sep 17 00:00:00 2001 From: Ana Bozianu Date: Thu, 6 Oct 2016 16:34:01 +0300 Subject: [PATCH] RM-4012 - moved the rest api to org.alfresco.rest.api package and extended nodes service --- .../rm-public-rest-context.xml | 14 +- .../rest/api/CategoryEntityResource.java | 36 --- .../rest/api/FileplanChildrenRelation.java | 53 ---- .../rest/api/impl/RMNodesImpl.java | 50 ---- .../rest/api/model/RMNode.java | 79 ------ .../FileplanComponentChildrenRelation.java} | 27 +- .../FileplanComponentsEntityResource.java} | 10 +- .../alfresco/rest/api/impl/RMNodesImpl.java | 247 ++++++++++++++++++ .../org/alfresco/rest/api/model/RMNode.java | 87 ++++++ .../rest/api/package-info.java | 8 +- 10 files changed, 370 insertions(+), 241 deletions(-) delete mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/CategoryEntityResource.java delete mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/FileplanChildrenRelation.java delete mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/impl/RMNodesImpl.java delete mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/model/RMNode.java rename rm-community/rm-community-repo/source/java/org/alfresco/{module/org_alfresco_module_rm/rest/api/CategoryChildrenRelation.java => rest/api/FileplanComponentChildrenRelation.java} (71%) rename rm-community/rm-community-repo/source/java/org/alfresco/{module/org_alfresco_module_rm/rest/api/RMFileplanComponentsEntityResource.java => rest/api/FileplanComponentsEntityResource.java} (92%) create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/rest/api/impl/RMNodesImpl.java create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/rest/api/model/RMNode.java rename rm-community/rm-community-repo/source/java/org/alfresco/{module/org_alfresco_module_rm => }/rest/api/package-info.java (89%) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml index 4f3404a3ae..2bc03dcb3f 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml @@ -23,8 +23,9 @@ - + + @@ -41,18 +42,11 @@ - + - + - - - - - - - \ No newline at end of file diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/CategoryEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/CategoryEntityResource.java deleted file mode 100644 index f5eef95d34..0000000000 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/CategoryEntityResource.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.module.org_alfresco_module_rm.rest.api; - -import org.alfresco.rest.framework.resource.EntityResource; - -@EntityResource(name="categories", title = "Categories") -public class CategoryEntityResource -{ - -} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/FileplanChildrenRelation.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/FileplanChildrenRelation.java deleted file mode 100644 index b8d07d8137..0000000000 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/FileplanChildrenRelation.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.module.org_alfresco_module_rm.rest.api; - -import org.alfresco.rest.api.Nodes; -import org.alfresco.rest.api.model.Node; -import org.alfresco.rest.framework.resource.RelationshipResource; -import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; -import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; -import org.alfresco.rest.framework.resource.parameters.Parameters; - -@RelationshipResource(name="children", entityResource = RMFileplanComponentsEntityResource.class, title = "Children of fileplan component") -public class FileplanChildrenRelation implements RelationshipResourceAction.Read -{ - private Nodes nodes; - - public void setNodes(Nodes nodes) - { - this.nodes = nodes; - } - - @Override - public CollectionWithPagingInfo readAll(String parentFolderNodeId, Parameters parameters) - { - return nodes.listChildren(parentFolderNodeId, parameters); - } - -} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/impl/RMNodesImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/impl/RMNodesImpl.java deleted file mode 100644 index bd6badcf37..0000000000 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/impl/RMNodesImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.module.org_alfresco_module_rm.rest.api.impl; - -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.rest.api.model.RMNode; -import org.alfresco.rest.api.impl.NodesImpl; -import org.alfresco.rest.api.model.Node; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -public class RMNodesImpl extends NodesImpl -{ - @Override - public Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List includeParam, Map mapUserInfo) - { - Node node = super.getFolderOrDocument(nodeRef, parentNodeRef, nodeTypeQName, includeParam, mapUserInfo); - Node node2 = new RMNode(node); - - return node2; - } -} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/model/RMNode.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/model/RMNode.java deleted file mode 100644 index 335333f1e5..0000000000 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/model/RMNode.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * #%L - * Alfresco Records Management Module - * %% - * Copyright (C) 2005 - 2016 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.module.org_alfresco_module_rm.rest.api.model; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.alfresco.rest.api.model.AssocChild; -import org.alfresco.rest.api.model.AssocTarget; -import org.alfresco.rest.api.model.Node; -import org.alfresco.rest.api.model.PathInfo; -import org.alfresco.rest.api.model.UserInfo; -import org.alfresco.service.cmr.repository.NodeRef; - -public class RMNode extends Node -{ - protected boolean hasRetentionSchedule; - - public boolean isHasRetentionSchedule() - { - return hasRetentionSchedule; - } - - public void setHasRetentionSchedule(boolean hasRetentionSchedule) - { - this.hasRetentionSchedule = hasRetentionSchedule; - } - - public RMNode(Node node) - { - this.nodeRef = node.getNodeRef(); - this.name = node.getName(); - this.createdAt = node.getCreatedAt(); - this.modifiedAt = node.getModifiedAt(); - this.createdByUser = node.getCreatedByUser(); - this.modifiedByUser = node.getModifiedByUser(); - this.archivedAt = node.getArchivedAt(); - this.archivedByUser = node.getArchivedByUser(); - this.isFolder = node.getIsFolder(); - this.isFile = node.getIsFile(); - this.isLink = node.getIsLink(); - this.parentNodeRef = node.getParentId(); - this.pathInfo = node.getPath(); - this.relativePath = node.getRelativePath(); - this.secondaryChildren = node.getSecondaryChildren(); - this.targets = node.getTargets(); - this.aspectNames = node.getAspectNames(); - this.properties = node.getProperties(); - this.allowableOperations = node.getAllowableOperations(); - - this.hasRetentionSchedule = true; - } -} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/CategoryChildrenRelation.java b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/FileplanComponentChildrenRelation.java similarity index 71% rename from rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/CategoryChildrenRelation.java rename to rm-community/rm-community-repo/source/java/org/alfresco/rest/api/FileplanComponentChildrenRelation.java index aa48716a8d..8c27c8078c 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/CategoryChildrenRelation.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/FileplanComponentChildrenRelation.java @@ -24,23 +24,26 @@ * along with Alfresco. If not, see . * #L% */ - -package org.alfresco.module.org_alfresco_module_rm.rest.api; +package org.alfresco.rest.api; import java.util.ArrayList; import java.util.List; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.rest.api.Nodes; import org.alfresco.rest.api.model.Node; -import org.alfresco.rest.framework.resource.EntityResource; import org.alfresco.rest.framework.resource.RelationshipResource; import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; +import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo; import org.alfresco.rest.framework.resource.parameters.Parameters; -@RelationshipResource(name="category-children", entityResource = CategoryEntityResource.class, title = "Children of Category type") -public class CategoryChildrenRelation implements - RelationshipResourceAction.Create +/** + * An implementation of an Entity Resource for a fileplan component + * + * @author Ana Bozianu + * @since 2.6 + */ +@RelationshipResource(name="children", entityResource = FileplanComponentsEntityResource.class, title = "Children of fileplan component") +public class FileplanComponentChildrenRelation implements RelationshipResourceAction.Read, + RelationshipResourceAction.Create { private Nodes nodes; @@ -49,6 +52,12 @@ public class CategoryChildrenRelation implements this.nodes = nodes; } + @Override + public CollectionWithPagingInfo readAll(String parentFolderNodeId, Parameters parameters) + { + return nodes.listChildren(parentFolderNodeId, parameters); + } + @Override public List create(String parentFolderNodeId, List nodeInfos, Parameters parameters) { @@ -56,11 +65,9 @@ public class CategoryChildrenRelation implements for (Node nodeInfo : nodeInfos) { - nodeInfo.setNodeType(RecordsManagementModel.RM_PREFIX + ":" + RecordsManagementModel.TYPE_RECORD_CATEGORY.getPrefixString()); result.add(nodes.createNode(parentFolderNodeId, nodeInfo, parameters)); } return result; } - } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/RMFileplanComponentsEntityResource.java b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/FileplanComponentsEntityResource.java similarity index 92% rename from rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/RMFileplanComponentsEntityResource.java rename to rm-community/rm-community-repo/source/java/org/alfresco/rest/api/FileplanComponentsEntityResource.java index c8860d17b1..62745edbbd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/RMFileplanComponentsEntityResource.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/FileplanComponentsEntityResource.java @@ -25,7 +25,7 @@ * #L% */ -package org.alfresco.module.org_alfresco_module_rm.rest.api; +package org.alfresco.rest.api; import org.alfresco.rest.api.Nodes; import org.alfresco.rest.api.model.Node; @@ -35,8 +35,14 @@ import org.alfresco.rest.framework.resource.EntityResource; import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction; import org.alfresco.rest.framework.resource.parameters.Parameters; +/** + * Fileplan component children + * + * @author Ana Bozianu + * @since 2.6 + */ @EntityResource(name="fileplan-components", title = "Fileplan Components") -public class RMFileplanComponentsEntityResource implements +public class FileplanComponentsEntityResource implements EntityResourceAction.ReadById { diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/impl/RMNodesImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/impl/RMNodesImpl.java new file mode 100644 index 0000000000..5a58216a20 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/impl/RMNodesImpl.java @@ -0,0 +1,247 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.api.impl; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.model.Repository; +import org.alfresco.rest.api.model.Node; +import org.alfresco.rest.api.model.PathInfo; +import org.alfresco.rest.api.model.RMNode; +import org.alfresco.rest.api.model.UserInfo; +import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; +import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Centralizes access to the repository. + * + * @author Ana Bozianu + * @since 2.6 + */ +public class RMNodesImpl extends NodesImpl +{ + String FILE_PLAN = "-filePlan-"; + String TRANSFERS = "-transfers-"; + String UNFILED = "-unfiled-"; + String HOLDS = "-holds-"; + + private enum RMNodeType + { + // Note: ordered + CATEGORY, RECORD_FOLDER, FILE + } + + private FilePlanService filePlanService; + private NodeService nodeService; + private ServiceRegistry sr; + private Repository repositoryHelper; + private DictionaryService dictionaryService; + private NamespaceService namespaceService; + + public void init() + { + super.init(); + this.nodeService = sr.getNodeService(); + this.dictionaryService = sr.getDictionaryService(); + this.namespaceService = sr.getNamespaceService(); + } + + public void setServiceRegistry(ServiceRegistry sr) + { + super.setServiceRegistry(sr); + this.sr = sr; + } + + public void setRepositoryHelper(Repository repositoryHelper) + { + super.setRepositoryHelper(repositoryHelper); + this.repositoryHelper = repositoryHelper; + } + + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + @Override + public Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List includeParam, Map mapUserInfo) + { + Map properties = nodeService.getProperties(nodeRef); + + // Get general information + if (nodeTypeQName == null) + { + nodeTypeQName = nodeService.getType(nodeRef); + } + + if (parentNodeRef == null) + { + parentNodeRef = getParentNodeRef(nodeRef); + } + + RMNodeType type = getType(nodeTypeQName, nodeRef); + RMNode node; + node = new RMNode(nodeRef, parentNodeRef, properties, mapUserInfo, sr); + + if (type == RMNodeType.CATEGORY) + { + node.setIsCategory(true); + } + else if (type == RMNodeType.RECORD_FOLDER) + { + node.setIsRecordFolder(true); + } + else if (type == RMNodeType.FILE) + { + node.setIsFile(true); + } + + PathInfo pathInfo = null; + if (includeParam.contains(PARAM_INCLUDE_PATH)) + { + ChildAssociationRef archivedParentAssoc = (ChildAssociationRef) properties.get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC); + pathInfo = lookupPathInfo(nodeRef, archivedParentAssoc); + } + node.setPath(pathInfo); + node.setNodeType(nodeTypeQName.toPrefixString(namespaceService)); + + // Get optional fields + if (includeParam.size() > 0) + { + node.setProperties(mapFromNodeProperties(properties, includeParam, mapUserInfo)); + } + + if (includeParam.contains(PARAM_INCLUDE_ASPECTNAMES)) + { + node.setAspectNames(mapFromNodeAspects(nodeService.getAspects(nodeRef))); + } + + return node; + } + + @Override + public NodeRef validateOrLookupNode(String nodeId, String path) + { + if ((nodeId == null) || (nodeId.isEmpty())) + { + throw new InvalidArgumentException("Missing nodeId"); + } + + if (nodeId.equals(FILE_PLAN)) + { + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if(filePlan != null) + { + return filePlan; + } + else + { + throw new EntityNotFoundException(nodeId); + } + } + else if (nodeId.equals(TRANSFERS)) + { + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if(filePlan != null) + { + return filePlanService.getTransferContainer(filePlan); + } + else + { + throw new EntityNotFoundException(nodeId); + } + } + else if (nodeId.equals(UNFILED)) + { + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if(filePlan != null) + { + return filePlanService.getUnfiledContainer(filePlan); + } + else + { + throw new EntityNotFoundException(nodeId); + } + } + else if (nodeId.equals(HOLDS)) + { + NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); + if(filePlan != null) + { + return filePlanService.getHoldContainer(filePlan); + } + else + { + throw new EntityNotFoundException(nodeId); + } + } + + return super.validateOrLookupNode(nodeId, path); + } + + private NodeRef getParentNodeRef(NodeRef nodeRef) + { + if (repositoryHelper.getCompanyHome().equals(nodeRef)) + { + return null; // note: does not make sense to return parent above C/H + } + + return nodeService.getPrimaryParent(nodeRef).getParentRef(); + } + + private RMNodeType getType(QName typeQName, NodeRef nodeRef) + { + // quick check for common types + if (typeQName.equals(RecordsManagementModel.TYPE_RECORD_FOLDER)) + { + return RMNodeType.RECORD_FOLDER; + } + if (typeQName.equals(RecordsManagementModel.TYPE_RECORD_CATEGORY)) + { + return RMNodeType.CATEGORY; + } + else if (typeQName.equals(ContentModel.TYPE_CONTENT) || dictionaryService.isSubClass(typeQName, ContentModel.TYPE_CONTENT)) + { + return RMNodeType.FILE; + } + + return null; // unknown + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/model/RMNode.java b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/model/RMNode.java new file mode 100644 index 0000000000..59ff66fa47 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/model/RMNode.java @@ -0,0 +1,87 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 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.api.model; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Concrete class carrying general information for an RM node + * + * @author Ana Bozianu + * @since 2.6 + */ +public class RMNode extends Node +{ + protected Boolean isCategory; + protected Boolean isRecordFolder; + protected Boolean hasRetentionSchedule; + + public RMNode(NodeRef nodeRef, NodeRef parentNodeRef, Map nodeProps, Map mapUserInfo, ServiceRegistry sr) + { + super(nodeRef, parentNodeRef, nodeProps, mapUserInfo, sr); + + isCategory = false; + isRecordFolder = false; + isFile = false; + } + + public Boolean getIsCategory() + { + return isCategory; + } + + public Boolean getIsRecordFolder() + { + return isRecordFolder; + } + + public Boolean getHasRetentionSchedule() + { + return hasRetentionSchedule; + } + + public void setIsCategory(Boolean isCategory) + { + this.isCategory = isCategory; + } + + public void setIsRecordFolder(Boolean isRecordFolder) + { + this.isRecordFolder = isRecordFolder; + } + + public void setHasRetentionSchedule(Boolean hasRetentionSchedule) + { + this.hasRetentionSchedule = hasRetentionSchedule; + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/package-info.java b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/package-info.java similarity index 89% rename from rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/package-info.java rename to rm-community/rm-community-repo/source/java/org/alfresco/rest/api/package-info.java index 46a42e731b..ff4c94f65d 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/rest/api/package-info.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/rest/api/package-info.java @@ -25,7 +25,13 @@ * #L% */ +/** + * Package info that defines the Information Governance REST API + * + * @author Ana Bozianu + * @since 2.6 + */ @WebApi(name="ig", scope=Api.SCOPE.PUBLIC, version=1) -package org.alfresco.module.org_alfresco_module_rm.rest.api; +package org.alfresco.rest.api; import org.alfresco.rest.framework.Api; import org.alfresco.rest.framework.WebApi; \ No newline at end of file