com.sapportals.wcm.app.xmlforms

Class ResourceUtils

java.lang.Object
  extended by com.sapportals.wcm.app.xmlforms.ResourceUtils

public class ResourceUtils
extends Object


Method Summary
 IResource createOrUpdateResource(IResourceContext resContext, ICollection c, String name, IContent content, IPropertyMap props)
          Create a resource, or update its content and properties, if it exists
 IResource createOrUpdateResource(IResourceContext resContext, com.sapportals.wcm.util.uri.RID rid, IContent content, IPropertyMap props)
          Create a resource, or update its content and properties, if it exists
 IResource createOrUpdateResource(IResourceContext resContext, String uri, IContent content, IPropertyMap props)
          Create a resource, or update its content and properties, if it exists
 IResource createOrUpdateResourceWithPropertyErrors(IResourceContext resContext, ICollection c, String name, IContent content, IPropertyMap props)
          Create a resource, or update its content and properties, if it exists.
 IResource createOrUpdateResourceWithPropertyErrors(IResourceContext resContext, com.sapportals.wcm.util.uri.RID rid, IContent content, IPropertyMap props)
          Create a resource, or update its content and properties, if it exists.
 IResource createOrUpdateResourceWithPropertyErrors(IResourceContext resContext, String uri, IContent content, IPropertyMap props)
          Create a resource, or update its content and properties, if it exists.
 IResource createResource(ICollection c, String name, IContent content, IPropertyMap props, IResourceContext resContext)
          Create a resource
 IResource createResource(IResourceContext resContext, com.sapportals.wcm.util.uri.RID rid, IContent content, IPropertyMap props)
          Create a resource
 IResource createResource(IResourceContext resContext, String uri, IContent content, IPropertyMap props)
          Create a resource
 boolean existsResource(IResourceContext resContext, com.sapportals.wcm.util.uri.RID rid)
          Checks if a resource exists
 boolean existsResource(IResourceContext resContext, String uri)
          Checks if a resource exists
 ICollection getCollection(IResourceContext resContext, com.sapportals.wcm.util.uri.RID rid)
          Get a collection by its RID.
static ResourceUtils getInstance()
           
 IResource getResource(IResourceContext resContext, com.sapportals.wcm.util.uri.RID rid)
          Get a resource by its RID
 IResource getResource(IResourceContext resContext, String uri)
          Get a resource by its URI
 IResource getResource(com.sapportals.wcm.util.uri.RID rid)
          Get a resource by its RID with the service context
 IResource getResource(String uri)
          Get a resource by its URI with the service context
 IResourceFactory getResourceFactory()
          Get a shared resource factory instance
 IResource getResourceNoException(IResourceContext resContext, com.sapportals.wcm.util.uri.RID rid)
          Get a resource by its RID, but do not throw an exception in error case
 IResource getResourceNoException(IResourceContext resContext, String uri)
          Get a resource by its URI, but do not throw an exception in error case
 IResource getResourceNoException(com.sapportals.wcm.util.uri.RID rid)
          Get a resource by its RID with the service context, but do not throw an exception in error case
 IResource getResourceNoException(String uri)
          Get a resource by its URI with the service context, but do not throw an exception in error case
 IResourceContext getServiceContext()
           
 InputStream getUnfilteredContentStream(IResource res)
          Get stream to resource content
 IResource updateResource(IResource resource, IContent content, IPropertyMap props)
          Update content and properties of an existing resource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ResourceUtils getInstance()
                                 throws XFException
Throws:
XFException

getResourceFactory

public IResourceFactory getResourceFactory()
Get a shared resource factory instance

Returns:
the resource factory

getResource

public IResource getResource(String uri)
                      throws XFException
Get a resource by its URI with the service context

Parameters:
uri - the resource URI
Returns:
an IResource, or null, if the resource does not exist
Throws:
XFException

getResource

public IResource getResource(com.sapportals.wcm.util.uri.RID rid)
                      throws XFException
