This library is an integration to Enonic XP application code for persons, referred to as employees, registered in CV-partner. This enables the ability to import employees and their profiles in CV-partner into Enonic XP node library
and create content for these respectively. This library create and send events which operate on new and modified data from CV-partners user APIs.
To install this library you need to add a new dependency to your app's build.gradle file.
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
include "no.item:lib-xp-cvpartner:0.0.1"
}
To update the version of enonic-types in package.json using npm, run the following command:
npm install --save-dev @item-enonic-types/lib-cvpartner
This library contains a task ("cvpartner-import"
) that can be run in the main.ts of another application:
run(
{
user: {
idProvider: "system",
login: "su",
},
},
() => {
submitTask({ descriptor: `${app.name}:cvpartner-import` });
}
);
You can select an employee in your Enonic XP application code with a CustomSelector
:
<input name="cvPartnerEmployeeId" type="CustomSelector">
<label i18n="employee.cvPartnerEmployeeId">Profile from CV-Partner</label>
<occurrences minimum="0" maximum="1"/>
<config>
<service>cv-partner-employee</service>
</config>
</input>
*In Enonic XP you may listen to the events emitted from this library by defining a `listener: *
listener<CVPartnerEmployeeNode & Node>({
type: "custom.cvpartner.*",
callback: (event) => {
// Handle event
},
});
Events that can be emitted from this library:
custom.cvpartner.create
custom.cvpartner.modify
custom.cvpartner.image
Add the following configuration to you XP_HOME/config/com.mycompany.cfg-file:
cvPartnerBaseUrl=https://<mycompany>.cvpartner.com
cvPartnerApiKey=<api key>
cvPartnerBaseUrl
, Base url to fetch data about cv-partner employee profiles. referencedapp.config.cvPartnerBaseUrl
cvPartnerApiKey
key identifier used to authenticate request for endpoints such ascvPartnerBaseUrl/{path}
+ . referencedapp.config.cvPartnerApiKey
To build the project run the following code
./gradlew build
Deploy locally for testing purposes:
./gradlew publishToMavenLocal
Go to the Jitpack page for lib-xp-cvpartner to deploy from GitHub (after creating a new versioned release).