Merge from SEAMIST3

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10732 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2008-09-04 11:15:27 +00:00
parent fb231f88bc
commit 57c7de2df6
16 changed files with 627 additions and 29 deletions

View File

@@ -0,0 +1,94 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.cmis.rest;
import java.util.List;
import org.alfresco.cmis.property.CMISPropertyService;
import org.alfresco.repo.template.TemplateNode;
import freemarker.ext.beans.BeanModel;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;
import freemarker.template.TemplateScalarModel;
/**
* Custom FreeMarker Template language method.
* <p>
* Retrieve the CMIS property value for an Alfresco node
* <p>
* Usage: cmisproperty(TemplateNode node, String propertyName)
*
* @author davidc
*/
public final class CMISPropertyValueMethod implements TemplateMethodModelEx
{
private CMISPropertyService propertyService;
/**
* Construct
*/
public CMISPropertyValueMethod(CMISPropertyService propertyService)
{
this.propertyService = propertyService;
}
/**
* @see freemarker.template.TemplateMethodModel#exec(java.util.List)
*/
@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException
{
Object result = null;
if (args.size() == 2)
{
Object arg0 = args.get(0);
if (arg0 instanceof BeanModel)
{
// extract node
TemplateNode node = null;
Object wrapped = ((BeanModel)arg0).getWrappedObject();
if (wrapped != null && wrapped instanceof TemplateNode)
{
node = (TemplateNode)wrapped;
}
// extract property name
String propertyName = null;
Object arg1 = args.get(1);
if (arg1 instanceof TemplateScalarModel)
{
propertyName = ((TemplateScalarModel)arg1).getAsString();
}
// retrieve property value
result = propertyService.getProperty(node.getNodeRef(), propertyName);
}
}
return result;
}
}

View File

