Merged V3.4-BUG-FIX to HEAD

28513: Merged DEV/SKYITALIA to V3.4-BUG-FIX
      26917: ALF-9145: AVM: fix "get store" (+ store not found)
         - if root node id is not found - remove from cache and throw concurrency failure (see also r26916)
         - add missing error info - report store name (if not found)
   28514: ALF-9145: Fixed merge issue
   28518: Fixed ALF-8511: Share - Property with prefix name with - can't be updated/found by Share
   28525: Merged DEV to V3.4-BUG-FIX
      28522: ALF-8197: Replication service fails to replicate Multilingual Containers
             1) Inject list of excluded aspects into ReplicationActionExecutor using replication-services-context.xml.
             2) Don't write value in XMLTransferManifestWriter.writeMLValue if it is null. 
   28534: Merged DEV/TEMPORARY to V3.4-BUG-FIX
      28533: ALF-9085: Share version numbers wrong when uploading initial change, initial Inline edit or adding versionable aspect.
         1. In ScriptNode.addAspect() if ContentModel.ASPECT_VERSIONABLE aspect added than call ensureVersioningEnabled(true, true) otherwise this.nodeService.addAspect (this.nodeRef, aspectQName, aspectProps)
         2. In VersionServiceImpl.ensureVersioningEnabled() the call of createVersion(nodeRef, null) is replaced on createVersion(nodeRef, Collections.<String,Serializable>singletonMap(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR));
   28536: Merged V3.4 to V3.4-BUG-FIX
      28246: ALF-3037: Fixed English in patch message
      28313: Latest L10N Updates from Gloria.
      28335: Removed translations of untranslated bundle!
      28364: Merged V3.4-TEAM to V3.4
         26978: Fixes: ALF-6107 - Fixes Tab order issues with Add event form.
      28387: Merged V3.4-BUG-FIX to V3.4
         28386: ALF-9100: Merged PATCHES/V3.4.1 to V3.4-BUG-FIX
            28249: ALF-8946: Avoid one full table scan per batch in full reindex
               - Now each batch scans a single time sample, dynamically adjusted based on the number of transactions in the previous sample, always aiming for 1000 transactions per sample.
      28421: ALF-9064: commas in "tinymce_languages=en,de,es,fr,it,ja" had been translated.
      28422: ALF-7882: security setting incorrect. FileFolderService.moveFrom arguments changed position, but not reflected in RM security file
      28496: ALF-2740 - File Types are not properly recognized by Alfresco
   28537: Merged V3.4 to V3.4-BUG-FIX (RECORD ONLY)
      28240: Merged V3.4-BUG-FIX to V3.4 (3.4.3)
      28535: Merged V3.4-BUG-FIX to V3.4
         28534: Merged DEV/TEMPORARY to V3.4-BUG-FIX
            28533: ALF-9085: Share version numbers wrong when uploading initial change, initial Inline edit or adding versionable aspect.
               1. In ScriptNode.addAspect() if ContentModel.ASPECT_VERSIONABLE aspect added than call ensureVersioningEnabled(true, true) otherwise this.nodeService.addAspect (this.nodeRef, aspectQName, aspectProps)
               2. In VersionServiceImpl.ensureVersioningEnabled() the call of createVersion(nodeRef, null) is replaced on createVersion(nodeRef, Collections.<String,Serializable>singletonMap(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR));
   28538: ALF-8589: Fixes "Message could not be displayed" errors with IMAP in Outlook Express
   - Corrected generation of subtypes


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28540 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2011-06-23 14:19:47 +00:00
parent 47b45d9ee1
commit 8d2485c755
24 changed files with 155 additions and 1998 deletions

View File

