com.wewebu.ow.server.app
Class OwDocumentImportItemContentElement

java.lang.Object
  extended by com.wewebu.ow.server.app.OwDocumentImportItemContentElement
All Implemented Interfaces:
OwContentElement

public class OwDocumentImportItemContentElement
extends Object
implements OwContentElement

Standard OwContentElement implementation that is wrapped around an OwDocumentImportItem.
Used by the OwDocumentImportItemContentCollection to represent the single pages (aka content streams) of the content collection.

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

See Also:
OwDocumentImportItemContentCollection

Field Summary
protected  int m_contentType
          the content type of this element
protected  OwDocumentImportItem m_importedDocument
          the imported document the content collection is based on
protected  int m_page
          the page number of this element
 
Constructor Summary
OwDocumentImportItemContentElement(int contentType_p, int page_p, OwDocumentImportItem importedDocument_p)
          Create a new OwDocumentImportItemContentElement that represents a page (aka.
 
Method Summary
 String getContentFilePath()
          Returns the file path to the content (optional, only available if content is stored locally).
NOTE:
This function is only used for ECM Systems which can only download through files.
 Object getContentObject()
          Returns the content object The content representation is of type Object
 int getContentRepresentation()
          get the content representation, which can be either url, stream or object
 InputStream getContentStream(OutputStream out_p)
          Returns the content from the object.
 String getContentURL()
          Returns the URL to the resource where the content can be retrieved.
 String getMIMEParameter()
          retrieve the MIME parameter for the specified page number
 String getMIMEType()
          retrieve the MIME type for the specified page number
 int getPageNumber(int lPageIndex_p)
          retrieve the page number for the given zero based index NOTE: the Page numbers might be arbitrary in the collection in order to submit specific page content
 boolean isInputStreamNative()
          Check if getContentStream is based on an native InputStream or OutputStream.
NOTE:
getContentStream must implement for Input- and OutputStream.
 void releaseResources()
          method is called e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_contentType

protected int m_contentType
the content type of this element


m_page

protected int m_page
the page number of this element


m_importedDocument

protected OwDocumentImportItem m_importedDocument
the imported document the content collection is based on

Constructor Detail

OwDocumentImportItemContentElement

public OwDocumentImportItemContentElement(int contentType_p,
                                          int page_p,
                                          OwDocumentImportItem importedDocument_p)
Create a new OwDocumentImportItemContentElement that represents a page (aka. content stream) of an imported document.

Parameters:
contentType_p - designating the type of content (CONTENT_TYPE_DOCUMENT, CONTENT_TYPE_ANNOTATION,...)
page_p - int Page number to set
Method Detail

getContentURL

public String getContentURL()
                     throws Exception
Returns the URL to the resource where the content can be retrieved.

Specified by:
getContentURL in interface OwContentElement
Returns:
the URL to the resource where the content can be retrieved
Throws:
Exception

isInputStreamNative

public boolean isInputStreamNative()
Check if getContentStream is based on an native InputStream or OutputStream.
NOTE:
getContentStream must implement for Input- and OutputStream. However for optimization the ContentCollection will tell, whether it is based on an InputStream or an OutputStream.

Specified by:
isInputStreamNative in interface OwContentElement
Returns:
true = InputStream is native, false = OutputStream is native

getContentFilePath

public String getContentFilePath()
                          throws Exception
Returns the file path to the content (optional, only available if content is stored locally).
NOTE:
This function is only used for ECM Systems which can only download through files. If a FilePath exists, a stream will also exist. The FilePath is optional, it can not be guranteed to exist.

Specified by:
getContentFilePath in interface OwContentElement
Returns:
String with path to a file where the content can be found or null if file is not available
Throws:
Exception

getContentStream

public InputStream getContentStream(OutputStream out_p)
                             throws Exception
Returns the content from the object. If the document is a multipage document, the first page is retrieved unless otherwise set in setPage(...) NOTE: For performance and optimization reasons both the optional return of an InputStream and writing to the given OutputStream MUST be implemented

Specified by:
getContentStream in interface OwContentElement
Parameters:
out_p - optional OutputStream, if set the method writes the OutputStream and returns null, otherwise it returns an InputStream
Returns:
content from the object, or throws OwContentNotFoundException if no content is available
Throws:
Exception

getContentObject

public Object getContentObject()
                        throws Exception
Returns the content object The content representation is of type Object

Specified by:
getContentObject in interface OwContentElement
Returns:
Object to content access
Throws:
Exception

getContentRepresentation

public int getContentRepresentation()
                             throws Exception
get the content representation, which can be either url, stream or object

Specified by:
getContentRepresentation in interface OwContentElement
Returns:
int with content representation type
Throws:
Exception

getPageNumber

public int getPageNumber(int lPageIndex_p)
                  throws Exception
retrieve the page number for the given zero based index NOTE: the Page numbers might be arbitrary in the collection in order to submit specific page content

Specified by:
getPageNumber in interface OwContentElement
Parameters:
lPageIndex_p - zero based page index for the pages in the collection
Returns:
long actual page number
Throws:
Exception

getMIMEType

public String getMIMEType()
                   throws Exception
retrieve the MIME type for the specified page number

Specified by:
getMIMEType in interface OwContentElement
Returns:
String Mimetype
Throws:
Exception

getMIMEParameter

public String getMIMEParameter()
                        throws Exception
retrieve the MIME parameter for the specified page number

Specified by:
getMIMEParameter in interface OwContentElement
Returns:
String Mimeparameter
Throws:
Exception

releaseResources

public void releaseResources()
Description copied from interface: OwContentElement
method is called e.g. by GetContent servlet after the content is consumed. Can be used to release resources e.g. streams, Interactions, Connections etc. AFTER content is fetched.

Specified by:
releaseResources in interface OwContentElement
See Also:
OwContentElement.releaseResources()


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.