org.alfresco.repo.webservice
Class Utils

java.lang.Object
  extended by org.alfresco.repo.webservice.Utils

public class Utils
extends java.lang.Object

Helper class used by the web services


Field Summary
static int DEFAULT_BATCH_SIZE
          Default batch size for query results - 1000
static java.lang.String QUERY_LANG_CQL
           
static java.lang.String QUERY_LANG_LUCENE
          Query language names
static java.lang.String QUERY_LANG_XPATH
           
static java.lang.String REPOSITORY_SERVICE_NAMESPACE
           
 
Method Summary
static org.alfresco.service.cmr.repository.NodeRef convertToNodeRef(org.alfresco.repo.webservice.types.ParentReference parentRef, org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.search.SearchService searchService, org.alfresco.service.namespace.NamespaceService namespaceService)
          Converts the given ParentReference web service type into a repository NodeRef
static org.alfresco.service.cmr.repository.NodeRef convertToNodeRef(org.alfresco.repo.webservice.types.Reference ref, org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.search.SearchService searchService, org.alfresco.service.namespace.NamespaceService namespaceService)
          Converts the given Reference web service type into a repository NodeRef
static org.alfresco.repo.webservice.types.Reference convertToReference(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.namespace.NamespaceService namespaceService, org.alfresco.service.cmr.repository.NodeRef node)
          Converts the given repository NodeRef object into a web service Reference type
static org.alfresco.repo.webservice.types.Store convertToStore(org.alfresco.service.cmr.repository.StoreRef ref)
          Converts a store reference ot a Store type
static org.alfresco.service.cmr.repository.StoreRef convertToStoreRef(org.alfresco.repo.webservice.types.Store store)
          Converts the web service Store type to a StoreRef used by the repository
static org.alfresco.repo.webservice.types.Version convertToVersion(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.namespace.NamespaceService namespaceService, org.alfresco.service.cmr.version.Version version)
          Converts a repository version object into a web service version object.
static org.alfresco.repo.webservice.types.NamedValue createNamedValue(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService, org.alfresco.service.namespace.QName propertyName, java.io.Serializable propertyValue)
          Create a named value object from the property name and value informaiton
static int getBatchSize(org.apache.axis.MessageContext msgContext)
          Returns the value of the fetchSize from the QueryConfiguration SOAP header (if present)
static org.alfresco.repo.transaction.RetryingTransactionHelper getRetryingTransactionHelper(org.apache.axis.MessageContext msgContext)
          Get the executer to wrap transactional callbacks in for better transaction behaviour.
static java.lang.String getSessionId()
          Gets the current http session id
static org.springframework.web.context.WebApplicationContext getSpringContext(org.apache.axis.MessageContext msgContext)
          Returns the current Spring WebApplicationContext object
static javax.transaction.UserTransaction getUserTransaction(org.apache.axis.MessageContext msgContext)
          Deprecated. Use Utils.getRetryingTransactionHelper(MessageContext)
static java.io.Serializable getValueFromNamedValue(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService, org.alfresco.service.namespace.QName propertyName, org.alfresco.repo.webservice.types.NamedValue namedValue)
          Utility method to convert from a string representation of a property value into the correct object representation.
static java.util.List resolvePredicate(org.alfresco.repo.webservice.types.Predicate predicate, org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.search.SearchService searchService, org.alfresco.service.namespace.NamespaceService namespaceService)
          Resolves the given predicate into a list of NodeRefs that can be acted upon
static org.alfresco.service.cmr.repository.NodeRef resolveToNodeRef(org.alfresco.repo.webservice.types.Store store, java.lang.String uuid, java.lang.String path, org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.search.SearchService searchService, org.alfresco.service.namespace.NamespaceService namespaceService)
          Resolves the given parameters to a repository NodeRef
static org.alfresco.repo.webservice.types.AssociationDefinition setupAssociationDefObject(org.alfresco.service.cmr.dictionary.AssociationDefinition ddAssocDef)
          Creates an AssociationDefinition web service type object for the given repository AssociationDefinition
static org.alfresco.repo.webservice.types.ClassDefinition setupClassDefObject(org.alfresco.service.cmr.dictionary.ClassDefinition ddClassDef)
          Creates a ClassDefinition web service type object for the given repository ClassDefinition