@@ -50,6 +50,8 @@ import org.alfresco.repo.domain.avm.AVMNodeEntity;
import org.alfresco.repo.domain.avm.AVMVersionRootEntity;
import org.alfresco.repo.domain.permissions.Acl;
import org.alfresco.service.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* iBATIS DAO wrapper for AVMNode
@@ -59,6 +61,8 @@ import org.alfresco.service.namespace.QName;
*/
class AVMNodeDAOIbatis implements AVMNodeDAO
{
private static Log logger = LogFactory.getLog(AVMNodeDAO.class);
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMNodeDAO#save(org.alfresco.repo.avm.AVMNode)
*/
@@ -150,11 +154,19 @@ class AVMNodeDAOIbatis implements AVMNodeDAO
/* package */ AVMNode getRootNodeByID(AVMStore store, long rootNodeId)
{
AVMNodeEntity rootNodeEntity = AVMDAOs.Instance().newAVMNodeDAO.getNode(rootNodeId);
AVMNodeEntity rootNodeEntity = null;
if (rootNodeEntity == null)
try
{
return null;
rootNodeEntity = AVMDAOs.Instance().newAVMNodeDAO.getNode(rootNodeId);
}
catch (RuntimeException re)
{
if (logger.isWarnEnabled())
{
logger.warn("Root node ("+rootNodeId+") not found for store: "+store);
}
throw re;
}
AVMNode rootNode = null;

View File

@@ -29,6 +29,7 @@ import org.alfresco.repo.avm.AVMStoreImpl;
import org.alfresco.repo.avm.DirectoryNode;
import org.alfresco.repo.domain.avm.AVMStoreEntity;
import org.alfresco.repo.domain.permissions.Acl;
import org.alfresco.service.cmr.avm.AVMException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -145,17 +146,18 @@ class AVMStoreDAOIbatis implements AVMStoreDAO
{
logger.warn("Root node id is null for store: "+storeEntity);
}
return null;
throw new AVMException(storeEntity.toString());
}
DirectoryNode rootNode = (DirectoryNode) ((AVMNodeDAOIbatis)AVMDAOs.Instance().fAVMNodeDAO).getRootNodeByID(store, rootNodeId);
if (rootNode == null)
{
// belts-and-braces
if (logger.isWarnEnabled())
{
logger.warn("Root node ("+rootNodeId+") not found for store: "+storeEntity);
}
return null;
throw new AVMException(storeEntity.toString());
}
store.setRoot(rootNode);

View File

@@ -156,7 +156,10 @@ public abstract class AbstractAVMNodeDAOImpl implements AVMNodeDAO
Pair<Long, AVMNodeEntity> entityPair = avmNodeCache.getByKey(nodeId);
if (entityPair == null)
{
return null;
// cache-only operation: belts-and-braces
avmNodeCache.removeByKey(nodeId);
throw new ConcurrencyFailureException("getNode: "+nodeId);
}
return entityPair.getSecond();
}

View File

@@ -1253,13 +1253,13 @@ public class FormServiceImplTest extends BaseAlfrescoSpringTest
assertEquals(1, assocs.size());
// request a form for a type with an underscore in it's name
fields = new ArrayList<String>(4);
fields = new ArrayList<String>(1);
fields.add("cm:name");
form = this.formService.getForm(new Item(TYPE_FORM_ITEM_KIND, "fdk:with_underscore"), fields);
assertNotNull(form);
// make sure there are 3 fields
// make sure there is 1 fields
fieldDefs = form.getFieldDefinitions();
assertNotNull(fieldDefs);
assertEquals(1, fieldDefs.size());
@@ -1271,6 +1271,34 @@ public class FormServiceImplTest extends BaseAlfrescoSpringTest
data.addFieldData(AbstractFormProcessor.DESTINATION, this.folder.toString());
NodeRef newNode = (NodeRef)this.formService.saveForm(new Item(TYPE_FORM_ITEM_KIND, "fdk:with_underscore"), data);
assertNotNull(newNode);
// get and save a form for a type and property that has a dash in the namespace prefix
fields = new ArrayList<String>(2);
fields.add("cm:name");
fields.add("my-fdk:more_text");
form = this.formService.getForm(new Item(TYPE_FORM_ITEM_KIND, "my-fdk:namespace-with-dash"), fields);
assertNotNull(form);
// make sure there are 2 fields
fieldDefs = form.getFieldDefinitions();
assertNotNull(fieldDefs);
assertEquals(2, fieldDefs.size());
// save the form to ensure persistence works too
nodeName = GUID.generate() + ".txt";
data = new FormData();
data.addFieldData("prop_cm_name", nodeName);
data.addFieldData("prop_my-fdk_more_text", "This is some text");
data.addFieldData(TypeFormProcessor.DESTINATION, this.folder.toString());
newNode = (NodeRef)this.formService.saveForm(new Item(TYPE_FORM_ITEM_KIND, "my-fdk_namespace-with-dash"), data);
assertNotNull(newNode);
// retrieve the properties and check the values
Map<QName, Serializable> props = nodeService.getProperties(newNode);
assertEquals(nodeName, (String)props.get(ContentModel.PROP_NAME));
assertEquals("This is some text", (String)props.get(
QName.createQName("http://www.alfresco.org/model/my-fdk/1.0", "more_text")));
}
public void testGetFormForJbpmTask() throws Exception

View File