Get a resource by its RID with the service context

Parameters:
rid - the resource RID
Returns:
an IResource, or null, if the resource does not exist
Throws:
XFException

getResource

public IResource getResource(IResourceContext resContext,
                             String uri)
                      throws XFException
Get a resource by its URI

Parameters:
resContext - the context to use
uri - the resource URI
Returns:
an IResource, or null, if the resource does not exist
Throws:
XFException

getResource

public IResource getResource(IResourceContext resContext,
                             com.sapportals.wcm.util.uri.RID rid)
                      throws XFException
Get a resource by its RID

Parameters:
resContext - the context to use
RID - the resource RID
Returns:
an IResource, or null, if the resource does not exist
Throws:
XFException

getCollection

public ICollection getCollection(IResourceContext resContext,
                                 com.sapportals.wcm.util.uri.RID rid)
                          throws XFException
Get a collection by its RID. If the collection does not exist, it is created.

Parameters:
resContext - the context to use
rid - the collection RID
Returns:
an ICollection representing the collectoin
Throws:
XFException

existsResource

public boolean existsResource(IResourceContext resContext,
                              String uri)
                       throws XFException
Checks if a resource exists

Parameters:
resContext - the context to use
uri - the resource URI
Returns:
true, if the resource exists, false otherwise
Throws:
XFException

existsResource

public boolean existsResource(IResourceContext resContext,
                              com.sapportals.wcm.util.uri.RID rid)
                       throws XFException
Checks if a resource exists

Parameters:
resContext - the context to use
rid - the resource RID
Returns:
true, if the resource exists, false otherwise
Throws:
XFException

getResourceNoException

public IResource getResourceNoException(IResourceContext resContext,
                                        String uri)
Get a resource by its URI, but do not throw an exception in error case

Parameters:
resContext - the context to use
uri - the resource URI
Returns:
an IResource, or null, if the resource does not exist, or if an error occurred

getResourceNoException

public IResource getResourceNoException(IResourceContext resContext,
                                        com.sapportals.wcm.util.uri.RID rid)
Get a resource by its RID, but do not throw an exception in error case

Parameters:
resContext - the context to use
rid - the resource RID
Returns:
an IResource, or null, if the resource does not exist, or if an error occurred

getResourceNoException

public IResource getResourceNoException(String uri)
Get a resource by its URI with the service context, but do not throw an exception in error case

Parameters:
uri - the resource URI
Returns:
an IResource, or null, if the resource does not exist, or if an error occurred

getResourceNoException

public IResource getResourceNoException(com.sapportals.wcm.util.uri.RID rid)
Get a resource by its RID with the service context, but do not throw an exception in error case

Parameters:
rid - the resource RID
Returns:
an IResource, or null, if the resource does not exist, or if an error occurred

createResource

public IResource createResource(ICollection c,
                                String name,
                                IContent content,
                                IPropertyMap props,
                                IResourceContext resContext)
                         throws XFException
Create a resource

Parameters:
c - the parent collection
name - the name of the new resource
content - the content of the new resource
props - the resource properties
Returns:
a handle to the new resource
Throws:
XFException

createResource

public IResource createResource(IResourceContext resContext,
                                String uri,
                                IContent content,
                                IPropertyMap props)
                         throws XFException
Create a resource

Parameters:
resContext - the context to use
uri - the URI of the new resource
content - the content of the new resource
props - the resource properties
Returns:
a handle to the new resource
Throws:
XFException

createResource

public IResource createResource(IResourceContext resContext,
                                com.sapportals.wcm.util.uri.RID rid,
                                IContent content,
                                IPropertyMap props)
                         throws XFException
Create a resource

Parameters:
resContext - the context to use
rid - the RID of the new resource
content - the content of the new resource
props - the resource properties
Returns:
a handle to the new resource
Throws:
XFException

createOrUpdateResource

