+

Search Tips   |   Advanced Search


com.ibm.workplace.wcm.api
Class WebContentLibraryService

 java.lang.Object
  extended by com.ibm.wps.services.Service
      extended by com.ibm.workplace.wcm.api.WebContentLibraryService

public abstract class WebContentLibraryService
extends com.ibm.wps.services.Service

WebContentLibraryService enables access to Web Content Library methods through Portal services. To ensure that the service is available at runtime, the following line must be added to the services.properties file (<WPS profile home>\PortalServer\config\config\services.properties):

com.ibm.workplace.wcm.api.WebContentLibraryService = com.ibm.workplace.wcm.api.WebContentLibraryServiceImpl

Here is an example of how to retrieve the WebContentLibraryService:

 try
 {
    // Construct and inital Context
    InitialContext ctx = new InitialContext();

    // Retrieve WebContentLibraryService using JNDI name
    WebContentLibraryService webContentLibraryService = (WebContentLibraryService) ctx.lookup("portal:service/wcm/WebContentLibraryService");
 }
 catch (NamingException ne)
 {
    System.out.print("Naming Exception: " + ne);
 }
 


Constructor Summary
WebContentLibraryService()
          Constructor
 
Method Summary
abstract  LibraryTaskResult copyLibraries(Workspace workspace, DocumentLibrary[] documentLibraries)
          Copies the supplied document libraries as new libraries.
abstract  LibraryTaskResult copyLibraries(Workspace workspace, DocumentLibrary[] documentLibraries, java.util.Locale locale)
          Copies the supplied document libraries as new libraries with the specified Locale.
abstract  LibraryTaskResult copyLibrary(Workspace workspace, DocumentLibrary documentLibrary, java.util.Locale locale)
          Copies the supplied document library as a new library.
abstract  DocumentLibrary createLibrary(Workspace workspace, java.util.Locale locale)
          Creates a new Library.
abstract  LibraryTaskResult deleteLibrary(Workspace workspace, DocumentLibrary documentLibrary)
          Deletes the DocumentLibrary.
abstract  LibraryTaskResult exportLibraryToStream(Workspace workspace, DocumentLibrary documentLibrary, java.io.OutputStream outputStream)
          Export a document library to the supplied output stream.
abstract  LibraryTaskResult importLibraryFromStream(Workspace workspace, java.io.InputStream inputStream, java.util.Locale locale)
          Import document library from the supplied input stream as a new library.
abstract  LibraryTaskResult outputDocumentListModifiedBetweenToStream(Workspace workspace, java.lang.String libraryName, java.util.Date startDate, java.util.Date endDate, DocumentListWriter out, java.util.Locale locale)
          Export a list of all items modified between the specified dates to the passed character stream.
abstract  LibraryTaskResult outputDocumentListModifiedSinceToStream(Workspace workspace, java.lang.String libraryName, java.util.Date modifiedDate, DocumentListWriter out, java.util.Locale locale)
          Export a list of all items modified since the specified date to the passed character stream.
abstract  LibraryTaskResult outputDocumentListToStream(Workspace workspace, java.lang.String libraryName, DocumentListWriter out, java.util.Locale locale)
          Export a list of all items in a document library to the passed character stream.
abstract  void saveLibrary(Workspace workspace, DocumentLibrary documentLibrary)
          Save the DocumentLibrary.
 
Methods inherited from class com.ibm.wps.services.Service
inspect
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebContentLibraryService

 public WebContentLibraryService()
Constructor

Method Detail

createLibrary

 public abstract DocumentLibrary createLibrary(Workspace workspace,
                                              java.util.Locale locale)
                                       throws java.lang.UnsupportedOperationException
Creates a new Library.
The DocumentLibrary object returned by this method will have a system defined title. This title can then be changed by calling DocumentLibrary.setTitle().

Parameters:
workspace - The workspace
locale - locale of the library to be created
Returns:
DocumentLibrary object
Throws:
java.lang.UnsupportedOperationException - If the operation is not supported

saveLibrary

 public abstract void saveLibrary(Workspace workspace,
                                 DocumentLibrary documentLibrary)
                          throws LibraryCreationException,
                                 java.lang.UnsupportedOperationException
Save the DocumentLibrary. If the document library is new, a library will be created.

Parameters:
workspace - The workspace
documentLibrary - document library object to be saved
Throws:
LibraryCreationException - If an error occurred creating the library
java.lang.UnsupportedOperationException - If the operation is not supported

deleteLibrary

 public abstract LibraryTaskResult deleteLibrary(Workspace workspace,
                                                DocumentLibrary documentLibrary)
                                         throws OperationFailedException,
                                                AuthorizationException,
                                                java.lang.UnsupportedOperationException
Deletes the DocumentLibrary. This task will be executed synchronously.
Calling LibraryTaskResult.getDocumentLibraries() will always return an empty array.

