com.extentech.ExtenXLS.web
Class MemeDocument

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

public class MemeDocument
extends com.extentech.ExtenDOC.DocHandle
implements com.extentech.toolkit.LogOutputter

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

Since:
Version:
Author:
John McMahon :: Copyright ©2010 Extentech Inc.
See Also:

Field Summary
static int ACCESS_STATUS_PRIVATE
           
static int ACCESS_STATUS_PUBLIC
           
static int ACCESS_STATUS_SHARED
           
 
Fields inherited from interface com.extentech.ExtenXLS.Document
ALLOWDUPES, DEBUG_HIGH, DEBUG_LOW, DEBUG_MEDIUM, SHAREDUPES, STRING_ENCODING_AUTO, STRING_ENCODING_COMPRESSED, STRING_ENCODING_UNICODE
 
Constructor Summary
MemeDocument()
          constructor inits meme database connection
MemeDocument(Connection dbc, byte[] bb)
          constructor inits meme database connection
MemeDocument(Connection connection2, byte[] bytes, com.extentech.security.User u, String nm)
          May 16, 2010
MemeDocument(Connection dbc, File input)
          constructor inits meme database connection
MemeDocument(Connection cx, int memeid, boolean storeAsFile, boolean xmlStore)
          retrieves XML bytes for database record ID and converts to XLS WorkBook
MemeDocument(InputStream urlx)
           
MemeDocument(int memeid)
          retrieves XML bytes for database record ID and converts to XLS WorkBook
MemeDocument(String path)
           
MemeDocument(String finpath, com.extentech.swingtools.ProgressDialog progdialog)
           
MemeDocument(URL urlx)
          Deprecated. - use FileStream constructor
 
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 createPage(String nm, int position)
          May 16, 2010
 void deleteBook(WorkBook book, int memeid)
          Deletes the meme record
 void deleteDoc(MemeDocument wbh, int parseInt)
          May 16, 2010
 ArrayList getAllDiffs(int memeid)
          retrieves ordered list of all differences for this meme_id
 WorkBook getBook(int memeid)
          retrieves XML bytes for database record ID and converts to XLS WorkBook
 Map getConcurrentUsers()
           
 Connection getConnection()
           
 String getCryptPass()
           
 ExtenXLSReportFactory getDataFactory()
           
 String getDatamapping()
           
 String getDefaultFileString(int memeid)
          Gets the correct path to save to.
 String getDescription()
           
 String getFileName()
          Get the filename for this document for saveasfile setting.
 String getLatestDiff(int memeid)
          retrieves most current String difference for database record ID
 int getMemeId()
           
 int getMemeType()
           
 com.extentech.comm.MessageManager getMessageManager()
           
 int getNumPages()
          May 16, 2010
 String getOutputDir()
          retrieve the webdir for this WebWorkBook
 int getOwnerId()
           
 com.extentech.ExtenDOC.PageHandle[] getPages()
          May 16, 2010
 List getRESTEmit()
           
 List getRESTlog()
           
 String getServerURL()
           
 javax.servlet.http.HttpSession getSession()
          Get the session associated with this WWB
 int getSharingAccess()
           
 File getTempfile()
           
 InputStream getXMLStream(int memeid)
          retrieves XML bytes for database record ID
 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 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)
          output the string to the log
 void log(String msg, Exception e)
          output the string to the log
 void log(String msg, Exception e, boolean b)
          Output an exception to the log, print stack trace optional
static void main(String[] args)
           
 DocumentHandle revert()
          retrieve the latest from the db and replaces current workbook
 void save(int memeid)
          Saves the existing book record to the database and the book itself to the correct location Book can
 void setConnection(Connection _connection)
           
 void setCryptPass(String _cryptPass)
           
 void setDataFactory(ExtenXLSReportFactory d)
           
 void setDatamapping(String d)
           
 void setDescription(String _description)
           
 void setMemeId(int _memeId)
           
 void setMemeType(int _memeType)
           
 void setMessageManager(com.extentech.comm.ChatMessageManager ms)
           
 void setOutputDir(String od)
           
 void setOwnerId(int _ownerId)
           
 void setRESTlog(List r)
           
 void setSaved(boolean s)
          Set if the workbook has ever been saved, or if it should be deleted on session end
 void setServerURL(String serverURL)
           
 void setSession(javax.servlet.http.HttpSession s)
          Set the session associated with this WWB
 void setSharingAccess(int access)
           
 void setStoreAsXML(boolean s)
           
 void setStoreBookAsFile(boolean s)
           
 void setTempfile(File tempfile)
           
 boolean storeAsXML()
           
 boolean storeBookAsFile()
           
 int storeDiff(int meme_id, StringBuffer diff)
          Saves the difference (in string format) between two versions of a workbook
 int storeNewDocument()
          Saves the Workbook as a new record in the database.
 StringBuffer writeBytes(OutputStream out)
           
 