public IResource createOrUpdateResource(IResourceContext resContext,
                                        ICollection c,
                                        String name,
                                        IContent content,
                                        IPropertyMap props)
                                 throws XFException
Create a resource, or update its content and properties, if it exists

Parameters:
resContext - the context to use
c - the parent collection
name - the new or existing resource name
content - the new resource content
props - the new resource properties
Returns:
a handle to the resource
Throws:
XFException

createOrUpdateResource

public IResource createOrUpdateResource(IResourceContext resContext,
                                        com.sapportals.wcm.util.uri.RID rid,
                                        IContent content,
                                        IPropertyMap props)
                                 throws XFException
Create a resource, or update its content and properties, if it exists

Parameters:
resContext - the context to use
rid - the RID of the new or existing resource
content - the new resource content
props - the new resource properties
Returns:
a handle to the resource
Throws:
XFException

createOrUpdateResource

public IResource createOrUpdateResource(IResourceContext resContext,
                                        String uri,
                                        IContent content,
                                        IPropertyMap props)
                                 throws XFException
Create a resource, or update its content and properties, if it exists

Parameters:
resContext - the context to use
uri - the URI of the new or existing resource
content - the new resource content
props - the new resource properties
Returns:
a handle to the resource
Throws:
XFException

updateResource

public IResource updateResource(IResource resource,
                                IContent content,
                                IPropertyMap props)
                         throws XFException
Update content and properties of an existing resource

Parameters:
resource - the resource to update
content - the new resource content
props - the new resource properties.
Returns:
a handle to the resource
Throws:
XFException

getUnfilteredContentStream

public InputStream getUnfilteredContentStream(IResource res)
                                       throws XFException
Get stream to resource content

Parameters:
res - handle to the resource
Returns:
InputStream to unfiltered resource content
Throws:
XFException

getServiceContext

public IResourceContext getServiceContext()
                                   throws XFException
Throws:
XFException

createOrUpdateResourceWithPropertyErrors

public IResource createOrUpdateResourceWithPropertyErrors(IResourceContext resContext,
                                                          ICollection c,
                                                          String name,
                                                          IContent content,
                                                          IPropertyMap props)
                                                   throws XFException,
                                                          AbstractPropertyException,
                                                          SetPropertiesException
Create a resource, or update its content and properties, if it exists. Throw property exceptions, if any.

Parameters:
resContext - the context to use
c - the parent collection
name - the new or existing resource name
content - the new resource content
props - the new resource properties
Returns:
a handle to the resource
Throws:
XFException
AbstractPropertyException
SetPropertiesException

createOrUpdateResourceWithPropertyErrors

public IResource createOrUpdateResourceWithPropertyErrors(IResourceContext resContext,
                                                          com.sapportals.wcm.util.uri.RID rid,
                                                          IContent content,
                                                          IPropertyMap props)
                                                   throws XFException,
                                                          AbstractPropertyException,
                                                          SetPropertiesException
Create a resource, or update its content and properties, if it exists. Throw property exceptions, if any.

Parameters:
resContext - the context to use
rid - the RID of the new or existing resource
content - the new resource content
props - the new resource properties
Returns:
a handle to the resource
Throws:
XFException
AbstractPropertyException
SetPropertiesException

createOrUpdateResourceWithPropertyErrors

public IResource createOrUpdateResourceWithPropertyErrors(IResourceContext resContext,
                                                          String uri,
                                                          IContent content,
                                                          IPropertyMap props)
                                                   throws XFException,
                                                          AbstractPropertyException,
                                                          SetPropertiesException
Create a resource, or update its content and properties, if it exists. Throw property exceptions, if any.

Parameters:
resContext - the context to use
uri - the URI of the new or existing resource
content - the new resource content
props - the new resource properties
Returns:
a handle to the resource
Throws:
XFException
AbstractPropertyException
SetPropertiesException
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM


Copyright 2012 SAP AG Complete Copyright Notice