Parameters:
workspace - The workspace
documentLibrary - the DocumentLibrary to delete
Returns:
a LibraryTaskResult object representing the result of this delete operation.
Throws:
OperationFailedException - If the library could not be found
AuthorizationException - If sufficient authority to delete the library is not present
java.lang.UnsupportedOperationException - If the operation is not supported

copyLibrary

 public abstract LibraryTaskResult copyLibrary(Workspace workspace,
                                              DocumentLibrary documentLibrary,
                                              java.util.Locale locale)
                                       throws OperationFailedException,
                                              LibraryCreationException,
                                              java.lang.UnsupportedOperationException
Copies the supplied document library as a new library.
The LibraryTaskResult object returned by this method contains the newly created library. To retrieve the DocumentLibrary use the following code:
DocumentLibrary[] copiedDocumentLibraries = (DocumentLibrary[]) LibraryTaskResult.getDocumentLibraries();
If the LibraryTaskResult does not indicate a successful copy, the unsuccessfully copied library can be retrieved by calling (DocumentLibrary[]) LibraryTaskResult.getDocumentLibraries(). The library can then be deleted.
The DocumentLibrary is created with a system defined title. The title can then be changed by calling DocumentLibrary.setTitle()

Parameters:
workspace - The workspace
documentLibrary - Source document library
locale - Locale of the new library
Returns:
LibraryTaskResult object that representing the result of this copy operation.
Throws:
OperationFailedException - If a repository related exception occurred
LibraryCreationException - If an error occurred creating the library
java.lang.UnsupportedOperationException - If the operation is not supported

copyLibraries

 public abstract LibraryTaskResult copyLibraries(Workspace workspace,
                                                DocumentLibrary[] documentLibraries)
                                         throws OperationFailedException,
                                                java.lang.UnsupportedOperationException
Copies the supplied document libraries as new libraries. Assigns unique names to the new libraries. Uses the original locales from the source document libraries.
The LibraryTaskResult object returned by this method contains the libraries that were created during this operation.
If the LibraryTaskResult indicates a successful copy, the successfully copied libraries can be retrieved by calling (DocumentLibrary[]) LibraryTaskResult.getDocumentLibraries().
If the LibraryTaskResult does not indicate a successful copy, the libraries that were created during the operation can be retrieved by calling (DocumentLibraries[]) LibraryTaskResult.getResult(). All libraries returned on an unsuccessful copy can then be deleted.
The titles of libraries created during this operation can then be changed by calling DocumentLibrary.setTitle() for each DocumentLibrary.

Parameters:
workspace - The workspace
documentLibraries - Source document libraries.
Returns:
LibraryTaskResult object representing the result of this copy operation.
Throws:
OperationFailedException - If a repository related exception occurred
java.lang.UnsupportedOperationException - If the operation is not supported

copyLibraries

 public abstract LibraryTaskResult copyLibraries(Workspace workspace,
                                                DocumentLibrary[] documentLibraries,
                                                java.util.Locale locale)
                                         throws OperationFailedException,
                                                java.lang.UnsupportedOperationException
Copies the supplied document libraries as new libraries with the specified Locale. Assigns unique names to the new libraries.
The LibraryTaskResult object returned by this method contains the libraries that were created during this operation.
If the LibraryTaskResult indicates a successful copy, the successfully copied libraries can be retrieved by calling (DocumentLibrary[]) LibraryTaskResult.getDocumentLibraries().
If the LibraryTaskResult does not indicate a successful copy, the libraries that were created during the operation can be retrieved by calling (DocumentLibrary[]) LibraryTaskResult.getDocumentLibraries(). All libraries returned on an unsuccessful copy can then be deleted.
The titles of libraries created during this operation can then be changed by calling DocumentLibrary.setTitle() for each DocumentLibrary.

Parameters:
workspace - The workspace
documentLibraries - Source document libraries.
locale - Locale to use for all new libraries.
Returns:
LibraryTaskResult object representing the result of this copy operation.
Throws:
OperationFailedException - If a repository related exception occurred
java.lang.UnsupportedOperationException - If the operation is not supported

exportLibraryToStream

 public abstract LibraryTaskResult exportLibraryToStream(Workspace workspace,
                                                        DocumentLibrary documentLibrary,
                                                        java.io.OutputStream outputStream)
                                                 throws OperationFailedException,
                                                        java.lang.UnsupportedOperationException
Export a document library to the supplied output stream. This task will be executed synchronously.
Calling LibraryTaskResult.getDocumentLibraries() will always return an empty array.

Parameters:
workspace - The workspace
documentLibrary - Source document library
outputStream - Output stream to export to
Returns:
LibraryTaskResult object representing the result of this export operation.
Throws:
OperationFailedException - if a repository related exception occurred
java.lang.UnsupportedOperationException - if the operation is not supported

importLibraryFromStream

 public abstract LibraryTaskResult importLibraryFromStream(Workspace workspace,
                                                          java.io.InputStream inputStream,
                                                          java.util.Locale locale)
                                                   throws OperationFailedException,
                                                          LibraryCreationException,
                                                          java.lang.UnsupportedOperationException
