Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.workplace.wcm.api
Interface WcmLibraryService

    public interface WcmLibraryService

WcmLibraryService enables access to Web Content Library methods through Portal services. `com.ibm.workplace.wcm.api.WcmLibraryService = com.ibm.workplace.wcm.api.WcmLibraryServiceImpl`

Here is an example of how to retrieve the `WcmLibraryService`:``

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

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

Since:
  8.5

Field Summary
`static java.lang.String` | `JNDI_NAME` JNDI name of this service

Method Summary
`void` | `addItemToFolder(Workspace workspace, Folder destination, Item item)` Deprecated. Use Folder.addDocument instead
`LibraryTaskResult` | `copyLibraries(Workspace workspace, DocumentLibrary[] documentLibraries)` Copies the supplied document libraries as new libraries.
`LibraryTaskResult` | `copyLibraries(Workspace workspace, DocumentLibrary[] documentLibraries, java.util.Locale locale)` Copies the supplied document libraries as new libraries with the specified `Locale`.
`LibraryTaskResult` | `copyLibrary(Workspace workspace, DocumentLibrary documentLibrary, java.util.Locale locale)` Copies the supplied document library as a new library.
`Folder` | `createFolder(Workspace workspace, Folder parentFolder)` Deprecated. Use Workspace.createFolder instead
`DocumentLibrary` | `createLibrary(Workspace workspace, java.util.Locale locale)` Creates a new `Library`.
`void` | `deleteFolder(Workspace workspace, Item folderId)` Deprecated. Use Workspace.purge instead
`LibraryTaskResult` | `deleteLibrary(Workspace workspace, DocumentLibrary documentLibrary)` Deletes the `DocumentLibrary`.
`LibraryTaskResult` | `exportLibrariesToStream(Workspace workspace, DocumentLibrary[] documentLibraries, java.io.OutputStream outputStream)` Export a group of document libraries to the supplied output stream.
`LibraryTaskResult` | `exportLibraryToStream(Workspace workspace, DocumentLibrary documentLibrary, java.io.OutputStream outputStream)` Export a document library to the supplied output stream.
`Folder` | `getFolderById(Workspace workspace, Identity folderId)` Deprecated. Use Workspace.getById instead
`Folder` | `getFolderByPath(Workspace workspace, java.lang.String folderPath)` Obtain a folder with the specified path.
`Folder` | `getFolderByRelativePath(Workspace workspace, java.lang.String folderPath, PresetFolderType type)` Obtain a folder with the specified folderPath on the library currently set on the specified workspace, with a specific preset type of `PresetFolderType` type For example, the following will return a nested folder named '32x32' within the "Intranet" library, of the Components view. DocumentLibrary library = workspace.getDocumentLibrary("Intranet"); workspace.setCurrentDocumentLibrary(library); Folder folder = WcmLibraryService.getFolderByRelativePath(workspace, "images/logo/32x32", PresetFolderType.COMPONENT)
`Folder` | `getPresetFolder(Workspace workspace, DocumentLibrary library, PresetFolderType type)` Deprecated. Use DocumentLibrary.getPresetFolder instead
`LibraryTaskResult` | `importLibraryFromStream(Workspace workspace, java.io.InputStream inputStream, java.util.Locale locale)` Import document library from the supplied input stream as a new library.
`void` | `moveItemToFolder(Workspace workspace, Folder destination, Item item)` Deprecated. Use Workspace.move instead
`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.
`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.
`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.
`void` | `saveFolder(Workspace workspace, Folder folder)` Deprecated. Use Workspace.save instead
`void` | `saveLibrary(Workspace workspace, DocumentLibrary documentLibrary)` Save the `DocumentLibrary`.

Field Detail

### JNDI_NAME

    static final java.lang.String JNDI_NAME

  JNDI name of this service

  See Also:
    Constant Field Values

Method Detail

### createLibrary

    DocumentLibrary createLibrary(Workspace workspace,
                                  java.util.Locale locale)

  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

### saveLibrary

    void saveLibrary(Workspace workspace,
                     DocumentLibrary documentLibrary)
                     throws LibraryCreationException

  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

### deleteLibrary

    LibraryTaskResult deleteLibrary(Workspace workspace,
                                    DocumentLibrary documentLibrary)
                                    throws AuthorizationException,
                                           OperationFailedException

  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:
    `AuthorizationException` - If sufficient authority to delete the library is not present
    `OperationFailedException` - If the library could not be found

### copyLibrary

    LibraryTaskResult copyLibrary(Workspace workspace,
                                  DocumentLibrary documentLibrary,
                                  java.util.Locale locale)
                                  throws OperationFailedException,
                                         LibraryCreationException

  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

### copyLibraries

    LibraryTaskResult copyLibraries(Workspace workspace,
                                    DocumentLibrary[] documentLibraries)
                                    throws OperationFailedException

  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

### copyLibraries

    LibraryTaskResult copyLibraries(Workspace workspace,
                                    DocumentLibrary[] documentLibraries,
                                    java.util.Locale locale)
                                    throws OperationFailedException

  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

### exportLibraryToStream

    LibraryTaskResult exportLibraryToStream(Workspace workspace,
                                            DocumentLibrary documentLibrary,
                                            java.io.OutputStream outputStream)
                                            throws OperationFailedException

  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

### exportLibrariesToStream

    LibraryTaskResult exportLibrariesToStream(Workspace workspace,
                                              DocumentLibrary[] documentLibraries,
                                              java.io.OutputStream outputStream)
                                              throws OperationFailedException

  Export a group of document libraries to the supplied output stream. This task will be executed synchronously.
  Calling `LibraryTaskResult.getDocumentLibraries()` will always return an empty array.

  Parameters:
    `workspace` - The workspace
    `documentLibraries` - Source document libraries
    `outputStream` - Output stream to export to
  Returns:
    `LibraryTaskResult` object representing the result of this export operation.
  Throws:
    `OperationFailedException` - if a repository related exception occurred
  Since:
    8.0

### importLibraryFromStream

    LibraryTaskResult importLibraryFromStream(Workspace workspace,
                                              java.io.InputStream inputStream,
                                              java.util.Locale locale)
                                              throws OperationFailedException,
                                                     LibraryCreationException

  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

### outputDocumentListToStream

    LibraryTaskResult outputDocumentListToStream(Workspace workspace,
                                                 java.lang.String libraryName,
                                                 DocumentListWriter out,
                                                 java.util.Locale locale)
                                                 throws OperationFailedException

  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

### outputDocumentListModifiedSinceToStream

    LibraryTaskResult outputDocumentListModifiedSinceToStream(Workspace workspace,
                                                              java.lang.String libraryName,
                                                              java.util.Date modifiedDate,
                                                              DocumentListWriter out,
                                                              java.util.Locale locale)
                                                              throws OperationFailedException

  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

### outputDocumentListModifiedBetweenToStream

    LibraryTaskResult outputDocumentListModifiedBetweenToStream(Workspace workspace,
                                                                java.lang.String libraryName,
                                                                java.util.Date startDate,
                                                                java.util.Date endDate,
                                                                DocumentListWriter out,
                                                                java.util.Locale locale)
                                                                throws OperationFailedException

  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

### getPresetFolder

    Folder getPresetFolder(Workspace workspace,
                           DocumentLibrary library,
                           PresetFolderType type)
                           throws AuthorizationException,
                                  DocumentRetrievalException

  Deprecated. Use DocumentLibrary.getPresetFolder instead

  Obtain a preset folders, which the given DocumentLibrary has, for the given class. Useful when creating a folder directly under library.

  Parameters:
    `workspace` - workspace
    `library` - to get preset folder from.
    `type` - class for the wanted preset folder.
  Returns:
    preset folder for the class, null if no folder for the class exits.
  Throws:
    `AuthorizationException`
    `DocumentRetrievalException`
  Since:
    7.0
  See Also:
    `DocumentLibrary.getPresetFolder(PresetFolderType)`

### createFolder

    Folder createFolder(Workspace workspace,
                        Folder parentFolder)
                        throws AuthorizationException,
                               DocumentCreationException

  Deprecated. Use Workspace.createFolder instead

  Create a folder object under the specified parent folder. Note saveFolder() need called to actually save created folder into repository.

  Parameters:
    `workspace` - workspace for this operation.
    `parentFolder` - parent folder id
  Returns:
    created folder.
  Throws:
    `AuthorizationException` - if the user does not have access permission
    `DocumentCreationException` - if the folder cannot be created
  Since:
    7.0
  See Also:
    `Workspace.createFolder(com.ibm.workplace.wcm.api.Folder)`

### deleteFolder

    void deleteFolder(Workspace workspace,
                      Item folderId)
                      throws AuthorizationException,
                             DocumentDeleteReferentialIntegrityException,
                             DocumentDeleteException,
                             FolderException

  Deprecated. Use Workspace.purge instead

  Delete a folder. The folder must be empty.

  Parameters:
    `workspace` - workspace for this operation.
    `folderId` - id of the folder to be deleted.
  Throws:
    `AuthorizationException` - if the user does not have access permissions
    `DocumentDeleteReferentialIntegrityException` - if the folder has any child item or folder.
    `DocumentDeleteException` - if the folder could not be deleted
    `FolderException` - the folder could not be found or an internal error occured
  Since:
    7.0
  See Also:
    `Workspace.purge(com.ibm.workplace.wcm.api.DocumentId)`

### saveFolder

    void saveFolder(Workspace workspace,
                    Folder folder)
                    throws AuthorizationException,
                           DuplicateChildException,
                           DocumentSaveException,
                           FolderException

  Deprecated. Use Workspace.save instead

  Save a folder under parent specified by `Folder`.getParent();

  Parameters:
    `workspace` - workspace for this operation.
    `folder` - folder to be saved
  Throws:
    `AuthorizationException` - if the user does not have enough access permission
    `DuplicateChildException` - if a object with the same name already exists at the same path
    `DocumentSaveException` - if the folder could not be saved
    `FolderException` - an internal error occured
  Since:
    7.0
  See Also:
    `Workspace.save(com.ibm.workplace.wcm.api.Document)`

### getFolderById

    Folder getFolderById(Workspace workspace,
                         Identity folderId)
                         throws AuthorizationException,
                                DocumentNotFoundException,
                                DocumentRetrievalException

  Deprecated. Use Workspace.getById instead

  Obtain a folder with the specified id.

  Parameters:
    `workspace` - workspace for this operation.
    `folderId` - folder id as `Item`
  Returns:
    Found folder, null no folder with the id exists.
  Throws:
    `AuthorizationException` - if the user does not have the required access
    `DocumentNotFoundException` - if the document cannot be found
    `DocumentRetrievalException` - if the document cannot be retrieved
  Since:
    7.0
  See Also:
    `Workspace.getById(com.ibm.workplace.wcm.api.DocumentId)`

### getFolderByPath

    Folder getFolderByPath(Workspace workspace,
                           java.lang.String folderPath)
                           throws AuthorizationException,
                                  DocumentNotFoundException,
                                  DocumentRetrievalException

  Obtain a folder with the specified path.

  Parameters:
    `workspace` - workspace for this operation.
    `folderPath` - path to the wanted folder, including preset folders
  Returns:
    Found folders, null if no folder with the path exists.
  Throws:
    `AuthorizationException` - if the user does not have the required access
    `DocumentNotFoundException` - if the document cannot be found
    `DocumentRetrievalException` - if the document cannot be retrieved
  Since:
    7.0

### getFolderByRelativePath

    Folder getFolderByRelativePath(Workspace workspace,
                                   java.lang.String folderPath,
                                   PresetFolderType type)
                                   throws DocumentNotFoundException,
                                          DocumentRetrievalException,
                                          AuthorizationException

  Obtain a folder with the specified folderPath on the library currently set on the specified workspace, with a specific preset type of `PresetFolderType` type
  For example, the following will return a nested folder named '32x32' within the "Intranet" library, of the Components view.
  DocumentLibrary library = workspace.getDocumentLibrary("Intranet");
  workspace.setCurrentDocumentLibrary(library);
  Folder folder = WcmLibraryService.getFolderByRelativePath(workspace, "images/logo/32x32", PresetFolderType.COMPONENT)

  Parameters:
    `workspace` - - workspace which will be used to retrieve the library.
    `folderPath` - - A relative path to a document.
    `type` - the `PresetFolderType`.
  Returns:
    The folder, null if no folder with the path exists.
  Throws:
    `AuthorizationException` - if the user does not have the required access
    `DocumentNotFoundException` - if the document cannot be found
    `DocumentRetrievalException` - if the document cannot be retrieved
  Since:
    7.0

### addItemToFolder

    void addItemToFolder(Workspace workspace,
                         Folder destination,
                         Item item)
                         throws AuthorizationException,
                                IllegalDocumentTypeException,
                                FolderException

  Deprecated. Use Folder.addDocument instead

  Add a `Item` into a specified destination `Folder`. The destination `Folder` must be for the class of the `Item`

  Parameters:
    `workspace` - workspace for this operation
    `destination` - destination folder
    `item` - item to be moved
  Throws:
    `AuthorizationException` - if the user does not have access to perform this operation on the item or parent.
    `IllegalDocumentTypeException` - if the given item is not of type valid for this `Folder`
    `FolderException` - if item or parent can not be found or an internal error occured.
  Since:
    7.0
  See Also:
    `Folder.addDocument(com.ibm.workplace.wcm.api.Document, boolean)`

### moveItemToFolder

    void moveItemToFolder(Workspace workspace,
                          Folder destination,
                          Item item)
                          throws AuthorizationException,
                                 IllegalDocumentTypeException,
                                 FolderException

  Deprecated. Use Workspace.move instead

  Move a `Item` into a specified destination `Folder`. The destination `Folder` must be for the class of the `Item`

  Parameters:
    `workspace` - workspace for this operation
    `destination` - destination folder
    `item` - item to be moved
  Throws:
    `AuthorizationException` - if the user does not have access to perform this operation on the item or parent.
    `IllegalDocumentTypeException` - if the given item is not of type valid for the destination `Folder`
    `FolderException` - if item or destination can not be found or an internal error occured.
  Since:
    7.0
  See Also:
    `Workspace.move(com.ibm.workplace.wcm.api.DocumentId, com.ibm.workplace.wcm.api.DocumentId)`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD