com.extentech.ExtenXLS.web
Class WebWorkBook

java.lang.Object
  extended by com.extentech.ExtenXLS.DocumentHandle
      extended by com.extentech.ExtenXLS.web.MemeDocument
          extended by com.extentech.ExtenXLS.web.MemeWorkBook
              extended by com.extentech.ExtenXLS.web.WebWorkBook
All Implemented Interfaces:
Document, Handle, WorkBook, com.extentech.toolkit.LogOutputter, Closeable

public class WebWorkBook
extends MemeWorkBook
implements WorkBook

The WebWorkBook class provides additional functionality to the WorkBookHandle class to allow it to participate in a Service-Oriented-Architecture. The additional functionality of the WebWorkBook relates to version and access control using a hosted architecture to provide for the security and versioning repository.

Author:
John McMahon -- Copyright ©2011Extentech Inc.
See Also:
WorkBook, WorkBookHandle, http://www.sheetster.com

Field Summary
 
Fields inherited from class com.extentech.ExtenXLS.web.MemeDocument
ACCESS_STATUS_PRIVATE, ACCESS_STATUS_PUBLIC, ACCESS_STATUS_SHARED, FILE_TYPE_NATIVE, FILE_TYPE_XLS, FILE_TYPE_XLSX, FILE_TYPE_XMLSS, MEME_TYPE, STORAGE_LOCATION_DB, STORAGE_LOCATION_FILESYSTEM, STORAGE_LOCATION_S3
 
Fields inherited from class com.extentech.ExtenXLS.DocumentHandle
FORMAT_NATIVE
 
Fields inherited from interface com.extentech.ExtenXLS.WorkBook
ALLOWDUPES, CALC_MODE_PROP, CALCULATE_ALWAYS, CALCULATE_AUTO, CALCULATE_EXPLICIT, REFTRACK_PROP, SHAREDUPES, STRING_ENCODING_AUTO, STRING_ENCODING_COMPRESSED, STRING_ENCODING_UNICODE
 
Fields inherited from interface com.extentech.ExtenXLS.Document
DEBUG_HIGH, DEBUG_LOW, DEBUG_MEDIUM
 
Constructor Summary
WebWorkBook()
           
WebWorkBook(byte[] b)
          Constructor which creates a spreadsheet from XLS or XLSX bytes
WebWorkBook(Connection dbc, byte[] in, com.extentech.security.User user, String description)
          Create a new WebWorkbook from a workbook passed in.
WebWorkBook(Connection dbcon, File fx)
           
WebWorkBook(Connection cx, int memeid, int storeType, int storeLocation)
          Deprecated. storetype and storelocation are now handled within storage
WebWorkBook(Connection dbcon, URL u)
           
WebWorkBook(InputStream urlx, com.extentech.security.User user)
          constructor that s workbook from an InputStream
WebWorkBook(int midi, com.extentech.security.User user)
          constructor retrieves workbook referenced by midi
WebWorkBook(int memeId, WorkBookHandle theBook)
          Create a new MemeWorkBook from the workbook passed in and set to the meme ID
WebWorkBook(String path)
          Constructor that s a spreadsheet from a file path.
WebWorkBook(String finpath, com.extentech.swingtools.ProgressDialog progdialog)
           
WebWorkBook(String fCurrent, String fLatest, String outputDir, boolean bDEBUG)
          constructor for file comparisons - testing purposes
WebWorkBook(URL urlx, com.extentech.security.User user)
          Deprecated. - use FileStream constructor Move user handling to more logical spot...
WebWorkBook(com.extentech.security.User user)
          Create a new WebWorkBook with the passed in user.
WebWorkBook(WorkBookHandle book)
           
 
Method Summary
 WorkBook applyDiff(StringBuffer diff)
          apply a single diff to a Document
 boolean commit()
          Deprecated. for now, this is not tested anywhere, and does not seem to function, returns false, handle storage/saving issues to reimplement (see 2 commented out storeNewDocument() and save() calls below)
