com.partnersoft.modules.inspection.app
Class InspectionCsvLogic

java.lang.Object
  extended by com.partnersoft.modules.inspection.app.InspectionCsvLogic

public class InspectionCsvLogic
extends java.lang.Object

Wrapper for Inspection definition data and the actions related to them.

Copyright 2009 Partner Software, Inc.

Version:
$Id$
Author:
Rich Stepanski

Constructor Summary
InspectionCsvLogic()
          Creates a new InspectionLogic instance, but does NOT load any csv.
InspectionCsvLogic(com.partnersoft.system.Module module)
          Creates a new InspectionLogic instance and loads all csv associated with passed module.
InspectionCsvLogic(java.lang.String moduleName)
          Creates a new InspectionDataLogic instance and loads all csv associated with passed module name.
 
Method Summary
 void addField(CsvFieldItem field)
           
 void addField(int index, CsvFieldItem field)
           
 void addPicklist(CsvPicklistItem pick)
           
 void addPicklist(int index, CsvPicklistItem pick)
           
 void addSubtype(CsvSubtypeItem sub)
           
 void addSubtype(int index, CsvSubtypeItem sub)
           
 void generateFieldsCsv()
          Generates fields.csv for this module, and generates schema.
 void generateHubDatabase()
           
 void generateLocalDatabase()
           
 void generatePicklistsCsv()
          Generates picklists.csv for this module, and generates schema.
 void generateReportsCsv()
          Generates reports.csv for this module.
 void generateSchema()
          Generates schema for this module.
 void generateSubtypesCsv()
          Generates subtypes.csv for this module.
 InspectionCsvData getInspectionData()
           
 com.partnersoft.system.Module getInspectionModule()
           
 com.partnersoft.system.Module getModule()
           
 void loadCsvData()
          Loads all data from Csv files stored in module associated with this logic.
static java.util.List<CsvFieldItem> loadFieldCsv(com.partnersoft.io.vfs.VfsFile fieldFile)
          Returns a List of Namings populated with name,tab,label,description, type keys.
static java.util.List<CsvPicklistItem> loadPicklistCsv(com.partnersoft.io.vfs.VfsFile picklistFile, java.lang.String moduleName)
          Returns a List of Namings populated with name, defaultValue, values keys.
static com.partnersoft.data.Naming loadReportCsv(com.partnersoft.io.vfs.VfsFile reportsFile)
          Returns a Naming.
