Support for different import strategies:

- replace existing
- remove existing
- throw error on conflict

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2027 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2005-12-12 17:05:30 +00:00
parent a622bf02cd
commit dbb20b17ab
7 changed files with 383 additions and 66 deletions

View File

@@ -49,6 +49,7 @@ public class NodeContext extends ElementContext
{
private ParentContext parentContext;
private NodeRef nodeRef;
private String uuid;
private TypeDefinition typeDef;
private String childName;
private Map<QName, AspectDefinition> nodeAspects = new HashMap<QName, AspectDefinition>();
@@ -69,6 +70,7 @@ public class NodeContext extends ElementContext
super(elementName, parentContext.getDictionaryService(), parentContext.getImporter());
this.parentContext = parentContext;
this.typeDef = typeDef;
this.uuid = null;
}
/* (non-Javadoc)
@@ -112,6 +114,23 @@ public class NodeContext extends ElementContext
{
this.nodeRef = nodeRef;
}
/*
* (non-Javadoc)
* @see org.alfresco.repo.importer.ImportNode#getUUID()
*/
public String getUUID()
{
return uuid;
}
/**
* @param uuid uuid
*/
public void setUUID(String uuid)
{
this.uuid = uuid;
}
/* (non-Javadoc)
* @see org.alfresco.repo.importer.ImportNode#getChildName()
@@ -128,8 +147,7 @@ public class NodeContext extends ElementContext
{
this.childName = childName;
}
/**
* Adds a collection property to the node
*
@@ -163,9 +181,17 @@ public class NodeContext extends ElementContext
*/
public void addProperty(QName property, String value)
{
// Do not import properties of sys:referenceable or cm:versionable
// Process "special" properties
// TODO: Make this configurable...
PropertyDefinition propDef = getDictionaryService().getProperty(property);
// Process Alfresco UUID
if (propDef != null && propDef.getName().equals(ContentModel.PROP_NODE_UUID))
{
uuid = value;
}
// Do not import properties of sys:referenceable or cm:versionable
ClassDefinition classDef = (propDef == null) ? null : propDef.getContainerClass();
if (classDef != null)
{

View File

@@ -110,6 +110,16 @@ public class ParentContext extends ElementContext
return parentRef;
}
/**
* Set Parent Reference
*
* @param parentRef parent reference
*/
public void setParentRef(NodeRef parentRef)
{
this.parentRef = parentRef;
}
/* (non-Javadoc)
* @see org.alfresco.repo.importer.ImportParent#getAssocType()
*/
@@ -118,6 +128,16 @@ public class ParentContext extends ElementContext
return assocType;
}
/**
* Set Parent / Child Assoc Type
*
* @param assocType association type
*/
public void setAssocType(QName assocType)
{
this.assocType = assocType;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/