static InputStream convertDocumentToInputStream(org.jdom.Document doc)
           
 StringBuffer getDiff(org.jdom.Document oldDoc, org.jdom.Document newDoc)
           
 List getDiffs()
          return an Iterator of diff history -- list[0] is the most current changes, applying list[0] to the current document brings it back 1 version.
 org.jdom.Document getLatestXML()
          retrieve the lastest XML stream from the conurl URL and format into a Document object
static String incrementVersionNumber(String origFName)
          test utilty to increase the version number (-n.XML) for file comparisons
 void init()
           
static void printDocument(org.jdom.Document doc, String fName)
           
 DocumentHandle revertDiff()
          revert current workbook to the most recent previous version
 
Methods inherited from class com.extentech.ExtenXLS.web.MemeWorkBook
addProperty, addSheetFromWorkBook, addSheetFromWorkBookWithFormatting, addWorkSheet, addWorkSheet, calculateFormulas, close, copyChartToSheet, copyChartToSheet, copyWorkSheet, createChart, createNamedRange, createWorkSheet, createWorkSheet, deleteChart, equals, eventMode, getAllStrings, getAllStringsInDocument, getBook, getBytes, getCell, getCellRanges, getCells, getChart, getChartById, getCharts, getConditionalFormats, getFactory, getFileExtension, getFileName, getFormat, getFormats, getFormulaCalculationMode, getFormulaHandle, getImage, getImage, getImages, getIsExcel2007, getName, getNamedRange, getNamedRangeInScope, getNamedRanges, getNamedRangesInScope, getNoSheetWorkBook, getNumCells, getNumWorkSheets, getPivotTable, getPivotTables, getProperties, getProperty, getStats, getStats, getTarget, getWorkBook, getWorkSheet, getWorkSheet, getWorkSheets, getXLSVersionString, getXML, hashCode, is1904, load, markFormulasDirty, recalc, removeAllWorkSheets, reset, revert, searchAndReplace, setDebugLevel, setDefaultColWidth, setDefaultRowHeight, setDupeStringMode, setFileName, setFormulaCalculationMode, setIsExcel2007, setName, setProperties, setProtected, setShowSheetTabs, setStringEncodingMode, showSheetTabs, toString, write, write, write, write, write, write, write, writeBytes, writeXLSXBytes, writeXLSXBytes
 
Methods inherited from class com.extentech.ExtenXLS.web.MemeDocument
addUser, appendOutputDir, bindData, deleteDocument, documentStorageLocation, getAllDiffs, getBook, getConcurrentUsers, getConnection, getCryptPass, getDataFactory, getDatamapping, getDefaultFileString, getFile, getLatestDiff, getMemeId, getMemeResolved, getMemeType, getMessageManager, getOutputDir, getOwnerId, getRESTEmit, getRESTlog, getSaveAsFileType, getScript, getServerURL, getSession, getSharingAccess, getStorageLocation, getTempfile, getXMLStream, isPublic, isSaved, load, loadDataDefinition, loadDataDefinition, log, log, log, setConnection, setCryptPass, setDataFactory, setDatamapping, setFile, setMemeId, setMemeResolved, setMemeType, setMessageManager, setOutputDir, setOwnerId, setRESTlog, setSaveAsFileType, setSaved, setScript, setServerURL, setSession, setSharingAccess, setStorageLocation, setTempfile, setVal, storeDiff
 
Methods inherited from class com.extentech.ExtenXLS.DocumentHandle
getInstance, getVersion
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.extentech.ExtenXLS.WorkBook
addProperty, addSheetFromWorkBook, addWorkSheet, calculateFormulas, copyChartToSheet, copyChartToSheet, copyWorkSheet, createWorkSheet, getBytes, getCell, getCells, getChart, getCharts, getFormats, getFormulaCalculationMode, getName, getNamedRange, getNamedRanges, getNoSheetWorkBook, getNumCells, getPivotTable, getPivotTables, getProperty, getWorkBook, getWorkSheet, getWorkSheet, getWorkSheets, removeAllWorkSheets, reset, setDebugLevel, setDefaultColWidth, setDefaultRowHeight, setDupeStringMode, setFormulaCalculationMode, setName, setProtected, setStringEncodingMode, toString, writeBytes
 