static java.util.List<CsvSubtypeItem> loadSubtypeCsv(com.partnersoft.io.vfs.VfsFile subtypeFile, com.partnersoft.io.vfs.VfsFile subtypeFieldsFile, com.partnersoft.system.Module module, java.util.List<CsvFieldItem> fields)
          Returns a List of Namings.
 void removeField(java.lang.String fieldName)
           
 void removePicklist(java.lang.String pickName)
           
 void removeSubtype(java.lang.String subName)
           
 void resetCsvData()
          Creates a new InspectionData to hold internally.
 void setInspectionCsvData(InspectionCsvData data)
           
 void setModule(com.partnersoft.system.Module module)
          Sets the module name and does NOT load the csv.
 void setModule(java.lang.String moduleName)
          Sets the module name and does NOT load the csv.
 void updateField(java.lang.String origName, java.lang.String changedName, java.lang.String dataType, java.lang.String desc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InspectionCsvLogic

public InspectionCsvLogic(java.lang.String moduleName)
Creates a new InspectionDataLogic instance and loads all csv associated with passed module name.

Parameters:
moduleName -

InspectionCsvLogic

public InspectionCsvLogic()
Creates a new InspectionLogic instance, but does NOT load any csv.


InspectionCsvLogic

public InspectionCsvLogic(com.partnersoft.system.Module module)
Creates a new InspectionLogic instance and loads all csv associated with passed module.

Parameters:
module -
Method Detail

addField

public void addField(CsvFieldItem field)

addField

public void addField(int index,
                     CsvFieldItem field)

addPicklist

public void addPicklist(CsvPicklistItem pick)

addPicklist

public void addPicklist(int index,
                        CsvPicklistItem pick)

addSubtype

public void addSubtype(int index,
                       CsvSubtypeItem sub)

addSubtype

public void addSubtype(CsvSubtypeItem sub)

removeField

public void removeField(java.lang.String fieldName)

removePicklist

public void removePicklist(java.lang.String pickName)

removeSubtype

public void removeSubtype(java.lang.String subName)

updateField

public void updateField(java.lang.String origName,
                        java.lang.String changedName,
                        java.lang.String dataType,
                        java.lang.String desc)

resetCsvData

public void resetCsvData()
Creates a new InspectionData to hold internally. Does not affect saved Csv or previously held InspectionData object. Watch for hanging references.


getModule

public com.partnersoft.system.Module getModule()

getInspectionModule

public com.partnersoft.system.Module getInspectionModule()

getInspectionData

public InspectionCsvData getInspectionData()

setInspectionCsvData

public void setInspectionCsvData(InspectionCsvData data)

setModule

public void setModule(java.lang.String moduleName)
Sets the module name and does NOT load the csv.

Parameters:
moduleName -

setModule

public void setModule(com.partnersoft.system.Module module)
Sets the module name and does NOT load the csv.

Parameters:
module -

loadCsvData

public void loadCsvData()
Loads all data from Csv files stored in module associated with this logic.


loadFieldCsv

public static java.util.List<CsvFieldItem> loadFieldCsv(com.partnersoft.io.vfs.VfsFile fieldFile)
Returns a List of Namings populated with name,tab,label,description, type keys.

Parameters:
fieldFile - - VfsFile field csv is stored in.
Returns:
List of Namings. Empty List is returned if file does not exist or an exception occurs.

loadPicklistCsv

public static java.util.List<CsvPicklistItem> loadPicklistCsv(com.partnersoft.io.vfs.VfsFile picklistFile,
                                                              java.lang.String moduleName)
Returns a List of Namings populated with name, defaultValue, values keys. name and defaultValue being Strings, values being a List of Strings.

Parameters:
picklistFile - - Vfs file containing picklist Csv data.
moduleName - - String name of the module for this data.
Returns:
List of Namings. Empty List if file does not exist or an exception occurs.

loadReportCsv

public static com.partnersoft.data.Naming loadReportCsv(com.partnersoft.io.vfs.VfsFile reportsFile)
Returns a Naming. All keys are subtypes, all values lists of field names for that subtype report.

Parameters:
reportsFile - - VfsFile containing report data.
Returns:
Naming, empty naming if file doesn't exist or an exception occurs.

loadSubtypeCsv

public static java.util.List<CsvSubtypeItem> loadSubtypeCsv(com.partnersoft.io.vfs.VfsFile subtypeFile,
                                                            com.partnersoft.io.vfs.VfsFile subtypeFieldsFile,
                                                            com.partnersoft.system.Module module,
                                                            java.util.List<CsvFieldItem> fields)
Returns a List of Namings. Each naming contains name, show, fields, and icon keys. name - String name of subtype. show - boolean, true to display in edit tree. fields - List of String field names associated with subtype. icon - path to the icon for this subtype, according to the style set in the module-mapset.

Parameters:
subtypeFile -
module -
fields -
Returns:

generateFieldsCsv

public void generateFieldsCsv()
Generates fields.csv for this module, and generates schema. Logs all progress.


generateSchema

public void generateSchema()
Generates schema for this module.


generateLocalDatabase

public void generateLocalDatabase()
                           throws java.sql.SQLException,
                                  java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

generateHubDatabase

public void generateHubDatabase()
                         throws java.sql.SQLException,
                                java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

generatePicklistsCsv

public void generatePicklistsCsv()
Generates picklists.csv for this module, and generates schema. Logs all progress.


generateSubtypesCsv

public void generateSubtypesCsv()
Generates subtypes.csv for this module. Logs all progress.


generateReportsCsv

public void generateReportsCsv()
Generates reports.csv for this module. NOT IMPLEMENTED 1/18/09