com.extentech.ExtenXLS.web
Class MemeDocument

java.lang.Object
  extended by com.extentech.ExtenXLS.DocumentHandle
      extended by com.extentech.ExtenXLS.web.MemeDocument
All Implemented Interfaces:
Document, Handle, com.extentech.toolkit.LogOutputter, Closeable
Direct Known Subclasses:
MemeDoc, MemeWorkBook

public abstract class MemeDocument
extends DocumentHandle
implements com.extentech.toolkit.LogOutputter

This class provides Saving and Reconstituting Documents as memes in the Extentech KB schema.


Field Summary
static int ACCESS_STATUS_PRIVATE
           
static int ACCESS_STATUS_PUBLIC
           
static int ACCESS_STATUS_SHARED
           
static int FILE_TYPE_NATIVE
           
static int FILE_TYPE_XLS
           
static int FILE_TYPE_XLSX
           
static int FILE_TYPE_XMLSS
           
static int MEME_TYPE
           
static int STORAGE_LOCATION_DB
           
static int STORAGE_LOCATION_FILESYSTEM
           
static int STORAGE_LOCATION_S3
           
 
Fields inherited from class com.extentech.ExtenXLS.DocumentHandle
FORMAT_NATIVE
 
Fields inherited from interface com.extentech.ExtenXLS.Document
DEBUG_HIGH, DEBUG_LOW, DEBUG_MEDIUM
 
Constructor Summary
MemeDocument()
          constructor inits meme database connection
MemeDocument(Connection dbc)
          constructor inits meme database connection
MemeDocument(Connection cx, int memeid)
          Deprecated. storeType and storeLocation are now in storage
MemeDocument(InputStream urlx)
           
MemeDocument(int memeid)
          retrieves XML bytes for database record ID and converts to XLS WorkBook
 
Method Summary
 void addUser(com.extentech.security.User usr)
          add a concurrent user to the book
 void appendOutputDir(String p)
          append to the existing outputDir, if any
 boolean bindData(Map values)
          Fetch and Merge Live Data: Returns a modified workbook
 void deleteDocument(DocumentHandle doc, int memeid)
          Deletes the meme record
 int documentStorageLocation()
          Where to store the document, maps to STORAGE_LOCATION ints
 ArrayList getAllDiffs(int memeid)
          retrieves ordered list of all differences for this meme_id
abstract  String getAllStringsInDocument()
           
 WorkBook getBook(int memeid)
          Deprecated.  
 Map getConcurrentUsers()
           
 Connection getConnection()
           
 String getCryptPass()
           
 ExtenXLSReportFactory getDataFactory()
           
 String getDatamapping()
           
 String getDefaultFileString(int memeid)
          Deprecated. use Storage
 File getFile()
          ------------------------------------------------------------
 String getLatestDiff(int memeid)
          retrieves most current String difference for database record ID
 int getMemeId()
           
 int getMemeResolved()
          ------------------------------------------------------------
 int getMemeType()
           
 com.extentech.comm.MessageManager getMessageManager()
           
 String getOutputDir()
          retrieve the webdir for this WebWorkBook
 int getOwnerId()
           
 List getRESTEmit()
           
 List getRESTlog()
           
 int getSaveAsFileType()
          Deprecated. storetype and storelocation are now handled within storage
 String getScript()
           
 String getServerURL()
           
 javax.servlet.http.HttpSession getSession()
          Get the session associated with this WWB
 int getSharingAccess()
           
 int getStorageLocation()
          ------------------------------------------------------------
 File getTempfile()
           
abstract  String getXML()
           
 InputStream getXMLStream(int memeid)
          Deprecated. use storage instead
 boolean isPublic()
          get whether this is a public document
 boolean isSaved()
          get if the workbook has ever been saved, or if it should be deleted on session end
 void load()
          Deprecated.  
abstract  void load(int memeid)
          Deprecated.  
 void loadDataDefinition()
          Load the data definition: loads RDF (report definition format) Records from database and initializes the ReportFactory
 void loadDataDefinition(WebWorkBook book, int rdfmeme)
          Load the data definition: loads RDF (report definition format) Records from database and initializes the ReportFactory
 void log(String msg)
           
 void log(String msg, Exception e)
           
 void log(String msg, Exception e, boolean b)
           
abstract  DocumentHandle revert()
          retrieve the latest from the db and replaces current workbook
 void setConnection(Connection _connection)
           
 void setCryptPass(String _cryptPass)
           
 void setDataFactory(ExtenXLSReportFactory d)
           
 void setDatamapping(String d)
           
 void setFile(File f)
          ------------------------------------------------------------
 void setMemeId(int _memeId)
           
 void setMemeResolved(int memeResolved)
          ------------------------------------------------------------
 void setMemeType(int _memeType)
           
 void setMessageManager(com.extentech.comm.ChatMessageManager ms)
           
 void setOutputDir(String od)
           
 void setOwnerId(int _ownerId)
           
 void setRESTlog(List r)
           
 void setSaveAsFileType(int fileType)
          Deprecated. storetype and storelocation are now handled within storage
 void setSaved(boolean s)
          Set if the workbook has ever been saved, or if it should be deleted on session end
 void setScript(String _script)
           
 void setServerURL(String serverURL)
           
 void setSession(javax.servlet.http.HttpSession s)
          Set the session associated with this WWB
 void setSharingAccess(int access)
           
 void setStorageLocation(int storageLocation)
          ------------------------------------------------------------
 void setTempfile(File tempfile)
           
 void setVal(String field, Object val)
          sets the value of a doc attribute in the database
 int storeDiff(int meme_id, StringBuffer diff)
          Saves the difference (in string format) between two versions of a workbook
 
Methods inherited from class com.extentech.ExtenXLS.DocumentHandle
addProperty, getFileExtension, getFileName, getFormat, getInstance, getName, getProperties, getProperty, getVersion, reset, setDebugLevel, setFileName, setName, setProperties, toString, write, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.io.Closeable
close
 

Field Detail

ACCESS_STATUS_PRIVATE

public static final int ACCESS_STATUS_PRIVATE
See Also:
Constant Field Values

ACCESS_STATUS_PUBLIC

public static final int ACCESS_STATUS_PUBLIC
See Also:
Constant Field Values

ACCESS_STATUS_SHARED

public static final int ACCESS_STATUS_SHARED
See Also:
Constant Field Values

FILE_TYPE_NATIVE

public static final int FILE_TYPE_NATIVE
See Also:
Constant Field Values

FILE_TYPE_XMLSS

public static final int FILE_TYPE_XMLSS
See Also:
Constant Field Values

FILE_TYPE_XLS

public static final int FILE_TYPE_XLS
See Also:
Constant Field Values

FILE_TYPE_XLSX

public static final int FILE_TYPE_XLSX
See Also:
Constant Field Values

STORAGE_LOCATION_DB

public static final int STORAGE_LOCATION_DB
See Also:
Constant Field Values

STORAGE_LOCATION_FILESYSTEM

public static final int STORAGE_LOCATION_FILESYSTEM
See Also:
Constant Field Values

STORAGE_LOCATION_S3

public static final int STORAGE_LOCATION_S3
See Also:
Constant Field Values

MEME_TYPE

public static int MEME_TYPE
Constructor Detail

MemeDocument

public MemeDocument()
constructor inits meme database connection


MemeDocument

public MemeDocument(int memeid)
retrieves XML bytes for database record ID and converts to XLS WorkBook

Parameters:
ID - int ID of database record
Throws:
SQLException

MemeDocument

public MemeDocument(Connection dbc)
constructor inits meme database connection


MemeDocument

public MemeDocument(Connection cx,
                    int memeid)
Deprecated. storeType and storeLocation are now in storage

Create a memeDocument

Parameters:
ID - int ID of database record
Connection - database connection
memeid - meme id
storeType - maps to STORAGE static ints, force to a specific save as type. native (0) will save as existing format
Throws:
SQLException

MemeDocument

public MemeDocument(InputStream urlx)
Method Detail

getOutputDir

public String getOutputDir()
retrieve the webdir for this WebWorkBook

