mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4012 - moved the rest api to org.alfresco.rest.api package and extended nodes service
This commit is contained in:
@@ -23,8 +23,9 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="rm.nodes" class="org.alfresco.module.org_alfresco_module_rm.rest.api.impl.RMNodesImpl" parent="nodes">
|
||||
<bean id="rm.nodes" class="org.alfresco.rest.api.impl.RMNodesImpl" parent="nodes" init-method="init">
|
||||
<property name="quickShareLinks" ref="rm.QuickShareLinks"/>
|
||||
<property name="filePlanService" ref="FilePlanService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="rm.Nodes" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
@@ -41,18 +42,11 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.module.org_alfresco_module_rm.rest.api.RMFileplanComponentsEntityResource">
|
||||
<bean class="org.alfresco.rest.api.FileplanComponentsEntityResource">
|
||||
<property name="nodes" ref="rm.Nodes" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.module.org_alfresco_module_rm.rest.api.FileplanChildrenRelation">
|
||||
<bean class="org.alfresco.rest.api.FileplanComponentChildrenRelation">
|
||||
<property name="nodes" ref="rm.Nodes" />
|
||||
</bean>
|
||||
|
||||
<bean class="org.alfresco.module.org_alfresco_module_rm.rest.api.CategoryEntityResource"/>
|
||||
|
||||
<bean class="org.alfresco.module.org_alfresco_module_rm.rest.api.CategoryChildrenRelation">
|
||||
<property name="nodes" ref="rm.Nodes" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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
|
||||
{
|
||||
|
||||
}
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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<Node>
|
||||
{
|
||||
private Nodes nodes;
|
||||
|
||||
public void setNodes(Nodes nodes)
|
||||
{
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Node> readAll(String parentFolderNodeId, Parameters parameters)
|
||||
{
|
||||
return nodes.listChildren(parentFolderNodeId, parameters);
|
||||
}
|
||||
|
||||
}
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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<String> includeParam, Map<String, UserInfo> mapUserInfo)
|
||||
{
|
||||
Node node = super.getFolderOrDocument(nodeRef, parentNodeRef, nodeTypeQName, includeParam, mapUserInfo);
|
||||
Node node2 = new RMNode(node);
|
||||
|
||||
return node2;
|
||||
}
|
||||
}
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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;
|
||||
}
|
||||
}
|
@@ -24,23 +24,26 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #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<Node>
|
||||
/**
|
||||
* 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<Node>,
|
||||
RelationshipResourceAction.Create<Node>
|
||||
{
|
||||
private Nodes nodes;
|
||||
|
||||
@@ -49,6 +52,12 @@ public class CategoryChildrenRelation implements
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CollectionWithPagingInfo<Node> readAll(String parentFolderNodeId, Parameters parameters)
|
||||
{
|
||||
return nodes.listChildren(parentFolderNodeId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Node> create(String parentFolderNodeId, List<Node> 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;
|
||||
}
|
||||
|
||||
}
|
@@ -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<Node>
|
||||
{
|
||||
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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<String> includeParam, Map<String, UserInfo> mapUserInfo)
|
||||
{
|
||||
Map<QName, Serializable> 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
|
||||
}
|
||||
}
|
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
* #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<QName, Serializable> nodeProps, Map<String, UserInfo> 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;
|
||||
}
|
||||
}
|
@@ -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;
|
Reference in New Issue
Block a user