This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from EHJ-52n/feature/gui-support-for-sample-ba…
- Loading branch information
Showing
15 changed files
with
1,558 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.x52North.sensorweb.sos.importer.x02.CsvMetadataDocument.CsvMetadata; | ||
import org.x52North.sensorweb.sos.importer.x02.DataFileDocument.DataFile; | ||
import org.x52North.sensorweb.sos.importer.x02.ParameterDocument.Parameter; | ||
import org.x52North.sensorweb.sos.importer.x02.SosImportConfigurationDocument.SosImportConfiguration; | ||
|
||
|
@@ -40,7 +41,7 @@ | |
* @author <a href="mailto:[email protected]">Eike Hinderk Jürrens</a> | ||
*/ | ||
public class Step2ModelHandler implements ModelHandler<Step2Model> { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(Step2ModelHandler.class); | ||
|
||
@Override | ||
|
@@ -49,24 +50,38 @@ public void handleModel(final Step2Model stepModel, | |
if (logger.isTraceEnabled()) { | ||
logger.trace("handleModel()"); | ||
} | ||
CsvMetadata cM = sosImportConf.getCsvMetadata(); | ||
Parameter p = null; | ||
CsvMetadata csvMetadata = sosImportConf.getCsvMetadata(); | ||
Parameter parameter = null; | ||
// | ||
if (cM == null) { | ||
cM = sosImportConf.addNewCsvMetadata(); | ||
p = cM.addNewParameter(); | ||
if (csvMetadata == null) { | ||
csvMetadata = sosImportConf.addNewCsvMetadata(); | ||
parameter = csvMetadata.addNewParameter(); | ||
} else { | ||
p = cM.getParameter(); | ||
parameter = csvMetadata.getParameter(); | ||
} | ||
if (parameter == null) { | ||
parameter = csvMetadata.addNewParameter(); | ||
} | ||
if (p == null) { | ||
p = cM.addNewParameter(); | ||
csvMetadata.setFirstLineWithData(stepModel.getFirstLineWithData()); | ||
csvMetadata.setUseHeader(stepModel.isUseHeader()); | ||
csvMetadata.setDecimalSeparator(stepModel.getDecimalSeparator()+""); | ||
parameter.setCommentIndicator(stepModel.getCommentIndicator()); | ||
parameter.setColumnSeparator(stepModel.getColumnSeparator()); | ||
parameter.setTextIndicator(stepModel.getTextQualifier()); | ||
if (stepModel.isSampleBased()) { | ||
// add other sampling parameters | ||
if (sosImportConf.getDataFile() == null) { | ||
sosImportConf.addNewDataFile(); | ||
} | ||
final DataFile dataFile = sosImportConf.getDataFile(); | ||
dataFile.setSampleStartRegEx(stepModel.getSampleBasedStartRegEx()); | ||
dataFile.setSampleDateOffset(stepModel.getSampleBasedDateOffset()); | ||
dataFile.setSampleDateExtractionRegEx(stepModel.getSampleBasedDateExtractionRegEx()); | ||
dataFile.setSampleDatePattern(stepModel.getSampleBasedDatePattern()); | ||
dataFile.setSampleDataOffset(stepModel.getSampleBasedDataOffset()); | ||
dataFile.setSampleSizeOffset(stepModel.getSampleBasedSampleSizeOffset()); | ||
dataFile.setSampleSizeRegEx(stepModel.getSampleBasedSampleSizeRegEx()); | ||
} | ||
cM.setFirstLineWithData(stepModel.getFirstLineWithData()); | ||
cM.setUseHeader(stepModel.getUseHeader()); | ||
cM.setDecimalSeparator(stepModel.getDecimalSeparator()+""); | ||
p.setCommentIndicator(stepModel.getCommentIndicator()); | ||
p.setColumnSeparator(stepModel.getColumnSeparator()); | ||
p.setTextIndicator(stepModel.getTextQualifier()); | ||
} | ||
|
||
} |
Oops, something went wrong.