Checkpoint of WCM workflow package support.

Setting titled and uifacets via AVMService instead of through
AVMNodeService.  1000 file import takes ~5 minutes.  Awful but better 
than before.  


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3995 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-10-02 19:42:56 +00:00
parent c2e407165e
commit 0fc71b8d68
7 changed files with 117 additions and 8 deletions

View File

@@ -1045,6 +1045,7 @@
<prop key="hasAspect">${server.transaction.mode.readOnly}</prop>
<prop key="getContentDataForWrite">${server.transaction.mode.default}</prop>
<prop key="getFileOutputStream">${server.transaction.mode.default}</prop>
<prop key="getAVMSystemStore">${server.transaction.mode.default}</prop>
<prop key="get*">${server.transaction.mode.readOnly}</prop>
<prop key="lookup">${server.transaction.mode.readOnly}</prop>
<prop key="*">${server.transaction.mode.default}</prop>

View File

@@ -12,7 +12,8 @@
<controller>
<variable name="assignee" access="write" mapped-name="wcmwf:assignee"/>
<variable name="description" access="write" mapped-name="wcmwf:description"/>
<variable name="sourcePath" access="write" mapped-name="wcmwf:sourcePath"/>
<variable name="storeName" access="write" mapped-name="wcmwf:storeName"/>
<variable name="package" access="write" mapped-name="bpm:package"/>
<variable name="workflowcontext" access="write" mapped-name="bpm:context"/>
</controller>
</task>
@@ -27,7 +28,8 @@
<task name="wcmwf:review" swimlane="assignee">
<controller>
<variable name="description" access="read,required" mapped-name="wcmwf:description"/>
<variable name="sourcePath" access="read,required" mapped-name="wcmwf:sourcePath"/>
<variable name="storeName" access="read,required" mapped-name="wcmwf:storeName"/>
<variable name="package" access="read,required" mapped-name="bpm:package"/>
<variable name="workflowcontext" access="read,required" mapped-name="bpm:context"/>
</controller>
</task>

View File

@@ -22,8 +22,8 @@
<type>d:text</type>
</property>
<property name="wcmwf:sourcePath">
<title>Source Sandbox Path</title>
<property name="wcmwf:storeName">
<title>Sandbox Store Name</title>
<type>d:text</type>
</property>
</properties>

View File

@@ -51,6 +51,8 @@ import org.apache.log4j.Logger;
*/
public class AVMServiceImpl implements AVMService
{
public static final String SYSTEM = "system";
private static Logger fgLogger = Logger.getLogger(AVMServiceImpl.class);
/**
@@ -741,6 +743,22 @@ public class AVMServiceImpl implements AVMService
}
}
/**
* Get (and create if necessary) the system store. This store houses things
* like workflow packages.
* @return The descriptor.
*/
public AVMStoreDescriptor getAVMSystemStore()
{
AVMStoreDescriptor store = getAVMStore(SYSTEM);
if (store == null)
{
createAVMStore(SYSTEM);
return getAVMStore(SYSTEM);
}
return store;
}
/**
* Get a descriptor for the specified AVMStore root.
* @param version The version to get.

View File

@@ -100,10 +100,7 @@
</subclass>
</subclass>
</class>
<!-- A store is the what we used to call a virtual repository.
Each store has it's own branch ids and layer ids but shares node ids
with other repositories. The physical repository is structured this way
for better scaling. -->
<!-- A store is the what we used to call a virtual repository. -->
<class table="avm_stores" name="AVMStoreImpl"
proxy="AVMStore" optimistic-lock="version">
<cache usage="read-write"/>

View File

@@ -0,0 +1,84 @@
package org.alfresco.repo.avm.wf;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avmsync.AVMDifference;
import org.alfresco.service.cmr.avmsync.AVMSyncService;
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.QName;
import org.alfresco.util.Pair;
import org.jbpm.graph.exe.ExecutionContext;
import org.springframework.beans.factory.BeanFactory;
public class AVMSubmitPackageHandler extends JBPMSpringActionHandler implements
Serializable
{
private static final long serialVersionUID = 4113360751217684995L;
/**
* The AVMService instance.
*/
private AVMService fAVMService;
/**
* The AVMSyncService instance.
*/
private AVMSyncService fAVMSyncService;
/**
* The NodeService reference.
*/
private NodeService fNodeService;
/**
* Initialize service references.
* @param factory The BeanFactory to get references from.
*/
@Override
protected void initialiseHandler(BeanFactory factory)
{
fAVMService = (AVMService)factory.getBean("AVMService");
fAVMSyncService = (AVMSyncService)factory.getBean("AVMSyncService");
fNodeService = (NodeService)factory.getBean("NodeService");
}
/**
* Do the actual work.
* @param executionContext The context to get stuff from.
*/
public void execute(ExecutionContext executionContext) throws Exception
{
String srcStoreName = (String)executionContext.getContextInstance().getVariable("storeName");
NodeRef pkg = (NodeRef)executionContext.getContextInstance().getVariable("package");
String webSiteName =
fAVMService.getStoreProperty(srcStoreName, QName.createQName(null, ".website.name")).getStringValue();
String stagingName = webSiteName + "-staging";
List<ChildAssociationRef> children = fNodeService.getChildAssocs(pkg);
List<AVMDifference> diffs = new ArrayList<AVMDifference>();
for (ChildAssociationRef child : children)
{
NodeRef childRef = child.getChildRef();
Pair<Integer, String> childPath = AVMNodeConverter.ToAVMVersionPath(childRef);
List<Pair<Integer, String>> possiblePaths =
fAVMService.getPathsInStoreHead(fAVMService.lookup(childPath.getFirst(), childPath.getSecond()),
srcStoreName);
Pair<Integer, String> actualPath = possiblePaths.get(0);
String [] pathParts = actualPath.getSecond().split(":");
AVMDifference diff =
new AVMDifference(-1, srcStoreName + ":" + pathParts[1],
-1, stagingName + ":" + pathParts[1],
AVMDifference.NEWER);
diffs.add(diff);
}
fAVMSyncService.update(diffs, true, true, false, false);
fAVMSyncService.flatten(srcStoreName + ":/appBase",
stagingName + ":/appBase");
}
}

View File

@@ -346,6 +346,13 @@ public interface AVMService
*/
public List<AVMStoreDescriptor> getAVMStores();
/**
* Get (and create if necessary) the system store. This store houses things
* like workflow packages.
* @return The descriptor.
*/
public AVMStoreDescriptor getAVMSystemStore();
/**
* Get a descriptor for an AVMStore.
* @param name The AVMStore's name.