mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fill out CMIS Web Service query result set:
- result set driven from select columns (not fixed set of doc/folder props) - support for multi-valued properties (to v0.5 spec, will have to change for v0.6) To support AIIM demo. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13728 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
<cmis:terminator/>
|
||||
<app:edited>${xmldate(node.properties.modified)}</app:edited>
|
||||
<alf:icon>${absurl(url.context)}${node.icon16}</alf:icon>
|
||||
<alf:noderef>${node.nodeRef}</alf:noderef>
|
||||
[/@entry]
|
||||
[/#macro]
|
||||
|
||||
@@ -83,6 +84,7 @@
|
||||
<cmis:terminator/>
|
||||
<app:edited>${xmldate(node.properties.modified)}</app:edited>
|
||||
<alf:icon>${absurl(url.context)}${node.icon16}</alf:icon>
|
||||
<alf:noderef>${node.nodeRef}</alf:noderef>
|
||||
[/@entry]
|
||||
[/#macro]
|
||||
|
||||
@@ -112,6 +114,7 @@
|
||||
<app:edited>${xmldate(node.properties.modified)}</app:edited>
|
||||
[#-- TODO: the edit link refers to the updatable node resource, allowing updates on PWCs without checkin --]
|
||||
<alf:icon>${absurl(url.context)}${node.icon16}</alf:icon>
|
||||
<alf:noderef>${node.nodeRef}</alf:noderef>
|
||||
[/@entry]
|
||||
[/#macro]
|
||||
|
||||
@@ -149,6 +152,7 @@
|
||||
<cmis:terminator/>
|
||||
<app:edited>${xmldate(node.properties.modified)}</app:edited>
|
||||
<alf:icon>${absurl(url.context)}${node.icon16}</alf:icon>
|
||||
<alf:noderef>${node.nodeRef}</alf:noderef>
|
||||
[/@entry]
|
||||
[/#macro]
|
||||
|
||||
@@ -224,6 +228,7 @@
|
||||
</cmis:object>
|
||||
<cmis:terminator/>
|
||||
<alf:icon>${absurl(url.context)}${node.icon16}</alf:icon>
|
||||
<alf:noderef>${node.nodeRef}</alf:noderef>
|
||||
[/@entry]
|
||||
[/#macro]
|
||||
|
||||
|
@@ -34,6 +34,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.validation.Validator;
|
||||
@@ -43,6 +44,7 @@ import junit.framework.Test;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.cmis.rest.xsd.CMISValidator;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.util.Base64;
|
||||
import org.alfresco.web.scripts.Format;
|
||||
import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
|
||||
@@ -58,6 +60,7 @@ import org.apache.abdera.ext.cmis.CMISObject;
|
||||
import org.apache.abdera.ext.cmis.CMISRepositoryInfo;
|
||||
import org.apache.abdera.i18n.iri.IRI;
|
||||
import org.apache.abdera.model.Collection;
|
||||
import org.apache.abdera.model.Element;
|
||||
import org.apache.abdera.model.Entry;
|
||||
import org.apache.abdera.model.Feed;
|
||||
import org.apache.abdera.model.Link;
|
||||
@@ -614,4 +617,19 @@ public class BaseCMISWebScriptTest extends BaseWebScriptTest
|
||||
return testFolder;
|
||||
}
|
||||
|
||||
//
|
||||
// Alfresco specific helpers
|
||||
//
|
||||
|
||||
protected NodeRef getNodeRef(Entry entry)
|
||||
{
|
||||
NodeRef nodeRef = null;
|
||||
Element element = entry.getFirstChild(new QName("http://www.alfresco.org", "noderef"));
|
||||
if (element != null)
|
||||
{
|
||||
nodeRef = new NodeRef(element.getText());
|
||||
}
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,21 @@
|
||||
*/
|
||||
package org.alfresco.repo.cmis.rest.test;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.scripts.TestWebScriptServer.GetRequest;
|
||||
import org.apache.abdera.i18n.iri.IRI;
|
||||
import org.apache.abdera.model.Entry;
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,14 +46,17 @@ package org.alfresco.repo.cmis.rest.test;
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class CMISCustomTypeTest extends CMISTest
|
||||
public class CMISCustomTypeTest extends BaseCMISWebScriptTest
|
||||
{
|
||||
private static String TEST_NAMESPACE = "http://www.alfresco.org/model/aiim";
|
||||
|
||||
|
||||
@Override
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
// Uncomment to change default behaviour of tests
|
||||
setCustomContext("classpath:cmis/cmis-test-context.xml");
|
||||
setDefaultRunAs("admin");
|
||||
// RemoteServer server = new RemoteServer();
|
||||
// server.username = "admin";
|
||||
@@ -49,7 +67,59 @@ public class CMISCustomTypeTest extends CMISTest
|
||||
// setListener(new CMISTestListener(System.out));
|
||||
// setTraceReqRes(true);
|
||||
|
||||
|
||||
// initServer("classpath:wcm/wcm-jbpm-context.xml");
|
||||
//
|
||||
// this.authenticationService = (AuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
|
||||
// this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
|
||||
// this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
|
||||
//
|
||||
// this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
//
|
||||
// // Create users
|
||||
// createUser(USER_ONE);
|
||||
// createUser(USER_TWO);
|
||||
// createUser(USER_THREE);
|
||||
// createUser(USER_FOUR);
|
||||
//
|
||||
// // Do tests as user one
|
||||
// this.authenticationComponent.setCurrentUser(USER_ONE);
|
||||
//
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void testX()
|
||||
throws Exception
|
||||
{
|
||||
IRI rootHREF = getRootChildrenCollection(getWorkspace(getRepository()));
|
||||
sendRequest(new GetRequest(rootHREF.toString()), 200, getAtomValidator());
|
||||
}
|
||||
|
||||
|
||||
public void testCreateSubType()
|
||||
throws Exception
|
||||
{
|
||||
final Entry testFolder = createTestFolder("testCreateSubType");
|
||||
final NodeRef testFolderRef = getNodeRef(testFolder);
|
||||
|
||||
// create node
|
||||
// TODO: For now create item via Alfresco foundation APIs
|
||||
// When multi-valued props supported, move to pure CMIS Create
|
||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||
{
|
||||
@SuppressWarnings("synthetic-access")
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
FileFolderService fileFolderService = (FileFolderService)getServer().getApplicationContext().getBean("FileFolderService");
|
||||
NodeService nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService");
|
||||
FileInfo file = fileFolderService.create(testFolderRef, "createSubType", QName.createQName(TEST_NAMESPACE, "content"));
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
|
||||
props.put(QName.createQName(TEST_NAMESPACE, "Title"), "createSubTypeTitle");
|
||||
props.put(QName.createQName(TEST_NAMESPACE, "Authors"), (Serializable)Arrays.asList(new String[] { "Dave", "Fred" }));
|
||||
nodeService.addProperties(file.getNodeRef(), props);
|
||||
return null;
|
||||
}
|
||||
}, getDefaultRunAs());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@
|
||||
package org.alfresco.repo.cmis.rest.test;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* CMIS API Test Harness
|
||||
*
|
||||
|
@@ -25,7 +25,9 @@
|
||||
package org.alfresco.repo.cmis.ws;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
@@ -358,10 +360,24 @@ public class DMAbstractServicePort
|
||||
return result;
|
||||
}
|
||||
|
||||
private void addBooleanProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
protected void addBooleanProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
{
|
||||
Serializable value = alfrescoProperties.get(name);
|
||||
if (filter.allow(name) && value != null)
|
||||
{
|
||||
if (value instanceof Collection)
|
||||
{
|
||||
long index = 0;
|
||||
for (Object multiValue : (Collection)value)
|
||||
{
|
||||
CmisPropertyBoolean propBoolean = new CmisPropertyBoolean ();
|
||||
propBoolean.setIndex(BigInteger.valueOf(index++));
|
||||
propBoolean.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
propBoolean.setValue((Boolean) multiValue);
|
||||
properties.getProperty().add(propBoolean);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmisPropertyBoolean propBoolean = new CmisPropertyBoolean ();
|
||||
propBoolean.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
@@ -369,11 +385,26 @@ public class DMAbstractServicePort
|
||||
properties.getProperty().add(propBoolean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addDateTimeProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
protected void addDateTimeProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
{
|
||||
Serializable value = alfrescoProperties.get(name);
|
||||
if (filter.allow(name) && value != null)
|
||||
{
|
||||
if (value instanceof Collection)
|
||||
{
|
||||
long index = 0;
|
||||
for (Object multiValue : (Collection)value)
|
||||
{
|
||||
CmisPropertyDateTime propDateTime = new CmisPropertyDateTime();
|
||||
propDateTime.setIndex(BigInteger.valueOf(index++));
|
||||
propDateTime.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
propDateTime.setValue(convert((Date) multiValue));
|
||||
properties.getProperty().add(propDateTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmisPropertyDateTime propDateTime = new CmisPropertyDateTime();
|
||||
propDateTime.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
@@ -381,11 +412,26 @@ public class DMAbstractServicePort
|
||||
properties.getProperty().add(propDateTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addIDProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
protected void addIDProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
{
|
||||
Serializable value = alfrescoProperties.get(name);
|
||||
if (filter.allow(name) && value != null)
|
||||
{
|
||||
if (value instanceof Collection)
|
||||
{
|
||||
long index = 0;
|
||||
for (Object multiValue : (Collection)value)
|
||||
{
|
||||
CmisPropertyId propID = new CmisPropertyId();
|
||||
propID.setIndex(BigInteger.valueOf(index++));
|
||||
propID.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
propID.setValue(multiValue.toString());
|
||||
properties.getProperty().add(propID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmisPropertyId propID = new CmisPropertyId();
|
||||
propID.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
@@ -393,11 +439,26 @@ public class DMAbstractServicePort
|
||||
properties.getProperty().add(propID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addIntegerProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
protected void addIntegerProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
{
|
||||
Serializable value = alfrescoProperties.get(name);
|
||||
if (filter.allow(name) && value != null)
|
||||
{
|
||||
if (value instanceof Collection)
|
||||
{
|
||||
long index = 0;
|
||||
for (Object multiValue : (Collection)value)
|
||||
{
|
||||
CmisPropertyInteger propInteger = new CmisPropertyInteger();
|
||||
propInteger.setIndex(BigInteger.valueOf(index++));
|
||||
propInteger.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
propInteger.setValue(BigInteger.valueOf((Long) multiValue));
|
||||
properties.getProperty().add(propInteger);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmisPropertyInteger propInteger = new CmisPropertyInteger();
|
||||
propInteger.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
@@ -405,11 +466,53 @@ public class DMAbstractServicePort
|
||||
properties.getProperty().add(propInteger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addStringProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
protected void addDecimalProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
{
|
||||
Serializable value = alfrescoProperties.get(name);
|
||||
if (filter.allow(name) && value != null)
|
||||
{
|
||||
if (value instanceof Collection)
|
||||
{
|
||||
long index = 0;
|
||||
for (Object multiValue : (Collection)value)
|
||||
{
|
||||
CmisPropertyDecimal propDecimal = new CmisPropertyDecimal();
|
||||
propDecimal.setIndex(BigInteger.valueOf(index++));
|
||||
propDecimal.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
propDecimal.setValue(BigDecimal.valueOf((Long) multiValue));
|
||||
properties.getProperty().add(propDecimal);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmisPropertyDecimal propDecimal = new CmisPropertyDecimal();
|
||||
propDecimal.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
propDecimal.setValue(BigDecimal.valueOf((Long) value));
|
||||
properties.getProperty().add(propDecimal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addStringProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
{
|
||||
Serializable value = alfrescoProperties.get(name);
|
||||
if (filter.allow(name) && value != null)
|
||||
{
|
||||
if (value instanceof Collection)
|
||||
{
|
||||
long index = 0;
|
||||
for (Object multiValue : (Collection)value)
|
||||
{
|
||||
CmisPropertyString propString = new CmisPropertyString();
|
||||
propString.setIndex(BigInteger.valueOf(index++));
|
||||
propString.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
propString.setValue(multiValue.toString());
|
||||
properties.getProperty().add(propString);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmisPropertyString propString = new CmisPropertyString();
|
||||
propString.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
@@ -417,8 +520,9 @@ public class DMAbstractServicePort
|
||||
properties.getProperty().add(propString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addStringProperty(CmisPropertiesType properties, PropertyFilter filter, String name, String value)
|
||||
protected void addStringProperty(CmisPropertiesType properties, PropertyFilter filter, String name, String value)
|
||||
{
|
||||
if (filter.allow(name) && value != null)
|
||||
{
|
||||
@@ -429,10 +533,24 @@ public class DMAbstractServicePort
|
||||
}
|
||||
}
|
||||
|
||||
private void addURIProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
protected void addURIProperty(CmisPropertiesType properties, PropertyFilter filter, String name, Map<String, Serializable> alfrescoProperties)
|
||||
{
|
||||
Serializable value = alfrescoProperties.get(name);
|
||||
if (filter.allow(name) && value != null)
|
||||
{
|
||||
if (value instanceof Collection)
|
||||
{
|
||||
long index = 0;
|
||||
for (Object multiValue : (Collection)value)
|
||||
{
|
||||
CmisPropertyUri propString = new CmisPropertyUri();
|
||||
propString.setIndex(BigInteger.valueOf(index++));
|
||||
propString.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
propString.setValue(multiValue.toString());
|
||||
properties.getProperty().add(propString);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CmisPropertyUri propString = new CmisPropertyUri();
|
||||
propString.setName(PropertyUtil.getCMISPropertyName(name));
|
||||
@@ -440,6 +558,7 @@ public class DMAbstractServicePort
|
||||
properties.getProperty().add(propString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets all <i>properties</i>' fields for specified node
|
||||
|
@@ -24,8 +24,14 @@
|
||||
*/
|
||||
package org.alfresco.repo.cmis.ws;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.CMISPropertyTypeEnum;
|
||||
import org.alfresco.cmis.search.CMISQueryOptions;
|
||||
import org.alfresco.cmis.search.CMISResultSet;
|
||||
import org.alfresco.cmis.search.CMISResultSetColumn;
|
||||
import org.alfresco.cmis.search.CMISResultSetMetaData;
|
||||
import org.alfresco.cmis.search.CMISResultSetRow;
|
||||
import org.alfresco.repo.cmis.PropertyFilter;
|
||||
|
||||
@@ -67,16 +73,71 @@ public class DMDiscoveryServicePort extends DMAbstractServicePort implements Dis
|
||||
options.setMaxItems(parameters.getPageSize().intValue());
|
||||
}
|
||||
|
||||
// execute query
|
||||
CMISResultSet resultSet = cmisQueryService.query(options);
|
||||
CMISResultSetMetaData metaData = resultSet.getMetaData();
|
||||
CMISResultSetColumn[] columns = metaData.getColumns();
|
||||
PropertyFilter filter = new PropertyFilter();
|
||||
|
||||
// build query response
|
||||
QueryResponse response = new QueryResponse();
|
||||
response.setHasMoreItems(resultSet.hasMore());
|
||||
|
||||
// for each row...
|
||||
for (CMISResultSetRow row : resultSet)
|
||||
{
|
||||
CmisPropertiesType properties = new CmisPropertiesType();
|
||||
Map<String, Serializable> values = row.getValues();
|
||||
|
||||
// for each column...
|
||||
for (CMISResultSetColumn column : columns)
|
||||
{
|
||||
CMISPropertyTypeEnum type = column.getPropertyType();
|
||||
if (type == CMISPropertyTypeEnum.BOOLEAN)
|
||||
{
|
||||
addBooleanProperty(properties, filter, column.getName(), values);
|
||||
}
|
||||
else if (type == CMISPropertyTypeEnum.DATETIME)
|
||||
{
|
||||
addDateTimeProperty(properties, filter, column.getName(), values);
|
||||
}
|
||||
else if (type == CMISPropertyTypeEnum.DECIMAL)
|
||||
{
|
||||
addDecimalProperty(properties, filter, column.getName(), values);
|
||||
}
|
||||
else if (type == CMISPropertyTypeEnum.ID)
|
||||
{
|
||||
addIDProperty(properties, filter, column.getName(), values);
|
||||
}
|
||||
else if (type == CMISPropertyTypeEnum.INTEGER)
|
||||
{
|
||||
addIntegerProperty(properties, filter, column.getName(), values);
|
||||
}
|
||||
else if (type == CMISPropertyTypeEnum.STRING)
|
||||
{
|
||||
addStringProperty(properties, filter, column.getName(), values);
|
||||
}
|
||||
else if (type == CMISPropertyTypeEnum.URI)
|
||||
{
|
||||
addURIProperty(properties, filter, column.getName(), values);
|
||||
}
|
||||
else if (type == CMISPropertyTypeEnum.XML)
|
||||
{
|
||||
// TODO:
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
else if (type == CMISPropertyTypeEnum.HTML)
|
||||
{
|
||||
// TODO:
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
CmisObjectType object = new CmisObjectType();
|
||||
object.setProperties(getPropertiesType(row.getValues(), new PropertyFilter()));
|
||||
object.setProperties(properties);
|
||||
response.getObject().add(object);
|
||||
}
|
||||
|
||||
response.setHasMoreItems(resultSet.hasMore());
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@@ -63,7 +63,7 @@ public class PropertyUtil
|
||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_FILENAME, new Pair<String, Boolean>("ContentStreamFilename", true));
|
||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_LABEL, new Pair<String, Boolean>("VersionLabel", true));
|
||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CHECKIN_COMMENT, new Pair<String, Boolean>("checkinComment", false));
|
||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_URI, new Pair<String, Boolean>("contentStreamURI", true));
|
||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_URI, new Pair<String, Boolean>("contentStreamUri", true));
|
||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_VERSION_SERIES_CHECKED_OUT_BY, new Pair<String, Boolean>("VersionSeriesCheckedOutBy", true));
|
||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_PARENT_ID, new Pair<String, Boolean>("ParentId", true));
|
||||
cmisToRepoPropertiesNamesMapping.put(CMISMapping.PROP_CONTENT_STREAM_ALLOWED, new Pair<String, Boolean>("ContentStreamAllowed", true));
|
||||
@@ -82,7 +82,9 @@ public class PropertyUtil
|
||||
*/
|
||||
public static String getCMISPropertyName(String internalName)
|
||||
{
|
||||
return cmisToRepoPropertiesNamesMapping.get(internalName).getFirst();
|
||||
return internalName;
|
||||
// TODO: remove the above mapping
|
||||
//return cmisToRepoPropertiesNamesMapping.get(internalName).getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -60,11 +60,16 @@ import org.apache.commons.httpclient.params.HttpClientParams;
|
||||
*/
|
||||
public abstract class BaseWebScriptTest extends TestCase
|
||||
{
|
||||
|
||||
// Test Listener
|
||||
private WebScriptTestListener listener = null;
|
||||
private boolean traceReqRes = false;
|
||||
|
||||
/** Local / Remote Server access */
|
||||
// Local Server access
|
||||
private static String customContext = null;
|
||||
private static TestWebScriptServer server = null;
|
||||
|
||||
// Remote Server access
|
||||
private String defaultRunAs = null;
|
||||
private RemoteServer remoteServer = null;
|
||||
private HttpClient httpClient = null;
|
||||
@@ -145,6 +150,16 @@ public abstract class BaseWebScriptTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets custom context for Test Web Script Server (in-process only)
|
||||
* @param customContext
|
||||
*/
|
||||
public static void setCustomContext(String customContext)
|
||||
{
|
||||
BaseWebScriptTest.customContext = customContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Test Listener
|
||||
*
|
||||
@@ -186,7 +201,7 @@ public abstract class BaseWebScriptTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Local Run As User
|
||||
* Set Default Local Run As User
|
||||
*
|
||||
* @param localRunAs
|
||||
*/
|
||||
@@ -195,6 +210,16 @@ public abstract class BaseWebScriptTest extends TestCase
|
||||
this.defaultRunAs = localRunAs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Default Local Run As User
|
||||
*
|
||||
* @return localRunAs
|
||||
*/
|
||||
public String getDefaultRunAs()
|
||||
{
|
||||
return defaultRunAs;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
@@ -208,31 +233,22 @@ public abstract class BaseWebScriptTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/** Test web script server */
|
||||
private static TestWebScriptServer server = null;
|
||||
|
||||
protected static TestWebScriptServer getServer()
|
||||
{
|
||||
if (BaseWebScriptTest.server == null)
|
||||
{
|
||||
if (BaseWebScriptTest.customContext == null)
|
||||
{
|
||||
BaseWebScriptTest.server = TestWebScriptRepoServer.getTestServer();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseWebScriptTest.server = TestWebScriptRepoServer.getTestServer(customContext);
|
||||
}
|
||||
}
|
||||
return BaseWebScriptTest.server;
|
||||
}
|
||||
|
||||
protected static TestWebScriptServer initServer()
|
||||
{
|
||||
return getServer();
|
||||
}
|
||||
|
||||
protected static TestWebScriptServer initServer(String appendTestConfigLocation)
|
||||
{
|
||||
if (BaseWebScriptTest.server == null)
|
||||
{
|
||||
BaseWebScriptTest.server = TestWebScriptRepoServer.getTestServer(appendTestConfigLocation);
|
||||
}
|
||||
return BaseWebScriptTest.server;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Log Enabled?
|
||||
|
@@ -85,10 +85,9 @@ public class AssetTest extends BaseWebScriptTest {
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
setCustomContext(SUBMIT_CONFIG_LOCATION);
|
||||
super.setUp();
|
||||
|
||||
initServer(SUBMIT_CONFIG_LOCATION);
|
||||
|
||||
this.authenticationService = (AuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
|
||||
this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
|
||||
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
|
||||
|
14
source/test-resources/cmis/cmis-test-context.xml
Normal file
14
source/test-resources/cmis/cmis-test-context.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="cmis.test.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
|
||||
<property name="models">
|
||||
<list>
|
||||
<value>cmis/cmisCustomModel.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
292
source/test-resources/cmis/cmisCustomModel.xml
Normal file
292
source/test-resources/cmis/cmisCustomModel.xml
Normal file
@@ -0,0 +1,292 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<model name="aiim:aiimmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
|
||||
|
||||
<description>AIIM Content Model</description>
|
||||
<author>Dr. Q</author>
|
||||
<version>1.0</version>
|
||||
|
||||
<imports>
|
||||
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
|
||||
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
|
||||
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
|
||||
</imports>
|
||||
|
||||
<namespaces>
|
||||
<namespace uri="http://www.alfresco.org/model/aiim" prefix="aiim"/>
|
||||
</namespaces>
|
||||
|
||||
<constraints>
|
||||
<!-- Title constraint Limited size -->
|
||||
<constraint name="aiim:TitleLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>100</value></parameter>
|
||||
</constraint>
|
||||
<!-- Sub title constraint Limited size -->
|
||||
<constraint name="aiim:SubTitleLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>100</value></parameter>
|
||||
</constraint>
|
||||
<!-- Author constraint Limited size -->
|
||||
<constraint name="aiim:AuthorLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>25</value></parameter>
|
||||
</constraint>
|
||||
<!-- Keyword constraint Limited size -->
|
||||
<constraint name="aiim:KeywordLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>50</value></parameter>
|
||||
</constraint>
|
||||
<!-- SourceRef constraint Limited size -->
|
||||
<constraint name="aiim:SourceRepLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>25</value></parameter>
|
||||
</constraint>
|
||||
<!-- InfoManTopic constraint Limited size -->
|
||||
<constraint name="aiim:InfoManTopicLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>60</value></parameter>
|
||||
</constraint>
|
||||
<!-- ITTopic constraint Limited size -->
|
||||
<constraint name="aiim:ITTopicLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>40</value></parameter>
|
||||
</constraint>
|
||||
<!-- Industry constraint Limited size -->
|
||||
<constraint name="aiim:IndustryLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>30</value></parameter>
|
||||
</constraint>
|
||||
<!-- LifeCycleStage constraint Limited size -->
|
||||
<constraint name="aiim:LifeCycleStageLength" type="LENGTH">
|
||||
<parameter name="minLength"><value>0</value></parameter>
|
||||
<parameter name="maxLength"><value>25</value></parameter>
|
||||
</constraint>
|
||||
<!-- InfoManTopic constraint List -->
|
||||
<constraint name="aiim:InfoManTopicList" type="LIST">
|
||||
<parameter name="allowedValues">
|
||||
<list>
|
||||
<value>Business Process Management (BPM)</value>
|
||||
<value>Content/Knowledge Organization</value>
|
||||
<value>Digital Asset Management (DAM)</value>
|
||||
<value>Document Management</value>
|
||||
<value>Email Archiving</value>
|
||||
<value>Findability/Information Organization and Access (IOA)</value>
|
||||
<value>Records Management</value>
|
||||
<value>Web Content Management (WCM)</value>
|
||||
<value>Other</value>
|
||||
</list>
|
||||
</parameter>
|
||||
<parameter name="caseSensitive"><value>true</value></parameter>
|
||||
</constraint>
|
||||
<!-- ITTopic constraint List -->
|
||||
<constraint name="aiim:ITTopicList" type="LIST">
|
||||
<parameter name="allowedValues">
|
||||
<list>
|
||||
<value>Disaster Recovery</value>
|
||||
<value>Green Computing</value>
|
||||
<value>Imaging</value>
|
||||
<value>Security</value>
|
||||
<value>Service Oriented Architecture(SOA)</value>
|
||||
<value>Software as a Service(SaaS)</value>
|
||||
<value>Standards</value>
|
||||
<value>Usability</value>
|
||||
<value>Other</value>
|
||||
</list>
|
||||
</parameter>
|
||||
<parameter name="caseSensitive"><value>true</value></parameter>
|
||||
</constraint>
|
||||
<!-- Industry constraint List -->
|
||||
<constraint name="aiim:IndustryList" type="LIST">
|
||||
<parameter name="allowedValues">
|
||||
<list>
|
||||
<value>Energy</value>
|
||||
<value>Financial Services</value>
|
||||
<value>Federal Government</value>
|
||||
<value>Health Services</value>
|
||||
<value>Email Archiving</value>
|
||||
<value>Manufacturing</value>
|
||||
<value>State and Local Government</value>
|
||||
<value>Other</value>
|
||||
</list>
|
||||
</parameter>
|
||||
<parameter name="caseSensitive"><value>true</value></parameter>
|
||||
</constraint>
|
||||
<!-- LifeCycleStage constraint List -->
|
||||
<constraint name="aiim:LifeCycleStageList" type="LIST">
|
||||
<parameter name="allowedValues">
|
||||
<list>
|
||||
<value>Planning</value>
|
||||
<value>Requirements</value>
|
||||
<value>Design</value>
|
||||
<value>Development</value>
|
||||
<value>Deployment</value>
|
||||
<value>Ongoing Maintenance</value>
|
||||
<value>N/A</value>
|
||||
</list>
|
||||
</parameter>
|
||||
<parameter name="caseSensitive"><value>true</value></parameter>
|
||||
</constraint>
|
||||
</constraints>
|
||||
|
||||
<types>
|
||||
<type name="aiim:content">
|
||||
<title>AIIM Content</title>
|
||||
<parent>cm:content</parent>
|
||||
<mandatory-aspects>
|
||||
<aspect>aiim:properties</aspect>
|
||||
</mandatory-aspects>
|
||||
</type>
|
||||
</types>
|
||||
<aspects>
|
||||
<!-- Definition of aiim properties Aspect -->
|
||||
<aspect name="aiim:properties">
|
||||
<title>AIIM Properties</title>
|
||||
<properties>
|
||||
<property name="aiim:Title">
|
||||
<title>AIIM Title</title>
|
||||
<type>d:text</type>
|
||||
<mandatory enforced="false">true</mandatory>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:TitleLength"/>
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="aiim:SubTitle">
|
||||
<title>AIIM Sub Title</title>
|
||||
<type>d:text</type>
|
||||
<mandatory>false</mandatory>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:SubTitleLength"/>
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="aiim:Authors">
|
||||
<title>AIIM Authors</title>
|
||||
<type>d:text</type>
|
||||
<mandatory>false</mandatory>
|
||||
<multiple>true</multiple>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:AuthorLength"/>
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="aiim:PublicationDate">
|
||||
<title>AIIM Publication Date</title>
|
||||
<type>d:date</type>
|
||||
<mandatory enforced="false">true</mandatory>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
</property>
|
||||
<property name="aiim:Keywords">
|
||||
<title>AIIM Keywords</title>
|
||||
<type>d:text</type>
|
||||
<mandatory>false</mandatory>
|
||||
<multiple>true</multiple>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:KeywordLength"/>
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="aiim:SourceRep">
|
||||
<title>AIIM Source Rep</title>
|
||||
<type>d:text</type>
|
||||
<mandatory enforced="false">true</mandatory>
|
||||
<default>Alfresco</default>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:SourceRepLength"/>
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="aiim:InfoManTopics">
|
||||
<title>AIIM Info Man Topic</title>
|
||||
<type>d:text</type>
|
||||
<mandatory>false</mandatory>
|
||||
<multiple>true</multiple>
|
||||
<default>Other</default>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:InfoManTopicLength"/>
|
||||
<constraint ref="aiim:InfoManTopicList"/>
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="aiim:ITTopics">
|
||||
<title>AIIM IT Topic</title>
|
||||
<type>d:text</type>
|
||||
<mandatory>false</mandatory>
|
||||
<multiple>true</multiple>
|
||||
<default>Other</default>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:ITTopicLength"/>
|
||||
<constraint ref="aiim:ITTopicList"/>
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="aiim:Industries">
|
||||
<title>AIIM Industry</title>
|
||||
<type>d:text</type>
|
||||
<mandatory>false</mandatory>
|
||||
<multiple>true</multiple>
|
||||
<default>Other</default>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:IndustryLength"/>
|
||||
<constraint ref="aiim:IndustryList"/>
|
||||
</constraints>
|
||||
</property>
|
||||
<property name="aiim:LifeCycleStages">
|
||||
<title>AIIM Life Cycle Stage</title>
|
||||
<type>d:text</type>
|
||||
<mandatory>false</mandatory>
|
||||
<multiple>true</multiple>
|
||||
<default>N/A</default>
|
||||
<index enabled="true">
|
||||
<atomic>false</atomic>
|
||||
<stored>false</stored>
|
||||
<tokenised>true</tokenised>
|
||||
</index>
|
||||
<constraints>
|
||||
<constraint ref="aiim:LifeCycleStageLength"/>
|
||||
<constraint ref="aiim:LifeCycleStageList"/>
|
||||
</constraints>
|
||||
</property>
|
||||
</properties>
|
||||
</aspect>
|
||||
</aspects>
|
||||
|
||||
</model>
|
@@ -35,7 +35,7 @@ public class DMDiscoveryServiceTest extends AbstractServiceTest
|
||||
|
||||
public final static String SERVICE_WSDL_LOCATION = CmisServiceTestHelper.ALFRESCO_URL + "/cmis/DiscoveryService?wsdl";
|
||||
public final static QName SERVICE_NAME = new QName("http://www.cmis.org/ns/1.0", "DiscoveryService");
|
||||
public final static String STATEMENT = "SELECT * FROM DOCUMENT";
|
||||
public final static String STATEMENT = "SELECT * FROM aiim_content";
|
||||
|
||||
public DMDiscoveryServiceTest()
|
||||
{
|
||||
|
Reference in New Issue
Block a user