@@ -0,0 +1,137 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.cmis.rest;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.alfresco.util.Content;
import org.alfresco.web.scripts.FormatReader;
import org.alfresco.web.scripts.WebScriptException;
import org.alfresco.web.scripts.WebScriptRequest;
import org.alfresco.web.scripts.WebScriptResponse;
/**
* Convert application/cmisrequest+xml;type=query to class String.
*
* @author davidc
*/
public class CMISQueryReader implements FormatReader<String>
{
/* (non-Javadoc)
* @see org.alfresco.web.scripts.FormatReader#getDestinationClass()
*/
public Class<String> getDestinationClass()
{
return String.class;
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.FormatReader#getSourceMimetype()
*/
public String getSourceMimetype()
{
return "application/cmisrequest+xml;type=query";
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.FormatReader#read(org.alfresco.web.scripts.WebScriptRequest)
*/
public String read(WebScriptRequest req)
{
Content content = req.getContent();
if (content == null)
{
throw new WebScriptException("Failed to convert request to String");
}
try
{
InputStreamReader reader;
if (content.getEncoding() != null)
{
reader = new InputStreamReader(content.getInputStream(), content.getEncoding());
}
else
{
reader = new InputStreamReader(content.getInputStream());
}
StringWriter writer = new StringWriter();
try
{
char[] buffer = new char[4096];
int bytesRead = -1;
while ((bytesRead = reader.read(buffer)) != -1)
{
writer.write(buffer, 0, bytesRead);
}
writer.flush();
return writer.toString();
}
finally
{
reader.close();
writer.close();
}
}
catch(UnsupportedEncodingException e)
{
throw new WebScriptException(HttpServletResponse.SC_BAD_REQUEST, "Failed to convert Query statement", e);
}
catch(IOException e)
{
throw new WebScriptException("Failed to convert Query statement", e);
}
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.FormatReader#createScriptParameters(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
*/
public Map<String, Object> createScriptParameters(WebScriptRequest req, WebScriptResponse res)
{
Map<String, Object> params = new HashMap<String, Object>();
params.put("query", req.parseContent());
return params;
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.FormatReader#createTemplateParameters(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
*/
public Map<String, Object> createTemplateParameters(WebScriptRequest req, WebScriptResponse res)
{
Map<String, Object> params = new HashMap<String, Object>();
params.put("query", req.parseContent());
return params;
}
}

View File

@@ -32,6 +32,9 @@ import org.alfresco.cmis.CMISService.TypesFilter;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.cmis.search.CMISQueryService;
import org.alfresco.cmis.search.FullTextSearchSupport;
import org.alfresco.cmis.search.JoinSupport;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
import org.alfresco.repo.jscript.ScriptNode;
@@ -51,12 +54,13 @@ import org.alfresco.service.cmr.repository.NodeRef;
*/
public class CMISScript extends BaseScopableProcessorExtension
{
private static final TypesFilter defaultTypesFilter = TypesFilter.FoldersAndDocuments;
private static final TypesFilter defaultTypesFilter = TypesFilter.Any;
private ServiceRegistry services;
private Repository repository;
private CMISService cmisService;
private CMISDictionaryService cmisDictionaryService;
private CMISQueryService cmisQueryService;
private Paging paging;
@@ -110,6 +114,16 @@ public class CMISScript extends BaseScopableProcessorExtension
this.cmisDictionaryService = cmisDictionaryService;
}
/**
* Set the CMIS Query Service
*
* @param cmisQueryService
*/
public void setCMISQueryService(CMISQueryService cmisQueryService)
{
this.cmisQueryService = cmisQueryService;
}
/**
* Gets the supported CMIS Version
*
@@ -367,7 +381,43 @@ public class CMISScript extends BaseScopableProcessorExtension
return null;
}
}
//
// SQL Query
//
/**
* Can you query non-latest versions of a document.
*
* The current latest version is always searchable according to the type definition.
*
* @return
*/
public boolean getAllVersionsSearchable()
{
return cmisQueryService.getAllVersionsSearchable();
}
/**
* Get the join support level in queries.
*
* @return
*/
public JoinSupport getJoinSupport()
{
return cmisQueryService.getJoinSupport();
}
/**
* Get the full text search support level in queries.
*
* @return
*/
public FullTextSearchSupport getFullTextSearchSupport()
{
return cmisQueryService.getFullTextSearchSupport();
}
/**
* Resolve to a Types Filter
*

View File

@@ -146,7 +146,13 @@ public class CMISTest extends BaseCMISWebScriptTest
private Entry createFolder(IRI parent, String name)
throws Exception
{
String createFolder = loadString("/cmis/rest/createfolder.atomentry.xml");
return createFolder(parent, name, "/cmis/rest/createfolder.atomentry.xml");
}
private Entry createFolder(IRI parent, String name, String atomEntryFile)
throws Exception
{
String createFolder = loadString(atomEntryFile);
createFolder = createFolder.replace("${NAME}", name);
Response res = sendRequest(new PostRequest(parent.toString(), createFolder, Format.ATOMENTRY.mimetype()), 201, getAtomValidator());
assertNotNull(res);
@@ -165,7 +171,13 @@ public class CMISTest extends BaseCMISWebScriptTest
private Entry createDocument(IRI parent, String name)
throws Exception
{
String createFile = loadString("/cmis/rest/createdocument.atomentry.xml");
return createDocument(parent, name, "/cmis/rest/createdocument.atomentry.xml");
}
private Entry createDocument(IRI parent, String name, String atomEntryFile)
throws Exception
{
String createFile = loadString(atomEntryFile);
name = name + " " + System.currentTimeMillis();
createFile = createFile.replace("${NAME}", name);
Response res = sendRequest(new PostRequest(parent.toString(), createFile, Format.ATOMENTRY.mimetype()), 201, getAtomValidator());
@@ -272,6 +284,30 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(children);
int entriesBefore = children.getEntries().size();
Entry document = createDocument(children.getSelfLink().getHref(), "testCreateDocument");
Response documentContentRes = sendRequest(new GetRequest(document.getContentSrc().toString()), 200);
String resContent = documentContentRes.getContentAsString();
assertEquals("test content " + document.getTitle(), resContent);
Feed feedFolderAfter = getFeed(childrenLink.getHref());
int entriesAfter = feedFolderAfter.getEntries().size();
assertEquals(entriesBefore +1, entriesAfter);
Entry entry = feedFolderAfter.getEntry(document.getId().toString());
assertNotNull(entry);
}
public void testCreateDocumentBase64()
throws Exception
{
Entry testFolder = createTestFolder("testCreateDocumentBase64");
Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN);
assertNotNull(childrenLink);
Feed children = getFeed(childrenLink.getHref());
assertNotNull(children);
int entriesBefore = children.getEntries().size();
Entry document = createDocument(children.getSelfLink().getHref(), "testCreateDocument", "/cmis/rest/createdocumentBase64.atomentry.xml");
Response documentContentRes = sendRequest(new GetRequest(document.getContentSrc().toString()), 200);
String testContent = loadString("/cmis/rest/createdocumentBase64.txt");
String resContent = documentContentRes.getContentAsString();
assertEquals(testContent, resContent);
Feed feedFolderAfter = getFeed(childrenLink.getHref());
int entriesAfter = feedFolderAfter.getEntries().size();
assertEquals(entriesBefore +1, entriesAfter);
@@ -396,6 +432,50 @@ public class CMISTest extends BaseCMISWebScriptTest
assertEquals(4, nextCount);
assertEquals(0, docIds.size());
}
public void testGetChildrenTypeFilter()
throws Exception
{
// create multiple children
Entry testFolder = createTestFolder("testChildrenTypeFilter");
Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN);
assertNotNull(childrenLink);
Entry document = createDocument(childrenLink.getHref(), "testChildren1");
assertNotNull(document);
Entry folder = createFolder(childrenLink.getHref(), "testChildren2");
assertNotNull(folder);
// invalid type filter
Map<String, String> args = new HashMap<String, String>();
args.put("types", "Invalid");
Response invalidRes = sendRequest(new GetRequest(childrenLink.getHref().toString()).setArgs(args), 400);
assertNotNull(invalidRes);
// no filter
Feed noFilters = getFeed(childrenLink.getHref());
assertNotNull(noFilters);
assertEquals(2, noFilters.getEntries().size());
// any filter
args.put("types", "Any");
Feed any = getFeed(childrenLink.getHref(), args);
assertNotNull(any);
assertEquals(2, any.getEntries().size());
// folders filter
args.put("types", "Folders");
Feed folders = getFeed(childrenLink.getHref(), args);
assertNotNull(folders);
assertEquals(1, folders.getEntries().size());
assertNotNull(folders.getEntry(folder.getId().toString()));
// documents filter
args.put("types", "Documents");
Feed documents = getFeed(childrenLink.getHref(), args);
assertNotNull(documents);
assertEquals(1, documents.getEntries().size());
assertNotNull(documents.getEntry(document.getId().toString()));
}
public void testGetParent()
throws Exception
@@ -405,7 +485,7 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(childrenLink);
Entry childFolder = createFolder(childrenLink.getHref(), "testParentChild");
assertNotNull(childFolder);
Link parentLink = childFolder.getLink(CMISConstants.REL_PARENT);
Link parentLink = childFolder.getLink(CMISConstants.REL_FOLDERPARENT);
assertNotNull(parentLink);
// ensure there is parent 'testParent'
@@ -421,10 +501,14 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(parentsToRoot);
assertEquals(4, parentsToRoot.getEntries().size());
assertEquals(testFolder.getId(), parentsToRoot.getEntries().get(0).getId());
assertNotNull(parentsToRoot.getEntries().get(0).getLink(CMISConstants.REL_PARENT));
assertEquals(testRunFolder.getId(), parentsToRoot.getEntries().get(1).getId());
assertNotNull(parentsToRoot.getEntries().get(1).getLink(CMISConstants.REL_PARENT));
assertEquals(testsFolder.getId(), parentsToRoot.getEntries().get(2).getId());
assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT));
Feed root = getFeed(getRootCollection(getRepository()));
assertEquals(root.getId(), parentsToRoot.getEntries().get(3).getId());
assertNull(parentsToRoot.getEntries().get(3).getLink(CMISConstants.REL_PARENT));
}
public void testGetParents()
@@ -451,10 +535,14 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(parentsToRoot);
assertEquals(4, parentsToRoot.getEntries().size());
assertEquals(testFolder.getId(), parentsToRoot.getEntries().get(0).getId());
assertNotNull(parentsToRoot.getEntries().get(0).getLink(CMISConstants.REL_PARENT));
assertEquals(testRunFolder.getId(), parentsToRoot.getEntries().get(1).getId());
assertNotNull(parentsToRoot.getEntries().get(1).getLink(CMISConstants.REL_PARENT));
assertEquals(testsFolder.getId(), parentsToRoot.getEntries().get(2).getId());
assertNotNull(parentsToRoot.getEntries().get(2).getLink(CMISConstants.REL_PARENT));
Feed root = getFeed(getRootCollection(getRepository()));
assertEquals(root.getId(), parentsToRoot.getEntries().get(3).getId());
assertNull(parentsToRoot.getEntries().get(3).getLink(CMISConstants.REL_PARENT));
}
public void testDelete()
@@ -546,6 +634,7 @@ public class CMISTest extends BaseCMISWebScriptTest
// create document for checkout
Entry document = createDocument(childrenLink.getHref(), "testCheckout");
CMISProperties docProps = document.getExtension(CMISConstants.PROPERTIES);
Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator());
assertNotNull(documentRes);
String documentXML = documentRes.getContentAsString();
@@ -555,7 +644,16 @@ public class CMISTest extends BaseCMISWebScriptTest
IRI checkedoutHREF = getCheckedOutCollection(getRepository());
Response pwcRes = sendRequest(new PostRequest(checkedoutHREF.toString(), documentXML, Format.ATOMENTRY.mimetype()), 201, getAtomValidator());
assertNotNull(pwcRes);
// TODO: test private working copy properties
String pwcXml = pwcRes.getContentAsString();
assertNotNull(pwcXml);
Entry pwc = abdera.parseEntry(new StringReader(pwcXml), null);
assertNotNull(pwc);
CMISProperties pwcProps = pwc.getExtension(CMISConstants.PROPERTIES);
assertNotNull(pwcProps);
assertTrue(pwcProps.isVersionSeriesCheckedOut());
assertEquals(docProps.getObjectId(), pwcProps.getVersionSeriesId());
assertEquals(pwcProps.getObjectId(), pwcProps.getVersionSeriesCheckedOutId());
assertNotNull(pwcProps.getVersionSeriesCheckedOutBy());
// test getCheckedOut is updated
CMISProperties props = testFolder.getExtension(CMISConstants.PROPERTIES);
@@ -642,6 +740,16 @@ public class CMISTest extends BaseCMISWebScriptTest
assertNotNull(checkedout);
assertEquals(1, checkedout.getEntries().size());
// test version properties of checked-out item
// test checked-in version properties
Entry checkedoutdoc = getEntry(document.getSelfLink().getHref());
CMISProperties checkedoutdocProps = checkedoutdoc.getExtension(CMISConstants.PROPERTIES);
assertNotNull(checkedoutdocProps);
assertTrue(checkedoutdocProps.isVersionSeriesCheckedOut());
assertEquals(checkedoutdocProps.getObjectId(), checkedoutdocProps.getVersionSeriesId());
assertNotNull(checkedoutdocProps.getVersionSeriesCheckedOutId());
assertNotNull(checkedoutdocProps.getVersionSeriesCheckedOutBy());
// test update of private working copy
String updateFile = loadString("/cmis/rest/updatedocument.atomentry.xml");
String guid = GUID.generate();
@@ -683,6 +791,15 @@ public class CMISTest extends BaseCMISWebScriptTest
assertEquals("text/plain", updatedDoc.getContentMimeType().toString());
Response updatedContentRes = sendRequest(new GetRequest(updatedDoc.getContentSrc().toString()), 200);
assertEquals("updated content " + guid, updatedContentRes.getContentAsString());
// test checked-in version properties
CMISProperties updatedProps = updatedDoc.getExtension(CMISConstants.PROPERTIES);
assertNotNull(updatedProps);
assertFalse(updatedProps.isVersionSeriesCheckedOut());
assertEquals(updatedProps.getObjectId(), updatedProps.getVersionSeriesId());
assertEquals("", updatedProps.getVersionSeriesCheckedOutId());
assertEquals("", updatedProps.getVersionSeriesCheckedOutBy());
assertEquals(guid, updatedProps.getCheckinComment());
}
public void testUpdateOnCheckIn()
@@ -846,6 +963,38 @@ public class CMISTest extends BaseCMISWebScriptTest
};
}
public void testGetTypeDefinition()
throws Exception
{
// retrieve test folder for checkins
Entry testFolder = createTestFolder("testGetEntryTypeDefinition");
Link childrenLink = testFolder.getLink(CMISConstants.REL_CHILDREN);
// create document
Entry document = createDocument(childrenLink.getHref(), "testGetEntryTypeDefinitionDoc");
Response documentRes = sendRequest(new GetRequest(document.getSelfLink().getHref().toString()), 200, getAtomValidator());
assertNotNull(documentRes);
// create folder
Entry folder = createFolder(childrenLink.getHref(), "testGetEntryTypeDefinitionFolder");
Response folderRes = sendRequest(new GetRequest(folder.getSelfLink().getHref().toString()), 200, getAtomValidator());
assertNotNull(folderRes);
// retrieve children
Feed children = getFeed(childrenLink.getHref());
for (Entry entry : children.getEntries())
{
// get type definition
Link typeLink = entry.getLink(CMISConstants.REL_TYPE);
assertNotNull(typeLink);
// TODO: spec issue 40 - use getEntry when wrapped as entry
Response type = sendRequest(new GetRequest(typeLink.getHref().toString()), 200, getAtomValidator());
//Entry type = getEntry(typeLink.getHref());
assertNotNull(type);
// TODO: test correct type for entry & properties of type
}
}
// public void testUnfiled()
// {
// }

View File

@@ -28,7 +28,6 @@ import java.util.List;
import org.alfresco.cmis.dictionary.CMISMapping;
import org.alfresco.cmis.dictionary.CMISTypeId;
import org.alfresco.repo.jscript.ScriptNode;
import org.alfresco.repo.template.TemplateNode;
import org.alfresco.service.namespace.QName;
@@ -41,8 +40,8 @@ import freemarker.template.TemplateModelException;
* <p>
* Retrieve the CMIS Type Id for an Alfresco node
* <p>
* Usage: cmisTypeId(ScriptNode node)
* cmisTypeId(QName nodeType)
* Usage: cmistypeid(TemplaateNode node)
* cmistypeid(QName nodeType)
*
* @author davidc
*/
@@ -61,6 +60,7 @@ public final class CMISTypeIdMethod implements TemplateMethodModelEx
/**
* @see freemarker.template.TemplateMethodModel#exec(java.util.List)
*/
@SuppressWarnings("unchecked")
public Object exec(List args) throws TemplateModelException
{
CMISTypeId result = null;

View File

@@ -141,6 +141,7 @@ public abstract class BaseWebScriptTest extends TestCase
if (logger.isDebugEnabled())
{
logger.debug("Request");
logger.debug(req.getMethod() + " " + req.getFullUri());
logger.debug(req.getBody() == null ? null : new String(req.getBody()));
}

View File

@@ -47,15 +47,29 @@ public interface CMISConstants
public static final QName PROPERTIES = new QName(CMIS_200805_NS, "properties");
public static final QName PROPERTY_STRING = new QName(CMIS_200805_NS, "propertyString");
public static final QName PROPERTY_ID = new QName(CMIS_200805_NS, "propertyID");
public static final QName PROPERTY_BOOLEAN = new QName(CMIS_200805_NS, "propertyBoolean");
public static final QName PROPERTY_NAME = new QName(CMIS_200805_NS, "name");
// CMIS Properties
public static final String PROP_OBJECTID = "objectId";
public static final String PROP_OBJECT_ID = "objectId";
public static final String PROP_BASETYPE = "baseType";
public static final String PROP_IS_IMMUTABLE = "isImmutable";
public static final String PROP_IS_LATEST_VERSION = "isLatestVersion";
public static final String PROP_IS_MAJOR_VERSION = "isMajorVersion";
public static final String PROP_IS_LATEST_MAJOR_VERSION = "isLatestMajorVersion";
public static final String PROP_VERSION_LABEL = "versionLabel";
public static final String PROP_VERSION_SERIES_ID = "versionSeriesID";
public static final String PROP_VERSION_SERIES_IS_CHECKED_OUT = "isVersionSeriesCheckedOut";
public static final String PROP_VERSION_SERIES_CHECKED_OUT_BY = "versionSeriesCheckedOutBy";
public static final String PROP_VERSION_SERIES_CHECKED_OUT_ID = "versionSeriesCheckedOutID";
public static final String PROP_CHECKIN_COMMENT = "checkinComment";
// CMIS Relationships
public static final String REL_CHILDREN = "cmis-children";
public static final String REL_PARENT = "cmis-parent";
public static final String REL_FOLDERPARENT = "cmis-folderparent";
public static final String REL_PARENTS = "cmis-parents";
public static final String REL_ALLVERSIONS = "cmis-allversions";
public static final String REL_TYPE = "cmis-type";
}

View File

@@ -55,7 +55,7 @@ public class CMISProperties extends ElementWrapper
public String getObjectId()
{
return findPropertyID(CMISConstants.PROP_OBJECTID);
return findPropertyID(CMISConstants.PROP_OBJECT_ID);
}
public String getBaseType()
@@ -63,6 +63,57 @@ public class CMISProperties extends ElementWrapper
return findPropertyString(CMISConstants.PROP_BASETYPE);
}
public boolean isImmutable()
{
return findPropertyBoolean(CMISConstants.PROP_IS_IMMUTABLE);
}
public boolean isLatestVersion()
{
return findPropertyBoolean(CMISConstants.PROP_IS_LATEST_VERSION);
}
public boolean isMajorVersion()
{
return findPropertyBoolean(CMISConstants.PROP_IS_MAJOR_VERSION);
}
public boolean isLatestMajorVersion()
{
return findPropertyBoolean(CMISConstants.PROP_IS_LATEST_MAJOR_VERSION);
}
public String getVersionLabel()
{
return findPropertyString(CMISConstants.PROP_VERSION_LABEL);
}
public String getVersionSeriesId()
{
return findPropertyID(CMISConstants.PROP_VERSION_SERIES_ID);
}
public boolean isVersionSeriesCheckedOut()
{
return findPropertyBoolean(CMISConstants.PROP_VERSION_SERIES_IS_CHECKED_OUT);
}
public String getVersionSeriesCheckedOutBy()
{
return findPropertyString(CMISConstants.PROP_VERSION_SERIES_CHECKED_OUT_BY);
}
public String getVersionSeriesCheckedOutId()
{
return findPropertyID(CMISConstants.PROP_VERSION_SERIES_CHECKED_OUT_ID);
}
public String getCheckinComment()
{
return findPropertyString(CMISConstants.PROP_CHECKIN_COMMENT);
}
private String findPropertyString(String name)
{
Element child = getFirstChild(CMISConstants.PROPERTY_STRING);
@@ -91,4 +142,19 @@ public class CMISProperties extends ElementWrapper
return null;
}
private boolean findPropertyBoolean(String name)
{
Element child = getFirstChild(CMISConstants.PROPERTY_BOOLEAN);
while(child != null)
{
if (name.equals(child.getAttributeValue(CMISConstants.PROPERTY_NAME)))
{
return Boolean.valueOf(child.getText());
}
child = child.getNextSibling(CMISConstants.PROPERTY_BOOLEAN);
}
return false;
}
}