mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
CM-690 extensions
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@117482 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1455,9 +1455,8 @@ public class CopyServiceImpl extends AbstractBaseCopyService implements CopyServ
|
|||||||
" " + copyDetails);
|
" " + copyDetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback behaviour retrieval for the 'ownable' aspect.
|
* Callback behaviour retrieval for the 'ownable' aspect.
|
||||||
*
|
*
|
||||||
|
@@ -21,7 +21,14 @@ package org.alfresco.repo.copy;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.copy.traitextender.DefaultCopyBehaviourCallbackExtension;
|
||||||
|
import org.alfresco.repo.copy.traitextender.DefaultCopyBehaviourCallbackTrait;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.traitextender.AJExtender;
|
||||||
|
import org.alfresco.traitextender.Extend;
|
||||||
|
import org.alfresco.traitextender.ExtendedTrait;
|
||||||
|
import org.alfresco.traitextender.Extensible;
|
||||||
|
import org.alfresco.traitextender.Trait;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,10 +48,16 @@ import org.alfresco.util.Pair;
|
|||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public class DefaultCopyBehaviourCallback extends AbstractCopyBehaviourCallback
|
public class DefaultCopyBehaviourCallback extends AbstractCopyBehaviourCallback implements Extensible
|
||||||
{
|
{
|
||||||
private static CopyBehaviourCallback instance = new DefaultCopyBehaviourCallback();
|
private static CopyBehaviourCallback instance = new DefaultCopyBehaviourCallback();
|
||||||
|
|
||||||
|
private final ExtendedTrait<DefaultCopyBehaviourCallbackTrait> defaultCopyBehaviourCallbackTrait;
|
||||||
|
|
||||||
|
public DefaultCopyBehaviourCallback()
|
||||||
|
{
|
||||||
|
defaultCopyBehaviourCallbackTrait=new ExtendedTrait<DefaultCopyBehaviourCallbackTrait>(createTrait());
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @return Returns a stateless singleton
|
* @return Returns a stateless singleton
|
||||||
*/
|
*/
|
||||||
@@ -58,6 +71,7 @@ public class DefaultCopyBehaviourCallback extends AbstractCopyBehaviourCallback
|
|||||||
*
|
*
|
||||||
* @return Returns <tt>true</tt> always
|
* @return Returns <tt>true</tt> always
|
||||||
*/
|
*/
|
||||||
|
@Extend(traitAPI=DefaultCopyBehaviourCallbackTrait.class,extensionAPI=DefaultCopyBehaviourCallbackExtension.class)
|
||||||
public boolean getMustCopy(QName classQName, CopyDetails copyDetails)
|
public boolean getMustCopy(QName classQName, CopyDetails copyDetails)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@@ -115,4 +129,30 @@ public class DefaultCopyBehaviourCallback extends AbstractCopyBehaviourCallback
|
|||||||
{
|
{
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DefaultCopyBehaviourCallbackTrait createTrait()
|
||||||
|
{
|
||||||
|
return new DefaultCopyBehaviourCallbackTrait()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean getMustCopy(final QName classQName, final CopyDetails copyDetails)
|
||||||
|
{
|
||||||
|
return AJExtender.run(new AJExtender.ExtensionBypass<Boolean>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Boolean run()
|
||||||
|
{
|
||||||
|
return getInstance().getMustCopy(classQName, copyDetails);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Trait> ExtendedTrait<T> getTrait(Class<? extends T> traitAPI)
|
||||||
|
{
|
||||||
|
return (ExtendedTrait<T>) defaultCopyBehaviourCallbackTrait;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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.copy.traitextender;
|
||||||
|
|
||||||
|
import org.alfresco.repo.copy.CopyDetails;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
public interface DefaultCopyBehaviourCallbackExtension
|
||||||
|
{
|
||||||
|
boolean getMustCopy(QName classQName, CopyDetails copyDetails);
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* 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.copy.traitextender;
|
||||||
|
|
||||||
|
import org.alfresco.repo.copy.CopyDetails;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.alfresco.traitextender.Trait;
|
||||||
|
|
||||||
|
public interface DefaultCopyBehaviourCallbackTrait extends Trait
|
||||||
|
{
|
||||||
|
boolean getMustCopy(QName classQName, CopyDetails copyDetails);
|
||||||
|
}
|
Reference in New Issue
Block a user