@@ -97,7 +97,7 @@ public abstract class ContentModelFormProcessor<ItemType, PersistType> extends
* names will look like <code>"prop_cm_name"</code>. The pattern can also be
* used to extract the "cm" and the "name" parts.
*/
protected Pattern propertyNamePattern = Pattern.compile(PROP_DATA_PREFIX + "([a-zA-Z0-9]+)_(.*)");
protected Pattern propertyNamePattern = Pattern.compile(PROP_DATA_PREFIX + "([a-zA-Z0-9-]+)_(.*)");
/**
* A regular expression which can be used to match tranisent property names.
@@ -112,7 +112,7 @@ public abstract class ContentModelFormProcessor<ItemType, PersistType> extends
* pattern can also be used to extract the "cm", the "name" and the suffix
* parts.
*/
protected Pattern associationNamePattern = Pattern.compile(ASSOC_DATA_PREFIX + "([a-zA-Z0-9]+)_(.*)(_[a-zA-Z]+)");
protected Pattern associationNamePattern = Pattern.compile(ASSOC_DATA_PREFIX + "([a-zA-Z0-9-]+)_(.*)(_[a-zA-Z]+)");
/**
* Sets the node service

View File

@@ -54,7 +54,7 @@ public interface ImapService
}
public String getSubtype()
{
return name().toLowerCase().substring(name().indexOf("_") + 1 + "TEXT".length());
return name().toLowerCase().substring(name().indexOf("_") + 2 + "TEXT".length());
}
public String getTypeSubtype()

View File

@@ -1980,7 +1980,14 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol
extractScriptableProperties((ScriptableObject)props, aspectProps);
}
QName aspectQName = createQName(type);
this.nodeService.addAspect(this.nodeRef, aspectQName, aspectProps);
if (aspectQName.equals(ContentModel.ASPECT_VERSIONABLE))
{
ensureVersioningEnabled(true, true);
}
else
{
this.nodeService.addAspect(this.nodeRef, aspectQName, aspectProps);
}
// reset the relevant cached node members
reset();

View File

@@ -18,6 +18,7 @@
*/
package org.alfresco.repo.replication;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -28,7 +29,6 @@ import org.alfresco.repo.action.ActionCancelledException;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.lock.JobLockService;
import org.alfresco.repo.lock.LockAcquisitionException;
import org.alfresco.repo.rule.RuleModel;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transfer.ChildAssociatedNodeFinder;
import org.alfresco.repo.transfer.ContentClassFilter;
@@ -51,6 +51,7 @@ import org.alfresco.service.cmr.transfer.TransferEventEnterState;
import org.alfresco.service.cmr.transfer.TransferEventError;
import org.alfresco.service.cmr.transfer.TransferFailureException;
import org.alfresco.service.cmr.transfer.TransferService2;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -73,6 +74,7 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
private TransactionService transactionService;
private ReplicationDefinitionPersisterImpl replicationDefinitionPersister;
private ReplicationParams replicationParams;
private List<QName> excludedAspects = new ArrayList<QName>();
/**
* By default, we lock for a minute, so if this server is shutdown another can take over a
@@ -159,6 +161,14 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
this.replicationParams = replicationParams;
}
public void setExcludedAspects(String[] excludedAspects)
{
for (String aspect : excludedAspects)
{
this.excludedAspects.add(QName.createQName(aspect));
}
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
// Not used - our definitions hold everything on them
@@ -218,8 +228,7 @@ public class ReplicationActionExecutor extends ActionExecuterAbstractBase {
// Exclude aspects from transfer
// NOTE: this list of aspects should be synced up with the NodeCrawler in expandPayload to
// ensure a coherent set of nodes are transferred
transferDefinition.setExcludedAspects(RuleModel.ASPECT_RULES,
ContentModel.ASPECT_VERSIONABLE);
transferDefinition.setExcludedAspects(excludedAspects);
return transferDefinition;
}

View File

@@ -471,8 +471,11 @@ public class XMLTransferManifestWriter implements TransferManifestWriter
writer.startElement(TransferModel.TRANSFER_MODEL_1_0_URI,
ManifestModel.LOCALNAME_ELEMENT_MLVALUE, PREFIX + ":"
+ ManifestModel.LOCALNAME_ELEMENT_MLVALUE, attributes);
String strValue = (String) DefaultTypeConverter.INSTANCE.convert(String.class, value);
writer.characters(strValue.toCharArray(), 0, strValue.length());
if (value != null)
{
String strValue = (String) DefaultTypeConverter.INSTANCE.convert(String.class, value);
writer.characters(strValue.toCharArray(), 0, strValue.length());
}
writer.endElement(TransferModel.TRANSFER_MODEL_1_0_URI,
ManifestModel.LOCALNAME_ELEMENT_MLVALUE, PREFIX + ":"
+ ManifestModel.LOCALNAME_ELEMENT_MLVALUE);

View File

@@ -21,6 +21,7 @@ package org.alfresco.repo.version;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -53,6 +54,7 @@ import org.alfresco.service.cmr.version.Version;
import org.alfresco.service.cmr.version.VersionHistory;
import org.alfresco.service.cmr.version.VersionService;
import org.alfresco.service.cmr.version.VersionServiceException;
import org.alfresco.service.cmr.version.VersionType;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
@@ -921,10 +923,10 @@ public class VersionServiceImpl extends AbstractVersionServiceImpl implements Ve
nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, props);
}
// Do we need to create the initial version history entry?
// Do we need to create the initial version history entry? By convention this is always a major version.
if(getVersionHistory(nodeRef) == null)
{
createVersion(nodeRef, null);
createVersion(nodeRef, Collections.<String,Serializable>singletonMap(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR));
}
// Put Auditable back