com.wewebu.ow.server.app
Class OwStandardDocumentImportItem

java.lang.Object
  extended by com.wewebu.ow.server.app.OwStandardDocumentImportItem
All Implemented Interfaces:
OwDocumentImportItem

public class OwStandardDocumentImportItem
extends Object
implements OwDocumentImportItem

The OwStandardDocumentImportItem is a default implementation that can be used if collecting the imported file(s), identified by a numerical ID, in some temporary directory.

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
protected  int m_id
          the ID of the imported file.
protected  String m_mimeParameter
          the MIME parameter of the imported file
protected  String m_mimeType
          the MIME type of the imported file
protected  String m_originalFileName
          the original file name
protected  String m_tempDir
          the temporary directory where the import file is stored
 
Constructor Summary
OwStandardDocumentImportItem(String tempDir_p, int id_p, String originalFileName_p)
          Create a new OwStandardDocumentImportItem with the given parameters.
 
Method Summary
 Boolean getCheckinAsMajor()
          Return a Boolean representing the checkin status for this item, possible values are: Boolean.TRUE: create/checkin as major version Boolean.FALSE: create/checkin as minor version null: action should be request from user/or ignore
 String getContentMimeParameter(int i_p)
          Returns the MIME parameter of the i-th content stream.
 String getContentMimeType(int i_p)
          Returns the MIME type of the i-th content stream.
 InputStream getContentStream(int i_p)
          Returns the ith content stream of the imported document as InputStream.
 int getContentStreamCount()
          Returns the number of content elements associated with this imported document.
 String getDisplayName()
          Returns a String that represents this imported Document.
Used for example for the stack of imported documents.
 String getObjectClassName()
          Return the ECM classification name for this OwDocumentItem, which should be used to save the document in the back-end system.
 String getPreviewFilePath(int i_p)
          Returns the full path to a file that can be used for preview of the i-th content stream.
 Map getPropertyValueMap()
          Returns a Map with property class to value mappings.
 String getProposedDocumentName()
          Returns the proposed Document name.
Nearly every ECM back-end knows some name property or represents item property that is used by this ECM system as a name of the document.
 void release()
          Release this imported document by freeing all temporarily acquired resources like deleting temporary files.
Please note:
This method must be able to deal with
  (a) multiple calls of this method, and
  (b) calls to this method AFTER a call to releaseAll of the creating importer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_tempDir

protected String m_tempDir
the temporary directory where the import file is stored


m_id

protected int m_id
the ID of the imported file.


m_originalFileName

protected String m_originalFileName
the original file name


m_mimeType

protected String m_mimeType
the MIME type of the imported file


m_mimeParameter

protected String m_mimeParameter
the MIME parameter of the imported file

Constructor Detail

OwStandardDocumentImportItem

public OwStandardDocumentImportItem(String tempDir_p,
                                    int id_p,
                                    String originalFileName_p)
                             throws Exception
Create a new OwStandardDocumentImportItem with the given parameters.

Parameters:
tempDir_p - the directory where the imported file is located
id_p - the numeric ID of the imported file. The file must be stored in the temporary directory by this ID as file name without a file extension, e.g. /foo/bar/123 where /foo/bar is the temp directory and 123 is the numeric ID
originalFileName_p - the original file name of the imported file
Throws:
Exception - if the MIME type can not be detected
Method Detail

getContentStream

public InputStream getContentStream(int i_p)
                             throws Exception
Description copied from interface: OwDocumentImportItem
Returns the ith content stream of the imported document as InputStream. The document importer has to keep this stream available until the clear() method has been called. Can be null if and only if the document does not have any content.

Specified by:
getContentStream in interface OwDocumentImportItem
Parameters:
i_p - zero-based index in the list of imported content streams
Returns:
the ith (0-based) content stream of the imported document as InputStream
Throws:
Exception - if the InputStream of this imported document can not be created

getPreviewFilePath

public String getPreviewFilePath(int i_p)
Description copied from interface: OwDocumentImportItem
Returns the full path to a file that can be used for preview of the i-th content stream. Can be null.

Specified by:
getPreviewFilePath in interface OwDocumentImportItem
Parameters:
i_p - zero-based index in the list of imported conent streams
Returns:
the full path to a file that can be used for preview of the i-th content stream. Can be null.

getContentStreamCount

public int getContentStreamCount()
Description copied from interface: OwDocumentImportItem
Returns the number of content elements associated with this imported document. If the singleConentStreamImports option is set to true, there is a maximum of 1 content element per document.

Specified by:
getContentStreamCount in interface OwDocumentImportItem
Returns:
the number of content elements associated with this imported document

getDisplayName

public String getDisplayName()
Description copied from interface: OwDocumentImportItem
Returns a String that represents this imported Document.
Used for example for the stack of imported documents.

Specified by:
getDisplayName in interface OwDocumentImportItem
Returns:
a String that represents this imported Document

getPropertyValueMap

public Map getPropertyValueMap()
Description copied from interface: OwDocumentImportItem
Returns a Map with property class to value mappings. These values will be set as initial values of the new object before the "edit properties" dialog is shown. The user will always have the possibility to override these values (if they are not marked as read only in the master plugin).

Specified by:
getPropertyValueMap in interface OwDocumentImportItem
Returns:
a Map with property class to value mappings

getProposedDocumentName

public String getProposedDocumentName()
Description copied from interface: OwDocumentImportItem
Returns the proposed Document name.
Nearly every ECM back-end knows some name property or represents item property that is used by this ECM system as a name of the document. This method makes a proposal for that name based on the imported document. May return null.

Specified by:
getProposedDocumentName in interface OwDocumentImportItem
Returns:
the proposed Document name. Can be null.

release

public void release()
             throws Exception
Description copied from interface: OwDocumentImportItem
Release this imported document by freeing all temporarily acquired resources like deleting temporary files.
Please note:
This method must be able to deal with
  (a) multiple calls of this method, and
  (b) calls to this method AFTER a call to releaseAll of the creating importer.

Specified by:
release in interface OwDocumentImportItem
Throws:
Exception - if there are problems freeing the ocupied resources

getContentMimeParameter

public String getContentMimeParameter(int i_p)
Description copied from interface: OwDocumentImportItem
Returns the MIME parameter of the i-th content stream. Can be null.

Specified by:
getContentMimeParameter in interface OwDocumentImportItem
Parameters:
i_p - zero-based index in the list of imported content streams
Returns:
the MIME parameter of the i-th content stream

getContentMimeType

public String getContentMimeType(int i_p)
Description copied from interface: OwDocumentImportItem
Returns the MIME type of the i-th content stream. Can be null.

Specified by:
getContentMimeType in interface OwDocumentImportItem
Parameters:
i_p - zero-based index in the list of imported content streams
Returns:
the MIME type of the i-th content stream

getCheckinAsMajor

public Boolean getCheckinAsMajor()
Description copied from interface: OwDocumentImportItem
Return a Boolean representing the checkin status for this item, possible values are:

Specified by:
getCheckinAsMajor in interface OwDocumentImportItem
Returns:
java.lang.Boolean or null

getObjectClassName

public String getObjectClassName()
Description copied from interface: OwDocumentImportItem
Return the ECM classification name for this OwDocumentItem, which should be used to save the document in the back-end system.

Can return null, so the default handling or user action should be processed.

Specified by:
getObjectClassName in interface OwDocumentImportItem
Returns:
String name of DocumentClass/ObjectClass, or null


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.