org.alfresco.web.scripts
Class DictionaryQuery

java.lang.Object
  extended by org.springframework.extensions.webscripts.processor.BaseProcessorExtension
      extended by org.alfresco.web.scripts.DictionaryQuery
All Implemented Interfaces:
java.io.Serializable, org.springframework.extensions.surf.core.processor.ProcessorExtension

public class DictionaryQuery
extends org.springframework.extensions.webscripts.processor.BaseProcessorExtension
implements java.io.Serializable

Slingleton scripting host object provided to allows scripts to execute basic Alfresco Data Dictionary model queries.

Service object that maintains no state other than the dictionary itself.

Queries include: isSubType, isAspect, hasProperty, getParentType etc.

See Also:
Serialized Form

Nested Class Summary
static class DictionaryQuery.DictionaryAssoc
          Simple structure class representing a single Data Dictionary association instance.
static class DictionaryQuery.DictionaryProperty
          Simple structure class representing a single Data Dictionary property instance.
 
Constructor Summary
DictionaryQuery()
           
 
Method Summary
 DictionaryQuery.DictionaryAssoc[] getAssociations(java.lang.String ddclass)
          getAssociations - return the target associations for the given dd class.
 DictionaryQuery.DictionaryAssoc[] getChildAssociations(java.lang.String ddclass)
          getChildAssociations - return the child associations for the given dd class.
 java.lang.String[] getDefaultAspects(java.lang.String type)
          getDefaultAspects - return Array of default aspects for the given type.
 java.lang.String getDescription(java.lang.String ddclass)
          getDescription - return the description string for the given dd class.
 java.lang.String getParent(java.lang.String ddclass)
          getParent - return the parent for the given dd class.
 DictionaryQuery.DictionaryProperty[] getProperties(java.lang.String ddclass)
          getProperties - return all properties for the given dd class.
 DictionaryQuery.DictionaryProperty[] getProperties(java.lang.String ddclass, boolean includeDefaultAspects)
          getProperties - return all properties for the given dd class.
 DictionaryQuery.DictionaryProperty getProperty(java.lang.String ddclass, java.lang.String property)
          getProperty - return a single named property for the given dd class.
 DictionaryQuery.DictionaryProperty getProperty(java.lang.String ddclass, java.lang.String property, boolean includeDefaultAspects)
          getProperty - return a single named property for the given dd class, optionally retrieve a property from the default aspects.
 java.lang.String getTitle(java.lang.String ddclass)
          getTitle - return the title string for the given dd class.
 boolean hasDefaultAspect(java.lang.String type, java.lang.String aspect)
          hasDefaultAspect - return if the type definition has the default aspect applied..
 boolean hasProperty(java.lang.String ddclass, java.lang.String property)
          hasProperty - return if a type or aspect has the given property definition.
 boolean hasProperty(java.lang.String ddclass, java.lang.String property, boolean includeDefaultAspects)
          hasProperty - return if a type or aspect has the given property definition.
 boolean isAspect(java.lang.String ddclass)
          isAspect - return if the supplied dd class is an aspect.
 boolean isContainer(java.lang.String type)
          isContainer - return if the specified type is a container
 boolean isSubType(java.lang.String type, java.lang.String isType)
          isSubType - return if the supplied type is a sub-type of a given type.
 boolean isType(java.lang.String ddclass)
          isType - return if the supplied dd class is a type.
 java.lang.String toString()
           
 
Methods inherited from class org.springframework.extensions.webscripts.processor.BaseProcessorExtension
getExtensionName, register, setExtensionName, setProcessors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DictionaryQuery

public DictionaryQuery()
Method Detail

isSubType

public boolean isSubType(java.lang.String type,
                         java.lang.String isType)
isSubType - return if the supplied type is a sub-type of a given type.

Parameters:
type - Type to test
isType - Is the type a subtype of this type?
Returns:
true if the type is a subtype of isType or the same type

hasDefaultAspect

public boolean hasDefaultAspect(java.lang.String type,
                                java.lang.String aspect)
hasDefaultAspect - return if the type definition has the default aspect applied..

Parameters:
type - Type to test
aspect - Aspect to look for in the default aspects
Returns:
true if the aspect is one of the default aspects

getDefaultAspects

public java.lang.String[] getDefaultAspects(java.lang.String type)
getDefaultAspects - return Array of default aspects for the given type.

