mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged 1.4 to HEAD
svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4145 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4146 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4159 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4160 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4164 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4165 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4165 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4166 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4176 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4178 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4179 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4181 . svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4145 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4146 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4630 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -40,48 +40,8 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
*/
|
||||
public class VersionCounterDaoComponentImpl
|
||||
extends HibernateDaoSupport
|
||||
implements VersionCounterService, NodeServicePolicies.BeforeCreateStorePolicy
|
||||
implements VersionCounterService
|
||||
{
|
||||
private PolicyComponent policyComponent;
|
||||
|
||||
/**
|
||||
* @param policyComponent the component to register behaviour
|
||||
*/
|
||||
public void setPolicyComponent(PolicyComponent policyComponent)
|
||||
{
|
||||
this.policyComponent = policyComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind to receive notifications of store creations
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateStore"),
|
||||
this,
|
||||
new JavaBehaviour(this, "beforeCreateStore"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a version counter for the store
|
||||
* @param nodeTypeQName
|
||||
* @param storeRef
|
||||
*/
|
||||
public void beforeCreateStore(QName nodeTypeQName, StoreRef storeRef)
|
||||
{
|
||||
final StoreKey storeKey = new StoreKey(storeRef.getProtocol(), storeRef.getIdentifier());
|
||||
VersionCount versionCount = (VersionCount) getHibernateTemplate().get(VersionCountImpl.class, storeKey);
|
||||
if (versionCount != null)
|
||||
{
|
||||
// already exists
|
||||
return;
|
||||
}
|
||||
versionCount = new VersionCountImpl();
|
||||
versionCount.setKey(storeKey);
|
||||
getHibernateTemplate().save(versionCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves or creates a version counter. This locks the counter against updates for the
|
||||
* current transaction.
|
||||
|
Reference in New Issue
Block a user