Humongous merge. It is incomplete, however; faces-config-navigation.xml and ClientConfigElement

were both beyond me, and are just the raw conflict merge data.  If Kev can't figure out how they should
go together by tomorrow AM (for me) I'll dig back in.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4306 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-11-08 05:17:40 +00:00
parent 2c20af6d2b
commit b2f9df29d1
140 changed files with 20060 additions and 16456 deletions

View File

@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.policy.ClassPolicyDelegate;
import org.alfresco.repo.policy.JavaBehaviour;
@@ -43,6 +44,7 @@ import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.CopyService;
import org.alfresco.service.cmr.repository.CopyServiceException;
import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
@@ -65,8 +67,12 @@ import org.alfresco.util.ParameterCheck;
*/
public class CopyServiceImpl implements CopyService
{
/** I18N labels */
private String COPY_OF_LABEL = "copy_service.copy_of_label";
/** The node service */
private NodeService nodeService;
private NodeService internalNodeService;
/** The dictionary service*/
private DictionaryService dictionaryService;
@@ -99,6 +105,16 @@ public class CopyServiceImpl implements CopyService
{
this.nodeService = nodeService;
}
/**
* Sets the internal node service
*
* @param internalNodeService the internal node service
*/
public void setInternalNodeService(NodeService internalNodeService)
{
this.internalNodeService = internalNodeService;
}
/**
* Sets the dictionary service
@@ -233,7 +249,32 @@ public class CopyServiceImpl implements CopyService
return copy;
}
public NodeRef copyAndRename(NodeRef sourceNodeRef, NodeRef destinationParent, QName destinationAssocTypeQName, QName destinationQName, boolean copyChildren)
{
// Make a note of the source name and do the copy
String sourceName = (String)this.internalNodeService.getProperty(sourceNodeRef, ContentModel.PROP_NAME);
NodeRef copy = copy(sourceNodeRef, destinationParent, destinationAssocTypeQName, destinationQName, copyChildren);
// Do the rename, iterating until a non-duplicate name is found
boolean bDone = false;
while (bDone == false)
{
try
{
this.internalNodeService.setProperty(copy, ContentModel.PROP_NAME, sourceName);
bDone = true;
}
catch(DuplicateChildNodeNameException exception)
{
sourceName = I18NUtil.getMessage(COPY_OF_LABEL, sourceName);
}
}
// Return the copy
return copy;
}
/**
* Invokes the copy complete policy for the node reference provided
*

View File

@@ -104,6 +104,7 @@ public class CopyServiceImplTest extends BaseSpringTest
private static final QName TEST_MANDATORY_ASPECT_QNAME = QName.createQName(TEST_TYPE_NAMESPACE, "testMandatoryAspect");
private static final QName PROP5_QNAME_MANDATORY = QName.createQName(TEST_TYPE_NAMESPACE, "prop5Mandatory");
private static final String TEST_NAME = "testName";
private static final String TEST_VALUE_1 = "testValue1";
private static final String TEST_VALUE_2 = "testValue2";
private static final String TEST_VALUE_3 = "testValue3";
@@ -239,6 +240,7 @@ public class CopyServiceImplTest extends BaseSpringTest
private Map<QName, Serializable> createTypePropertyBag()
{
Map<QName, Serializable> result = new HashMap<QName, Serializable>();
result.put(ContentModel.PROP_NAME, TEST_NAME);
result.put(PROP1_QNAME_MANDATORY, TEST_VALUE_1);
result.put(PROP2_QNAME_OPTIONAL, TEST_VALUE_2);
result.put(PROP5_QNAME_MANDATORY, TEST_VALUE_3);
@@ -624,6 +626,31 @@ public class CopyServiceImplTest extends BaseSpringTest
assertNotNull(value);
assertEquals(nodeTwoCopy, value);
}
public void testCopyAndRename()
{
// Check a normal copy with no dup restrictions
NodeRef copy = this.copyService.copyAndRename(
this.sourceNodeRef,
this.rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}copyAssoc"),
false);
checkCopiedNode(this.sourceNodeRef, copy, true, true, false);
assertTrue(TEST_NAME.equals(this.nodeService.getProperty(copy, ContentModel.PROP_NAME)));
// Create a folder and content node
Map<QName, Serializable> propsFolder = new HashMap<QName, Serializable>(1);
propsFolder.put(ContentModel.PROP_NAME, "tempFolder");
NodeRef folderNode = this.nodeService.createNode(this.rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}tempFolder"), ContentModel.TYPE_FOLDER, propsFolder).getChildRef();
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
props.put(ContentModel.PROP_NAME, TEST_NAME);
NodeRef contentNode = this.nodeService.createNode(folderNode, ContentModel.ASSOC_CONTAINS, QName.createQName("{test}renametest"), ContentModel.TYPE_CONTENT, props).getChildRef();
// Now copy the content node with the duplicate name restriction
NodeRef contentCopy = this.copyService.copy(contentNode, folderNode, ContentModel.ASSOC_CONTAINS, QName.createQName("{test}bobbins"), false);
assertFalse(TEST_NAME.equals(this.nodeService.getProperty(contentCopy, ContentModel.PROP_NAME)));
}
/**
* Check that the copied node contains the state we are expecting