Parameters:
type - Type to inspect
Returns:
Array of default aspects for the type, can be empty but never null.

isAspect

public boolean isAspect(java.lang.String ddclass)
isAspect - return if the supplied dd class is an aspect.

Parameters:
ddclass - DD class to test
Returns:
true if the supplied dd class is an aspect

isType

public boolean isType(java.lang.String ddclass)
isType - return if the supplied dd class is a type.

Parameters:
ddclass - DD class to test
Returns:
true if the supplied dd class is a type

hasProperty

public boolean hasProperty(java.lang.String ddclass,
                           java.lang.String property)
hasProperty - return if a type or aspect has the given property definition. This method correctly reports properties inherited from base types.

Parameters:
ddclass - Type or aspect to test
property - Property to look for in the type or aspect definition
Returns:
true if the property is defined on the type or aspect

hasProperty

public boolean hasProperty(java.lang.String ddclass,
                           java.lang.String property,
                           boolean includeDefaultAspects)
hasProperty - return if a type or aspect has the given property definition. This method correctly reports properties inherited from base types and also optionally checks any default aspects applied to the type for the property.

Parameters:
ddclass - Type or aspect to test
property - Property to look for in the type or aspect definition
includeDefaultAspects - If true, check default aspects for the given property.
Returns:
true if the property is defined on the type or aspect or any of its default aspects.

getTitle

public java.lang.String getTitle(java.lang.String ddclass)
getTitle - return the title string for the given dd class.

Parameters:
ddclass - DD class to inspect
Returns:
title string

getDescription

public java.lang.String getDescription(java.lang.String ddclass)
getDescription - return the description string for the given dd class.

Parameters:
ddclass - DD class to inspect
Returns:
description string

getParent

public java.lang.String getParent(java.lang.String ddclass)
getParent - return the parent for the given dd class.

Parameters:
ddclass - DD class to inspect
Returns:
parent type or null for a root type with no parent.

isContainer

public boolean isContainer(java.lang.String type)
isContainer - return if the specified type is a container

Parameters:
type - Type to inspect
Returns:
true if the type is a container, false otherwise

getProperty

public DictionaryQuery.DictionaryProperty getProperty(java.lang.String ddclass,
                                                      java.lang.String property)
getProperty - return a single named property for the given dd class.

Parameters:
ddclass - DD class to inspect
property - Property to look for in the type or aspect definition
Returns:
DictionaryProperty describing the property definition or null if not found

getProperty

public DictionaryQuery.DictionaryProperty getProperty(java.lang.String ddclass,
                                                      java.lang.String property,
                                                      boolean includeDefaultAspects)
getProperty - return a single named property for the given dd class, optionally retrieve a property from the default aspects.

Parameters:
ddclass - DD class to inspect
property - Property to look for in the type or aspect definition
includeDefaultAspects - If true, check default aspects for the given property.
Returns:
DictionaryProperty describing the property definition or null if not found

getProperties

public DictionaryQuery.DictionaryProperty[] getProperties(java.lang.String ddclass)
getProperties - return all properties for the given dd class.

Parameters:
ddclass - DD class to inspect
Returns:
Array of DictionaryProperty objects describing the property definitions for the class. Can be empty but never null.

getProperties

public DictionaryQuery.DictionaryProperty[] getProperties(java.lang.String ddclass,
                                                          boolean includeDefaultAspects)
getProperties - return all properties for the given dd class.

Parameters:
ddclass - DD class to inspect
includeDefaultAspects - If true, also retrieve properties from the default aspects.
Returns:
Array of DictionaryProperty objects describing the property definitions for the class and default aspects. Can be empty but never null.

getAssociations

public DictionaryQuery.DictionaryAssoc[] getAssociations(java.lang.String ddclass)
getAssociations - return the target associations for the given dd class.

Parameters:
ddclass - DD class to inspect
Returns:
Array of DictionaryAssoc objects describing the target associations for the class. Can be empty but never null.

getChildAssociations

public DictionaryQuery.DictionaryAssoc[] getChildAssociations(java.lang.String ddclass)
getChildAssociations - return the child associations for the given dd class.

Parameters:
ddclass - DD class to inspect
Returns:
Array of DictionaryAssoc objects describing the child associations for the class. Can be empty but never null.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.