diff --git a/config/alfresco/bootstrap/descriptor.xml b/config/alfresco/bootstrap/descriptor.xml
index ccda4622f8..f7836a4e8f 100644
--- a/config/alfresco/bootstrap/descriptor.xml
+++ b/config/alfresco/bootstrap/descriptor.xml
@@ -13,6 +13,7 @@
${version.major}
${version.minor}
${version.revision}
+ ${version.edition}
${version.label}
${version.schema}
diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml
index 1035e24cf7..a2b9ab0a0f 100644
--- a/config/alfresco/core-services-context.xml
+++ b/config/alfresco/core-services-context.xml
@@ -617,9 +617,170 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${server.transaction.allow-writes}
+
+
+
+
+
+
+ ${alfresco_user_store.store}
+
+
+
+ ${alfresco_user_store.system_container.childname}
+ ${alfresco_user_store.user_container.childname}
+ ${alfresco_user_store.authorities_container.childname}
+
+
+
+
+
+
+ ${system.store}
+
+
+
+ ${spaces.store}
+
+
+
+
+ ${version.major}
+ ${version.minor}
+ ${version.revision}
+ ${version.label}
+ ${version.schema}
+ ${version.edition}
+ ${system.descriptor.childname}
+ ${system.descriptor.current.childname}
+
+
+
+
+
+
+ ${spaces.store}
+
+
+
+ ${spaces.company_home.childname}
+ ${spaces.guest_home.childname}
+ ${system.system_container.childname}
+ ${system.people_container.childname}
+ ${spaces.dictionary.childname}
+ ${spaces.templates.childname}
+ ${spaces.templates.content.childname}
+ ${spaces.savedsearches.childname}
+
+
+
+
+
+
+ workspace://lightWeightVersionStore
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties
index 27abbc0bb1..fbfe808b16 100644
--- a/config/alfresco/messages/patch-service.properties
+++ b/config/alfresco/messages/patch-service.properties
@@ -60,3 +60,6 @@ patch.emailTemplatesFolder.result.created=The email templates folder was success
patch.emailTemplatesContent.description=Loads the email templates into the Email Templates folder.
patch.emailTemplatesContent.result=Imported the Email Templates into the default folder.
+
+patch.descriptorUpdate.description=Update Repository descriptor
+patch.descriptorUpdate.result=Repository descriptor updated
diff --git a/config/alfresco/model/systemModel.xml b/config/alfresco/model/systemModel.xml
index 621ef9eae2..a8f2ba6067 100644
--- a/config/alfresco/model/systemModel.xml
+++ b/config/alfresco/model/systemModel.xml
@@ -46,9 +46,10 @@
true
0
-
- d:content
-
+
+ d:any
+ true
+
diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml
index cd9b656612..bc777ea14c 100644
--- a/config/alfresco/patch/patch-services-context.xml
+++ b/config/alfresco/patch/patch-services-context.xml
@@ -320,4 +320,19 @@
+
+ patch.descriptorUpdate
+ patch.descriptorUpdate.description
+ 0
+ 11
+ 12
+
+
+
+
+
+
+
+
+
diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties
index 6c47efc00b..b30388b8a6 100644
--- a/config/alfresco/version.properties
+++ b/config/alfresco/version.properties
@@ -7,7 +7,7 @@
version.major=1
version.minor=3
version.revision=0
-version.label=dev
+version.label=
# Edition label
@@ -15,4 +15,4 @@ version.edition=Community Network
# Schema number
-version.schema=11
+version.schema=12
diff --git a/source/java/org/alfresco/model/ContentModel.java b/source/java/org/alfresco/model/ContentModel.java
index 13ac3157da..25f1e99b11 100644
--- a/source/java/org/alfresco/model/ContentModel.java
+++ b/source/java/org/alfresco/model/ContentModel.java
@@ -58,7 +58,8 @@ public interface ContentModel
static final QName PROP_SYS_VERSION_REVISION = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionRevision");
static final QName PROP_SYS_VERSION_LABEL = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionLabel");
static final QName PROP_SYS_VERSION_SCHEMA = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionSchema");
- static final QName PROP_SYS_LICENSE = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "license");
+ static final QName PROP_SYS_VERSION_EDITION = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "versionEdition");
+
//
diff --git a/source/java/org/alfresco/repo/admin/patch/AbstractPatch.java b/source/java/org/alfresco/repo/admin/patch/AbstractPatch.java
index 0674eb99ab..0857e07fbc 100644
--- a/source/java/org/alfresco/repo/admin/patch/AbstractPatch.java
+++ b/source/java/org/alfresco/repo/admin/patch/AbstractPatch.java
@@ -277,7 +277,7 @@ public abstract class AbstractPatch implements Patch
{
if (value == null)
{
- throw new PatchException(ERR_PROPERTY_NOT_SET, "bootstrapView", this);
+ throw new PatchException(ERR_PROPERTY_NOT_SET, name, this);
}
}
diff --git a/source/java/org/alfresco/repo/admin/patch/impl/DescriptorUpdatePatch.java b/source/java/org/alfresco/repo/admin/patch/impl/DescriptorUpdatePatch.java
new file mode 100644
index 0000000000..b6b5d0abb7
--- /dev/null
+++ b/source/java/org/alfresco/repo/admin/patch/impl/DescriptorUpdatePatch.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2005 Alfresco, Inc.
+ *
+ * Licensed under the Mozilla Public License version 1.1
+ * with a permitted attribution clause. You may obtain a
+ * copy of the License at
+ *
+ * http://www.alfresco.org/legal/license.txt
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the
+ * License.
+ */
+package org.alfresco.repo.admin.patch.impl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+
+import org.alfresco.i18n.I18NUtil;
+import org.alfresco.model.ContentModel;
+import org.alfresco.repo.admin.patch.AbstractPatch;
+import org.alfresco.repo.importer.ImporterBootstrap;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.StoreRef;
+
+/**
+ * Apply Version Edition to Repository Descriptor
+ *
+ * @author David Caruana
+ */
+public class DescriptorUpdatePatch extends AbstractPatch
+{
+ private static final String MSG_SUCCESS = "patch.descriptorUpdate.result";
+
+ private ImporterBootstrap systemBootstrap;
+
+ public void setSystemBootstrap(ImporterBootstrap systemBootstrap)
+ {
+ this.systemBootstrap = systemBootstrap;
+ }
+
+ @Override
+ protected String applyInternal() throws Exception
+ {
+ checkPropertyNotNull(systemBootstrap, "systemBootstrap");
+
+ // retrieve system descriptor location
+ StoreRef storeRef = systemBootstrap.getStoreRef();
+ Properties systemProperties = systemBootstrap.getConfiguration();
+
+ // check for the store
+ if (nodeService.exists(storeRef))
+ {
+ // get the current descriptor
+ String path = systemProperties.getProperty("system.descriptor.current.childname");
+ String searchPath = "/" + path;
+ NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
+ List nodeRefs = searchService.selectNodes(rootNodeRef, searchPath, null, namespaceService, false);
+ if (nodeRefs.size() > 0)
+ {
+ NodeRef descriptorNodeRef = nodeRefs.get(0);
+
+ // set version edition
+ Serializable value = nodeService.getProperty(descriptorNodeRef, ContentModel.PROP_SYS_VERSION_EDITION);
+ if (value == null)
+ {
+ String edition = systemProperties.getProperty("version.edition");
+ Collection editions = new ArrayList();
+ editions.add(edition);
+ nodeService.setProperty(descriptorNodeRef, ContentModel.PROP_SYS_VERSION_EDITION, (Serializable)editions);
+ }
+ }
+ }
+
+ // done
+ String msg = I18NUtil.getMessage(MSG_SUCCESS);
+ return msg;
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java
index 2c932b6b79..e9b02fada2 100644
--- a/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java
+++ b/source/java/org/alfresco/repo/coci/CheckOutCheckInServiceImplTest.java
@@ -18,6 +18,7 @@ package org.alfresco.repo.coci;
import java.io.Serializable;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.alfresco.model.ContentModel;
@@ -27,6 +28,7 @@ import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.repo.version.VersionModel;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.lock.LockService;
+import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentReader;
@@ -282,6 +284,32 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
this.cociService.checkin(workingCopy2, new HashMap(), null, true);
}
+ public void testCheckOutCheckInWithTranslatableAspect()
+ {
+ // Create a node to be used as the translation
+ NodeRef translationNodeRef = this.nodeService.createNode(
+ rootNodeRef,
+ ContentModel.ASSOC_CHILDREN,
+ QName.createQName("{test}translation"),
+ ContentModel.TYPE_CONTENT).getChildRef();
+
+ this.nodeService.addAspect(this.nodeRef, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "translatable"), null);
+ this.nodeService.createAssociation(this.nodeRef, translationNodeRef, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "translations"));
+
+ // Check it out
+ NodeRef workingCopy = this.cociService.checkout(
+ this.nodeRef,
+ this.rootNodeRef,
+ ContentModel.ASSOC_CHILDREN,
+ QName.createQName("{test}workingCopy"));
+
+
+ // Check it back in again
+ Map versionProperties = new HashMap();
+ versionProperties.put(Version.PROP_DESCRIPTION, "This is a test version");
+ this.cociService.checkin(workingCopy, versionProperties);
+ }
+
/**
* Test when the aspect is not set when check-in is performed
*/
@@ -399,8 +427,8 @@ public class CheckOutCheckInServiceImplTest extends BaseSpringTest
});
- //NodeRef wk3 = this.cociService.getWorkingCopy(this.nodeRef);
- //assertNull(wk3);
+ NodeRef wk3 = this.cociService.getWorkingCopy(this.nodeRef);
+ assertNull(wk3);
}
}
diff --git a/source/java/org/alfresco/repo/content/RoutingContentService.java b/source/java/org/alfresco/repo/content/RoutingContentService.java
index 750a78e367..40167749f8 100644
--- a/source/java/org/alfresco/repo/content/RoutingContentService.java
+++ b/source/java/org/alfresco/repo/content/RoutingContentService.java
@@ -240,9 +240,7 @@ public class RoutingContentService implements ContentService
private ContentReader getReader(NodeRef nodeRef, QName propertyQName, boolean fireContentReadPolicy)
{
- // get the property value
ContentData contentData = null;
-
Serializable propValue = nodeService.getProperty(nodeRef, propertyQName);
if (propValue instanceof Collection)
{
@@ -252,6 +250,7 @@ public class RoutingContentService implements ContentService
propValue = (Serializable)colPropValue.iterator().next();
}
}
+
if (propValue instanceof ContentData)
{
contentData = (ContentData)propValue;
@@ -272,7 +271,7 @@ public class RoutingContentService implements ContentService
propertyQName);
}
}
-
+
// check that the URL is available
if (contentData == null || contentData.getContentUrl() == null)
{
@@ -315,9 +314,10 @@ public class RoutingContentService implements ContentService
ContentWriter writer = store.getWriter(existingContentReader, null);
// set extra data on the reader if the property is pre-existing
- ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, propertyQName);
- if (contentData != null)
+ Serializable contentValue = nodeService.getProperty(nodeRef, propertyQName);
+ if (contentValue != null && contentValue instanceof ContentData)
{
+ ContentData contentData = (ContentData)contentValue;
writer.setMimetype(contentData.getMimetype());
writer.setEncoding(contentData.getEncoding());
}
diff --git a/source/java/org/alfresco/repo/copy/CopyServiceImpl.java b/source/java/org/alfresco/repo/copy/CopyServiceImpl.java
index 8cf798d84f..95bf7bb7bb 100644
--- a/source/java/org/alfresco/repo/copy/CopyServiceImpl.java
+++ b/source/java/org/alfresco/repo/copy/CopyServiceImpl.java
@@ -607,9 +607,23 @@ public class CopyServiceImpl implements CopyService
{
for (AssociationRef assocRef : nodeAssocRefs)
{
- // Add the association
NodeRef targetRef = assocRef.getTargetRef();
- this.nodeService.createAssociation(destinationNodeRef, targetRef, assocRef.getTypeQName());
+
+ boolean exists = false;
+ for (AssociationRef assocRef2 : this.nodeService.getTargetAssocs(destinationNodeRef, assocRef.getTypeQName()))
+ {
+ if (targetRef.equals(assocRef2.getTargetRef()) == true)
+ {
+ exists = true;
+ break;
+ }
+ }
+
+ if (exists == false)
+ {
+ // Add the association
+ this.nodeService.createAssociation(destinationNodeRef, targetRef, assocRef.getTypeQName());
+ }
}
}
}
diff --git a/source/java/org/alfresco/repo/descriptor/DescriptorServiceImpl.java b/source/java/org/alfresco/repo/descriptor/DescriptorServiceImpl.java
index 91dd547322..92aa77577b 100644
--- a/source/java/org/alfresco/repo/descriptor/DescriptorServiceImpl.java
+++ b/source/java/org/alfresco/repo/descriptor/DescriptorServiceImpl.java
@@ -20,7 +20,6 @@ import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -239,33 +238,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
}
}
- /**
- * Create current repository descriptor
- *
- * @return descriptor
- */
- private Descriptor createCurrentRepositoryDescriptor()
- {
- // retrieve system descriptor location
- StoreRef storeRef = systemBootstrap.getStoreRef();
- Properties systemProperties = systemBootstrap.getConfiguration();
- String path = systemProperties.getProperty("system.descriptor.current.childname");
-
- // retrieve system descriptor
- NodeRef descriptorNodeRef = getDescriptorNodeRef(storeRef, path, false);
- // create appropriate descriptor
- if (descriptorNodeRef != null)
- {
- Map properties = nodeService.getProperties(descriptorNodeRef);
- return new RepositoryDescriptor(properties);
- }
- else
- {
- // descriptor cannot be found
- return new UnknownDescriptor();
- }
- }
-
/**
* Push the current server descriptor properties into persistence.
*
@@ -286,13 +258,12 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
return;
}
// set the properties
- Map properties = new HashMap(17);
- properties.put(ContentModel.PROP_SYS_VERSION_MAJOR, serverDescriptor.getVersionMajor());
- properties.put(ContentModel.PROP_SYS_VERSION_MINOR, serverDescriptor.getVersionMinor());
- properties.put(ContentModel.PROP_SYS_VERSION_REVISION, serverDescriptor.getVersionRevision());
- properties.put(ContentModel.PROP_SYS_VERSION_LABEL, serverDescriptor.getVersionLabel());
- properties.put(ContentModel.PROP_SYS_VERSION_SCHEMA, serverDescriptor.getSchema());
- nodeService.setProperties(currentDescriptorNodeRef, properties);
+ nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MAJOR, serverDescriptor.getVersionMajor());
+ nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_MINOR, serverDescriptor.getVersionMinor());
+ nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_REVISION, serverDescriptor.getVersionRevision());
+ nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_LABEL, serverDescriptor.getVersionLabel());
+ nodeService.setProperty(currentDescriptorNodeRef, ContentModel.PROP_SYS_VERSION_SCHEMA, serverDescriptor.getSchema());
+
// done
if (logger.isDebugEnabled())
{
@@ -377,8 +348,8 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
// NOTE: We could tie in the License Component via Spring configuration, but then it could
// be declaratively taken out in an installed environment.
Class licenseComponentClass = Class.forName("org.alfresco.license.LicenseComponent");
- Constructor constructor = licenseComponentClass.getConstructor(new Class[] { ApplicationContext.class, Descriptor.class} );
- licenseService = (LicenseService)constructor.newInstance(new Object[] { applicationContext, createCurrentRepositoryDescriptor() } );
+ Constructor constructor = licenseComponentClass.getConstructor(new Class[] { ApplicationContext.class} );
+ licenseService = (LicenseService)constructor.newInstance(new Object[] { applicationContext });
}
catch (ClassNotFoundException e)
{
@@ -415,13 +386,6 @@ public class DescriptorServiceImpl implements DescriptorService, ApplicationList
*/
private class NOOPLicenseService implements LicenseService
{
- /* (non-Javadoc)
- * @see org.alfresco.service.license.LicenseService#install()
- */
- public void installLicense() throws LicenseException
- {
- }
-
/* (non-Javadoc)
* @see org.alfresco.service.license.LicenseService#verify()
*/
diff --git a/source/java/org/alfresco/repo/descriptor/DescriptorStartupLog.java b/source/java/org/alfresco/repo/descriptor/DescriptorStartupLog.java
index 3ad304833a..13d77fff3b 100644
--- a/source/java/org/alfresco/repo/descriptor/DescriptorStartupLog.java
+++ b/source/java/org/alfresco/repo/descriptor/DescriptorStartupLog.java
@@ -16,6 +16,7 @@
*/
package org.alfresco.repo.descriptor;
+import java.security.Principal;
import java.util.Date;
import java.util.Map;
@@ -88,6 +89,11 @@ public class DescriptorStartupLog implements ApplicationListener
{
String subject = license.getSubject();
String msg = "Alfresco license: " + subject;
+ String holder = getHolderOrganisation(license.getHolder());
+ if (holder != null)
+ {
+ msg += " granted to " + holder;
+ }
Date validUntil = license.getValidUntil();
if (validUntil != null)
{
@@ -100,6 +106,8 @@ public class DescriptorStartupLog implements ApplicationListener
{
msg += " (does not expire)";
}
+
+
logger.info(msg);
}
@@ -119,4 +127,34 @@ public class DescriptorStartupLog implements ApplicationListener
}
}
+
+ /**
+ * Get Organisation from Principal
+ *
+ * @param holderPrincipal
+ * @return organisation
+ */
+ private String getHolderOrganisation(Principal holderPrincipal)
+ {
+ String holder = null;
+ if (holderPrincipal != null)
+ {
+ holder = holderPrincipal.getName();
+ if (holder != null)
+ {
+ String[] properties = holder.split(",");
+ for (String property : properties)
+ {
+ String[] parts = property.split("=");
+ if (parts[0].equals("O"))
+ {
+ holder = parts[1];
+ }
+ }
+ }
+ }
+
+ return holder;
+ }
+
}
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryBootstrap.java b/source/java/org/alfresco/repo/dictionary/DictionaryBootstrap.java
index f91b09318a..fa083eca82 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryBootstrap.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryBootstrap.java
@@ -22,6 +22,8 @@ import java.util.List;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.service.cmr.dictionary.DictionaryException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
@@ -40,6 +42,10 @@ public class DictionaryBootstrap
// Dictionary DAO
private DictionaryDAO dictionaryDAO = null;
+
+ // Logger
+ private static Log logger = LogFactory.getLog(DictionaryDAO.class);
+
/**
* Sets the Dictionary DAO
@@ -86,6 +92,9 @@ public class DictionaryBootstrap
}
try
{
+ if (logger.isInfoEnabled())
+ logger.info("Loading model from " + bootstrapModel);
+
M2Model model = M2Model.createModel(modelStream);
dictionaryDAO.putModel(model);
}
diff --git a/source/java/org/alfresco/repo/dictionary/DictionaryDAOImpl.java b/source/java/org/alfresco/repo/dictionary/DictionaryDAOImpl.java
index 3a81f40e07..efc473dc4d 100644
--- a/source/java/org/alfresco/repo/dictionary/DictionaryDAOImpl.java
+++ b/source/java/org/alfresco/repo/dictionary/DictionaryDAOImpl.java
@@ -31,6 +31,8 @@ import org.alfresco.service.cmr.dictionary.ModelDefinition;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.namespace.QName;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
@@ -56,6 +58,9 @@ public class DictionaryDAOImpl implements DictionaryDAO
// Map of model name to compiled model
private Map compiledModels = new HashMap();
+ // Logger
+ private static Log logger = LogFactory.getLog(DictionaryDAO.class);
+
/**
* Construct
@@ -99,6 +104,15 @@ public class DictionaryDAOImpl implements DictionaryDAO
// Publish new Model Definition
compiledModels.put(modelName, compiledModel);
+
+ if (logger.isInfoEnabled())
+ {
+ logger.info("Registered model " + modelName.toPrefixString(namespaceDAO));
+ for (M2Namespace namespace : model.getNamespaces())
+ {
+ logger.info("Registered namespace '" + namespace.getUri() + "' (prefix '" + namespace.getPrefix() + "')");
+ }
+ }
}
/**
diff --git a/source/java/org/alfresco/tools/Import.java b/source/java/org/alfresco/tools/Import.java
index e532478544..d79393eb70 100644
--- a/source/java/org/alfresco/tools/Import.java
+++ b/source/java/org/alfresco/tools/Import.java
@@ -26,13 +26,16 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.security.AccessPermission;
import org.alfresco.service.cmr.view.ImportPackageHandler;
+import org.alfresco.service.cmr.view.ImporterBinding;
import org.alfresco.service.cmr.view.ImporterException;
import org.alfresco.service.cmr.view.ImporterProgress;
import org.alfresco.service.cmr.view.ImporterService;
import org.alfresco.service.cmr.view.Location;
+import org.alfresco.service.cmr.view.ImporterBinding.UUID_BINDING;
import org.alfresco.service.namespace.QName;
+
/**
* Import Tool.
*
@@ -126,6 +129,18 @@ public class Import extends Tool
}
context.encoding = args[i];
}
+ else if (args[i].equals("-uuidBinding"))
+ {
+ i++;
+ try
+ {
+ context.uuidBinding = UUID_BINDING.valueOf(UUID_BINDING.class, args[i]);
+ }
+ catch(IllegalArgumentException e)
+ {
+ throw new ToolException("The value " + args[i] + " is an invalid uuidBinding");
+ }
+ }
else if (args[i].equals("-quiet"))
{
context.setQuiet(true);
@@ -168,6 +183,7 @@ public class Import extends Tool
System.out.println(" -d[ir] the source directory to import from (default: current directory)");
System.out.println(" -pwd password for login");
System.out.println(" -encoding package file encoding (default: " + Charset.defaultCharset() + ")");
+ System.out.println(" -uuidBinding CREATE_NEW, REMOVE_EXISTING, REPLACE_EXISTING, UPDATE_EXISTING, THROW_ON_COLLISION (default: CREATE_NEW)");
System.out.println(" -quiet do not display any messages during import");
System.out.println(" -verbose report import progress");
}
@@ -202,7 +218,8 @@ public class Import extends Tool
try
{
- importer.importView(importHandler, context.getLocation(), null, new ImportProgress());
+ ImportBinding binding = new ImportBinding(context.uuidBinding);
+ importer.importView(importHandler, context.getLocation(), binding, new ImportProgress());
}
catch(ImporterException e)
{
@@ -360,6 +377,8 @@ public class Import extends Tool
private String packageName;
/** The package encoding */
private String encoding = null;
+ /** The UUID Binding */
+ private UUID_BINDING uuidBinding = UUID_BINDING.CREATE_NEW;
/** Zip Package? */
private boolean zipFile = false;
@@ -451,5 +470,57 @@ public class Import extends Tool
return (zipFile) ? new File(packageName) : getDataFile();
}
}
+
+
+ /**
+ * Import Tool Binding
+ *
+ * @author davidc
+ */
+ private class ImportBinding implements ImporterBinding
+ {
+ private UUID_BINDING uuidBinding = null;
+ /**
+ * Construct
+ *
+ * @param uuidBinding
+ */
+ public ImportBinding(UUID_BINDING uuidBinding)
+ {
+ this.uuidBinding = uuidBinding;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.service.cmr.view.ImporterBinding#getUUIDBinding()
+ */
+ public UUID_BINDING getUUIDBinding()
+ {
+ return uuidBinding;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.service.cmr.view.ImporterBinding#allowReferenceWithinTransaction()
+ */
+ public boolean allowReferenceWithinTransaction()
+ {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.alfresco.service.cmr.view.ImporterBinding#getValue(java.lang.String)
+ */
+ public String getValue(String key)
+ {
+ return null;
+ }
+
+ public QName[] getExcludedClasses()
+ {
+ return new QName[] {};
+ }
+ }
}