Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

80865: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud)
      80840: MNT-11223 : Upgrade OpenCMIS library to 0.11.0 on 4.2 code line
      Fix for CMISTCKCRUD test. Added special handling of content stream file name property via accessor.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@83121 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Will Abson
2014-09-03 18:06:43 +00:00
parent aeff570cd3
commit 0bb93f7aa5
2 changed files with 57 additions and 2 deletions

View File

@@ -0,0 +1,56 @@
/*
* Copyright (C) 2005-2014 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.opencmis.mapping;
import java.io.Serializable;
import org.alfresco.model.ContentModel;
import org.alfresco.opencmis.CMISConnector;
import org.alfresco.opencmis.dictionary.CMISNodeInfo;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.ContentData;
import org.apache.chemistry.opencmis.commons.PropertyIds;
/**
* Accessor for CMIS content stream filename property
*
* @author alex.mukha
* @since 4.2.4
*/
public class ContentStreamFileNameProperty extends DirectProperty
{
public ContentStreamFileNameProperty(ServiceRegistry serviceRegistry, CMISConnector connector)
{
super(serviceRegistry, connector, PropertyIds.CONTENT_STREAM_FILE_NAME, ContentModel.PROP_NAME);
}
@Override
public Serializable getValueInternal(CMISNodeInfo nodeInfo)
{
ContentData contentData = getContentData(nodeInfo);
if (contentData != null && contentData.getSize() > 0)
{
return super.getValueInternal(nodeInfo);
}
else
{
return null;
}
}
}

View File

@@ -134,8 +134,7 @@ public class RuntimePropertyAccessorMapping implements PropertyAccessorMapping,
registerPropertyAccessor(new ContentStreamLengthProperty(serviceRegistry, cmisConnector));
registerPropertyAccessor(new ContentStreamMimetypeProperty(serviceRegistry, cmisConnector));
registerPropertyAccessor(new ContentStreamIdProperty(serviceRegistry, cmisConnector));
registerPropertyAccessor(new DirectProperty(serviceRegistry, cmisConnector,
PropertyIds.CONTENT_STREAM_FILE_NAME, ContentModel.PROP_NAME));
registerPropertyAccessor(new ContentStreamFileNameProperty(serviceRegistry, cmisConnector));
registerPropertyAccessor(new ParentProperty(serviceRegistry, cmisConnector));
registerPropertyAccessor(new PathProperty(serviceRegistry, cmisConnector));
registerPropertyAccessor(new AllowedChildObjectTypeIdsProperty(serviceRegistry, cmisConnector, cmisMapping));