static org.alfresco.repo.webservice.types.PropertyDefinition setupPropertyDefObject(org.alfresco.service.cmr.dictionary.PropertyDefinition ddPropDef)
          Creates a PropertyDefinition web service type object for the given repository PropertyDefinition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BATCH_SIZE

public static final int DEFAULT_BATCH_SIZE
Default batch size for query results - 1000

See Also:
Constant Field Values

REPOSITORY_SERVICE_NAMESPACE

public static final java.lang.String REPOSITORY_SERVICE_NAMESPACE
See Also:
Constant Field Values

QUERY_LANG_LUCENE

public static final java.lang.String QUERY_LANG_LUCENE
Query language names

See Also:
Constant Field Values

QUERY_LANG_XPATH

public static final java.lang.String QUERY_LANG_XPATH
See Also:
Constant Field Values

QUERY_LANG_CQL

public static final java.lang.String QUERY_LANG_CQL
See Also:
Constant Field Values
Method Detail

getValueFromNamedValue

public static java.io.Serializable getValueFromNamedValue(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService,
                                                          org.alfresco.service.namespace.QName propertyName,
                                                          org.alfresco.repo.webservice.types.NamedValue namedValue)
Utility method to convert from a string representation of a property value into the correct object representation.

Parameters:
dictionaryService - the dictionary service
propertyName - the qname of the property in question
propertyValue - the property vlaue as a string
Returns:
the object value of the property

createNamedValue

public static org.alfresco.repo.webservice.types.NamedValue createNamedValue(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService,
                                                                             org.alfresco.service.namespace.QName propertyName,
                                                                             java.io.Serializable propertyValue)
Create a named value object from the property name and value informaiton

Parameters:
dictionaryService - the dictionary service
propertyName - the property qname
propertyValue - the property value
Returns:
the namedValue object

convertToStoreRef

public static org.alfresco.service.cmr.repository.StoreRef convertToStoreRef(org.alfresco.repo.webservice.types.Store store)
Converts the web service Store type to a StoreRef used by the repository

Parameters:
store - The Store to convert
Returns:
The converted StoreRef

convertToStore

public static org.alfresco.repo.webservice.types.Store convertToStore(org.alfresco.service.cmr.repository.StoreRef ref)
Converts a store reference ot a Store type

Parameters:
ref - the store reference
Returns:
the store

convertToNodeRef

public static org.alfresco.service.cmr.repository.NodeRef convertToNodeRef(org.alfresco.repo.webservice.types.Reference ref,
                                                                           org.alfresco.service.cmr.repository.NodeService nodeService,
                                                                           org.alfresco.service.cmr.search.SearchService searchService,
                                                                           org.alfresco.service.namespace.NamespaceService namespaceService)
Converts the given Reference web service type into a repository NodeRef

Parameters:
ref - The Reference to convert
Returns:
The NodeRef representation of the Reference

convertToNodeRef

public static org.alfresco.service.cmr.repository.NodeRef convertToNodeRef(org.alfresco.repo.webservice.types.ParentReference parentRef,
                                                                           org.alfresco.service.cmr.repository.NodeService nodeService,
                                                                           org.alfresco.service.cmr.search.SearchService searchService,
                                                                           org.alfresco.service.namespace.NamespaceService namespaceService)
Converts the given ParentReference web service type into a repository NodeRef

Parameters:
parentRef - The ParentReference to convert
Returns:
The NodeRef representation of the ParentReference

convertToReference

public static org.alfresco.repo.webservice.types.Reference convertToReference(org.alfresco.service.cmr.repository.NodeService nodeService,
                                                                              org.alfresco.service.namespace.NamespaceService namespaceService,
                                                                              org.alfresco.service.cmr.repository.NodeRef node)
Converts the given repository NodeRef object into a web service Reference type

Parameters:
node - The node to create a Reference for
Returns:
The Reference

resolveToNodeRef

