mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
59887: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 59643: Merged DEV to V4.2-BUG-FIX (4.2.2) 59235: MNT-10223 : CMIS: Created document has incorrect value on Properties tab Fixed the isLatestMajorVersion() implementation to return false if the version of the doc is minor. 59236: MNT-10223 : CMIS: Created document has incorrect value on Properties tab Added a test for the issue. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62205 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
*
|
*
|
||||||
* This file is part of Alfresco
|
* This file is part of Alfresco
|
||||||
*
|
*
|
||||||
@@ -592,7 +592,9 @@ public class CMISNodeInfoImpl implements CMISNodeInfo
|
|||||||
isLatestMajorVersion = Boolean.FALSE;
|
isLatestMajorVersion = Boolean.FALSE;
|
||||||
if (!isPWC())
|
if (!isPWC())
|
||||||
{
|
{
|
||||||
if(isCurrentNode())
|
// MNT-10223. It should not be a version and not a minor version
|
||||||
|
Version version = getVersion();
|
||||||
|
if (isCurrentNode() && version != null && version.getVersionType() == VersionType.MAJOR)
|
||||||
{
|
{
|
||||||
isLatestMajorVersion = Boolean.TRUE;
|
isLatestMajorVersion = Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 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;
|
package org.alfresco.opencmis;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -17,6 +36,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.cmis.CMISDictionaryModel;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
import org.alfresco.repo.action.evaluator.ComparePropertyValueEvaluator;
|
||||||
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
|
import org.alfresco.repo.action.executer.AddFeaturesActionExecuter;
|
||||||
@@ -1317,4 +1337,54 @@ public class CMISTest
|
|||||||
assertEquals(2, ol.getNumItems());
|
assertEquals(2, ol.getNumItems());
|
||||||
assertEquals("3", changeLogToken.getValue());
|
assertEquals("3", changeLogToken.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MNT-10223
|
||||||
|
* Check the IsLatestMajorVersion for a doc with minor version.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testIsLatestMajorVersion()
|
||||||
|
{
|
||||||
|
final TestContext testContext = new TestContext();
|
||||||
|
|
||||||
|
// create simple text plain content
|
||||||
|
final PropertiesImpl properties = new PropertiesImpl();
|
||||||
|
String objectTypeId = "cmis:document";
|
||||||
|
properties.addProperty(new PropertyIdImpl(PropertyIds.OBJECT_TYPE_ID, objectTypeId));
|
||||||
|
String fileName = "textFile" + GUID.generate();
|
||||||
|
properties.addProperty(new PropertyStringImpl(PropertyIds.NAME, fileName));
|
||||||
|
final ContentStreamImpl contentStream = new ContentStreamImpl(fileName, MimetypeMap.MIMETYPE_TEXT_PLAIN, "Simple text plain document");
|
||||||
|
|
||||||
|
withCmisService(new CmisServiceCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public String execute(CmisService cmisService) {
|
||||||
|
List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null);
|
||||||
|
assertTrue(repositories.size() > 0);
|
||||||
|
RepositoryInfo repo = repositories.get(0);
|
||||||
|
String repositoryId = repo.getId();
|
||||||
|
String objectId = cmisService.create(repositoryId, properties, repositoryHelper.getCompanyHome().getId(), contentStream, VersioningState.MINOR, null, null);
|
||||||
|
|
||||||
|
ObjectData cmidDoc = cmisService.getObject(repositoryId, objectId, null, true, IncludeRelationships.NONE, null, false, false, null);
|
||||||
|
List<PropertyData<?>> properties = cmidDoc.getProperties().getPropertyList();
|
||||||
|
boolean found = false;
|
||||||
|
PropertyData<?> propIsLatestMajorVersion = null;
|
||||||
|
for (PropertyData<?> property : properties)
|
||||||
|
{
|
||||||
|
if (property.getId().equals(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION))
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
propIsLatestMajorVersion = property;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//properties..contains(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION);
|
||||||
|
assertTrue("The CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION property was not found", found);
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
assertFalse("The CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION should be false as minor version was created", (Boolean) propIsLatestMajorVersion.getValues().get(0));
|
||||||
|
}
|
||||||
|
return objectId;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user