diff --git a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java index d65c918241..56ac596e94 100644 --- a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java +++ b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImpl.java @@ -34,6 +34,8 @@ import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.BeforeCheckOut; import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCancelCheckOut; import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.OnCheckIn; 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.ClassPolicyDelegate; 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.version.VersionService; 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.LogFactory; import org.springframework.extensions.surf.util.I18NUtil; @@ -70,7 +77,7 @@ import org.springframework.extensions.surf.util.I18NUtil; * * @author Roy Wetherall */ -public class CheckOutCheckInServiceImpl implements CheckOutCheckInService +public class CheckOutCheckInServiceImpl implements CheckOutCheckInService,Extensible { /** * I18N labels @@ -111,7 +118,15 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService /** Component to determine which behaviours are active and which not */ private BehaviourFilter behaviourFilter; + private final ExtendedTrait checkOutCheckInServiceTrait; + + + public CheckOutCheckInServiceImpl() + { + this.checkOutCheckInServiceTrait=new ExtendedTrait(AJProxyTrait.create(this, CheckOutCheckInServiceTrait.class)); + } + /** * @param behaviourFilter the behaviourFilter to set */ @@ -348,6 +363,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef checkout(NodeRef nodeRef) { // Find the primary parent in order to determine where to put the copy @@ -358,6 +374,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef checkout( final NodeRef nodeRef, final NodeRef destinationParentNodeRef, @@ -504,6 +521,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef checkin( NodeRef workingCopyNodeRef, Map versionProperties) @@ -512,6 +530,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef checkin( NodeRef workingCopyNodeRef, Map versionProperties, @@ -521,6 +540,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef checkin( NodeRef workingCopyNodeRef, Map versionProperties, @@ -671,6 +691,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef cancelCheckout(NodeRef workingCopyNodeRef) { // Check that we have been handed a working copy @@ -721,6 +742,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef getWorkingCopy(NodeRef nodeRef) { NodeRef workingCopy = null; @@ -746,6 +768,7 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public NodeRef getCheckedOut(NodeRef nodeRef) { NodeRef original = null; @@ -771,12 +794,14 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public boolean isWorkingCopy(NodeRef nodeRef) { return nodeService.hasAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY); } @Override + @Extend(traitAPI=CheckOutCheckInServiceTrait.class,extensionAPI=CheckOutCheckInServiceExtension.class) public boolean isCheckedOut(NodeRef nodeRef) { return nodeService.hasAspect(nodeRef, ContentModel.ASPECT_CHECKED_OUT); @@ -876,4 +901,10 @@ public class CheckOutCheckInServiceImpl implements CheckOutCheckInService { return I18NUtil.getMessage(MSG_WORKING_COPY_LABEL); } + + @Override + public ExtendedTrait getTrait(Class traitAPI) + { + return (ExtendedTrait) checkOutCheckInServiceTrait; + } } diff --git a/source/java/org/alfresco/repo/coci/traitextender/CheckOutCheckInServiceExtension.java b/source/java/org/alfresco/repo/coci/traitextender/CheckOutCheckInServiceExtension.java new file mode 100644 index 0000000000..c037c7f6cc --- /dev/null +++ b/source/java/org/alfresco/repo/coci/traitextender/CheckOutCheckInServiceExtension.java @@ -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 +{ + +} diff --git a/source/java/org/alfresco/repo/coci/traitextender/CheckOutCheckInServiceTrait.java b/source/java/org/alfresco/repo/coci/traitextender/CheckOutCheckInServiceTrait.java new file mode 100644 index 0000000000..40c7a1a250 --- /dev/null +++ b/source/java/org/alfresco/repo/coci/traitextender/CheckOutCheckInServiceTrait.java @@ -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 +{ + +}