Skip to content

Commit

Permalink
#126: remove @internal if the field is already marked as @optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabrina Wullschleger committed Mar 8, 2024
1 parent 2994ed4 commit d6aad65
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 39 deletions.
31 changes: 12 additions & 19 deletions gretl/src/main/java/ch/so/agi/gretl/tasks/Csv2Excel.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,36 @@ public File getCsvFile() {
return csvFile;
}

@Internal
@Optional
public Boolean isFirstLineIsHeader() {
return firstLineIsHeader;
}

@Internal
@Optional
public Character getValueDelimiter() {
return valueDelimiter;
}

@Internal
@Optional
public Character getValueSeparator() {
return valueSeparator;
}

@Internal
@Optional
public String getEncoding() {
return encoding;
}

@Internal
@Optional
public String getModels() {
return models;
}

@Internal
@Optional
public String getModeldir() {
return modeldir;
}

@Internal
@Optional
public File getOutputDir() {
return outputDir;
Expand All @@ -80,35 +73,35 @@ public File getOutputDir() {
public void run() {
log = LogEnvironment.getLogger(Csv2Excel.class);

if (getCsvFile() == null) {
if (csvFile == null) {
throw new IllegalArgumentException("csvFile must not be null");
}

Settings settings = new Settings();
settings.setValue(IoxWkfConfig.SETTING_FIRSTLINE,
firstLineIsHeader ? IoxWkfConfig.SETTING_FIRSTLINE_AS_HEADER : IoxWkfConfig.SETTING_FIRSTLINE_AS_VALUE);

if (getValueDelimiter() != null) {
settings.setValue(IoxWkfConfig.SETTING_VALUEDELIMITER, getValueDelimiter().toString());
if (valueDelimiter != null) {
settings.setValue(IoxWkfConfig.SETTING_VALUEDELIMITER, valueDelimiter.toString());
}

if (getValueSeparator() != null) {
settings.setValue(IoxWkfConfig.SETTING_VALUESEPARATOR, getValueSeparator().toString());
if (valueSeparator != null) {
settings.setValue(IoxWkfConfig.SETTING_VALUESEPARATOR, valueSeparator.toString());
}

if (getEncoding() != null) {
settings.setValue(CsvReader.ENCODING, getEncoding());
if (encoding != null) {
settings.setValue(CsvReader.ENCODING, encoding);
}

if (getModels() != null) {
settings.setValue(Validator.SETTING_MODELNAMES, getModels());
if (models != null) {
settings.setValue(Validator.SETTING_MODELNAMES, models);
}

if (getModeldir() != null) {
settings.setValue(Validator.SETTING_ILIDIRS, getModeldir());
if (modeldir != null) {
settings.setValue(Validator.SETTING_ILIDIRS, modeldir);
}

if (getOutputDir() == null) {
if (outputDir == null) {
outputDir = getCsvFile().getParentFile();
}

Expand Down
7 changes: 0 additions & 7 deletions gretl/src/main/java/ch/so/agi/gretl/tasks/Csv2Parquet.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,36 @@ public File getCsvFile() {
return csvFile;
}

@Internal
@Optional
public Boolean isFirstLineIsHeader() {
return firstLineIsHeader;
}

@Internal
@Optional
public Character getValueDelimiter() {
return valueDelimiter;
}

@Internal
@Optional
public Character getValueSeparator() {
return valueSeparator;
}

@Internal
@Optional
public String getEncoding() {
return encoding;
}

@Internal
@Optional
public String getModels() {
return models;
}

@Internal
@Optional
public String getModeldir() {
return modeldir;
}

@Internal
@Optional
public File getOutputDir() {
return outputDir;
Expand Down
2 changes: 1 addition & 1 deletion gretl/src/main/java/ch/so/agi/gretl/tasks/CsvExport.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class CsvExport extends DefaultTask {

private Boolean firstLineIsHeader = true;

private Character valueDelimiter = null;
private Character valueDelimiter = null;/**/

private Character valueSeparator = null;

Expand Down
7 changes: 0 additions & 7 deletions gretl/src/main/java/ch/so/agi/gretl/tasks/Curl.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,43 +70,36 @@ public int getExpectedStatusCode() {
return expectedStatusCode;
}

@Internal
@Optional
public String getExpectedBody() {
return expectedBody;
}

@Internal
@Optional
public Map<String, Object> getFormData() {
return formData;
}

@Internal
@Optional
public File getOutputFile() {
return outputFile;
}

@Internal
@Optional
public File getDataBinary() {
return dataBinary;
}

@Internal
@Optional
public Map<String, String> getHeaders() {
return headers;
}

@Internal
@Optional
public String getUser() {
return user;
}

@Internal
@Optional
public String getPassword() {
return password;
Expand Down
10 changes: 5 additions & 5 deletions gretl/src/main/java/ch/so/agi/gretl/tasks/Ili2gpkgImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

public class Ili2gpkgImport extends Ili2gpkgAbstractTask {
private Object dataFile;
private Boolean coalesceJson;
private Boolean nameByTopic;
private Boolean coalesceJson = false;
private Boolean nameByTopic = false;
private String defaultSrsCode;
private Boolean createEnumTabs;
private Boolean createMetaInfo;
private Boolean createGeomIdx;
private Boolean createEnumTabs = false;
private Boolean createMetaInfo = false;
private Boolean createGeomIdx = false;

@InputFile
public Object getDataFile(){
Expand Down

0 comments on commit d6aad65

Please sign in to comment.