public static org.alfresco.service.cmr.repository.NodeRef resolveToNodeRef(org.alfresco.repo.webservice.types.Store store,
                                                                           java.lang.String uuid,
                                                                           java.lang.String path,
                                                                           org.alfresco.service.cmr.repository.NodeService nodeService,
                                                                           org.alfresco.service.cmr.search.SearchService searchService,
                                                                           org.alfresco.service.namespace.NamespaceService namespaceService)
Resolves the given parameters to a repository NodeRef

Parameters:
store - The Store to search within
uuid - The id of the required node.c
path - The path to the required node. If a uuid is given the uuid is used + * to find the node. Otherwise, the path is used.
nodeService - NodeService to use
searchService - SearchService to use
namespaceService - NamespaceService to use
Returns:
A repository NodeRef

resolvePredicate

public static java.util.List resolvePredicate(org.alfresco.repo.webservice.types.Predicate predicate,
                                              org.alfresco.service.cmr.repository.NodeService nodeService,
                                              org.alfresco.service.cmr.search.SearchService searchService,
                                              org.alfresco.service.namespace.NamespaceService namespaceService)
Resolves the given predicate into a list of NodeRefs that can be acted upon

Parameters:
predicate - The predicate passed from the client
nodeService - NodeService to use
searchService - SearchService to use
namespaceService - NamespaceService to use
Returns:
A List of NodeRef objects

getSpringContext

public static org.springframework.web.context.WebApplicationContext getSpringContext(org.apache.axis.MessageContext msgContext)
Returns the current Spring WebApplicationContext object

Parameters:
msgContext - SOAP message context
Returns:
The Spring WebApplicationContext

getUserTransaction

public static javax.transaction.UserTransaction getUserTransaction(org.apache.axis.MessageContext msgContext)
Deprecated. Use Utils.getRetryingTransactionHelper(MessageContext)

Returns a UserTransaction that can be used within a service call

Parameters:
msgContext - SOAP message context
Returns:
a UserTransaction

getRetryingTransactionHelper

public static org.alfresco.repo.transaction.RetryingTransactionHelper getRetryingTransactionHelper(org.apache.axis.MessageContext msgContext)
Get the executer to wrap transactional callbacks in for better transaction behaviour.

Parameters:
msgContext - SOAP message context
Returns:
a transactional, retrying, callback executer

getSessionId

public static java.lang.String getSessionId()
Gets the current http session id

Returns:
the current http session id, null if none found

getBatchSize

public static int getBatchSize(org.apache.axis.MessageContext msgContext)
Returns the value of the fetchSize from the QueryConfiguration SOAP header (if present)

Parameters:
msgContext - The SOAP MessageContext
Returns:
The current batch size or -1 if the header is not present

convertToVersion

public static org.alfresco.repo.webservice.types.Version convertToVersion(org.alfresco.service.cmr.repository.NodeService nodeService,
                                                                          org.alfresco.service.namespace.NamespaceService namespaceService,
                                                                          org.alfresco.service.cmr.version.Version version)
Converts a repository version object into a web service version object.

Parameters:
version - the repository version object
Returns:
the web service version object

setupClassDefObject

public static org.alfresco.repo.webservice.types.ClassDefinition setupClassDefObject(org.alfresco.service.cmr.dictionary.ClassDefinition ddClassDef)
Creates a ClassDefinition web service type object for the given repository ClassDefinition

Parameters:
ddClassDef - The repository ClassDefinition to generate
Returns:
The web service ClassDefinition representation

setupPropertyDefObject

public static org.alfresco.repo.webservice.types.PropertyDefinition setupPropertyDefObject(org.alfresco.service.cmr.dictionary.PropertyDefinition ddPropDef)
Creates a PropertyDefinition web service type object for the given repository PropertyDefinition

Parameters:
ddPropertyDef - The repository PropertyDefinition to generate
Returns:
The web service PropertyDefinition representation

setupAssociationDefObject

public static org.alfresco.repo.webservice.types.AssociationDefinition setupAssociationDefObject(org.alfresco.service.cmr.dictionary.AssociationDefinition ddAssocDef)
Creates an AssociationDefinition web service type object for the given repository AssociationDefinition

Parameters:
ddAssociationDef - The repository AssociationDefinition to generate
Returns:
The web service AssociationDefinition representation


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