mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Minor adjustment to the Transfer Service JS API so that the transfer operation returns a ScriptNode rather than a NodeRef.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19248 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -30,8 +30,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.transfer.TransferDefinition;
|
||||
import org.alfresco.service.cmr.transfer.TransferService;
|
||||
import org.alfresco.service.cmr.transfer.TransferTarget;
|
||||
import org.mozilla.javascript.NativeArray;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
|
||||
/**
|
||||
* Java Script Transfer Service. Adapts the Java Transfer Service to
|
||||
@@ -118,7 +116,8 @@ public class ScriptTransferService extends BaseScopableProcessorExtension
|
||||
* @param nodes the nodes to transfer - Java Script Array of either ScriptNodes, NodeRef or String
|
||||
* @return node ref of transfer report.
|
||||
*/
|
||||
public NodeRef transfer(String targetName, Object nodesToTransfer)
|
||||
@SuppressWarnings("unchecked")
|
||||
public ScriptNode transfer(String targetName, Object nodesToTransfer)
|
||||
{
|
||||
Object nodesObject = valueConverter.convertValueForJava(nodesToTransfer);
|
||||
|
||||
@@ -158,9 +157,9 @@ public class ScriptTransferService extends BaseScopableProcessorExtension
|
||||
}
|
||||
|
||||
toTransfer.setNodes(nodeCollection);
|
||||
NodeRef retVal = transferService.transfer(targetName, toTransfer);
|
||||
NodeRef reportNode = transferService.transfer(targetName, toTransfer);
|
||||
|
||||
return retVal;
|
||||
return new ScriptNode(reportNode, serviceRegistry, getScope());
|
||||
}
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
|
@@ -24,7 +24,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.repo.jscript.ClasspathScriptLocation;
|
||||
import org.alfresco.repo.transfer.TransferServiceImpl;
|
||||
import org.alfresco.repo.transfer.TransferTargetImpl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.ScriptLocation;
|
||||
@@ -50,19 +49,16 @@ public class ScriptTransferServiceTest extends BaseAlfrescoSpringTest
|
||||
// String GUEST_HOME_XPATH_QUERY = "/{http://www.alfresco.org/model/application/1.0}company_home/{http://www.alfresco.org/model/application/1.0}guest_home";
|
||||
|
||||
private ScriptService scriptService;
|
||||
private TransferService transferService;
|
||||
private TransferService transferServiceImpl;
|
||||
private ScriptTransferService scriptTransferService;
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void onSetUpInTransaction() throws Exception
|
||||
{
|
||||
super.onSetUpInTransaction();
|
||||
|
||||
// Get the required services
|
||||
this.scriptService = (ScriptService)this.applicationContext.getBean("ScriptService");
|
||||
this.transferService = (TransferService)this.applicationContext.getBean("TransferService");
|
||||
this.transferServiceImpl = (TransferServiceImpl)this.applicationContext.getBean("transferService");
|
||||
this.scriptTransferService = (ScriptTransferService)this.applicationContext.getBean("transferServiceScript");
|
||||
|
||||
}
|
||||
@@ -71,8 +67,6 @@ public class ScriptTransferServiceTest extends BaseAlfrescoSpringTest
|
||||
|
||||
public void testJSAPI() throws Exception
|
||||
{
|
||||
String name = "testTransferJSAPI";
|
||||
|
||||
/**
|
||||
* Prepare some dummy data for tests
|
||||
*/
|
||||
|
Reference in New Issue
Block a user