mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
MNT-18340: no longer ignores property updates for "unrelated" aspect removal
https://issues.alfresco.com/jira/browse/MNT-18340
This commit is contained in:
@@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.opencmis;
|
package org.alfresco.opencmis;
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
@@ -50,17 +50,17 @@ import java.util.Map.Entry;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import javax.xml.datatype.DatatypeConfigurationException;
|
import javax.xml.datatype.DatatypeConfigurationException;
|
||||||
import javax.xml.datatype.DatatypeFactory;
|
import javax.xml.datatype.DatatypeFactory;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.events.types.ContentEvent;
|
import org.alfresco.events.types.ContentEvent;
|
||||||
import org.alfresco.events.types.ContentEventImpl;
|
import org.alfresco.events.types.ContentEventImpl;
|
||||||
import org.alfresco.events.types.ContentReadRangeEvent;
|
import org.alfresco.events.types.ContentReadRangeEvent;
|
||||||
import org.alfresco.events.types.Event;
|
import org.alfresco.events.types.Event;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.service.cmr.activities.ActivityInfo;
|
import org.alfresco.service.cmr.activities.ActivityInfo;
|
||||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||||
import org.alfresco.opencmis.dictionary.CMISAllowedActionEnum;
|
import org.alfresco.opencmis.dictionary.CMISAllowedActionEnum;
|
||||||
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
||||||
@@ -81,8 +81,8 @@ import org.alfresco.opencmis.search.CMISResultSetRow;
|
|||||||
import org.alfresco.repo.Client;
|
import org.alfresco.repo.Client;
|
||||||
import org.alfresco.repo.Client.ClientType;
|
import org.alfresco.repo.Client.ClientType;
|
||||||
import org.alfresco.repo.action.executer.ContentMetadataExtracter;
|
import org.alfresco.repo.action.executer.ContentMetadataExtracter;
|
||||||
import org.alfresco.repo.cache.SimpleCache;
|
import org.alfresco.repo.cache.SimpleCache;
|
||||||
import org.alfresco.repo.coci.CheckOutCheckInServiceImpl;
|
import org.alfresco.repo.coci.CheckOutCheckInServiceImpl;
|
||||||
import org.alfresco.repo.events.EventPreparator;
|
import org.alfresco.repo.events.EventPreparator;
|
||||||
import org.alfresco.repo.events.EventPublisher;
|
import org.alfresco.repo.events.EventPublisher;
|
||||||
import org.alfresco.repo.model.filefolder.GetChildrenCannedQuery;
|
import org.alfresco.repo.model.filefolder.GetChildrenCannedQuery;
|
||||||
@@ -462,22 +462,22 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
this.objectsDefaultDepth = objectsDefaultDepth;
|
this.objectsDefaultDepth = objectsDefaultDepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the default number of content changes to return if nothing is specified
|
* Set the default number of content changes to return if nothing is specified
|
||||||
*/
|
*/
|
||||||
public void setContentChangesDefaultMaxItems(int contentChangesDefaultMaxItems)
|
public void setContentChangesDefaultMaxItems(int contentChangesDefaultMaxItems)
|
||||||
{
|
{
|
||||||
if (contentChangesDefaultMaxItems < 1)
|
if (contentChangesDefaultMaxItems < 1)
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("The default maximum number of content changes to retrieve must be greater than zero.");
|
throw new IllegalArgumentException("The default maximum number of content changes to retrieve must be greater than zero.");
|
||||||
}
|
}
|
||||||
else if (contentChangesDefaultMaxItems == Integer.MAX_VALUE)
|
else if (contentChangesDefaultMaxItems == Integer.MAX_VALUE)
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("The server cannot return " + Integer.MAX_VALUE + " content changes in a request!");
|
throw new IllegalArgumentException("The server cannot return " + Integer.MAX_VALUE + " content changes in a request!");
|
||||||
}
|
}
|
||||||
this.contentChangesDefaultMaxItems = contentChangesDefaultMaxItems;
|
this.contentChangesDefaultMaxItems = contentChangesDefaultMaxItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set rendition kind mapping.
|
* Set rendition kind mapping.
|
||||||
*/
|
*/
|
||||||
@@ -504,14 +504,14 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||||
{
|
{
|
||||||
this.serviceRegistry = serviceRegistry;
|
this.serviceRegistry = serviceRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the service registry
|
* Return the service registry
|
||||||
*/
|
*/
|
||||||
public final ServiceRegistry getServiceRegistry()
|
public final ServiceRegistry getServiceRegistry()
|
||||||
{
|
{
|
||||||
return this.serviceRegistry;
|
return this.serviceRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3185,8 +3185,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
|
|
||||||
Set<QName> ignore = new HashSet<QName>();
|
Set<QName> ignore = new HashSet<QName>();
|
||||||
ignore.add(ContentModel.ASPECT_REFERENCEABLE);
|
ignore.add(ContentModel.ASPECT_REFERENCEABLE);
|
||||||
ignore.add(ContentModel.ASPECT_LOCALIZED);
|
ignore.add(ContentModel.ASPECT_LOCALIZED);
|
||||||
ignore.add(ContentModel.ASPECT_WORKING_COPY);
|
ignore.add(ContentModel.ASPECT_WORKING_COPY);
|
||||||
|
|
||||||
// aspects to add == the list of secondary types - existing aspects - ignored aspects
|
// aspects to add == the list of secondary types - existing aspects - ignored aspects
|
||||||
Set<QName> toAdd = new HashSet<QName>(secondaryTypeAspects);
|
Set<QName> toAdd = new HashSet<QName>(secondaryTypeAspects);
|
||||||
@@ -3213,13 +3213,6 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
for(QName aspectQName : aspectsToRemove)
|
for(QName aspectQName : aspectsToRemove)
|
||||||
{
|
{
|
||||||
nodeService.removeAspect(nodeRef, aspectQName);
|
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
|
// add aspects and properties
|
||||||
@@ -3607,21 +3600,21 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String newName = value.toString();
|
String newName = value.toString();
|
||||||
// If the node is checked out and the name property is set on the working copy, make sure the new name has the working copy format
|
// If the node is checked out and the name property is set on the working copy, make sure the new name has the working copy format
|
||||||
if (checkOutCheckInService.isWorkingCopy(nodeRef))
|
if (checkOutCheckInService.isWorkingCopy(nodeRef))
|
||||||
{
|
{
|
||||||
String wcLabel = (String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_WORKING_COPY_LABEL);
|
String wcLabel = (String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_WORKING_COPY_LABEL);
|
||||||
if (wcLabel == null)
|
if (wcLabel == null)
|
||||||
{
|
{
|
||||||
wcLabel = CheckOutCheckInServiceImpl.getWorkingCopyLabel();
|
wcLabel = CheckOutCheckInServiceImpl.getWorkingCopyLabel();
|
||||||
}
|
}
|
||||||
if (!newName.contains(wcLabel))
|
if (!newName.contains(wcLabel))
|
||||||
{
|
{
|
||||||
newName = CheckOutCheckInServiceImpl.createWorkingCopyName(newName, wcLabel);
|
newName = CheckOutCheckInServiceImpl.createWorkingCopyName(newName, wcLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileFolderService.rename(nodeRef, newName);
|
fileFolderService.rename(nodeRef, newName);
|
||||||
}
|
}
|
||||||
@@ -3709,30 +3702,30 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
|||||||
params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
|
params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
|
||||||
params.setForward(true);
|
params.setForward(true);
|
||||||
params.setFromId(from);
|
params.setFromId(from);
|
||||||
|
|
||||||
// So we have a BigInteger. We need to ensure that we cut it down to an integer smaller than Integer.MAX_VALUE
|
// So we have a BigInteger. We need to ensure that we cut it down to an integer smaller than Integer.MAX_VALUE
|
||||||
|
|
||||||
int maxResults = (maxItems == null ? contentChangesDefaultMaxItems : maxItems.intValue());
|
int maxResults = (maxItems == null ? contentChangesDefaultMaxItems : maxItems.intValue());
|
||||||
maxResults = maxResults < 1 ? contentChangesDefaultMaxItems : maxResults; // Just a double check of the unbundled contents
|
maxResults = maxResults < 1 ? contentChangesDefaultMaxItems : maxResults; // Just a double check of the unbundled contents
|
||||||
maxResults = maxResults > contentChangesDefaultMaxItems ? contentChangesDefaultMaxItems : maxResults; // cut it down
|
maxResults = maxResults > contentChangesDefaultMaxItems ? contentChangesDefaultMaxItems : maxResults; // cut it down
|
||||||
int queryFor = maxResults + 1; // Query for 1 more so that we know if there are more results
|
int queryFor = maxResults + 1; // Query for 1 more so that we know if there are more results
|
||||||
|
|
||||||
auditService.auditQuery(changeLogCollectingCallback, params, queryFor);
|
auditService.auditQuery(changeLogCollectingCallback, params, queryFor);
|
||||||
|
|
||||||
String newChangeLogToken = null;
|
String newChangeLogToken = null;
|
||||||
// Check if we got more than the client requested
|
// Check if we got more than the client requested
|
||||||
if (result.getObjects().size() >= maxResults)
|
if (result.getObjects().size() >= maxResults)
|
||||||
{
|
{
|
||||||
// Build the change log token from the last item
|
// Build the change log token from the last item
|
||||||
StringBuilder clt = new StringBuilder();
|
StringBuilder clt = new StringBuilder();
|
||||||
newChangeLogToken = (from == null ? clt.append(maxItems.intValue() + 1).toString() : clt.append(from.longValue() + maxItems.intValue()).toString()); // TODO: Make this readable
|
newChangeLogToken = (from == null ? clt.append(maxItems.intValue() + 1).toString() : clt.append(from.longValue() + maxItems.intValue()).toString()); // TODO: Make this readable
|
||||||
// Remove extra item that was not actually requested
|
// Remove extra item that was not actually requested
|
||||||
result.getObjects().remove(result.getObjects().size() - 1).getId();
|
result.getObjects().remove(result.getObjects().size() - 1).getId();
|
||||||
// Note to client that there are more items
|
// Note to client that there are more items
|
||||||
result.setHasMoreItems(true);
|
result.setHasMoreItems(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We got the same or fewer than the number requested, so there are no more items
|
// We got the same or fewer than the number requested, so there are no more items
|
||||||
result.setHasMoreItems(false);
|
result.setHasMoreItems(false);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user