CMIS bag of stuff;:

- Add CMIS Allowable Actions to Abdera CMIS extension
- Add testAllowableActions(), testQueryAllowableActions
- Pass all AppClientTest (AtomPub server test suite) tests
- Fix encoding issues while parsing Atom requests
- Fix ignoring of Atom slug
- Fix support of pure Atom entries (those without CMIS extensions)
- Add test suite for custom sub-types / props (CMISCustomTypeTest)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13921 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-04-09 15:19:47 +00:00
parent 4fd502de4b
commit 7205e4b956
8 changed files with 52 additions and 23 deletions

View File

@@ -161,14 +161,14 @@ public interface CMISTypeDefinition
* *
* @return property definitions * @return property definitions
*/ */
public Map<CMISPropertyId, CMISPropertyDefinition> getPropertyDefinitions(); public Map<String, CMISPropertyDefinition> getPropertyDefinitions();
/** /**
* Gets the property definitions owned by this type * Gets the property definitions owned by this type
* *
* @return * @return
*/ */
public Map<CMISPropertyId, CMISPropertyDefinition> getOwnedPropertyDefinitions(); public Map<String, CMISPropertyDefinition> getOwnedPropertyDefinitions();
/** /**
* Gets the Action evaluators for this type * Gets the Action evaluators for this type

View File

@@ -321,8 +321,8 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
boolean isMatchingType = (matchingType == null); boolean isMatchingType = (matchingType == null);
if (property != null && matchingType != null) if (property != null && matchingType != null)
{ {
Map<CMISPropertyId, CMISPropertyDefinition> props = matchingType.getPropertyDefinitions(); Map<String, CMISPropertyDefinition> props = matchingType.getPropertyDefinitions();
if (props.containsKey(property.getPropertyId())) if (props.containsKey(property.getPropertyId().getName()))
{ {
isMatchingType = true; isMatchingType = true;
} }
@@ -362,7 +362,7 @@ public abstract class CMISAbstractDictionaryService extends AbstractLifecycleBea
createDefinitions(registry); createDefinitions(registry);
for (CMISAbstractTypeDefinition objectTypeDef : registry.objectDefsByTypeId.values()) for (CMISAbstractTypeDefinition objectTypeDef : registry.objectDefsByTypeId.values())
{ {
Map<CMISPropertyId, CMISPropertyDefinition> propDefs = objectTypeDef.createProperties(cmisMapping, dictionaryService); Map<String, CMISPropertyDefinition> propDefs = objectTypeDef.createProperties(cmisMapping, dictionaryService);
for (CMISPropertyDefinition propDef : propDefs.values()) for (CMISPropertyDefinition propDef : propDefs.values())
{ {
registry.registerPropertyDefinition(propDef); registry.registerPropertyDefinition(propDef);

View File

@@ -79,9 +79,9 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
protected boolean includeInSuperTypeQuery; protected boolean includeInSuperTypeQuery;
protected Collection<CMISTypeId> subTypeIds = new ArrayList<CMISTypeId>(); protected Collection<CMISTypeId> subTypeIds = new ArrayList<CMISTypeId>();
protected Collection<CMISTypeDefinition> subTypes = new ArrayList<CMISTypeDefinition>(); protected Collection<CMISTypeDefinition> subTypes = new ArrayList<CMISTypeDefinition>();
protected Map<CMISPropertyId, CMISPropertyDefinition> properties = new HashMap<CMISPropertyId, CMISPropertyDefinition>(); protected Map<String, CMISPropertyDefinition> properties = new HashMap<String, CMISPropertyDefinition>();
protected Map<CMISPropertyId, CMISPropertyDefinition> inheritedProperties = new HashMap<CMISPropertyId, CMISPropertyDefinition>(); protected Map<String, CMISPropertyDefinition> inheritedProperties = new HashMap<String, CMISPropertyDefinition>();
protected Map<CMISPropertyId, CMISPropertyDefinition> ownedProperties = new HashMap<CMISPropertyId, CMISPropertyDefinition>(); protected Map<String, CMISPropertyDefinition> ownedProperties = new HashMap<String, CMISPropertyDefinition>();
protected Map<CMISAllowedActionEnum, CMISActionEvaluator> actionEvaluators; protected Map<CMISAllowedActionEnum, CMISActionEvaluator> actionEvaluators;
@@ -92,7 +92,7 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
* @param dictionaryService * @param dictionaryService
* @return * @return
*/ */
/*package*/ Map<CMISPropertyId, CMISPropertyDefinition> createProperties(CMISMapping cmisMapping, DictionaryService dictionaryService) /*package*/ Map<String, CMISPropertyDefinition> createProperties(CMISMapping cmisMapping, DictionaryService dictionaryService)
{ {
// map properties directly defined on this type // map properties directly defined on this type
for (PropertyDefinition propDef : cmisClassDef.getProperties().values()) for (PropertyDefinition propDef : cmisClassDef.getProperties().values())
@@ -102,7 +102,7 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
if (cmisMapping.getDataType(propDef.getDataType()) != null) if (cmisMapping.getDataType(propDef.getDataType()) != null)
{ {
CMISPropertyDefinition cmisPropDef = createProperty(cmisMapping, propDef); CMISPropertyDefinition cmisPropDef = createProperty(cmisMapping, propDef);
properties.put(cmisPropDef.getPropertyId(), cmisPropDef); properties.put(cmisPropDef.getPropertyId().getName(), cmisPropDef);
} }
} }
} }
@@ -374,7 +374,7 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
* (non-Javadoc) * (non-Javadoc)
* @see org.alfresco.cmis.dictionary.CMISTypeDefinition#getPropertyDefinitions() * @see org.alfresco.cmis.dictionary.CMISTypeDefinition#getPropertyDefinitions()
*/ */
public Map<CMISPropertyId, CMISPropertyDefinition> getPropertyDefinitions() public Map<String, CMISPropertyDefinition> getPropertyDefinitions()
{ {
return inheritedProperties; return inheritedProperties;
} }
@@ -383,7 +383,7 @@ public class CMISAbstractTypeDefinition implements CMISTypeDefinition, Serializa
* (non-Javadoc) * (non-Javadoc)
* @see org.alfresco.cmis.dictionary.CMISTypeDefinition#getOwnedPropertyDefinitions() * @see org.alfresco.cmis.dictionary.CMISTypeDefinition#getOwnedPropertyDefinitions()
*/ */
public Map<CMISPropertyId, CMISPropertyDefinition> getOwnedPropertyDefinitions() public Map<String, CMISPropertyDefinition> getOwnedPropertyDefinitions()
{ {
return ownedProperties; return ownedProperties;
} }

