cst.adminTool.io
Class TrialSubjectDataSpreadsheetParsingEngine

java.lang.Object
  extended by cst.adminTool.io.TrialSubjectDataSpreadsheetParsingEngine

public class TrialSubjectDataSpreadsheetParsingEngine
extends java.lang.Object

The engine imports subject records from tabular data represented in character-delimited text files. If the parsing activity involves parsing the first header line, then the class delegates the task of validating header values to TrialSubjectDataHeaderParser.

Each subject is represented by a row which will contain a column value containing a unique identifier (eg: a serial number) and one or more date column values. The format of date values is specified when users fill in the DataSelectionEditor.

The data import methods scan the text file in two passes. In the first pass, the engine attempts to validate all the data. If any error occurs, an error report is generated. Otherwise, the engine imports the data and submits records to the data repository via the importTrialSubjectModels(...) method of the AdminServiceAPI interface.


 Copyright 2010 Medical Research Council Unit for Lifelong Health and Ageing
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing, software 
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.  
 

Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net)

Constructor Summary
TrialSubjectDataSpreadsheetParsingEngine(SessionProperties sessionProperties)
           
 
Method Summary
 int getNumberOfModifiedRecords()
           
 SpreadsheetTransferSettings getSpreadsheetTransferSettings()
           
 boolean hasErrors()
           
 void importFile(java.io.File coreDataImportFile)
          imports a tab-delimited text file containing subject records.
 void importTextData(java.lang.String text)
           
 void mapCoreField(java.lang.String coreFieldDisplayName, java.lang.String coreFieldDataStorageName)
           
 void mapPrimaryKeyConcept(java.lang.String spreadsheetHeaderLabel, java.lang.String dataStorageFieldName)
           
 void setApplicationName(java.lang.String applicationName)
           
 void setDelimiter(java.lang.String delimiter)
           
 void setErrorReportDestinationDirectory(java.io.File directory)
           
 void setFirstLineNumberOfInput(int firstLineNumberOfInput)
           
 void setSkipHeader(boolean skipHeader)
           
 void writeErrorReport()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrialSubjectDataSpreadsheetParsingEngine

public TrialSubjectDataSpreadsheetParsingEngine(SessionProperties sessionProperties)
Method Detail

getSpreadsheetTransferSettings

public SpreadsheetTransferSettings getSpreadsheetTransferSettings()

getNumberOfModifiedRecords

public int getNumberOfModifiedRecords()

setFirstLineNumberOfInput

public void setFirstLineNumberOfInput(int firstLineNumberOfInput)

setApplicationName

public void setApplicationName(java.lang.String applicationName)

setDelimiter

public void setDelimiter(java.lang.String delimiter)

setSkipHeader

public void setSkipHeader(boolean skipHeader)

setErrorReportDestinationDirectory

public void setErrorReportDestinationDirectory(java.io.File directory)

mapPrimaryKeyConcept

public void mapPrimaryKeyConcept(java.lang.String spreadsheetHeaderLabel,
                                 java.lang.String dataStorageFieldName)

mapCoreField

public void mapCoreField(java.lang.String coreFieldDisplayName,
                         java.lang.String coreFieldDataStorageName)
                  throws CSTException
Throws:
CSTException

hasErrors

public boolean hasErrors()

importFile

public void importFile(java.io.File coreDataImportFile)
                throws CSTException
imports a tab-delimited text file containing subject records.

Parameters:
coreDataImportFile -
Throws:
CSTException

importTextData

public void importTextData(java.lang.String text)
                    throws CSTException
Throws:
CSTException

writeErrorReport

public void writeErrorReport()
                      throws CSTException
Throws:
CSTException