Skip to content

Commit

Permalink
Merge pull request #61 from axonivy-market/MARP-967
Browse files Browse the repository at this point in the history
Enhance Docuware Connector
  • Loading branch information
nvvi authored Sep 11, 2024
2 parents 244029d + e30c42c commit 616cb96
Show file tree
Hide file tree
Showing 17 changed files with 262 additions and 59 deletions.
3 changes: 2 additions & 1 deletion docuware-connector-demo/config/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
# '<project>/Config/_<environment>/variables.yaml
#
Variables:
docuware-connector:
docuwareConnector:
host: ''
username: ''
password: ''
hostid: ''
organization: ''
fileCabinetId: ''
69 changes: 49 additions & 20 deletions docuware-connector-demo/processes/DocuWareDemo.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"startDescription" : "Start a UI to demonstrate some basic UI calls.",
"outLink" : "start.ivp",
"startName" : "Start some DocuWare calls",
"tags" : "demo"
"tags" : "demo",
"case" : { }
},
"visual" : {
"at" : { "x" : 96, "y" : 64 },
Expand Down Expand Up @@ -50,13 +51,14 @@
"input" : {
"code" : [
"import org.apache.commons.lang3.StringUtils;",
"ivy.log.info(\"Username: {0}\", ivy.var.get(\"docuware-connector.username\"));",
"ivy.log.info(\"Password set: {0}\", StringUtils.isNotBlank(ivy.var.get(\"docuware-connector_password\")));",
"ivy.log.info(\"HostId: {0}\", ivy.var.get(\"docuware-connector_hostid\"));",
"ivy.log.info(\"BaseUrl: {0}\", ivy.var.get(\"docuware-connector_baseurl\"));"
"ivy.log.info(\"Username: {0}\", ivy.var.get(\"docuwareConnector.username\"));",
"ivy.log.info(\"Password set: {0}\", StringUtils.isNotBlank(ivy.var.get(\"docuwareConnector_password\")));",
"ivy.log.info(\"HostId: {0}\", ivy.var.get(\"docuwareConnector_hostid\"));",
"ivy.log.info(\"BaseUrl: {0}\", ivy.var.get(\"docuwareConnector_baseurl\"));"
]
},
"startName" : "Log Organization names"
"startName" : "Log Organization names",
"case" : { }
},
"visual" : {
"at" : { "x" : 96, "y" : 224 },
Expand Down Expand Up @@ -121,7 +123,8 @@
"Load FileCabinets",
"from your Organization"
],
"startName" : "Load File Cabinets"
"startName" : "Load File Cabinets",
"case" : { }
},
"visual" : {
"at" : { "x" : 96, "y" : 352 },
Expand Down Expand Up @@ -326,7 +329,8 @@
"out.document.id" : "165"
}
},
"outLink" : "downloadFile.ivp"
"outLink" : "downloadFile.ivp",
"case" : { }
},
"visual" : {
"at" : { "x" : 720, "y" : 536 },
Expand Down Expand Up @@ -466,7 +470,8 @@
"out.document.id" : "165"
}
},
"outLink" : "sections.ivp"
"outLink" : "sections.ivp",
"case" : { }
},
"visual" : {
"at" : { "x" : 904, "y" : 712 },
Expand Down Expand Up @@ -568,7 +573,8 @@
"out.document.id" : "165"
}
},
"outLink" : "dialogs.ivp"
"outLink" : "dialogs.ivp",
"case" : { }
},
"visual" : {
"at" : { "x" : 1216, "y" : 768 },
Expand Down Expand Up @@ -709,7 +715,8 @@
"name" : "fileIndexFields.ivp",
"config" : {
"callSignature" : "fileIndexFields",
"outLink" : "fileIndexFields.ivp"
"outLink" : "fileIndexFields.ivp",
"case" : { }
},
"visual" : {
"at" : { "x" : 176, "y" : 848 }
Expand Down Expand Up @@ -755,10 +762,17 @@
},
"resultType" : "com.docuware.dev.schema._public.services.platform.FileCabinets",
"responseCode" : [
"import com.docuware.dev.schema._public.services.platform.FileCabinet;",
"import org.apache.commons.collections4.CollectionUtils;",
"",
"if(result != null && CollectionUtils.isNotEmpty(result.getFileCabinet())){ ",
" in.cabinet = result.getFileCabinet().get(0);",
"if(result != null && CollectionUtils.isNotEmpty(result.getFileCabinet())){",
" for(FileCabinet fileCabinet : result.getFileCabinet()) { ",
" // check with global variable fileCabinetId ",
" if(ivy.var.docuwareConnector_fileCabinetId.equalsIgnoreCase(fileCabinet.#id)) {",
" in.cabinet = fileCabinet;",
" break;",
" }",
" }",
"}"
]
},
Expand All @@ -778,7 +792,11 @@
{ "name" : "indexFields", "type" : "List<com.axonivy.connector.docuware.connector.DocuWareProperty>" },
{ "name" : "configuration", "type" : "com.axonivy.connector.docuware.connector.DocuWareEndpointConfiguration" }
],
"map" : {
"param.configuration.fileCabinetId" : "in.cabinet.id"
},
"code" : [
"import com.axonivy.connector.docuware.connector.DocuWareFieldTableItem;",
"import com.axonivy.connector.docuware.connector.DocuWareEndpointConfiguration;",
"import com.axonivy.connector.docuware.connector.demo.DocuWareDemoService;",
"import com.axonivy.connector.docuware.connector.DocuWareProperty;",
Expand All @@ -790,11 +808,21 @@
"List properties = new ArrayList();",
"//Note IndexFields are individual for each docuware instance. This is just an example",
"DocuWareProperty dp = new DocuWareProperty();",
"dp.setFieldName(\"DOCUMENTTYPE\");",
"dp.setItem(\"CORRESPONDENCE\");",
"dp.setFieldName(\"VENDOR_NAME\");",
"dp.setItem(\"DUMMY INC.\");",
"dp.setItemElementName(\"String\");",
"properties.add(dp);",
"",
"DocuWareFieldTableItem dwt = new DocuWareFieldTableItem();",
"dwt.createRow()",
" .addColumnValue(\"LINE__INVOICE_LINE_NUMBER\", \"1\", \"String\")",
" .addColumnValue(\"LINE__QTY\", \"3\", \"String\")",
" .addColumnValue(\"LINE__UNIT_PRICE\", \"18.00\", \"String\")",
";",
"",
"DocuWareProperty dwtp = new DocuWareProperty(\"LINE___ITEM\", dwt, \"Table\");",
"properties.add(dwtp);",
"",
"param.indexFields = properties;"
]
},
Expand Down Expand Up @@ -828,6 +856,7 @@
{ "name" : "configuration", "type" : "com.axonivy.connector.docuware.connector.DocuWareEndpointConfiguration" }
],
"map" : {
"param.documentId" : "String.valueOf(in.document.id)",
"param.configuration.fileCabinetId" : "in.cabinet.id"
},
"code" : [
Expand All @@ -840,8 +869,8 @@
"List properties = new ArrayList();",
"DocuWareProperty dp = new DocuWareProperty();",
"",
"dp.setFieldName(\"DOCUMENTTYPE\");",
"dp.setItem(\"CONTRACT\");",
"dp.setFieldName(\"VENDOR_NAME\");",
"dp.setItem(\"EXAMPLE\");",
"dp.setItemElementName(\"String\");",
"properties.add(dp);",
"",
Expand All @@ -852,7 +881,7 @@
"output" : {
"map" : {
"out" : "in",
"out.error" : "result.error"
"out.error" : "result.#error"
}
}
},
Expand All @@ -869,8 +898,8 @@
"output" : {
"map" : {
"out" : "in",
"out.error" : "result.error",
"out.file" : "result.file"
"out.error" : "result.#error",
"out.file" : "result.#file"
}
},
"call" : {
Expand Down
13 changes: 1 addition & 12 deletions docuware-connector-product/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,7 @@ Before any interactions between the Axon Ivy Engine and DocuWare services can be
1. Override the global variables for `host-name`, `user-name`, `password` and `host-id` in the demo project as shown in the example below.

```
Variables:
docuware-connector:
host: <myhost>.docuware.cloud
username: <myuser>
# [password]
password: <mypass>
hostid: <mhostid>
@variables.yaml@
```

If your REST URL does not follow the predefined REST URL pattern of this connector, you can change the URL in the Engine Cockpit. To change the URL in the Designer, you have to unpack the connector project and change it there.
Expand Down
5 changes: 5 additions & 0 deletions docuware-connector-product/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<artifactId>docuware-connector-product</artifactId>
<version>10.0.13-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<variables.yaml.file>../docuware-connector/config/variables.yaml</variables.yaml.file>
</properties>

<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@
<Field FieldName="DWDISKNO" FieldLabel="Disk number" ReadOnly="true">
<Int>1</Int>
</Field>
<Field FieldName="EMPLOYEE_NOTES" FieldLabel="Employee Notes" ReadOnly="true">
<Table>
<Row>
<ColumnValue FieldName="NOTES__CONTENT" FieldLabel="Content">
<String>HR input profile.</String>
</ColumnValue>
<ColumnValue FieldName="NOTES__AUTHOR" FieldLabel="Author">
<String>PTA</String>
</ColumnValue>
</Row>
<Row>
<ColumnValue FieldName="NOTES__CONTENT" FieldLabel="Content">
<String>HR Manager check profile: OK</String>
</ColumnValue>
<ColumnValue FieldName="NOTES__AUTHOR" FieldLabel="Author">
<String>LSA</String>
</ColumnValue>
</Row>
</Table>
</Field>
</Fields>
<Flags />
<Version Major="1" Minor="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,24 @@
<Field FieldName="DWDISKNO" FieldLabel="Disk number" ReadOnly="true">
<Int>1</Int>
</Field>
<Field FieldName="EMPLOYEE_NOTES" FieldLabel="Employee Notes" ReadOnly="true">
<Table>
<Row>
<ColumnValue FieldName="NOTES__CONTENT" FieldLabel="Content">
<String>HR input profile.</String>
</ColumnValue>
<ColumnValue FieldName="NOTES__AUTHOR" FieldLabel="Author">
<String>PTA</String>
</ColumnValue>
</Row>
<Row>
<ColumnValue FieldName="NOTES__CONTENT" FieldLabel="Content">
<String>HR Manager check profile: OK</String>
</ColumnValue>
<ColumnValue FieldName="NOTES__AUTHOR" FieldLabel="Author">
<String>LSA</String>
</ColumnValue>
</Row>
</Table>
</Field>
</DocumentIndexFields>
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@
<Field FieldName="DWDISKNO" FieldLabel="Disk number" ReadOnly="true">
<Int>1</Int>
</Field>
<Field FieldName="EMPLOYEE_NOTES" FieldLabel="Employee Notes" ReadOnly="true">
<Table>
<Row>
<ColumnValue FieldName="NOTES__CONTENT" FieldLabel="Content">
<String>HR input profile.</String>
</ColumnValue>
<ColumnValue FieldName="NOTES__AUTHOR" FieldLabel="Author">
<String>PTA</String>
</ColumnValue>
</Row>
<Row>
<ColumnValue FieldName="NOTES__CONTENT" FieldLabel="Content">
<String>HR Manager check profile: OK</String>
</ColumnValue>
<ColumnValue FieldName="NOTES__AUTHOR" FieldLabel="Author">
<String>LSA</String>
</ColumnValue>
</Row>
</Table>
</Field>
</Fields>
<Flags />
<Version Major="1" Minor="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@
<Field FieldName="DWDISKNO" FieldLabel="Disk number" ReadOnly="true">
<Int>1</Int>
</Field>
<Field FieldName="EMPLOYEE_NOTES" FieldLabel="Employee Notes" ReadOnly="true">
<Table>
<Row>
<ColumnValue FieldName="NOTES__CONTENT" FieldLabel="Content">
<String>HR input profile.</String>
</ColumnValue>
<ColumnValue FieldName="NOTES__AUTHOR" FieldLabel="Author">
<String>PTA</String>
</ColumnValue>
</Row>
<Row>
<ColumnValue FieldName="NOTES__CONTENT" FieldLabel="Content">
<String>HR Manager check profile: OK</String>
</ColumnValue>
<ColumnValue FieldName="NOTES__AUTHOR" FieldLabel="Author">
<String>LSA</String>
</ColumnValue>
</Row>
</Table>
</Field>
</Fields>
<Flags />
<Version Major="1" Minor="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void noHost() {
.property(Property.PASSWORD, "notMySecret").property(Property.HOSTID, "axoooooniiiivy")
.target("someResource").request().get())
.isInstanceOf(ProcessingException.class)
.hasMessageContaining("variable 'docuware-connector.host'");
.hasMessageContaining("variable 'docuwareConnector.host'");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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.DocuWareProperty;

