Merge branch 'fix/MNT-18340_needs_two_updates' into develop

This commit is contained in:
Matt Ward
2017-09-22 15:44:15 +01:00
2 changed files with 531 additions and 528 deletions

View File

@@ -3214,13 +3214,6 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
for(QName aspectQName : aspectsToRemove)
{
nodeService.removeAspect(nodeRef, aspectQName);
// aspect is being removed so remove all of its properties from the propsToAdd map
TypeDefinitionWrapper w = getOpenCMISDictionaryService().findNodeType(aspectQName);
for(PropertyDefinitionWrapper wr : w.getProperties())
{
String propertyId = wr.getPropertyId();
propsToAdd.remove(propertyId);
}
}
// add aspects and properties

View File

@@ -50,6 +50,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.alfresco.model.ContentModel;
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
@@ -1755,9 +1756,13 @@ public class CMISTest
List secondaryTypeIds = currentProperties.getProperties().get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues();
assertTrue(secondaryTypeIds.contains(aspectName));
secondaryTypeIds.remove(aspectName);
final PropertiesImpl newProperties = new PropertiesImpl();
newProperties.addProperty(new PropertyStringImpl(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypeIds));
final String updatedName = "My_new_name_"+UUID.randomUUID().toString();
newProperties.replaceProperty(new PropertyStringImpl(PropertyIds.NAME, updatedName));
withCmisService(new CmisServiceCallback<Void>()
{
@@ -1765,6 +1770,8 @@ public class CMISTest
public Void execute(CmisService cmisService)
{
Holder<String> latestObjectIdHolder = getHolderOfObjectOfLatestVersion(cmisService, repositoryId, objectIdHolder);
// This will result in aspectName being removed
// but that shouldn't mean that, for example, a cmis:name prop update gets ignored (MNT-18340)
cmisService.updateProperties(repositoryId, latestObjectIdHolder, null, newProperties, null);
return null;
}
@@ -1775,12 +1782,15 @@ public class CMISTest
@Override
public Properties execute(CmisService cmisService)
{
Properties properties = cmisService.getProperties(repositoryId, objectIdHolder.getValue(), null, null);
Holder<String> latestObjectIdHolder = getHolderOfObjectOfLatestVersion(cmisService, repositoryId, objectIdHolder);
Properties properties = cmisService.getProperties(repositoryId, latestObjectIdHolder.getValue(), null, null);
return properties;
}
}, CmisVersion.CMIS_1_1);
secondaryTypeIds = currentProperties1.getProperties().get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues();
assertFalse(secondaryTypeIds.contains(aspectName));
assertEquals(updatedName, currentProperties1.getProperties().get(PropertyIds.NAME).getFirstValue());
}
/**