Returns:
String directory

appendOutputDir

public void appendOutputDir(String p)
append to the existing outputDir, if any

Parameters:
p -

addUser

public void addUser(com.extentech.security.User usr)
add a concurrent user to the book

Parameters:
usr -

getXML

public abstract String getXML()
                       throws IOException
Throws:
IOException

getAllStringsInDocument

public abstract String getAllStringsInDocument()

getXMLStream

public InputStream getXMLStream(int memeid)
                         throws SQLException
Deprecated. use storage instead

retrieves XML bytes for database record ID

Parameters:
ID - int ID of database record
Connection - database connection
Returns:
WorkBookHandle
Throws:
SQLException

getDefaultFileString

public String getDefaultFileString(int memeid)
                            throws SQLException
Deprecated. use Storage

Gets the correct path to save to. Path is relative and is based on the owner ID and meme ID of the book The filename is handed by the media_idx table

Parameters:
ID - int ID of database record
Returns:
relative path to the file
Throws:
SQLException

getBook

public WorkBook getBook(int memeid)
                 throws SQLException
Deprecated. 

retrieves XML bytes for database record ID and converts to XLS WorkBook

Parameters:
ID - int ID of database record
Returns:
WorkBookHandle
Throws:
SQLException

load

public void load()
Deprecated. 

initialize the WorkBook from underlying data

Parameters:
memeid -

load

public abstract void load(int memeid)
Deprecated. 

initialize the WorkBook from underlying data

Parameters:
memeid -

setVal

public void setVal(String field,
                   Object val)
            throws Exception
sets the value of a doc attribute in the database

Parameters:
memeid - int ID of this meme database record
Throws:
SQLException
Exception

deleteDocument

public void deleteDocument(DocumentHandle doc,
                           int memeid)
                    throws SQLException
Deletes the meme record

Parameters:
book - WorkBookHandle
memeid - int ID of this meme database record
Throws:
SQLException

storeDiff

public int storeDiff(int meme_id,
                     StringBuffer diff)
              throws SQLException
Saves the difference (in string format) between two versions of a workbook

Parameters:
diff - StringBuffer String format of the differences between the XML of workbook versions
connection - database connection
Throws:
SQLException
See Also:
WebWorkBook.java

getLatestDiff

public String getLatestDiff(int memeid)
                     throws SQLException
retrieves most current String difference for database record ID

Parameters:
ID - int ID of database record
Connection - database connection
Returns:
String
Throws:
SQLException

getAllDiffs

public ArrayList getAllDiffs(int memeid)
                      throws SQLException
retrieves ordered list of all differences for this meme_id

Parameters:
memeid -
Returns:
ArrayList of differences
Throws:
SQLException

isPublic

public boolean isPublic()
get whether this is a public document

Returns:

loadDataDefinition

public void loadDataDefinition(WebWorkBook book,
                               int rdfmeme)
                        throws Exception
Load the data definition: loads RDF (report definition format) Records from database and initializes the ReportFactory

Parameters:
rdfmeme -
Throws:
Exception

loadDataDefinition

public void loadDataDefinition()
Load the data definition: loads RDF (report definition format) Records from database and initializes the ReportFactory

Parameters:
rdfmeme -

bindData

public boolean bindData(Map values)
                 throws Exception
Fetch and Merge Live Data: Returns a modified workbook

Parameters:
values -
Returns:
Throws:
Exception

getConnection

public Connection getConnection()
Returns:
Returns the connection.

setConnection

public void setConnection(Connection _connection)
Parameters:
connection - The connection to set.

getMemeType

public int getMemeType()
Returns:
Returns the memeType.

setMemeType

public void setMemeType(int _memeType)
Parameters:
memeType - The memeType to set.

getOwnerId

public int getOwnerId()
Returns:
Returns the ownerId.

setOwnerId

public void setOwnerId(int _ownerId)
Parameters:
ownerId - The ownerId to set.

getScript

public String getScript()
Returns:
Returns the script.

setScript

public void setScript(String _script)
Parameters:
script - The script to set.