Import document library from the supplied input stream as a new library. This task will be executed synchronously.

If LibraryTaskResult indicates a successful import, calling (DocumentLibrary[]) LibraryTaskResult.getDocumentLibraries() returns the successfully imported library.

If LibraryTaskResult does not indicate a successful import, calling (DocumentLibrary[]) LibraryTaskResult.getDocumentLibraries(); will return the the newly created library. The library can then be deleted.

Parameters:
workspace - The workspace
inputStream - Input stream to read data from
locale - Locale of the new library
Returns:
LibraryTaskResult object representing the result of this import operation.
Throws:
OperationFailedException - If a repository related exception occurred
LibraryCreationException - If an error occurred creating the library
java.lang.UnsupportedOperationException - If the operation is not supported

outputDocumentListToStream

 public abstract LibraryTaskResult outputDocumentListToStream(Workspace workspace,
                                                             java.lang.String libraryName,
                                                             DocumentListWriter out,
                                                             java.util.Locale locale)
                                                      throws OperationFailedException,
                                                             java.lang.UnsupportedOperationException
Export a list of all items in a document library to the passed character stream. This task will be executed synchronously and depending on the number of items in the document library can take longer to finish.
The following information / properties are written to the DocumentListWriter for each document item in this order:
  1. Name of the library
  2. ID of the document item
  3. Name of the document item
  4. Non-localized English name of the document item type
  5. Localized name of the document item type
  6. Timestamp of last modification of the document item
  7. Integer that indicates the current workflow status of the item (0 - Draft, 1 - Published, 2 - Expired, 3 - Deleted)
  8. Localized value for current workflow state of the item

Parameters:
workspace - The workspace
libraryName - The title of the document library to export the list for
out - DocumentListWriter object the list is written to and that handles the format of the written list.
locale - The locale used to localize
Returns:
LibraryTaskResult object representing the result of this operation.
Throws:
OperationFailedException - If a repository related exception occurred
java.lang.UnsupportedOperationException - If the operation is not supported

outputDocumentListModifiedSinceToStream

 public abstract LibraryTaskResult outputDocumentListModifiedSinceToStream(Workspace workspace,
                                                                          java.lang.String libraryName,
                                                                          java.util.Date modifiedDate,
                                                                          DocumentListWriter out,
                                                                          java.util.Locale locale)
                                                                   throws OperationFailedException,
                                                                          java.lang.UnsupportedOperationException
Export a list of all items modified since the specified date to the passed character stream. This task will be executed synchronously and depending on the number of items in the document library can take longer to finish.
The following information / properties are written to the DocumentListWriter for each document item in this order:
  1. Name of the library
  2. ID of the document item
  3. Name of the document item
  4. Non-localized English name of the document item type
  5. Localized name of the document item type
  6. Timestamp of last modification of the document item
  7. Integer that indicates the current workflow status of the item (0 - Draft, 1 - Published, 2 - Expired, 3 - Deleted)
  8. Localized value for current workflow state of the item

Parameters:
workspace - The workspace
libraryName - The title of the document library to export the list for
modifiedDate - limits the result to documents modified since the given date.
out - DocumentListWriter object the list is written to and that handles the format of the written list.
locale - The locale used to localize
Returns:
LibraryTaskResult object representing the result of this operation.
Throws:
OperationFailedException - If a repository related exception occurred
java.lang.UnsupportedOperationException - If the operation is not supported

outputDocumentListModifiedBetweenToStream

 public abstract LibraryTaskResult outputDocumentListModifiedBetweenToStream(Workspace workspace,
                                                                            java.lang.String libraryName,
                                                                            java.util.Date startDate,
                                                                            java.util.Date endDate,
                                                                            DocumentListWriter out,
                                                                            java.util.Locale locale)
                                                                     throws OperationFailedException,
                                                                            java.lang.UnsupportedOperationException
Export a list of all items modified between the specified dates to the passed character stream. This task will be executed synchronously and depending on the number of items in the document library can take longer to finish.
The following information / properties are written to the DocumentListWriter for each document item in this order:
  1. Name of the library
  2. ID of the document item
  3. Name of the document item
  4. Non-localized English name of the document item type
  5. Localized name of the document item type
  6. Timestamp of last modification of the document item
  7. Integer that indicates the current workflow status of the item (0 - Draft, 1 - Published, 2 - Expired, 3 - Deleted)
  8. Localized value for current workflow state of the item

Parameters:
workspace - The workspace
libraryName - The title of the document library to export the list for
startDate - the date at the beginning of the range
endDate - the data at the end of the range
out - DocumentListWriter object the list is written to and that handles the format of the written list.
locale - The locale used to localize
Returns:
LibraryTaskResult object representing the result of this operation.
Throws:
OperationFailedException - If a repository related exception occurred
java.lang.UnsupportedOperationException - If the operation is not supported