Methods inherited from interface com.extentech.toolkit.LogOutputter
log, log, log
 

Constructor Detail

WebWorkBook

public WebWorkBook(String fCurrent,
                   String fLatest,
                   String outputDir,
                   boolean bDEBUG)
constructor for file comparisons - testing purposes

Parameters:
fCurrent - original XML filename
fLatest - updated XML filename

WebWorkBook

public WebWorkBook(String path)
Constructor that s a spreadsheet from a file path.

Parameters:
path -

WebWorkBook

public WebWorkBook(int memeId,
                   WorkBookHandle theBook)
Create a new MemeWorkBook from the workbook passed in and set to the meme ID

Parameters:
theBook -

WebWorkBook

public WebWorkBook(WorkBookHandle book)

WebWorkBook

public WebWorkBook(Connection cx,
                   int memeid,
                   int storeType,
                   int storeLocation)
Deprecated. storetype and storelocation are now handled within storage

constructor with a meme_id

Parameters:
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

WebWorkBook

public WebWorkBook(URL urlx,
                   com.extentech.security.User user)
Deprecated. - use FileStream constructor Move user handling to more logical spot...

constructor that s workbook from a URL


WebWorkBook

public WebWorkBook(InputStream urlx,
                   com.extentech.security.User user)
constructor that s workbook from an InputStream


WebWorkBook

public WebWorkBook(com.extentech.security.User user)
Create a new WebWorkBook with the passed in user. The user param will be the owner of the new workbook


WebWorkBook

public WebWorkBook(int midi,
                   com.extentech.security.User user)
constructor retrieves workbook referenced by midi


WebWorkBook

public WebWorkBook(Connection dbc,
                   byte[] in,
                   com.extentech.security.User user,
                   String description)
            throws SQLException
Create a new WebWorkbook from a workbook passed in.

Parameters:
bk -
user -
Throws:
SQLException

WebWorkBook

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

WebWorkBook

public WebWorkBook()

WebWorkBook

public WebWorkBook(Connection dbcon,
                   File fx)

WebWorkBook

public WebWorkBook(Connection dbcon,
                   URL u)

WebWorkBook

public WebWorkBook(byte[] b)
Constructor which creates a spreadsheet from XLS or XLSX bytes

Parameters:
xls - or xlsx file bytes
Method Detail

init

public void init()

commit

public boolean commit()
Deprecated. for now, this is not tested anywhere, and does not seem to function, returns false, handle storage/saving issues to reimplement (see 2 commented out storeNewDocument() and save() calls below)

commit changes from the existing workbook as compared to the stored version retrieve changes as diff and store

Returns:
boolean truth of "commit was successful"

getDiffs

public List getDiffs()
return an Iterator of diff history -- list[0] is the most current changes, applying list[0] to the current document brings it back 1 version. applying list[1] after applying list[0] brings the current document back 2 versions. and so on.


applyDiff

public WorkBook applyDiff(StringBuffer diff)
apply a single diff to a Document

Parameters:
diff - StringBuffer of diffs in specific diff format
Returns:
WorkBook representing changes

getDiff

public StringBuffer getDiff(org.jdom.Document oldDoc,
                            org.jdom.Document newDoc)

getLatestXML

public org.jdom.Document getLatestXML()
retrieve the lastest XML stream from the conurl URL and format into a Document object

Returns:
Document object representing the XML stream from the URL

incrementVersionNumber

public static String incrementVersionNumber(String origFName)
test utilty to increase the version number (-n.XML) for file comparisons

Returns:

printDocument

public static void printDocument(org.jdom.Document doc,
                                 String fName)

convertDocumentToInputStream

public static InputStream convertDocumentToInputStream(org.jdom.Document doc)
                                                throws IOException
Throws:
IOException

revertDiff

public DocumentHandle revertDiff()
revert current workbook to the most recent previous version

Returns:
reverted Workbook or null


Copyright © 2011 Extentech Inc. All Rights Reserved.