mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'feature/FileAndDeclareApi'
Conflicts: rm-community/rm-community-repo/source/java/org/alfresco/rm/rest/api/nodes/RecordsEntityResource.java
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
package org.alfresco.rm.rest.api;
|
||||
|
||||
import org.alfresco.rest.api.Nodes;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* RM Nodes API
|
||||
@@ -45,4 +47,15 @@ public interface RMNodes extends Nodes
|
||||
public static String PARAM_INCLUDE_HAS_RETENTION_SCHEDULE = "hasRetentionSchedule";
|
||||
public static String PARAM_INCLUDE_IS_CLOSED = "isClosed";
|
||||
public static String PARAM_INCLUDE_IS_COMPLETED = "isCompleted";
|
||||
|
||||
/**
|
||||
* Gets or creates the relative path starting from the provided parent folder.
|
||||
* The method decides the type of the created elements considering the
|
||||
* parent container's type and the type of the node to be created.
|
||||
* @param parentFolderNodeId the parent folder to start from
|
||||
* @param relativePath the relative path
|
||||
* @param nodeTypeQName the type of the node to be created
|
||||
* @return reference to the last element of the created path
|
||||
*/
|
||||
public NodeRef getOrCreatePath(String parentFolderNodeId, String relativePath, QName nodeTypeQName);
|
||||
}
|
||||
|
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* #%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.rm.rest.api;
|
||||
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rm.rest.api.model.TargetContainer;
|
||||
|
||||
/**
|
||||
* Records API
|
||||
*
|
||||
* @author Ana Bozianu
|
||||
* @since 2.6
|
||||
*/
|
||||
public interface Records
|
||||
{
|
||||
public static final String PARAM_HIDE_RECORD = "hideRecord";
|
||||
|
||||
/**
|
||||
* Creates a record from a file
|
||||
*
|
||||
* @param fileId the id of a non record file
|
||||
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
||||
* @return information about the created record
|
||||
*/
|
||||
public Node declareFileAsRecord(String fileId, Parameters parameters);
|
||||
|
||||
/**
|
||||
* Files a record into th fileplan.
|
||||
* If the record is already filed it links the record to the target folder
|
||||
*
|
||||
* @param recordId the id of the record do file/link
|
||||
* @param target the target parent folder
|
||||
* @param parameters the {@link Parameters} object to get the parameters passed into the request
|
||||
* @return information about the new state of the record
|
||||
*/
|
||||
public Node fileOrLinkRecord(String recordId, TargetContainer target, Parameters parameters);
|
||||
}
|
@@ -25,7 +25,7 @@
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rm.rest.api.nodes;
|
||||
package org.alfresco.rm.rest.api.fileplancomponents;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@@ -25,7 +25,7 @@
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rm.rest.api.nodes;
|
||||
package org.alfresco.rm.rest.api.fileplancomponents;
|
||||
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* #%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 info that defines the Information Governance Fileplan Components REST API
|
||||
*
|
||||
* @author Ana Bozianu
|
||||
* @since 2.6
|
||||
*/
|
||||
@WebApi(name="ig", scope=Api.SCOPE.PUBLIC, version=1)
|
||||
package org.alfresco.rm.rest.api.fileplancomponents;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.WebApi;
|
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* #%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.rm.rest.api.files;
|
||||
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.framework.Operation;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rest.framework.webscripts.WithResponse;
|
||||
import org.alfresco.rm.rest.api.Records;
|
||||
import org.alfresco.rm.rest.api.model.TargetContainer;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* An implementation of an Entity Resource for a file
|
||||
*
|
||||
* @author Ana Bozianu
|
||||
* @since 2.6
|
||||
*/
|
||||
@EntityResource(name="files", title = "Files")
|
||||
public class FilesEntityResource implements InitializingBean
|
||||
{
|
||||
private Records records;
|
||||
|
||||
public void setRecords(Records records)
|
||||
{
|
||||
this.records = records;
|
||||
}
|
||||
|
||||
@Operation("declare")
|
||||
@WebApiDescription(title = "Declare as record", description="Declare a file as record.")
|
||||
public Node declareAsRecord(String fileId, Void body, Parameters parameters, WithResponse withResponse)
|
||||
{
|
||||
return records.declareFileAsRecord(fileId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
ParameterCheck.mandatory("records", this.records);
|
||||
}
|
||||
}
|
@@ -26,12 +26,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Package info that defines the Information Governance Nodes REST API
|
||||
* Package info that defines the Information Governance Files REST API
|
||||
*
|
||||
* @author Ana Bozianu
|
||||
* @since 2.6
|
||||
*/
|
||||
@WebApi(name="ig", scope=Api.SCOPE.PUBLIC, version=1)
|
||||
package org.alfresco.rm.rest.api.nodes;
|
||||
package org.alfresco.rm.rest.api.files;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.WebApi;
|
@@ -336,25 +336,30 @@ public class RMNodesImpl extends NodesImpl implements RMNodes
|
||||
public Node createNode(String parentFolderNodeId, Node nodeInfo, Parameters parameters)
|
||||
{
|
||||
// create RM path if needed and call the super method with the last element of the created path
|
||||
NodeRef parentNodeRef = getOrCreatePath(parentFolderNodeId, nodeInfo);
|
||||
String relativePath = nodeInfo.getRelativePath();
|
||||
|
||||
// Get the type of the node to be created
|
||||
String nodeType = nodeInfo.getNodeType();
|
||||
if ((nodeType == null) || nodeType.isEmpty())
|
||||
{
|
||||
throw new InvalidArgumentException("Node type is expected: "+parentFolderNodeId+","+nodeInfo.getName());
|
||||
}
|
||||
QName nodeTypeQName = createQName(nodeType);
|
||||
|
||||
// Get or create the path
|
||||
NodeRef parentNodeRef = getOrCreatePath(parentFolderNodeId, relativePath, nodeTypeQName);
|
||||
|
||||
// Set relative path to null as we pass the last element from the path
|
||||
nodeInfo.setRelativePath(null);
|
||||
|
||||
return super.createNode(parentNodeRef.getId(), nodeInfo, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or creates the relative path specified in nodeInfo.relativePath
|
||||
* starting from the provided parent folder.
|
||||
* The method decides the type of the created elements considering the
|
||||
* parent container's type and the type of the node to be created.
|
||||
* @param parentFolderNodeId the parent folder to start from
|
||||
* @param nodeInfo information about the node to be created
|
||||
* @return reference to the last element of the created path
|
||||
*/
|
||||
protected NodeRef getOrCreatePath(String parentFolderNodeId, Node nodeInfo)
|
||||
@Override
|
||||
public NodeRef getOrCreatePath(String parentFolderNodeId, String relativePath, QName nodeTypeQName)
|
||||
{
|
||||
NodeRef parentNodeRef = validateOrLookupNode(parentFolderNodeId, null);
|
||||
String relativePath = nodeInfo.getRelativePath();
|
||||
|
||||
if (relativePath == null)
|
||||
{
|
||||
return parentNodeRef;
|
||||
@@ -413,14 +418,6 @@ public class RMNodesImpl extends NodesImpl implements RMNodes
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the type of the node to be created
|
||||
String nodeType = nodeInfo.getNodeType();
|
||||
if ((nodeType == null) || nodeType.isEmpty())
|
||||
{
|
||||
throw new InvalidArgumentException("Node type is expected: "+parentFolderNodeId+","+nodeInfo.getName());
|
||||
}
|
||||
QName nodeTypeQName = createQName(nodeType);
|
||||
|
||||
/* Outside the unfiled record container the path elements are record categories
|
||||
* except the last element which is a record folder if the created node is of type content
|
||||
*/
|
||||
|
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* #%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.rm.rest.api.impl;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
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.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rm.rest.api.RMNodes;
|
||||
import org.alfresco.rm.rest.api.Records;
|
||||
import org.alfresco.rm.rest.api.model.TargetContainer;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.dao.ConcurrencyFailureException;
|
||||
import org.springframework.extensions.surf.util.ParameterCheck;
|
||||
|
||||
public class RecordsImpl implements Records, InitializingBean
|
||||
{
|
||||
protected RecordService recordService;
|
||||
protected FilePlanService filePlanService;
|
||||
protected NodeService nodeService;
|
||||
protected FileFolderService fileFolderService;
|
||||
protected DictionaryService dictionaryService;
|
||||
protected RMNodes nodes;
|
||||
|
||||
public void setRecordService(RecordService recordService)
|
||||
{
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
public void setFileFolderService(FileFolderService fileFolderService)
|
||||
{
|
||||
this.fileFolderService = fileFolderService;
|
||||
}
|
||||
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
public void setNodes(RMNodes nodes)
|
||||
{
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node declareFileAsRecord(String fileId, Parameters parameters)
|
||||
{
|
||||
// Parameter check
|
||||
if ((fileId == null) || (fileId.isEmpty()))
|
||||
{
|
||||
throw new InvalidArgumentException("Missing fileId");
|
||||
}
|
||||
|
||||
// Get file to be declared
|
||||
NodeRef fileNodeRef = nodes.validateNode(fileId) ;
|
||||
|
||||
// Get fileplan
|
||||
NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef doWork()
|
||||
{
|
||||
return filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
||||
}
|
||||
});
|
||||
|
||||
// default false (if not provided)
|
||||
boolean hideRecord = Boolean.valueOf(parameters.getParameter(PARAM_HIDE_RECORD));
|
||||
|
||||
// Create the record
|
||||
recordService.createRecord(filePlan, fileNodeRef, !hideRecord);
|
||||
|
||||
// Get information about the new record
|
||||
return nodes.getFolderOrDocument(fileId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Node fileOrLinkRecord(String recordId, TargetContainer target, Parameters parameters)
|
||||
{
|
||||
ParameterCheck.mandatoryString("recordId", recordId);
|
||||
|
||||
if((target.getTargetParentId() == null || target.getTargetParentId().isEmpty()) &&
|
||||
(target.getRelativePath() == null || target.getRelativePath().isEmpty()))
|
||||
{
|
||||
throw new InvalidParameterException("No target folder information was provided");
|
||||
}
|
||||
|
||||
// Get record
|
||||
NodeRef record = nodes.validateNode(recordId);
|
||||
|
||||
// Get record folder to file/link the record to
|
||||
String parentContainerId = target.getTargetParentId();
|
||||
if(parentContainerId == null || parentContainerId.isEmpty())
|
||||
{
|
||||
// If target container not provided get fileplan
|
||||
parentContainerId = AuthenticationUtil.runAsSystem(new RunAsWork<String>()
|
||||
{
|
||||
@Override
|
||||
public String doWork()
|
||||
{
|
||||
return filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID).getId();
|
||||
}
|
||||
});
|
||||
}
|
||||
NodeRef parentRecordFolder = nodes.getOrCreatePath(parentContainerId, target.getRelativePath(), ContentModel.TYPE_CONTENT);
|
||||
|
||||
// Check if the target is a record folder
|
||||
if(!dictionaryService.isSubClass(nodeService.getType(parentRecordFolder), RecordsManagementModel.TYPE_RECORD_FOLDER))
|
||||
{
|
||||
throw new InvalidArgumentException("The provided target parent is not a record folder");
|
||||
}
|
||||
|
||||
// Get the current parent type to decide if we link or move the record
|
||||
NodeRef primaryParent = nodeService.getPrimaryParent(record).getParentRef();
|
||||
if(dictionaryService.isSubClass(nodeService.getType(primaryParent), RecordsManagementModel.TYPE_RECORD_FOLDER))
|
||||
{
|
||||
recordService.link(record, parentRecordFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
fileFolderService.moveFrom(record, primaryParent, parentRecordFolder, null);
|
||||
}
|
||||
catch (FileExistsException e)
|
||||
{
|
||||
throw new IntegrityException(e.getMessage(), null);
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
throw new ConcurrencyFailureException("The record was deleted while filing it", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the record info
|
||||
return nodes.getFolderOrDocument(recordId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
ParameterCheck.mandatory("recordService", recordService);
|
||||
ParameterCheck.mandatory("filePlanService", filePlanService);
|
||||
ParameterCheck.mandatory("nodes", nodes);
|
||||
ParameterCheck.mandatory("nodeService", nodeService);
|
||||
ParameterCheck.mandatory("fileFolderService", fileFolderService);
|
||||
ParameterCheck.mandatory("dictionaryService", dictionaryService);
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* #%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.rm.rest.api.model;
|
||||
|
||||
/**
|
||||
* A target container object
|
||||
*
|
||||
* @author Ana Bozianu
|
||||
* @since 2.6
|
||||
*/
|
||||
public class TargetContainer
|
||||
{
|
||||
String targetParentId;
|
||||
String relativePath;
|
||||
|
||||
public TargetContainer()
|
||||
{
|
||||
}
|
||||
|
||||
public String getTargetParentId()
|
||||
{
|
||||
return targetParentId;
|
||||
}
|
||||
|
||||
public void setTargetParentId(String targetParentId)
|
||||
{
|
||||
this.targetParentId = targetParentId;
|
||||
}
|
||||
|
||||
public String getRelativePath()
|
||||
{
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
public void setRelativePath(String relativePath)
|
||||
{
|
||||
this.relativePath = relativePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder("NodeTarget{");
|
||||
sb.append("targetParentId=").append(targetParentId);
|
||||
sb.append(", relativePath='").append(relativePath).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -25,16 +25,21 @@
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.rm.rest.api.nodes;
|
||||
package org.alfresco.rm.rest.api.records;
|
||||
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.framework.BinaryProperties;
|
||||
import org.alfresco.rest.framework.Operation;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.BinaryResourceAction;
|
||||
import org.alfresco.rest.framework.resource.content.BinaryResource;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.rest.framework.webscripts.WithResponse;
|
||||
import org.alfresco.rm.rest.api.RMNodes;
|
||||
import org.alfresco.rm.rest.api.Records;
|
||||
import org.alfresco.rm.rest.api.model.TargetContainer;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@@ -50,16 +55,16 @@ public class RecordsEntityResource implements BinaryResourceAction.Read,
|
||||
{
|
||||
|
||||
private RMNodes nodes;
|
||||
private Records records;
|
||||
|
||||
public void setNodes(RMNodes nodes)
|
||||
{
|
||||
this.nodes = nodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
public void setRecords(Records records)
|
||||
{
|
||||
ParameterCheck.mandatory("nodes", this.nodes);
|
||||
this.records = records;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,4 +83,22 @@ public class RecordsEntityResource implements BinaryResourceAction.Read,
|
||||
return nodes.getContent(recordId, parameters, true);
|
||||
}
|
||||
|
||||
@Operation("file")
|
||||
@WebApiDescription(title = "File record", description="File a record into fileplan.")
|
||||
public Node fileRecord(String recordId, TargetContainer target, Parameters parameters, WithResponse withResponse)
|
||||
{
|
||||
try{
|
||||
return records.fileOrLinkRecord(recordId, target, parameters);
|
||||
}catch(Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
ParameterCheck.mandatory("nodes", this.nodes);
|
||||
ParameterCheck.mandatory("records", this.records);
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* #%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 info that defines the Information Governance Records REST API
|
||||
*
|
||||
* @author Ana Bozianu
|
||||
* @since 2.6
|
||||
*/
|
||||
@WebApi(name="ig", scope=Api.SCOPE.PUBLIC, version=1)
|
||||
package org.alfresco.rm.rest.api.records;
|
||||
import org.alfresco.rest.framework.Api;
|
||||
import org.alfresco.rest.framework.WebApi;
|
Reference in New Issue
Block a user