Skip to content

Commit

Permalink
Merge pull request #70 from axonivy-market/feat/MARP-1280
Browse files Browse the repository at this point in the history
feat/MARP-1280: Add Class for Keywords data type
  • Loading branch information
ptanhaxon authored Oct 31, 2024
2 parents 504d00d + 4e11c00 commit a0034ef
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docuware-connector-demo/processes/DocuWareDemo.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@
"param.configuration.fileCabinetId" : "in.cabinet.id"
},
"code" : [
"import com.axonivy.connector.docuware.connector.DocuWareKeywordsField;",
"import com.axonivy.connector.docuware.connector.DocuWareFieldTableItem;",
"import com.axonivy.connector.docuware.connector.DocuWareEndpointConfiguration;",
"import com.axonivy.connector.docuware.connector.demo.DocuWareDemoService;",
Expand Down Expand Up @@ -823,6 +824,13 @@
"DocuWareProperty dwtp = new DocuWareProperty(\"LINE___ITEM\", dwt, \"Table\");",
"properties.add(dwtp);",
"",
"DocuWareKeywordsField keywordField = new DocuWareKeywordsField();",
"keywordField.append(\"1st Keyword\");",
"keywordField.append(\"2nd Keyword\");",
"",
"DocuWareProperty keywordProperty = new DocuWareProperty(\"VALIDATION_CHECK\", keywordField, \"Keywords\");",
"properties.add(keywordProperty);",
"",
"param.indexFields = properties;"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.axonivy.connector.docuware.connector.DocuWareAuthFeature;
import com.axonivy.connector.docuware.connector.DocuWareEndpointConfiguration;
import com.axonivy.connector.docuware.connector.DocuWareFieldTableItem;
import com.axonivy.connector.docuware.connector.DocuWareKeywordsField;
import com.axonivy.connector.docuware.connector.DocuWareProperty;

import ch.ivyteam.ivy.application.IApplication;
Expand Down Expand Up @@ -57,6 +58,12 @@ protected List<DocuWareProperty> prepareDocuWareProperties() {
DocuWareProperty dwtp = new DocuWareProperty("EMPLOYEE_NOTES", dwt, "Table");
propertyList.add(dwtp);

DocuWareKeywordsField keywordField = new DocuWareKeywordsField();
keywordField.append("1st Keyword");
keywordField.append("2nd Keyword");
DocuWareProperty keywordProperty = new DocuWareProperty("TAGS", keywordField, "Keywords");
propertyList.add(keywordProperty);

return propertyList;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.axonivy.connector.docuware.connector;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
* DocuWareKeywordsField class to match the JSON format used by the Docuware rest
* services for setting item value of {@link DocuWareProperty} which
* type="Keywords".
*/
@JsonPropertyOrder({ "$type", "Keyword" })
public class DocuWareKeywordsField {

@JsonProperty(value = "$type")
final private String type = "DocumentIndexFieldKeywords";

@JsonProperty(value = "Keyword")
private List<String> keywords;

public DocuWareKeywordsField() {
keywords = new ArrayList<>();
}

/**
* @return the keywords
*/
public List<String> getKeywords() {
return keywords;
}

/**
* @param keywords the keywords to set
*/
public void setKeywords(List<String> keywords) {
this.keywords = keywords;
}

/**
* @return the type
*/
public String getType() {
return type;
}

/**
*
* @param value
* Utility function to add keyword to the list
*/
public void append(String value) {
if (Objects.isNull(keywords)) {
keywords = new ArrayList<>();
}
keywords.add(value);
}

}

0 comments on commit a0034ef

Please sign in to comment.