View File

@@ -31,7 +31,6 @@ import java.util.Map;
import org.alfresco.cmis.CMISDictionaryModel; import org.alfresco.cmis.CMISDictionaryModel;
import org.alfresco.cmis.CMISPropertyDefinition; import org.alfresco.cmis.CMISPropertyDefinition;
import org.alfresco.cmis.CMISPropertyId;
import org.alfresco.cmis.CMISScope; import org.alfresco.cmis.CMISScope;
import org.alfresco.cmis.CMISTypeDefinition; import org.alfresco.cmis.CMISTypeDefinition;
import org.alfresco.cmis.CMISTypeId; import org.alfresco.cmis.CMISTypeId;
@@ -120,7 +119,7 @@ public class CMISRelationshipTypeDefinition extends CMISAbstractTypeDefinition
* @see org.alfresco.cmis.dictionary.CMISObjectTypeDefinition#createProperties(org.alfresco.cmis.dictionary.CMISMapping, org.alfresco.service.cmr.dictionary.DictionaryService) * @see org.alfresco.cmis.dictionary.CMISObjectTypeDefinition#createProperties(org.alfresco.cmis.dictionary.CMISMapping, org.alfresco.service.cmr.dictionary.DictionaryService)
*/ */
@Override @Override
/*package*/ Map<CMISPropertyId, CMISPropertyDefinition> createProperties(CMISMapping cmisMapping, DictionaryService dictionaryService) /*package*/ Map<String, CMISPropertyDefinition> createProperties(CMISMapping cmisMapping, DictionaryService dictionaryService)
{ {
if (objectTypeId.equals(CMISDictionaryModel.RELATIONSHIP_TYPE_ID)) if (objectTypeId.equals(CMISDictionaryModel.RELATIONSHIP_TYPE_ID))
{ {

View File

@@ -31,7 +31,6 @@ import java.util.Map;
import org.alfresco.cmis.CMISDictionaryService; import org.alfresco.cmis.CMISDictionaryService;
import org.alfresco.cmis.CMISPropertyDefinition; import org.alfresco.cmis.CMISPropertyDefinition;
import org.alfresco.cmis.CMISPropertyId;
import org.alfresco.cmis.CMISServices; import org.alfresco.cmis.CMISServices;
import org.alfresco.cmis.CMISTypeDefinition; import org.alfresco.cmis.CMISTypeDefinition;
import org.alfresco.cmis.CMISTypesFilterEnum; import org.alfresco.cmis.CMISTypesFilterEnum;
@@ -483,7 +482,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
{ {
throw new AlfrescoRuntimeException("Type " + typeQName + " not found in CMIS Dictionary"); throw new AlfrescoRuntimeException("Type " + typeQName + " not found in CMIS Dictionary");
} }
Map<CMISPropertyId, CMISPropertyDefinition> propDefs = typeDef.getPropertyDefinitions(); Map<String, CMISPropertyDefinition> propDefs = typeDef.getPropertyDefinitions();
Map<String, Serializable> values = new HashMap<String, Serializable>(propDefs.size()); Map<String, Serializable> values = new HashMap<String, Serializable>(propDefs.size());
for (CMISPropertyDefinition propDef : propDefs.values()) for (CMISPropertyDefinition propDef : propDefs.values())
{ {

View File

@@ -65,8 +65,12 @@ public class ContentStreamUriProperty extends AbstractProperty
sb.append(nodeRef.getStoreRef().getIdentifier()); sb.append(nodeRef.getStoreRef().getIdentifier());
sb.append("/"); sb.append("/");
sb.append(nodeRef.getId()); sb.append(nodeRef.getId());
sb.append("/content."); sb.append("/content");
sb.append(getServiceRegistry().getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME)); String name = (String)getServiceRegistry().getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME);
if (name.lastIndexOf('.') != -1)
{
sb.append(name.substring(name.lastIndexOf('.')));
}
return sb.toString(); return sb.toString();
} }

View File

@@ -36,7 +36,6 @@ import org.alfresco.cmis.CMISCardinalityEnum;
import org.alfresco.cmis.CMISDictionaryService; import org.alfresco.cmis.CMISDictionaryService;
import org.alfresco.cmis.CMISJoinEnum; import org.alfresco.cmis.CMISJoinEnum;
import org.alfresco.cmis.CMISPropertyDefinition; import org.alfresco.cmis.CMISPropertyDefinition;
import org.alfresco.cmis.CMISPropertyId;
import org.alfresco.cmis.CMISQueryException; import org.alfresco.cmis.CMISQueryException;
import org.alfresco.cmis.CMISQueryOptions; import org.alfresco.cmis.CMISQueryOptions;
import org.alfresco.cmis.CMISScope; import org.alfresco.cmis.CMISScope;
@@ -533,7 +532,7 @@ public class CMISQueryParser
{ {
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias()); throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
} }
Map<CMISPropertyId, CMISPropertyDefinition> propDefs = typeDef.getPropertyDefinitions(); Map<String, CMISPropertyDefinition> propDefs = typeDef.getPropertyDefinitions();
for (CMISPropertyDefinition definition : propDefs.values()) for (CMISPropertyDefinition definition : propDefs.values())
{ {
if (definition.getCardinality() == CMISCardinalityEnum.SINGLE_VALUED) if (definition.getCardinality() == CMISCardinalityEnum.SINGLE_VALUED)
@@ -570,7 +569,7 @@ public class CMISQueryParser
{ {
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias()); throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
} }
Map<CMISPropertyId, CMISPropertyDefinition> propDefs = typeDef.getPropertyDefinitions(); Map<String, CMISPropertyDefinition> propDefs = typeDef.getPropertyDefinitions();
for (CMISPropertyDefinition definition : propDefs.values()) for (CMISPropertyDefinition definition : propDefs.values())
{ {
if (definition.getCardinality() == CMISCardinalityEnum.SINGLE_VALUED) if (definition.getCardinality() == CMISCardinalityEnum.SINGLE_VALUED)

View File

@@ -24,7 +24,10 @@
*/ */
package org.alfresco.repo.jscript; package org.alfresco.repo.jscript;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Serializable; import java.io.Serializable;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
@@ -2704,18 +2707,43 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol
{ {
ContentService contentService = services.getContentService(); ContentService contentService = services.getContentService();
ContentReader reader = contentService.getReader(nodeRef, property); ContentReader reader = contentService.getReader(nodeRef, property);
return (reader != null && reader.exists()) ? reader.getContentString() : ""; return (reader != null && reader.exists()) ? reader.getContentString() : "";
} }
/*
* (non-Javadoc)
* @see org.alfresco.util.Content#getInputStream()
*/
public InputStream getInputStream() public InputStream getInputStream()
{ {
ContentService contentService = services.getContentService(); ContentService contentService = services.getContentService();
ContentReader reader = contentService.getReader(nodeRef, property); ContentReader reader = contentService.getReader(nodeRef, property);
return (reader != null && reader.exists()) ? reader.getContentInputStream() : null; return (reader != null && reader.exists()) ? reader.getContentInputStream() : null;
} }
/*
* (non-Javadoc)
* @see org.alfresco.util.Content#getReader()
*/
public Reader getReader()
{
ContentService contentService = services.getContentService();
ContentReader reader = contentService.getReader(nodeRef, property);
if (reader != null && reader.exists())
{
try
{
return (contentData.getEncoding() == null) ? new InputStreamReader(reader.getContentInputStream()) : new InputStreamReader(reader.getContentInputStream(), contentData.getEncoding());
}
catch (IOException e)
{
// NOTE: fall-through
}
}
return null;
}
/** /**
* Set the content stream * Set the content stream
* *