import ch.ivyteam.ivy.application.IApplication;
Expand All @@ -16,11 +17,11 @@
public class TestDocuWareConnector {

protected void prepareRestClient(IApplication app, AppFixture fixture) {
fixture.var("docuware-connector.host", "TESTHOST");
fixture.var("docuware-connector.username", "TESTUSER");
fixture.var("docuware-connector.password", "TESTPASS");
fixture.var("docuware-connector.hostid", "TESTHOSTID");
fixture.var("docuware-connector.filecabinetid", "123");
fixture.var("docuwareConnector.host", "TESTHOST");
fixture.var("docuwareConnector.username", "TESTUSER");
fixture.var("docuwareConnector.password", "TESTPASS");
fixture.var("docuwareConnector.hostid", "TESTHOSTID");
fixture.var("docuwareConnector.filecabinetid", "123");
RestClient restClient = RestClients.of(app).find("DocuWare");
// change created client: use test url and a slightly different version of
// the
Expand All @@ -47,6 +48,15 @@ protected List<DocuWareProperty> prepareDocuWareProperties() {
dwp.setItem("3");
dwp.setItemElementName("String");
propertyList.add(dwp);

DocuWareFieldTableItem dwt = new DocuWareFieldTableItem();
dwt.createRow()
.addColumnValue("NOTES__CONTENT", "HR input profile.", "String")
.addColumnValue("NOTES__AUTHOR", "PTA", "String")
;
DocuWareProperty dwtp = new DocuWareProperty("EMPLOYEE_NOTES", dwt, "Table");
propertyList.add(dwtp);

return propertyList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public void testOrganizations(BpmClient bpmClient, ISession session, AppFixture
}

private void prepareRestClient(IApplication app, AppFixture fixture) {
fixture.var("docuware-connector.host", "TESTHOST");
fixture.var("docuware-connector.username", "TESTUSER");
fixture.var("docuware-connector.password", "TESTPASS");
fixture.var("docuware-connector.hostid", "TESTHOSTID");
fixture.var("docuwareConnector.host", "TESTHOST");
fixture.var("docuwareConnector.username", "TESTUSER");
fixture.var("docuwareConnector.password", "TESTPASS");
fixture.var("docuwareConnector.hostid", "TESTHOSTID");
RestClient restClient = RestClients.of(app).find("DocuWare");
// change created client: use test url and a slightly different version of
// the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void uploadFileWithEndpointConfiguration(BpmClient bpmClient, ISession se
@Test
public void uploadFileWithEndpointConfigurationWithStoreDialogFromVariable(BpmClient bpmClient, ISession session, AppFixture fixture,
IApplication app) throws IOException {
fixture.var("docuware-connector.storedialogid", "" + Constants.EXPECTED_DOCUMENT_ID_FOR_STORE_DIALOG_1);
fixture.var("docuwareConnector.storedialogid", "" + Constants.EXPECTED_DOCUMENT_ID_FOR_STORE_DIALOG_1);
prepareRestClient(app, fixture);
List<DocuWareProperty> propertyList = prepareDocuWareProperties();
DocuWareEndpointConfiguration configuration = prepareDocuWareEndpointConfiguration();
Expand Down
Loading

0 comments on commit 616cb96

Please sign in to comment.