mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fixed AR-525:
basePatch bean has the following beans injected and held as protected fields transactionService namespaceService searchService nodeService authenticationComponent git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2643 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -22,9 +22,13 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
import org.alfresco.repo.transaction.TransactionUtil;
|
import org.alfresco.repo.transaction.TransactionUtil;
|
||||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||||
import org.alfresco.service.cmr.admin.PatchException;
|
import org.alfresco.service.cmr.admin.PatchException;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@@ -59,7 +63,16 @@ public abstract class AbstractPatch implements Patch
|
|||||||
private boolean applied;
|
private boolean applied;
|
||||||
/** the service to register ourselves with */
|
/** the service to register ourselves with */
|
||||||
private PatchService patchService;
|
private PatchService patchService;
|
||||||
private TransactionService transactionService;
|
/** used to ensure a unique transaction per execution */
|
||||||
|
protected TransactionService transactionService;
|
||||||
|
/** support service */
|
||||||
|
protected NamespaceService namespaceService;
|
||||||
|
/** support service */
|
||||||
|
protected NodeService nodeService;
|
||||||
|
/** support service */
|
||||||
|
protected SearchService searchService;
|
||||||
|
/** support service */
|
||||||
|
protected AuthenticationComponent authComponent;
|
||||||
|
|
||||||
public AbstractPatch()
|
public AbstractPatch()
|
||||||
{
|
{
|
||||||
@@ -100,6 +113,35 @@ public abstract class AbstractPatch implements Patch
|
|||||||
this.transactionService = transactionService;
|
this.transactionService = transactionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a generally-used service
|
||||||
|
*/
|
||||||
|
public void setNamespaceService(NamespaceService namespaceService)
|
||||||
|
{
|
||||||
|
this.namespaceService = namespaceService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a generally-used service
|
||||||
|
*/
|
||||||
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a generally-used service
|
||||||
|
*/
|
||||||
|
public void setSearchService(SearchService searchService)
|
||||||
|
{
|
||||||
|
this.searchService = searchService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthenticationComponent(AuthenticationComponent authComponent)
|
||||||
|
{
|
||||||
|
this.authComponent = authComponent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This ensures that this bean gets registered with the appropriate {@link PatchService service}.
|
* This ensures that this bean gets registered with the appropriate {@link PatchService service}.
|
||||||
*/
|
*/
|
||||||
@@ -250,6 +292,10 @@ public abstract class AbstractPatch implements Patch
|
|||||||
checkPropertyNotNull(id, "id");
|
checkPropertyNotNull(id, "id");
|
||||||
checkPropertyNotNull(description, "description");
|
checkPropertyNotNull(description, "description");
|
||||||
checkPropertyNotNull(transactionService, "transactionService");
|
checkPropertyNotNull(transactionService, "transactionService");
|
||||||
|
checkPropertyNotNull(namespaceService, "namespaceService");
|
||||||
|
checkPropertyNotNull(nodeService, "nodeService");
|
||||||
|
checkPropertyNotNull(searchService, "searchService");
|
||||||
|
checkPropertyNotNull(authComponent, "authComponent");
|
||||||
if (fixesFromSchema == -1 || fixesToSchema == -1 || targetSchema == -1)
|
if (fixesFromSchema == -1 || fixesToSchema == -1 || targetSchema == -1)
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException(
|
throw new AlfrescoRuntimeException(
|
||||||
|
@@ -17,28 +17,18 @@
|
|||||||
package org.alfresco.repo.admin.patch.impl;
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.alfresco.i18n.I18NUtil;
|
import org.alfresco.i18n.I18NUtil;
|
||||||
import org.alfresco.model.ContentModel;
|
|
||||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
import org.alfresco.repo.importer.ACPImportPackageHandler;
|
import org.alfresco.repo.importer.ACPImportPackageHandler;
|
||||||
import org.alfresco.repo.importer.ImporterBootstrap;
|
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
|
||||||
import org.alfresco.service.cmr.admin.PatchException;
|
import org.alfresco.service.cmr.admin.PatchException;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
|
||||||
import org.alfresco.service.cmr.view.ImporterService;
|
import org.alfresco.service.cmr.view.ImporterService;
|
||||||
import org.alfresco.service.cmr.view.Location;
|
import org.alfresco.service.cmr.view.Location;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
@@ -64,11 +54,7 @@ public class EmailTemplatesContentPatch extends AbstractPatch
|
|||||||
public static final String PROPERTY_EMAIL_TEMPLATES_CHILDNAME = "spaces.templates.email.childname";
|
public static final String PROPERTY_EMAIL_TEMPLATES_CHILDNAME = "spaces.templates.email.childname";
|
||||||
|
|
||||||
private ImporterBootstrap importerBootstrap;
|
private ImporterBootstrap importerBootstrap;
|
||||||
private NamespaceService namespaceService;
|
|
||||||
private SearchService searchService;
|
|
||||||
private ImporterService importerService;
|
private ImporterService importerService;
|
||||||
private AuthenticationComponent authComponent;
|
|
||||||
private NodeService nodeService;
|
|
||||||
private MessageSource messageSource;
|
private MessageSource messageSource;
|
||||||
|
|
||||||
protected Properties configuration;
|
protected Properties configuration;
|
||||||
@@ -81,31 +67,11 @@ public class EmailTemplatesContentPatch extends AbstractPatch
|
|||||||
this.importerBootstrap = importerBootstrap;
|
this.importerBootstrap = importerBootstrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNamespaceService(NamespaceService namespaceService)
|
|
||||||
{
|
|
||||||
this.namespaceService = namespaceService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSearchService(SearchService searchService)
|
|
||||||
{
|
|
||||||
this.searchService = searchService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImporterService(ImporterService importerService)
|
public void setImporterService(ImporterService importerService)
|
||||||
{
|
{
|
||||||
this.importerService = importerService;
|
this.importerService = importerService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAuthenticationComponent(AuthenticationComponent authComponent)
|
|
||||||
{
|
|
||||||
this.authComponent = authComponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageSource(MessageSource messageSource)
|
public void setMessageSource(MessageSource messageSource)
|
||||||
{
|
{
|
||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
@@ -124,34 +90,10 @@ public class EmailTemplatesContentPatch extends AbstractPatch
|
|||||||
*/
|
*/
|
||||||
protected void checkRequiredProperties() throws Exception
|
protected void checkRequiredProperties() throws Exception
|
||||||
{
|
{
|
||||||
if (importerBootstrap == null)
|
checkPropertyNotNull(importerBootstrap, "importerBootstrap");
|
||||||
{
|
checkPropertyNotNull(importerService, "importerService");
|
||||||
throw new PatchException("'importerBootstrap' property has not been set");
|
checkPropertyNotNull(messageSource, "messageSource");
|
||||||
}
|
checkPropertyNotNull(templatesACP, "templatesACP");
|
||||||
if (namespaceService == null)
|
|
||||||
{
|
|
||||||
throw new PatchException("'namespaceService' property has not been set");
|
|
||||||
}
|
|
||||||
if (searchService == null)
|
|
||||||
{
|
|
||||||
throw new PatchException("'searchService' property has not been set");
|
|
||||||
}
|
|
||||||
if (nodeService == null)
|
|
||||||
{
|
|
||||||
throw new PatchException("'nodeService' property has not been set");
|
|
||||||
}
|
|
||||||
if (importerService == null)
|
|
||||||
{
|
|
||||||
throw new PatchException("'importerService' property has not been set");
|
|
||||||
}
|
|
||||||
if (messageSource == null)
|
|
||||||
{
|
|
||||||
throw new PatchException("'messageSource' property has not been set");
|
|
||||||
}
|
|
||||||
if (templatesACP == null || templatesACP.length() == 0)
|
|
||||||
{
|
|
||||||
throw new PatchException("'templatesACP' property has not been set");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -29,10 +29,7 @@ import org.alfresco.repo.importer.ImporterBootstrap;
|
|||||||
import org.alfresco.service.cmr.admin.PatchException;
|
import org.alfresco.service.cmr.admin.PatchException;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
|
|
||||||
@@ -62,9 +59,6 @@ public class EmailTemplatesFolderPatch extends AbstractPatch
|
|||||||
private static final String PROPERTY_ICON = "space-icon-default";
|
private static final String PROPERTY_ICON = "space-icon-default";
|
||||||
|
|
||||||
private ImporterBootstrap importerBootstrap;
|
private ImporterBootstrap importerBootstrap;
|
||||||
private NamespaceService namespaceService;
|
|
||||||
private SearchService searchService;
|
|
||||||
private NodeService nodeService;
|
|
||||||
private MessageSource messageSource;
|
private MessageSource messageSource;
|
||||||
|
|
||||||
protected NodeRef dictionaryNodeRef;
|
protected NodeRef dictionaryNodeRef;
|
||||||
@@ -76,21 +70,6 @@ public class EmailTemplatesFolderPatch extends AbstractPatch
|
|||||||
this.importerBootstrap = importerBootstrap;
|
this.importerBootstrap = importerBootstrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNamespaceService(NamespaceService namespaceService)
|
|
||||||
{
|
|
||||||
this.namespaceService = namespaceService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSearchService(SearchService searchService)
|
|
||||||
{
|
|
||||||
this.searchService = searchService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageSource(MessageSource messageSource)
|
public void setMessageSource(MessageSource messageSource)
|
||||||
{
|
{
|
||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
@@ -101,22 +80,8 @@ public class EmailTemplatesFolderPatch extends AbstractPatch
|
|||||||
*/
|
*/
|
||||||
protected void checkCommonProperties() throws Exception
|
protected void checkCommonProperties() throws Exception
|
||||||
{
|
{
|
||||||
if (importerBootstrap == null)
|
checkPropertyNotNull(importerBootstrap, "importerBootstrap");
|
||||||
{
|
checkPropertyNotNull(messageSource, "messageSource");
|
||||||
throw new PatchException("'importerBootstrap' property has not been set");
|
|
||||||
}
|
|
||||||
else if (namespaceService == null)
|
|
||||||
{
|
|
||||||
throw new PatchException("'namespaceService' property has not been set");
|
|
||||||
}
|
|
||||||
else if (searchService == null)
|
|
||||||
{
|
|
||||||
throw new PatchException("'searchService' property has not been set");
|
|
||||||
}
|
|
||||||
else if (nodeService == null)
|
|
||||||
{
|
|
||||||
throw new PatchException("'nodeService' property has not been set");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -25,10 +25,7 @@ import org.alfresco.repo.admin.patch.AbstractPatch;
|
|||||||
import org.alfresco.repo.importer.ImporterBootstrap;
|
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||||
import org.alfresco.service.cmr.admin.PatchException;
|
import org.alfresco.service.cmr.admin.PatchException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic patch that uses existing {@link org.alfresco.repo.importer.ImporterBootstrap importers}
|
* Generic patch that uses existing {@link org.alfresco.repo.importer.ImporterBootstrap importers}
|
||||||
@@ -46,28 +43,10 @@ public class GenericBootstrapPatch extends AbstractPatch
|
|||||||
private static final String MSG_CREATED = "patch.genericBootstrap.result.created";
|
private static final String MSG_CREATED = "patch.genericBootstrap.result.created";
|
||||||
private static final String ERR_MULTIPLE_FOUND = "patch.genericBootstrap.err.multiple_found";
|
private static final String ERR_MULTIPLE_FOUND = "patch.genericBootstrap.err.multiple_found";
|
||||||
|
|
||||||
private NamespaceService namespaceService;
|
|
||||||
private NodeService nodeService;
|
|
||||||
private SearchService searchService;
|
|
||||||
private ImporterBootstrap importerBootstrap;
|
private ImporterBootstrap importerBootstrap;
|
||||||
private String checkPath;
|
private String checkPath;
|
||||||
private Properties bootstrapView;
|
private Properties bootstrapView;
|
||||||
|
|
||||||
public void setNamespaceService(NamespaceService namespaceService)
|
|
||||||
{
|
|
||||||
this.namespaceService = namespaceService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSearchService(SearchService searchService)
|
|
||||||
{
|
|
||||||
this.searchService = searchService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param importerBootstrap the bootstrap bean that performs the user store bootstrap
|
* @param importerBootstrap the bootstrap bean that performs the user store bootstrap
|
||||||
*/
|
*/
|
||||||
@@ -100,9 +79,6 @@ public class GenericBootstrapPatch extends AbstractPatch
|
|||||||
@Override
|
@Override
|
||||||
protected void checkProperties()
|
protected void checkProperties()
|
||||||
{
|
{
|
||||||
checkPropertyNotNull(namespaceService, "blah");
|
|
||||||
checkPropertyNotNull(nodeService, "nodeService");
|
|
||||||
checkPropertyNotNull(searchService, "searchService");
|
|
||||||
checkPropertyNotNull(importerBootstrap, "importerBootstrap");
|
checkPropertyNotNull(importerBootstrap, "importerBootstrap");
|
||||||
checkPropertyNotNull(checkPath, "checkPath");
|
checkPropertyNotNull(checkPath, "checkPath");
|
||||||
checkPropertyNotNull(bootstrapView, "bootstrapView");
|
checkPropertyNotNull(bootstrapView, "bootstrapView");
|
||||||
|
@@ -29,10 +29,7 @@ import org.alfresco.repo.importer.ImporterBootstrap;
|
|||||||
import org.alfresco.service.cmr.admin.PatchException;
|
import org.alfresco.service.cmr.admin.PatchException;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
|
|
||||||
@@ -62,9 +59,6 @@ public class SavedSearchFolderPatch extends AbstractPatch
|
|||||||
private static final String PROPERTY_ICON = "space-icon-default";
|
private static final String PROPERTY_ICON = "space-icon-default";
|
||||||
|
|
||||||
private ImporterBootstrap importerBootstrap;
|
private ImporterBootstrap importerBootstrap;
|
||||||
private NamespaceService namespaceService;
|
|
||||||
private SearchService searchService;
|
|
||||||
private NodeService nodeService;
|
|
||||||
private MessageSource messageSource;
|
private MessageSource messageSource;
|
||||||
|
|
||||||
protected NodeRef dictionaryNodeRef;
|
protected NodeRef dictionaryNodeRef;
|
||||||
@@ -76,21 +70,6 @@ public class SavedSearchFolderPatch extends AbstractPatch
|
|||||||
this.importerBootstrap = importerBootstrap;
|
this.importerBootstrap = importerBootstrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNamespaceService(NamespaceService namespaceService)
|
|
||||||
{
|
|
||||||
this.namespaceService = namespaceService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSearchService(SearchService searchService)
|
|
||||||
{
|
|
||||||
this.searchService = searchService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNodeService(NodeService nodeService)
|
|
||||||
{
|
|
||||||
this.nodeService = nodeService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessageSource(MessageSource messageSource)
|
public void setMessageSource(MessageSource messageSource)
|
||||||
{
|
{
|
||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
|
Reference in New Issue
Block a user