Skip to content

Commit

Permalink
MARP-148 S4HANA connector - update rest client, example and document (#…
Browse files Browse the repository at this point in the history
…11)

* Update rest client, example and document

* Update to version 10.0.19-SNAPSHOT

* Update README.md - Added changes from Andreas

---------

Co-authored-by: Sabine Gillner <[email protected]>
  • Loading branch information
phhung-axonivy and ivy-sgi authored Jun 10, 2024
1 parent f274916 commit 93f7243
Show file tree
Hide file tree
Showing 24 changed files with 466 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
demoHANAData #class
com.axon.market.s4.hana.demo #namespace
businessPartners java.util.List<com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerType> #field
totalCount Integer #field
2 changes: 1 addition & 1 deletion S4HANA-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.axonivy.connector.s4hana</groupId>
<artifactId>s4-hana-demo</artifactId>
<version>10.0.0-SNAPSHOT</version>
<version>10.0.19-SNAPSHOT</version>
<packaging>iar</packaging>
<dependencies>
<dependency>
Expand Down
62 changes: 43 additions & 19 deletions S4HANA-demo/processes/demoHANA.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,27 @@
"config" : {
"output" : {
"code" : [
"import java.util.Arrays;",
"import com.axon.market.s4hana.client.APIBUSINESSPARTNERAAddressEmailAddressType;",
"import com.axon.market.s4hana.client.APIBUSINESSPARTNERABPContactToAddressTypeToEmailAddress;",
"import com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerAddressType;",
"import com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerType;",
"int i =0;",
"import java.util.Arrays;",
"ivy.log.info(\"Total count: {0}\", in.totalCount);",
"int i = 0;",
"for (APIBUSINESSPARTNERABusinessPartnerType bp: in.businessPartners) {",
" ivy.log.info(\"BusinessPartners(\"+i+\"):{0}\",String.join(\",\", Arrays.asList(bp.getBusinessPartnerFullName() , bp.getBusinessPartnerCategory() , bp.getBusinessPartnerGrouping() )));",
" ivy.log.info(\"BusinessPartners(\"+i+\"): {0}\", String.join(\",\", Arrays.asList(bp.getBusinessPartnerFullName(), bp.getBusinessPartnerCategory(), bp.getBusinessPartnerGrouping())));",
" for (APIBUSINESSPARTNERABusinessPartnerAddressType add: bp.toBusinessPartnerAddress.results) {",
" ivy.log.info(\"Address City {0}: \", add.cityName);",
" if (add.toEmailAddress.results.isEmpty()) {",
" ivy.log.info(\"Empty email\");",
" }",
"",
" for (APIBUSINESSPARTNERAAddressEmailAddressType em: add.toEmailAddress.results) {",
" ivy.log.info(\"Email {0}\",em.emailAddress);",
" }",
"",
" ivy.log.info(\" Address {0}\",add.cityName);",
" if (add.toEmailAddress.results.isEmpty()){ ivy.log.info(\" empty email \");}",
" for (APIBUSINESSPARTNERABPContactToAddressTypeToEmailAddress em: add.toEmailAddress.results) {",
" ",
" for (APIBUSINESSPARTNERAAddressEmailAddressType email: em.results) {",
" ivy.log.info(\" email {0}\",(email.emailAddress));",
" }",
" }",
" ",
" }",
" i++;",
" ",
"}"
]
}
Expand All @@ -41,15 +40,17 @@
"at" : { "x" : 400, "y" : 160 },
"size" : { "width" : 128, "height" : 60 }
},
"connect" : { "id" : "f12", "to" : "f10" }
"connect" : { "id" : "f1", "to" : "f0" }
}, {
"id" : "f8",
"type" : "RequestStart",
"name" : "getBusinessPartnersWithEmailAndBank.ivp",
"name" : "getBusinessPartners.ivp",
"config" : {
"callSignature" : "getBusinessPartnersWithEmailAndBank",
"callSignature" : "getBusinessPartners",
"outLink" : "getBusinessPartnersWithEmailAndBank.ivp",
"tags" : "demo"
"startName" : "Get a list of business partners",
"tags" : "demo",
"case" : { }
},
"visual" : {
"at" : { "x" : 96, "y" : 160 },
Expand All @@ -65,7 +66,8 @@
"output" : {
"map" : {
"out" : "in",
"out.businessPartners" : "result.businessPartners"
"out.businessPartners" : "result.businessPartners",
"out.totalCount" : "result.totalCount"
}
},
"call" : {
Expand All @@ -74,6 +76,7 @@
],
"map" : {
"param.request.query.expand" : "[\"to_BusinessPartnerAddress/to_EmailAddress\",\"to_BusinessPartnerBank\",\"to_BuPaIdentification\",\"to_BusinessPartnerContact\",\"to_BusinessPartnerRole\",\"to_Customer\",\"to_Supplier\"]",
"param.request.query.topCount" : "50",
"param.request.sapClient" : "200"
}
}
Expand All @@ -87,7 +90,28 @@
"id" : "f10",
"type" : "TaskEnd",
"visual" : {
"at" : { "x" : 528, "y" : 160 }
"at" : { "x" : 720, "y" : 160 }
}
}, {
"id" : "f0",
"type" : "DialogCall",
"name" : "BusinessPartnerView",
"config" : {
"dialogId" : "com.axon.market.s4.hana.demo.BusinessPartnerView",
"startMethod" : "start(List<com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerType>)",
"call" : {
"params" : [
{ "name" : "businessPartners", "type" : "List<com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerType>" }
],
"map" : {
"param.businessPartners" : "in.businessPartners"
}
}
},
"visual" : {
"at" : { "x" : 585, "y" : 161 },
"size" : { "width" : 146, "height" : 63 }
},
"connect" : { "id" : "f2", "to" : "f10" }
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<richDialogDescriptor>
<property>
<name>viewTechnology</name>
<value>JSF</value>
</property>
</richDialogDescriptor>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:body>
<ui:composition template="/layouts/frame-10.xhtml">
<ui:define name="title">Business Partner View</ui:define>
<ui:define name="content">

<h3>List of Business Partner</h3>

<h:form id="form">
<p:dataTable var="businessPartner" value="#{data.businessPartners}"
rows="10" paginator="true" paginatorPosition="bottom"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="{startRecord}-{endRecord} of {totalRecords} records"
rowsPerPageTemplate="5,10,20">

<p:column headerText="Business Partner"
sortBy="#{businessPartner.businessPartner}">
<h:outputText value="#{businessPartner.businessPartner}" />
</p:column>

<p:column headerText="Name"
sortBy="#{businessPartner.businessPartnerFullName}">
<h:outputText value="#{businessPartner.businessPartnerFullName}" />
</p:column>

<p:column headerText="Grouping"
sortBy="#{businessPartner.businessPartnerGrouping}">
<h:outputText value="#{businessPartner.businessPartnerGrouping}" />
</p:column>

<p:column headerText="Category"
sortBy="#{businessPartner.businessPartnerCategory}">
<h:outputText value="#{businessPartner.businessPartnerCategory}" />
</p:column>

<p:column headerText="City">
<h:outputText
value="#{empty businessPartner.toBusinessPartnerAddress.results ? '' : businessPartner.toBusinessPartnerAddress.results.get(0).cityName}" />
</p:column>

</p:dataTable>
<br />
<div class="command-btns">
<p:commandButton id="proceed" actionListener="#{logic.close}"
value="Close" update="form" icon="pi pi-check" />
</div>
</h:form>

</ui:define>
</ui:composition>
</h:body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BusinessPartnerViewData #class
com.axon.market.s4.hana.demo.BusinessPartnerView #namespace
businessPartners List<com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerType> #field
businessPartners PERSISTENT #fieldModifier
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"format" : "10.0.0",
"id" : "18FDC5AB53AFDA15",
"kind" : "HTML_DIALOG",
"config" : {
"data" : "com.axon.market.s4.hana.demo.BusinessPartnerView.BusinessPartnerViewData"
},
"elements" : [ {
"id" : "f0",
"type" : "HtmlDialogStart",
"name" : "start(List<APIBUSINESSPARTNERABusinessPartnerType>)",
"config" : {
"callSignature" : "start",
"input" : {
"params" : [
{ "name" : "businessPartners", "type" : "List<com.axon.market.s4hana.client.APIBUSINESSPARTNERABusinessPartnerType>" }
],
"map" : {
"out.businessPartners" : "param.businessPartners"
}
},
"guid" : "18FDC5AB53C99122"
},
"visual" : {
"at" : { "x" : 96, "y" : 64 }
},
"connect" : { "id" : "f2", "to" : "f1" }
}, {
"id" : "f1",
"type" : "HtmlDialogEnd",
"visual" : {
"at" : { "x" : 224, "y" : 64 }
}
}, {
"id" : "f3",
"type" : "HtmlDialogEventStart",
"name" : "close",
"config" : {
"guid" : "18FDC5AB53F884AF"
},
"visual" : {
"at" : { "x" : 96, "y" : 160 }
},
"connect" : { "id" : "f5", "to" : "f4" }
}, {
"id" : "f4",
"type" : "HtmlDialogExit",
"visual" : {
"at" : { "x" : 224, "y" : 160 }
}
} ]
}
60 changes: 60 additions & 0 deletions S4HANA-demo/webContent/layouts/frame-10.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">

