Skip to content

Commit

Permalink
Pull request changes, added rest api key feature
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasKulhanek committed Feb 23, 2023
1 parent 37ba14f commit 7670c97
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 24 deletions.
5 changes: 3 additions & 2 deletions talentlink-connector-product/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# TalentLink Connector
Axon Ivy’s TalentLink connector helps you accelerate your process automation initiatives by integrating TalenLink with your process application in the shortest possible time.
Link to TalentLink: https://developer.lumesse-talenthub.com/
Axon Ivy’s TalentLink connector helps you accelerate your process automation initiatives by integrating TalentLink with your process application in the shortest possible time.

This connector:

Expand All @@ -13,7 +14,7 @@ This connector:

## Setup

Before any interactions between the Axon Ivy Engine and TalentLink services can be run, they have to be introducted to each other. This can be done as follows:
Before any interactions between the Axon Ivy Engine and TalentLink services can be run, they have to be introduced to each other. This can be done as follows:

1. Get a TalentLink account `host-name`, `user-name`, `password` and `api_key` to use.

Expand Down
6 changes: 3 additions & 3 deletions talentlink-connector-product/product.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"data": {
"projects": [
{
"groupId": "com.axonivy.connector.talentlink.demo",
"artifactId": "talentlink-demo",
"version": "1.0.0",
"groupId": "com.axonivy.connector.talentlink",
"artifactId": "talentlink-connector-demo",
"version": "${version}",
"type": "iar"
}
],
Expand Down
1 change: 1 addition & 0 deletions talentlink-connector/config/rest-clients.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RestClients:
Features:
- ch.ivyteam.ivy.rest.client.mapper.JsonFeature
- ch.ivyteam.ivy.rest.client.authentication.HttpBasicAuthenticationFeature
- com.axonivy.connector.talentlink.features.RestApiFeature
Properties:
username: ${ivy.var.talentlink-connector.username}
password: ${decrypt:\u00AC\u0078\u004A\u00A5\u000B\u0039\u0050\u0072\u0026\u0091\u000E\u0012\u00D2\u0048\u00F6\u009F\u0012\u00CB\u0048\u00B2\u00B2\u0098\u001A\u00BE\u0098\u0070\u0063\u0067\u0010\u00A4\u00A9\u00F5\u002E\u0097\u0021\u0041\u00D7\u001E\u00A5\u0049\u003B\u0065\u0001\u006C\u00EF\u0024\u00D4\u0008\u0031\u0036\u0081\u00DD\u0096\u0013\u00CE\u0016\u00B5\u00FD\u0049\u00D0\u00BE\u004F\u0031\u0032\u00E7\u00B2\u0014\u000D\u00E1\u00DA\u00AB\u00DE\u006D\u00CD\u0045\u0065\u005C\u0047\u0074\u00D6\u0092\u0088\u001D\u00FE\u0057\u00E9\u003F\u0017\u007A\u006D\u0028\u0077\u00FE\u004D\u00D7\u002C\u0078\u002E\u0003\u0066\u00B7\u0060\u00A5\u0090\u00A1\u00FF\u00DE\u0009\u0005\u0061\u0013\u0084\u0045\u00D3\u00D1\u00B0\u0044\u006F\u0095\u0082\u00DF\u0007\u0089\u004C\u002D\u0004\u007C\u003E\u007E\u00F2\u0028\u001B\u007B\u006F\u00B5\u0062\u0083\u0020\u0097\u0037\u00A1\u0037\u008E\u00B0\u006E\u0016\u00F7\u0052\u0042\u00DE\u00E8\u00A7\u000E\u0046\u00B9\u00BD\u0066\u001F\u0069\u0003\u0006\u00DB\u00BA\u00D3\u00C2\u004E\u0047\u000E\u0013\u00A2\u003B\u00B0\u0053\u000F\u00DB\u00C2\u00C1\u003E\u007F\u005E\u0083\u0052\u0072\u00A1\u00ED\u005A\u0013\u00B0\u002C\u0068\u00CB\u006E\u0083\u0060\u0020\u00CE\u00DB\u0037\u009E\u00CB\u00E1\u00F5\u00D7\u00F9\u00F5\u00A2\u0006\u0010\u000A\u00A8\u00E0\u00F6\u00FC\u0079\u0061\u00BC\u006C\u005F\u00CB\u00A3\u00DA\u00F1\u002D\u0002\u0022\u00B1\u0011\u00D2\u006F\u001B\u0065\u00BB\u00C3\u009C\u00F4\u00DA\u006A\u00A6\u0093\u00D1\u00F4\u0006\u001F\u00E5\u0084\u00A7\u00CB\u0092\u00E6\u0058\u00E2\u00D9\u0091\u00CC\u00B5\u00DE}
Expand Down
Binary file not shown.
37 changes: 34 additions & 3 deletions talentlink-connector/processes/rest/Application.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"queryParams" : {
"query" : "java.net.URLEncoder.encode(\"{applications(first: 10, after: 0, where: {id_eq:\"+in.applicationId+\"}) {id}}\", \"utf-8\")",
"stream" : "",
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")"
"api_key" : ""
},
"statusErrorCode" : "ivy:error:rest:client",
"responseMapping" : {
Expand All @@ -61,6 +61,22 @@
"visual" : {
"at" : { "x" : 264, "y" : 64 }
},
"boundaries" : [ {
"id" : "f10",
"type" : "ErrorBoundaryEvent",
"config" : {
"output" : {
"map" : {
"out" : "in",
"out.error" : "error"
}
}
},
"visual" : {
"at" : { "x" : 296, "y" : 104 }
},
"connect" : { "id" : "f11", "to" : "f1", "via" : [ { "x" : 376, "y" : 104 } ] }
} ],
"connect" : { "id" : "f3", "to" : "f1" }
}, {
"id" : "f4",
Expand Down Expand Up @@ -106,8 +122,7 @@
"clientErrorCode" : "ivy:error:rest:client",
"queryParams" : {
"query" : "java.net.URLEncoder.encode(in.queryForApplication, \"utf-8\")",
"stream" : "",
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")"
"stream" : ""
},
"statusErrorCode" : "ivy:error:rest:client",
"responseMapping" : {
Expand All @@ -118,6 +133,22 @@
"visual" : {
"at" : { "x" : 256, "y" : 176 }
},
"boundaries" : [ {
"id" : "f12",
"type" : "ErrorBoundaryEvent",
"config" : {
"output" : {
"map" : {
"out" : "in",
"out.error" : "error"
}
}
},
"visual" : {
"at" : { "x" : 288, "y" : 216 }
},
"connect" : { "id" : "f13", "to" : "f5" }
} ],
"connect" : { "id" : "f7", "to" : "f5" }
} ]
}
6 changes: 2 additions & 4 deletions talentlink-connector/processes/rest/Candidate.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
"clientErrorCode" : "ivy:error:rest:client",
"queryParams" : {
"query" : "java.net.URLEncoder.encode(\"{ candidates(first: 10, after: 0, where: {id_eq:\"+in.candidateId+\"}) { id, firstname, lastname, academicTitle, attachments{id, fileName}, email, personalData{dateOfBirth}}}\", \"utf-8\")",
"stream" : "",
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")"
"stream" : ""
},
"statusErrorCode" : "ivy:error:rest:client",
"responseMapping" : {
Expand Down Expand Up @@ -124,8 +123,7 @@
"clientErrorCode" : "ivy:error:rest:client",
"queryParams" : {
"query" : "java.net.URLEncoder.encode(in.queryForCandidate, \"utf-8\")",
"stream" : "",
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")"
"stream" : ""
},
"statusErrorCode" : "ivy:error:rest:client",
"responseMapping" : {
Expand Down
3 changes: 1 addition & 2 deletions talentlink-connector/processes/rest/Department.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
"clientErrorCode" : "ivy:error:rest:client",
"queryParams" : {
"query" : "java.net.URLEncoder.encode(\"\"+in.queryForDepartment+\"\",\"utf-8\")",
"stream" : "",
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")"
"stream" : ""
},
"statusErrorCode" : "ivy:error:rest:client",
"responseMapping" : {
Expand Down
4 changes: 0 additions & 4 deletions talentlink-connector/processes/rest/Document.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@
"path" : "/candidate/document/{documentId}",
"clientId" : "d8e4652e-41d5-4023-90c5-5c822b8600e2",
"clientErrorCode" : "ivy:error:rest:client",
"queryParams" : {
"query" : "",
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")"
},
"statusErrorCode" : "ivy:error:rest:client",
"templateParams" : {
"documentId" : "in.documentId"
Expand Down
6 changes: 2 additions & 4 deletions talentlink-connector/processes/rest/Position.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
"clientErrorCode" : "ivy:error:rest:client",
"queryParams" : {
"query" : "java.net.URLEncoder.encode(\"{positions(first: 10, after: 0, where: {id_eq: \"+in.positionId+\"}) {id, expectedContractDates{start, end}, location{city, region, country}, configurableFields{lovs{valueLovId, value} }, organization{id, name, parentId, level, structure{id, name, level, parentId}}}}\", \"utf-8\")",
"stream" : "",
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")"
"stream" : ""
},
"statusErrorCode" : "ivy:error:rest:client",
"responseMapping" : {
Expand Down Expand Up @@ -126,8 +125,7 @@
"clientErrorCode" : "ivy:error:rest:client",
"queryParams" : {
"query" : "java.net.URLEncoder.encode(\"{positions(first: 10, after: 0, where: {id_eq: \"+in.positionId+\"}) {id, expectedContractDates{start, end}, location{city, region, country}, configurableFields{lovs{valueLovId, value} }, organization{id, name, parentId, level, structure{id, name, level, parentId}}}}\", \"utf-8\")",
"stream" : "",
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")"
"stream" : ""
},
"statusErrorCode" : "ivy:error:rest:client",
"responseMapping" : {
Expand Down
1 change: 0 additions & 1 deletion talentlink-connector/processes/rest/Queue.p.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"clientId" : "d8e4652e-41d5-4023-90c5-5c822b8600e2",
"clientErrorCode" : "ivy:error:rest:client",
"queryParams" : {
"api_key" : "ivy.var.get(\"talentlink-connector.apikey\")",
"showCandidateData" : ""
},
"statusErrorCode" : "ivy:error:rest:client",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public class ApiFeature implements WebServiceClientFeature {
@Override
public void initialize(WebServiceClientFeatureContext context) {
Client proxy = ClientProxy.getClient(context.getBindingProvider());
proxy.getRequestContext().put("org.apache.cxf.message.Message.QUERY_STRING", "api_key="+Ivy.var().variable("talentlink-connector.apikey").value());
proxy.getRequestContext().put("org.apache.cxf.message.Message.QUERY_STRING", "api_key=" + Ivy.var().variable("talentlink-connector.apikey").value());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.axonivy.connector.talentlink.features;

import javax.ws.rs.core.FeatureContext;

import ch.ivyteam.ivy.rest.client.mapper.JsonFeature;

public class RestApiFeature extends JsonFeature{

@Override
public boolean configure(FeatureContext context) {
context.register(TalentlinkQueryStringFilter.class);
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.axonivy.connector.talentlink.features;

import java.io.IOException;
import java.net.URI;
import java.util.regex.Matcher;

import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import javax.ws.rs.core.UriBuilder;

import ch.ivyteam.ivy.environment.Ivy;

public class TalentlinkQueryStringFilter implements ClientRequestFilter{

private final static String api_key = Ivy.var().get("talentlink-connector.apikey");

@Override
public void filter(ClientRequestContext requestContext) throws IOException {
URI uri = requestContext.getUri();

UriBuilder uriBuilder = UriBuilder.fromUri(uri);

requestContext.setUri(uriBuilder.queryParam("api_key", api_key).build());
}


}

0 comments on commit 7670c97

Please sign in to comment.