mirror of
				https://github.com/Alfresco/alfresco-community-repo.git
				synced 2025-10-29 15:21:53 +00:00 
			
		
		
		
	.externalToolBuilders
config
source
cpp
java
org
alfresco
example
filesys
jcr
model
repo
action
admin
attributes
audit
avm
actions
hibernate
locking
util
wf
AVMClearSubmittedHandler.java
AVMRemoveWFStoreHandler.java
AVMSubmitHandler.java
AVMSubmitPackageHandler.java
AVMSubmitTransactionListener.java
AVMSubmittedAspect.java
AVMAspectName.java
AVMAspectNameDAO.java
AVMAspectNameImpl.java
AVMCrawlTestP.java
AVMCrawler.java
AVMDAOs.java
AVMExpiredContentJob.java
AVMExpiredContentProcessor.java
AVMExpiredContentTest.java
AVMInterpreter.java
AVMLookupCacheListener.java
AVMNode.java
AVMNodeConverter.java
AVMNodeConverterTest.java
AVMNodeDAO.java
AVMNodeImpl.java
AVMNodeProperty.java
AVMNodePropertyDAO.java
AVMNodePropertyImpl.java
AVMNodeService.java
AVMNodeType.java
AVMNodeUnwrapper.java
AVMRemoteLocal.java
AVMRemoteTransportService.java
AVMRepository.java
AVMServiceImpl.java
AVMServicePerfTest.java
AVMServiceTest.java
AVMServiceTestBase.java
AVMStore.java
AVMStoreDAO.java
AVMStoreImpl.java
AVMStoreProperty.java
AVMStorePropertyDAO.java
AVMStorePropertyImpl.java
AVMStressTestP.java
AVMSyncServiceImpl.java
AVMSyncServiceTransportImpl.java
AVMTestRemote.java
AVMTester.java
AvmBootstrap.java
BasicAttributes.java
BasicAttributesImpl.java
ChildEntry.java
ChildEntryDAO.java
ChildEntryImpl.java
ChildKey.java
CreateStoreCallback.java
CreateStoreTxnListener.java
CreateVersionCallback.java
CreateVersionTxnListener.java
DeletedNode.java
DeletedNodeImpl.java
DirectoryNode.java
DirectoryNodeImpl.java
FileNameValidator.java
FileNameValidatorTest.java
FileNode.java
FileNodeImpl.java
HistoryLink.java
HistoryLinkDAO.java
HistoryLinkImpl.java
Issuer.java
IssuerDAO.java
Layered.java
LayeredDirectoryNode.java
LayeredDirectoryNodeImpl.java
LayeredFileNode.java
LayeredFileNodeImpl.java
Lookup.java
LookupCache.java
LookupComponent.java
LookupKey.java
MergeLink.java
MergeLinkDAO.java
MergeLinkImpl.java
OrphanReaper.java
OrphanReaperJob.java
PlainDirectoryNode.java
PlainDirectoryNodeImpl.java
PlainFileNode.java
PlainFileNodeImpl.java
PurgeStoreCallback.java
PurgeStoreTxnListener.java
PurgeTestP.java
PurgeVersionCallback.java
PurgeVersionTxnListener.java
SimultaneousLoadTest.java
TestDeploymentCallback.java
VersionLayeredNodeEntry.java
VersionLayeredNodeEntryDAO.java
VersionLayeredNodeEntryImpl.java
VersionRoot.java
VersionRootDAO.java
VersionRootImpl.java
cache
clt
coci
configuration
content
copy
deploy
descriptor
dictionary
domain
exporter
forum
importer
jscript
lock
model
module
node
ownable
policy
processor
remote
rule
search
security
service
template
transaction
version
workflow
sandbox
service
tools
util
apache
queryRegister.dtd
meta-inf
test-resources
web
.classpath
.project
build.xml
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5186 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
		
			
				
	
	
		
			95 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			95 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
