CM-690 extensions

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@117481 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Bogdan Horje
2015-11-12 19:19:53 +00:00
parent 4fa8436e55
commit 1151a782f4
3 changed files with 85 additions and 1 deletions

View File

@@ -34,6 +34,8 @@ import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.BeforeCheckOut;
import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCancelCheckOut; import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCancelCheckOut;
import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCheckIn; import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCheckIn;
import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCheckOut; import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCheckOut;
import org.alfresco.repo.coci.traitextender.CheckOutCheckInServiceExtension;
import org.alfresco.repo.coci.traitextender.CheckOutCheckInServiceTrait;
import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.policy.ClassPolicyDelegate; import org.alfresco.repo.policy.ClassPolicyDelegate;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
@@ -61,6 +63,11 @@ import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.OwnableService; import org.alfresco.service.cmr.security.OwnableService;
import org.alfresco.service.cmr.version.VersionService; import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.traitextender.AJProxyTrait;
import org.alfresco.traitextender.Extend;
import org.alfresco.traitextender.ExtendedTrait;
import org.alfresco.traitextender.Extensible;
import org.alfresco.traitextender.Trait;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.util.I18NUtil; import org.springframework.extensions.surf.util.I18NUtil;
@@ -70,7 +77,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class CheckOutCheckInServiceImpl implements CheckOutCheckInService public class CheckOutCheckInServiceImpl implements CheckOutCheckInService,Extensible
{ {
/** /**
* I18N labels * I18N labels
@@ -111,6 +118,14 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
/** Component to determine which behaviours are active and which not */ /** Component to determine which behaviours are active and which not */
private BehaviourFilter behaviourFilter; private BehaviourFilter behaviourFilter;
private final ExtendedTrait<CheckOutCheckInServiceTrait> checkOutCheckInServiceTrait;
public CheckOutCheckInServiceImpl()
{
this.checkOutCheckInServiceTrait=new ExtendedTrait<CheckOutCheckInServiceTrait>(AJProxyTrait.create(this, CheckOutCheckInServiceTrait.class));
}
/** /**
* @param behaviourFilter the behaviourFilter to set * @param behaviourFilter the behaviourFilter to set
@@ -348,6 +363,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef checkout(NodeRef nodeRef) public NodeRef checkout(NodeRef nodeRef)
{ {
// Find the primary parent in order to determine where to put the copy // Find the primary parent in order to determine where to put the copy
@@ -358,6 +374,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef checkout( public NodeRef checkout(
final NodeRef nodeRef, final NodeRef nodeRef,
final NodeRef destinationParentNodeRef, final NodeRef destinationParentNodeRef,
@@ -504,6 +521,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef checkin( public NodeRef checkin(
NodeRef workingCopyNodeRef, NodeRef workingCopyNodeRef,
Map<String, Serializable> versionProperties) Map<String, Serializable> versionProperties)
@@ -512,6 +530,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef checkin( public NodeRef checkin(
NodeRef workingCopyNodeRef, NodeRef workingCopyNodeRef,
Map<String, Serializable> versionProperties, Map<String, Serializable> versionProperties,
@@ -521,6 +540,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef checkin( public NodeRef checkin(
NodeRef workingCopyNodeRef, NodeRef workingCopyNodeRef,
Map<String,Serializable> versionProperties, Map<String,Serializable> versionProperties,
@@ -671,6 +691,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef cancelCheckout(NodeRef workingCopyNodeRef) public NodeRef cancelCheckout(NodeRef workingCopyNodeRef)
{ {
// Check that we have been handed a working copy // Check that we have been handed a working copy
@@ -721,6 +742,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef getWorkingCopy(NodeRef nodeRef) public NodeRef getWorkingCopy(NodeRef nodeRef)
{ {
NodeRef workingCopy = null; NodeRef workingCopy = null;
@@ -746,6 +768,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public NodeRef getCheckedOut(NodeRef nodeRef) public NodeRef getCheckedOut(NodeRef nodeRef)
{ {
NodeRef original = null; NodeRef original = null;
@@ -771,12 +794,14 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public boolean isWorkingCopy(NodeRef nodeRef) public boolean isWorkingCopy(NodeRef nodeRef)
{ {
return nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY); return nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY);
} }
@Override @Override
@Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class)
public boolean isCheckedOut(NodeRef nodeRef) public boolean isCheckedOut(NodeRef nodeRef)
{ {
return nodeService.hasAspect(nodeRef, ContentModel.ASPECT_CHECKED_OUT); return nodeService.hasAspect(nodeRef, ContentModel.ASPECT_CHECKED_OUT);
@@ -876,4 +901,10 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService
{ {
return I18NUtil.getMessage(MSG_WORKING_COPY_LABEL); return I18NUtil.getMessage(MSG_WORKING_COPY_LABEL);
} }
@Override
public <T extends Trait> ExtendedTrait<T> getTrait(Class<? extends T> traitAPI)
{
return (ExtendedTrait<T>) checkOutCheckInServiceTrait;
}
} }

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see http://www.gnu.org/licenses/.
*/
package org.alfresco.repo.coci.traitextender;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
public interface CheckOutCheckInServiceExtension extends CheckOutCheckInService
{
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see http://www.gnu.org/licenses/.
*/
package org.alfresco.repo.coci.traitextender;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.traitextender.Trait;
public interface CheckOutCheckInServiceTrait extends Trait,CheckOutCheckInService
{
}