Methods inherited from class com.extentech.ExtenDOC.DocHandle
addProperty, close, finalize, getAllText, getBytes, getChart, getCharts, getFactory, getFormatHandles, getFormats, getName, getPage, getParagraphs, getProperties, getProperty, getTextRangeHandles, getVersion, getWorkingDirectory, getXHTML, reset, searchAndReplace, setDebugLevel, setDupeStringMode, setFileName, setName, setProperties, setProtected, setStringEncodingMode, setXHTML, toString, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
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,
                    byte[] bb)
constructor inits meme database connection


MemeDocument

public MemeDocument(Connection dbc,
                    File input)
constructor inits meme database connection


MemeDocument

public MemeDocument(URL urlx)
Deprecated. - use FileStream constructor

constructor that loads workbook from a URL


MemeDocument

public MemeDocument(String finpath,
                    com.extentech.swingtools.ProgressDialog progdialog)

MemeDocument

public MemeDocument(Connection cx,
                    int memeid,
                    boolean storeAsFile,
                    boolean xmlStore)
retrieves XML bytes for database record ID and converts to XLS WorkBook

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

MemeDocument

public MemeDocument(String path)

MemeDocument

public MemeDocument(InputStream urlx)

MemeDocument

public MemeDocument(Connection connection2,
                    byte[] bytes,
                    com.extentech.security.User u,
                    String nm)
May 16, 2010

Parameters:
connection2 -
bytes -
u -
nm -
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 -

storeNewDocument

public int storeNewDocument()
                     throws SQLException
Saves the Workbook as a new record in the database. When performed with a new book, this saves as a mwb that now exists in the db When performed with a book initialzied from the database, this essentially performs a 'save as' function creating a new copy in the database with current changes

Parameters:
connection - database connection
Throws:
SQLException

getFileName

public String getFileName()
Get the filename for this document for saveasfile setting.

Overrides:
getFileName in class com.extentech.ExtenDOC.DocHandle
Returns:

getXMLStream

public InputStream getXMLStream(int memeid)
                         throws SQLException
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
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
retrieves XML bytes for database record ID and converts to XLS WorkBook

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

save

public void save(int memeid)
          throws Exception
Saves the existing book record to the database and the book itself to the correct location Book can

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

writeBytes

public StringBuffer writeBytes(OutputStream out)
Specified by:
writeBytes in interface Document
Overrides:
writeBytes in class com.extentech.ExtenDOC.DocHandle
See Also:
Document.writeBytes(java.io.OutputStream)

deleteBook

public void deleteBook(WorkBook book,
                       int memeid)
                throws SQLException
Deletes the meme record

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

main

public static void main(String[] args)

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.

getDescription

public String getDescription()
Returns:
Returns the description.

setDescription

public void setDescription(String _description)
Parameters:
description - The description to set.

getConcurrentUsers

public Map getConcurrentUsers()

log

public void log(String msg,
                Exception e)
Description copied from interface: com.extentech.toolkit.LogOutputter
output the string to the log

Specified by:
log in interface com.extentech.toolkit.LogOutputter

log

public void log(String msg)
Description copied from interface: com.extentech.toolkit.LogOutputter
output the string to the log

Specified by:
log in interface com.extentech.toolkit.LogOutputter

log

public void log(String msg,
                Exception e,
                boolean b)
Description copied from interface: com.extentech.toolkit.LogOutputter
Output an exception to the log, print stack trace optional

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.

setStoreBookAsFile

public void setStoreBookAsFile(boolean s)
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


storeAsXML

public boolean storeAsXML()

revert

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

Returns:
new WorkBook

setStoreAsXML

public void setStoreAsXML(boolean s)

storeBookAsFile

public boolean storeBookAsFile()

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.

deleteDoc

public void deleteDoc(MemeDocument wbh,
                      int parseInt)
May 16, 2010

Parameters:
wbh -
parseInt -

createPage

public void createPage(String nm,
                       int position)
May 16, 2010

Parameters:
nm -
position -

getNumPages

public int getNumPages()
May 16, 2010

Returns:

getPages

public com.extentech.ExtenDOC.PageHandle[] getPages()
May 16, 2010

Overrides:
getPages in class com.extentech.ExtenDOC.DocHandle
Returns:


Copyright © 2010 Extentech Inc. All Rights Reserved.