/*
 | 
						|
 * Copyright (C) 2005-2007 Alfresco Software Limited.
 | 
						|
 *
 | 
						|
 * This program is free software; you can redistribute it and/or
 | 
						|
 * modify it under the terms of the GNU General Public License
 | 
						|
 * as published by the Free Software Foundation; either version 2
 | 
						|
 * of the License, or (at your option) any later version.
 | 
						|
 | 
						|
 * This program 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 General Public License for more details.
 | 
						|
 | 
						|
 * You should have received a copy of the GNU General Public License
 | 
						|
 * along with this program; if not, write to the Free Software
 | 
						|
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 | 
						|
 * As a special exception to the terms and conditions of version 2.0 of
 | 
						|
 * the GPL, you may redistribute this Program in connection with Free/Libre
 | 
						|
 * and Open Source Software ("FLOSS") applications as described in Alfresco's
 | 
						|
 * FLOSS exception.  You should have recieved a copy of the text describing
 | 
						|
 * the FLOSS exception, and it is also available here:
 | 
						|
 * http://www.alfresco.com/legal/licensing" */
 | 
						|
 | 
						|
package org.alfresco.repo.avm.wf;
 | 
						|
 | 
						|
import java.util.List;
 | 
						|
 | 
						|
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.namespace.QName;
 | 
						|
import org.apache.log4j.Logger;
 | 
						|
import org.jbpm.graph.exe.ExecutionContext;
 | 
						|
import org.springframework.beans.factory.BeanFactory;
 | 
						|
 | 
						|
/**
 | 
						|
 * Performs a 'submit' operation: update from one sandbox layer to
 | 
						|
 * its corresponding staging sandbox.
 | 
						|
 * @author britt
 | 
						|
 */
 | 
						|
public class AVMSubmitHandler extends JBPMSpringActionHandler
 | 
						|
{
 | 
						|
    private static final long serialVersionUID = 7561005904505181493L;
 | 
						|
 | 
						|
    private static Logger fgLogger = Logger.getLogger(AVMSubmitHandler.class);
 | 
						|
    
 | 
						|
    /**
 | 
						|
     * The AVMSyncService.
 | 
						|
     */ 
 | 
						|
    private AVMSyncService fAVMSyncService;
 | 
						|
    
 | 
						|
    /**
 | 
						|
     * The AVMService.
 | 
						|
     */
 | 
						|
    private AVMService fAVMService;
 | 
						|
    
 | 
						|
    /**
 | 
						|
     * Set any bean references necessary.
 | 
						|
     * @param factory The BeanFactory from which to get beans.
 | 
						|
     */
 | 
						|
    @Override
 | 
						|
    protected void initialiseHandler(BeanFactory factory)
 | 
						|
    {
 | 
						|
        fAVMSyncService = (AVMSyncService)factory.getBean("AVMSyncService");
 | 
						|
        fAVMService = (AVMService)factory.getBean("AVMService");
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Do the actual submit work.
 | 
						|
     * @param executionContext The jBPM context.
 | 
						|
     */
 | 
						|
    public void execute(ExecutionContext executionContext) throws Exception
 | 
						|
    {
 | 
						|
        String avmSource = (String)executionContext.getContextInstance().getVariable("sourcePath");
 | 
						|
        String [] storePath = avmSource.split(":");
 | 
						|
        if (storePath.length != 2)
 | 
						|
        {
 | 
						|
            fgLogger.error("Malformed path: " + avmSource);
 | 
						|
            return;
 | 
						|
        }
 | 
						|
        String webSiteName = 
 | 
						|
            fAVMService.getStoreProperty(storePath[0], QName.createQName(null, ".website.name")).
 | 
						|
            getStringValue();
 | 
						|
        String avmDest = webSiteName + "-staging:" + storePath[1];
 | 
						|
        List<AVMDifference> diffs = 
 | 
						|
            fAVMSyncService.compare(-1, avmSource, -1, avmDest, null);
 | 
						|
        // TODO fix update comments if needed.
 | 
						|
        // Ignore conflicts and older nodes for now.
 | 
						|
        fAVMSyncService.update(diffs, null, true, true, false, false, null, null);
 | 
						|
        // Now flatten out the source.
 | 
						|
        fAVMSyncService.flatten(avmSource, avmDest);
 | 
						|
    }
 | 
						|
}
 |