alfresco-community-repo/source/java/org/alfresco/cmis/mapping/AbstractVersioningProperty.java
Dave Ward 6155c6ec15 Merged V4.0-BUG-FIX to HEAD
37067: ALF-13294	CIFS: When versionable aspect is active, using the Microsoft Word for Mac 2008 option "always create a backup copy" leads to document versions loss
   37073: ALF-14319 Add a unit test for using the real remote credentials shared container (most use a test one to avoid issues/clashing), and tweak the qname to match other similar ones
   37074: Merged V3.4-BUG-FIX to V4.0-BUG_FIX
      36881: Merged DEV to V3.4-BUG-FIX
         36759: Fix to Checkin failing to distinguish between 'null' and 'unset' properties
         - Some minor ammendments to unit test as well
      36898: Merge HEAD to V3.4-BUG-FIX:
         33668: ALF-12541 / ALF-14254: AMP files need to be able to be pinned to specific "edition(s)" of Alfresco. It is now possible to specify a module.editions property (eg. community) which is checked by the MMT. Also, the version is checked on install. Also, started refactoring some of the code for better reuse.
         33793: ALF-12541 / ALF-14254: Better fix for ALF-12541 - AMP files need to be able to be pinned to specific "edition(s)" of Alfresco Share doesn't have a version.properties file so I need to cater for that scenario. I didn't want to create the LogOutput interface but its a stop-gap until the MMT gets re-worked.
         33695: ALF-12531 / ALF-14255: MMT needs to properly support upgrading of AMP files
         33725: ALF-12532 / ALF-14256: MMT should fail with an error if the target war file doesn't exist
         33735: ALF-12533 / ALF-14257: When run with -directory, MMT should only backup the alfresco.war file once
         33781: ALF-12540 / ALF-14258: AMP - file-mapping.properties: white space at end of line is significant
         33880: ALF-12777 / ALF-14259: MMT should not install AMPs which override pre-existing files in the war file, unless -force is provided. The MMT is moving toward more of a validation phase (checks things, calculate changes) then an execution phase (makes the changes).
         33707: ALF-12541 / ALF-14254: Fix for failing unit tests
      37030: ALF-12511 Allow debugging of the authentication chain at a high level
         - enable with log4j.loggerorg.alfresco.repo.security.authentication.AbstractChainingAuthenticationService=debug
      37066: Merged DEV to V3.4-BUG-FIX (3.4.10)
         37063: ALF-11956: WCM accessibility
            New Tab focus plugin is added for TinyMCE:
            - plugin covers the RTE changes special for 'XForms';
            - configuration for custom appearance has been set in 'web-client-config-wcm.xml'
      37069: ALF-13379: READ_ONLY_LOCK prevents access via deprecated CMIS API
      - Fix by Alex Bykov
   37075: Fix for ALF-14267 SOLR index check - First transaction time used instead of first ACL time - indexCheck, checkInitialState
   37076: Merged V3.4-BUG-FIX to V4.0-BUG-FIX (RECORD ONLY)
      36942: ALF-12081: Cancel Editing button should only be shown for documents that are checked out for offline editing.
      36957: ALF-12081: Reverse-merging r36942 pending UI team review


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37079 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2012-05-28 11:33:15 +00:00

79 lines
3.0 KiB
Java

/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.cmis.mapping;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.version.VersionBaseModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.lock.LockType;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
/**
* Base class for versioning property accessors.
*
* @author dward
*
*/
public abstract class AbstractVersioningProperty extends AbstractProperty
{
/**
* Construct
*/
protected AbstractVersioningProperty(ServiceRegistry serviceRegistry, String propertyName)
{
super(serviceRegistry, propertyName);
}
public NodeRef getVersionSeries(NodeRef nodeRef)
{
if (nodeRef.getStoreRef().getProtocol().equals(VersionBaseModel.STORE_PROTOCOL))
{
// Due to the remapping done for us by the versioned node services, we can simply look up the properties
// containing the component parts of the node ref to map back to the original node
Map<QName, Serializable> properties = getServiceRegistry().getNodeService().getProperties(nodeRef);
nodeRef = new NodeRef((String) properties.get(ContentModel.PROP_STORE_PROTOCOL),
(String) properties.get(ContentModel.PROP_STORE_IDENTIFIER), (String) properties
.get(ContentModel.PROP_NODE_UUID));
}
else if (isWorkingCopy(nodeRef))
{
NodeRef originalNodeRef = getServiceRegistry().getCopyService().getOriginal(nodeRef);
nodeRef = originalNodeRef == null ? nodeRef : originalNodeRef;
}
return nodeRef;
}
public boolean isWorkingCopy(NodeRef nodeRef)
{
return getServiceRegistry().getCheckOutCheckInService().isWorkingCopy(nodeRef);
}
public boolean hasWorkingCopy(NodeRef nodeRef)
{
final ServiceRegistry serviceRegistry = getServiceRegistry();
return serviceRegistry.getLockService().getLockType(nodeRef) == LockType.READ_ONLY_LOCK
&& serviceRegistry.getCheckOutCheckInService().getWorkingCopy(nodeRef) != null;
}
}