com.wewebu.ow.server.ecmimpl.opencmis.object
Class OwCMISAbstractTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>

java.lang.Object
  extended by com.wewebu.ow.server.ecmimpl.opencmis.object.OwCMISAbstractTransientObject<N>
All Implemented Interfaces:
OwCMISTransientObject<N>
Direct Known Subclasses:
OwCMISBatchTransientObject, OwCMISBulkTransientObject

public abstract class OwCMISAbstractTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>
extends Object
implements OwCMISTransientObject<N>

Caches CmisObject properties to minimize the number of DMS repository accesses.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Field Summary
protected  OwCMISContextBoundObject<N> contextBoundObject
           
protected  org.apache.chemistry.opencmis.client.api.Session session
           
 
Constructor Summary
OwCMISAbstractTransientObject(N transientCmisObject, org.apache.chemistry.opencmis.client.api.OperationContext creationContext, org.apache.chemistry.opencmis.client.api.Session session)
           
 
Method Summary
protected  org.apache.chemistry.opencmis.client.api.OperationContext addFilter(org.apache.chemistry.opencmis.client.api.OperationContext context, Set<String> nativePropertyFilter)
           
 void detach()
          Detaches this transient object form the ECM CMIS repository.
protected  org.apache.chemistry.opencmis.client.api.Session getSession()
           
 N getTransientCmisObject()
           
 org.apache.chemistry.opencmis.client.api.OperationContext getTransientContext()
           
 boolean isDetached()
           
 void refresh(Collection<String> propertyNames)
          Refreshes the requested cached CMIS properties.
protected abstract  OwCMISContextBoundObject<N> retrieveProperties(Set<String> nativePropertyFilter)
           
 N secureObject(Collection<String> propertyNames)
          Make sure we have these properties cached.
 N secureObject(String... propertyNames)
           
 Map<String,org.apache.chemistry.opencmis.client.api.Property<?>> secureProperties(Collection<String> propertyNames)
           
 org.apache.chemistry.opencmis.client.api.Property<?> secureProperty(String propertyName)
          The property is first looked up in the cache, if not found it is loaded from the DMS repository.
 void setProperties(Map<String,Object> propertyValues)
          Persists to the CMIS-ECM and sets the mapped property values to the underlying TransientCmisObject.
protected  String toStringFilter(Set<String> nativePropertyFilter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected org.apache.chemistry.opencmis.client.api.Session session

contextBoundObject

protected OwCMISContextBoundObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject> contextBoundObject
Constructor Detail

OwCMISAbstractTransientObject

public OwCMISAbstractTransientObject(N transientCmisObject,
                                     org.apache.chemistry.opencmis.client.api.OperationContext creationContext,
                                     org.apache.chemistry.opencmis.client.api.Session session)
Method Detail

detach

public void detach()
Description copied from interface: OwCMISTransientObject
Detaches this transient object form the ECM CMIS repository. No CMIS server round-trip call will be performed on its caching or setting method calls.

Specified by:
detach in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>

isDetached

public boolean isDetached()
Specified by:
isDetached in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>

getSession

protected org.apache.chemistry.opencmis.client.api.Session getSession()

getTransientContext

public org.apache.chemistry.opencmis.client.api.OperationContext getTransientContext()
Specified by:
getTransientContext in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>
Returns:
the transient state creation context

getTransientCmisObject

public N getTransientCmisObject()
Specified by:
getTransientCmisObject in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>
Returns:
the TransientCmisObject state data

retrieveProperties

protected abstract OwCMISContextBoundObject<N> retrieveProperties(Set<String> nativePropertyFilter)
                                                                                                                                throws com.wewebu.ow.server.exceptions.OwException
Throws:
com.wewebu.ow.server.exceptions.OwException

toStringFilter

protected final String toStringFilter(Set<String> nativePropertyFilter)

addFilter

protected org.apache.chemistry.opencmis.client.api.OperationContext addFilter(org.apache.chemistry.opencmis.client.api.OperationContext context,
                                                                              Set<String> nativePropertyFilter)

secureObject

public N secureObject(String... propertyNames)
                                                                                    throws com.wewebu.ow.server.exceptions.OwException
Specified by:
secureObject in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>
Parameters:
propertyNames - CMIS property IDs that need to be secured
Returns:
the TransientCmisObject state data with the given properties secured
Throws:
com.wewebu.ow.server.exceptions.OwException

secureObject

public N secureObject(Collection<String> propertyNames)
                                                                                    throws com.wewebu.ow.server.exceptions.OwException
Make sure we have these properties cached.

Specified by:
secureObject in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>
Parameters:
propertyNames -
Returns:
the TransientCmisObject state data with the given properties secured
Throws:
com.wewebu.ow.server.exceptions.OwException

secureProperties

public Map<String,org.apache.chemistry.opencmis.client.api.Property<?>> secureProperties(Collection<String> propertyNames)
                                                                                  throws com.wewebu.ow.server.exceptions.OwException
Specified by:
secureProperties in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>
Parameters:
propertyNames - Collection of String (native property names)
Returns:
a map of (Native Name -> Native Property) values.
Throws:
com.wewebu.ow.server.exceptions.OwException

secureProperty

public org.apache.chemistry.opencmis.client.api.Property<?> secureProperty(String propertyName)
                                                                    throws com.wewebu.ow.server.exceptions.OwException
The property is first looked up in the cache, if not found it is loaded from the DMS repository.

Specified by:
secureProperty in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>
Parameters:
propertyName - native property name (not qualified)
Returns:
the property with the given name
Throws:
com.wewebu.ow.server.exceptions.OwException - If the property is not defined for this object or it could not be retrieved from the DMS repository.

refresh

public void refresh(Collection<String> propertyNames)
Description copied from interface: OwCMISTransientObject
Refreshes the requested cached CMIS properties.

Specified by:
refresh in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>

setProperties

public void setProperties(Map<String,Object> propertyValues)
Description copied from interface: OwCMISTransientObject
Persists to the CMIS-ECM and sets the mapped property values to the underlying TransientCmisObject.

Specified by:
setProperties in interface OwCMISTransientObject<N extends org.apache.chemistry.opencmis.client.api.TransientCmisObject>


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.