Refactor CMIS Dictionary part 2

- further simplification of CMISDictionaryService and fixup fallout
- added logging
- consolidate & fix property definition handling (only one definition per property)
- include support for aspect properties
- fix property.isInherited
- open up the door for types outside of CMIS doc, folder, rel & policy

Dictionary Service
- add isOverride() to PropertyDefinition

Invite Workflows
- ensure they create their own namespace for new types/props
- NOTE: the previous way uses a hole in the DictinaryService which has been there
        unnoticed for over 4 years, till now. At some point, the hole will be filled in.
        
Tests pass for CMIS REST / Web Services and Query.
Tests pass for Invitation Service.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13787 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2009-03-31 17:48:49 +00:00
parent 4e9c3a3d3a
commit 146ad53fe5

View File

@@ -0,0 +1,121 @@
/*
* Copyright (C) 2005-20079 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.cmis.dictionary;
import java.util.Collection;
import org.alfresco.service.cmr.dictionary.ClassDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.namespace.QName;
/**
* CMIS Object Type Definition
*
* @author davidc
*/
public class CMISObjectTypeDefinition extends CMISAbstractTypeDefinition
{
private static final long serialVersionUID = -3131505923356013430L;
/**
* Construct
*
* @param cmisMapping
* @param typeId
* @param cmisClassDef
*/
public CMISObjectTypeDefinition(CMISMapping cmisMapping, CMISTypeId typeId, ClassDefinition cmisClassDef, boolean isPublic)
{
this.isPublic = isPublic;
// Object type properties
objectTypeId = typeId;
objectTypeQueryName = cmisMapping.buildPrefixEncodedString(typeId.getQName(), false);
if (cmisClassDef != null)
{
this.cmisClassDef = cmisClassDef;
displayName = (cmisClassDef.getTitle() != null) ? cmisClassDef.getTitle() : typeId.getId();
description = cmisClassDef.getDescription();
QName parentQName = cmisMapping.getCmisType(cmisClassDef.getParentName());
if (parentQName != null)
{
parentTypeId = cmisMapping.getCmisTypeId(CMISScope.OBJECT, parentQName);
}
}
creatable = false;
queryable = false;
controllable = false;
includeInSuperTypeQuery = false;
}
/**
* Create Sub Types
*
* @param cmisMapping
* @param dictionaryService
*/
/*package*/ void createSubTypes(CMISMapping cmisMapping, DictionaryService dictionaryService)
{
Collection<QName> subTypes = dictionaryService.getSubTypes(objectTypeId.getQName(), false);
for (QName subType : subTypes)
{
CMISTypeId subTypeId = cmisMapping.getCmisTypeId(subType);
if (subTypeId != null)
{
subTypeIds.add(subTypeId);
}
}
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("CMISObjectTypeDefinition[");
builder.append("Public=").append(isPublic()).append(", ");
builder.append("ObjectTypeId=").append(getTypeId()).append(", ");
builder.append("ObjectTypeQueryName=").append(getQueryName()).append(", ");
builder.append("ObjectTypeDisplayName=").append(getDisplayName()).append(", ");
builder.append("ParentTypeId=").append(getParentType() == null ? "<none>" : getParentType().getTypeId()).append(", ");
builder.append("Description=").append(getDescription()).append(", ");
builder.append("Creatable=").append(isCreatable()).append(", ");
builder.append("Queryable=").append(isQueryable()).append(", ");
builder.append("Controllable=").append(isControllable()).append(", ");
builder.append("IncludeInSuperTypeQuery=").append(isIncludeInSuperTypeQuery()).append(", ");
builder.append("SubTypes=").append(getSubTypes(false).size()).append(", ");
builder.append("Properties=").append(getPropertyDefinitions().size());
builder.append("]");
return builder.toString();
}
}