Extracted RM Community REST API code to a separate project

This commit is contained in:
Tuna Aksoy
2016-10-04 12:28:39 +01:00
parent 0005e0021f
commit a429101955
10 changed files with 7 additions and 434 deletions

View File

@@ -258,7 +258,4 @@
<!-- Import the Content Services --> <!-- Import the Content Services -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/content-context.xml"/> <import resource="classpath:alfresco/module/org_alfresco_module_rm/content-context.xml"/>
<!-- Import the RM public api -->
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-public-rest-context.xml"/>
</beans> </beans>

View File

@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="rm.quickShareLinks" parent="quickShareLinks">
<property name="nodes" ref="rm.nodes"/>
</bean>
<bean id="rm.QuickShareLinks" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>org.alfresco.rest.api.QuickShareLinks</value>
</property>
<property name="target">
<ref bean="rm.quickShareLinks" />
</property>
<property name="interceptorNames">
<list>
<idref bean="legacyExceptionInterceptor" />
</list>
</property>
</bean>
<bean id="rm.nodes" class="org.alfresco.module.org_alfresco_module_rm.rest.api.impl.RMNodesImpl" parent="nodes">
<property name="quickShareLinks" ref="rm.QuickShareLinks"/>
</bean>
<bean id="rm.Nodes" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>org.alfresco.rest.api.Nodes</value>
</property>
<property name="target">
<ref bean="rm.nodes" />
</property>
<property name="interceptorNames">
<list>
<idref bean="legacyExceptionInterceptor" />
</list>
</property>
</bean>
<bean class="org.alfresco.module.org_alfresco_module_rm.rest.api.RMFileplanComponentsEntityResource">
<property name="nodes" ref="rm.Nodes" />
</bean>
<bean class="org.alfresco.module.org_alfresco_module_rm.rest.api.FileplanChildrenRelation">
<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>

View File

@@ -26,6 +26,7 @@
<skip.integrationtests>true</skip.integrationtests> <skip.integrationtests>true</skip.integrationtests>
<alfresco.solr.home>${project.build.directory}/solr/home</alfresco.solr.home> <alfresco.solr.home>${project.build.directory}/solr/home</alfresco.solr.home>
<maven.alfresco.rm.api.explorer.version>1.0-SNAPSHOT</maven.alfresco.rm.api.explorer.version> <maven.alfresco.rm.api.explorer.version>1.0-SNAPSHOT</maven.alfresco.rm.api.explorer.version>
<alfresco.rm.community.rest.api.version>1.0-SNAPSHOT</alfresco.rm.community.rest.api.version>
</properties> </properties>
<build> <build>
@@ -340,6 +341,11 @@
<artifactId>reflections</artifactId> <artifactId>reflections</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-rm-community-rest-api</artifactId>
<version>${alfresco.rm.community.rest.api.version}</version>
</dependency>
</dependencies> </dependencies>
<profiles> <profiles>

View File

@@ -1,66 +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 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.Parameters;
@RelationshipResource(name="category-children", entityResource = CategoryEntityResource.class, title = "Children of Category type")
public class CategoryChildrenRelation implements
RelationshipResourceAction.Create<Node>
{
private Nodes nodes;
public void setNodes(Nodes nodes)
{
this.nodes = nodes;
}
@Override
public List<Node> create(String parentFolderNodeId, List<Node> nodeInfos, Parameters parameters)
{
List<Node> result = new ArrayList<>(nodeInfos.size());
for (Node nodeInfo : nodeInfos)
{
nodeInfo.setNodeType(RecordsManagementModel.RM_PREFIX + ":" + RecordsManagementModel.TYPE_RECORD_CATEGORY.getPrefixString());
result.add(nodes.createNode(parentFolderNodeId, nodeInfo, parameters));
}
return result;
}
}

View File

@@ -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
{
}

View File

@@ -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);
}
}

View File

@@ -1,57 +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.WebApiDescription;
import org.alfresco.rest.framework.WebApiParam;
import org.alfresco.rest.framework.resource.EntityResource;
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
import org.alfresco.rest.framework.resource.parameters.Parameters;
@EntityResource(name="fileplan-components", title = "Fileplan Components")
public class RMFileplanComponentsEntityResource implements
EntityResourceAction.ReadById<Node>
{
private Nodes nodes;
public void setNodes(Nodes nodes)
{
this.nodes = nodes;
}
@WebApiDescription(title = "Get Node Information", description = "Get information for the fileplan component with id 'nodeId'")
@WebApiParam(name = "nodeId", title = "The node id")
public Node readById(String nodeId, Parameters parameters)
{
return nodes.getFolderOrDocument(nodeId, parameters);
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -1,31 +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%
*/
@WebApi(name="ig", scope=Api.SCOPE.PUBLIC, version=1)
package org.alfresco.module.org_alfresco_module_rm.rest.api;
import org.alfresco.rest.framework.Api;
import org.alfresco.rest.framework.WebApi;