com.wewebu.ow.server.ecm
Class OwStandardContentCollection

java.lang.Object
  extended by com.wewebu.ow.server.ecm.OwStandardContentCollection
All Implemented Interfaces:
OwContentCollection, OwContentElement

public class OwStandardContentCollection
extends Object
implements OwContentCollection, OwContentElement

Standard Implementation of the OwContentCollection interface for just one content type and page.

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
 
Fields inherited from interface com.wewebu.ow.server.ecm.OwContentCollection
CONTENT_REPRESENTATION_TYPE_NONE, CONTENT_REPRESENTATION_TYPE_OBJECT, CONTENT_REPRESENTATION_TYPE_STREAM, CONTENT_REPRESENTATION_TYPE_URL, CONTENT_REPRESENTATION_TYPE_USER_START, CONTENT_TYPE_ANNOTATION, CONTENT_TYPE_DOCUMENT, CONTENT_TYPE_SECURITY, CONTENT_TYPE_USER_START
 
Constructor Summary
OwStandardContentCollection(InputStream input_p, int iContentType_p, int iPageNumber_p)
          construct a content collection with just one page and one content type
OwStandardContentCollection(InputStream input_p, int iContentType_p, int iPageNumber_p, String sMimeType_p)
          construct a content collection with just one page and one content type
 
Method Summary
 OwContentElement getContentElement(int iContentType_p, int iPage_p)
          get a content element for the given type and page
 String getContentFilePath()
          get 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.
 Object getContentObject()
          get 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)
          get the content from the object.
 Collection getContentTypes()
          get a list of content types used in this object
 String getContentURL()
          get the content URL from the object.
 String getMIMEParameter()
          retrieve the MIME parameter for the specified page number
 String getMIMEType()
          retrieve the MIME type for the specified page number
 int getPageCount()
          retrieve the page count
 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
 

Constructor Detail

OwStandardContentCollection

public OwStandardContentCollection(InputStream input_p,
                                   int iContentType_p,
                                   int iPageNumber_p)
construct a content collection with just one page and one content type

Parameters:
input_p - InputStream to the content
iContentType_p - int the one and only content type
iPageNumber_p - int the page number of the one and only page

OwStandardContentCollection

public OwStandardContentCollection(InputStream input_p,
                                   int iContentType_p,
                                   int iPageNumber_p,
                                   String sMimeType_p)
construct a content collection with just one page and one content type

Parameters:
input_p - InputStream to the content
iContentType_p - int the one and only content type
iPageNumber_p - int the page number of the one and only page
sMimeType_p - MIME Type
Method Detail

getContentURL

public String getContentURL()
                     throws Exception
get the content URL from the object.

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

getContentObject

public Object getContentObject()
                        throws Exception
get 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

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

getContentElement

public OwContentElement getContentElement(int iContentType_p,
                                          int iPage_p)
                                   throws Exception
get a content element for the given type and page

Specified by:
getContentElement in interface OwContentCollection
Parameters:
iContentType_p - int
iPage_p - int
Returns:
OwContentElement
Throws:
Exception

getContentStream

public InputStream getContentStream(OutputStream out_p)
                             throws Exception
get 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

getContentTypes

public Collection getContentTypes()
                           throws Exception
get a list of content types used in this object

Specified by:
getContentTypes in interface OwContentCollection
Returns:
List of int content types
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

getPageCount

public int getPageCount()
                 throws Exception
retrieve the page count

Specified by:
getPageCount in interface OwContentCollection
Returns:
long page count
Throws:
Exception

getContentFilePath

public String getContentFilePath()
                          throws Exception
get 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 guaranteed 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

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.