<!--
DESCRIPTION:
This is the default template to use the freya-ivy theme as well as iFrames approach.
PORTAL:
If you are using the Axon Ivy Portal, you can pass several parameters to it to use some features (e.g. process chain).
You'll find the list of parameters here: https://developer.axonivy.com/portal/10.0/doc/portal-developer-guide/components/layout-templates.html#components-layout-templates-iframe-task-template
For further information about iframes and usage in Portal please refer to: https://developer.axonivy.com/portal/10.0/doc/portal-developer-guide/iframe/index.html
BRANDING:
If you want to brand your dialogs, please take a look at our documentation: https://developer.axonivy.com/doc/10.0/designer-guide/user-interface/branding/index.html
STYLING:
If you want to add custom styles, you can simply add your own .css file (e.g. at the location: "webContent/layouts/styles/style.css")
and refence it below in the head part.
-->

<h:head>
<f:attribute name="primefaces.THEME" value="#{ivyFreyaTheme.theme}" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><ui:insert name="title">Ivy Html Dialog</ui:insert></title>
<link rel="shortcut icon" href="#{resource['ivy-branding:favicon']}" />
<h:outputScript name="js/layout.js" library="#{ivyFreyaTheme.library}" />
<h:outputStylesheet name="#{ivyFreyaTheme.layout}" library="#{ivyFreyaTheme.library}" />
<h:outputStylesheet name="primeflex-2.min.css" library="primeflex" />
<h:outputStylesheet name="custom.css" library="ivy-branding" />
<!-- Optional Style or Script files:
<h:outputStylesheet name="layouts/styles/style.css" />
-->
</h:head>
<h:body class="body-hd #{ivyFreyaTheme.mode}">
<ui:include src="/layouts/includes/progress-loader.xhtml" />
<div id="content" class="container frame">
<ui:insert name="content">
default content
</ui:insert>
</div>

<ui:insert name="exception">
<ui:include src="/layouts/includes/exception.xhtml" />
</ui:insert>

<!-- optional Portal parameters:
<script>
window.
</script>
-->

</h:body>
</html>
Loading

0 comments on commit 93f7243

Please sign in to comment.