Skip to content

Commit f286588

Browse files
ssambasuMarkLogic Builder
authored andcommitted
Adding "separator" to gradle hubRunFlow command arguments
1 parent a191925 commit f286588

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/step/impl/WriteStepRunner.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,15 @@ public RunStepResponse run() {
306306
if(fileLocations.get("outputURIReplacement") != null) {
307307
this.outputURIReplacement = fileLocations.get("outputURIReplacement");
308308
}
309+
if(fileLocations.get("separator") != null) {
310+
if(! this.inputFileType.equalsIgnoreCase("csv")){
311+
throw new IllegalArgumentException("Invalid argument for file type " + inputFileType );
312+
}
313+
this.separator = fileLocations.get("separator").trim();
314+
if (separator.equals("\\t")) {
315+
separator = "\t";
316+
}
317+
}
309318
}
310319
if(stepConfig.get("stopOnFailure") != null){
311320
this.withStopOnFailure(Boolean.parseBoolean(stepConfig.get("stopOnFailure").toString()));

ml-data-hub-plugin/src/main/groovy/com/marklogic/gradle/task/RunFlowTask.groovy

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ class RunFlowTask extends HubTask {
4949
@Input
5050
public String outputURIReplacement
5151

52+
@Input
53+
public String separator
54+
5255
@Input
5356
public Boolean showOptions
5457

@@ -97,6 +100,11 @@ class RunFlowTask extends HubTask {
97100
project.property("inputFileType") : null
98101
}
99102

103+
if (separator == null) {
104+
separator = project.hasProperty("separator") ?
105+
project.property("separator") : null
106+
}
107+
100108
if (outputURIReplacement == null) {
101109
outputURIReplacement = project.hasProperty("outputURIReplacement") ?
102110
project.property("outputURIReplacement") : null
@@ -162,7 +170,7 @@ class RunFlowTask extends HubTask {
162170
stepConfig.put("stopOnFailure", failHard)
163171
}
164172

165-
if(inputFileType != null || inputFilePath != null || outputURIReplacement != null){
173+
if(inputFileType != null || inputFilePath != null || outputURIReplacement != null || separator !=null){
166174
runFlowString.append("\n\tWith File Locations Settings:")
167175
Map<String, String> fileLocations = new HashMap<>()
168176
if(inputFileType != null) {
@@ -177,6 +185,14 @@ class RunFlowTask extends HubTask {
177185
runFlowString.append("\n\t\tOutput URI Replacement:" + outputURIReplacement.toString())
178186
fileLocations.put("outputURIReplacement", outputURIReplacement)
179187
}
188+
if(separator != null) {
189+
if(inputFileType != null && !inputFileType.equalsIgnoreCase("csv")) {
190+
throw new IllegalArgumentException("Invalid argument for file type " + inputFileType)
191+
}
192+
runFlowString.append("\n\t\tSeparator:" + separator.toString())
193+
fileLocations.put("separator", separator)
194+
}
195+
180196
stepConfig.put("fileLocations", fileLocations)
181197
}
182198
if (showOptions) {

0 commit comments

Comments
 (0)