getConcurrentUsers

public Map getConcurrentUsers()

log

public void log(String msg,
                Exception e)
Specified by:
log in interface com.extentech.toolkit.LogOutputter

log

public void log(String msg)
Specified by:
log in interface com.extentech.toolkit.LogOutputter

log

public void log(String msg,
                Exception e,
                boolean b)
Specified by:
log in interface com.extentech.toolkit.LogOutputter

getCryptPass

public String getCryptPass()

setCryptPass

public void setCryptPass(String _cryptPass)

getMemeId

public int getMemeId()
Returns:
Returns the memeId.

setMemeId

public void setMemeId(int _memeId)
Parameters:
memeId - The memeId to set.

getRESTEmit

public List getRESTEmit()
Returns:
Returns the rESTEmit.

getDatamapping

public String getDatamapping()
Returns:
Returns the datamapping.

setDatamapping

public void setDatamapping(String d)
Parameters:
datamapping - The datamapping to set.

getDataFactory

public ExtenXLSReportFactory getDataFactory()
Returns:
Returns the dataFactory.

setDataFactory

public void setDataFactory(ExtenXLSReportFactory d)
Parameters:
dataFactory - The dataFactory to set.

setSaveAsFileType

public void setSaveAsFileType(int fileType)
Deprecated. storetype and storelocation are now handled within storage

Utilize the FILE_TYPE static ints from MemeDocument

Parameters:
storeBookAsFile - whether to store the book as a file

getSaveAsFileType

public int getSaveAsFileType()
Deprecated. storetype and storelocation are now handled within storage

Utilize the FILE_TYPE static ints from MemeDocument

Parameters:
storeBookAsFile - whether to store the book as a file

isSaved

public boolean isSaved()
get if the workbook has ever been saved, or if it should be deleted on session end

Returns:

setSaved

public void setSaved(boolean s)
Set if the workbook has ever been saved, or if it should be deleted on session end

Parameters:
isSaved -

getSession

public javax.servlet.http.HttpSession getSession()
Get the session associated with this WWB

Returns:

setSession

public void setSession(javax.servlet.http.HttpSession s)
Set the session associated with this WWB


revert

public abstract DocumentHandle revert()
retrieve the latest from the db and replaces current workbook

Returns:
new WorkBook

documentStorageLocation

public int documentStorageLocation()
Where to store the document, maps to STORAGE_LOCATION ints

Returns:

getSharingAccess

public int getSharingAccess()

setSharingAccess

public void setSharingAccess(int access)

getMessageManager

public com.extentech.comm.MessageManager getMessageManager()

setMessageManager

public void setMessageManager(com.extentech.comm.ChatMessageManager ms)

getServerURL

public String getServerURL()

setServerURL

public void setServerURL(String serverURL)

getRESTlog

public List getRESTlog()
Returns:
Returns the restlog.

setRESTlog

public void setRESTlog(List r)
Parameters:
restlog - The restlog to set.

getTempfile

public File getTempfile()
Returns:
Returns the tempfile.

setTempfile

public void setTempfile(File tempfile)
Parameters:
tempfile - The tempfile to set.

setOutputDir

public void setOutputDir(String od)
Parameters:
outputDir - The outputDir to set.

getStorageLocation

public int getStorageLocation()
------------------------------------------------------------

Returns:
Returns the storageLocation.

setStorageLocation

public void setStorageLocation(int storageLocation)
------------------------------------------------------------

Parameters:
storageLocation - The storageLocation to set.

getFile

public File getFile()
------------------------------------------------------------

Overrides:
getFile in class DocumentHandle
Returns:
Returns the file.

setFile

public void setFile(File f)
------------------------------------------------------------

Overrides:
setFile in class DocumentHandle
Parameters:
file - The file to set.

getMemeResolved

public int getMemeResolved()
------------------------------------------------------------

Returns:
Returns the memeResolved.

setMemeResolved

public void setMemeResolved(int memeResolved)
------------------------------------------------------------

Parameters:
memeResolved - The memeResolved to set.


Copyright © 2011 Extentech Inc. All Rights Reserved.