GithubHelp home page GithubHelp logo

preller / eam-wshub-core Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cern-eam/eam-wshub-core

0.0 0.0 0.0 1.05 MB

High-level Java SE library that provides all core functionalities of EAM WS Hub.

License: GNU General Public License v3.0

Shell 0.10% Perl 0.82% Java 99.08%

eam-wshub-core's Introduction

EAM WSHub Core

EAM WSHub Core is a Java library that can execute operations on Infor instances.

This library is used internally by EAM WSHub. If you run a JVM-based application, you have the option of using directly EAM WSHub Core, instead of installing EAM WSHub.

Installation

To use EAM WSHub Core in your project, you just need to add the following Maven dependency:

<dependency>
    <groupId>ch.cern.eam</groupId>
    <artifactId>eam-wshub-core</artifactId>
    <version>11.4-0</version>
</dependency>

Usage

InforClient

The class InforClient is the entry point of this library. You first need to create an instance of InforClient, with the configuration specific to your environment:

InforClient inforClient = new InforClient.Builder(
        "https://<your.domain.name>/axis/services/EWSConnector") 
    .withDefaultTenant("<tenant>")
    .withDefaultOrganizationCode("<your-organization-code>")
    .build();

The InforClient instance you get is thread-safe and should be reused across your application.

InforClient Options
Option Description Required?
url URL of your Infor instance Yes
tenant Tenant Yes
defaultOrganizationCode Default organization that will be used in every Infor call in case none is provided in InforContext. No
inforInterceptor Object that includes callbacks to execute before/after every Infor call. No
executorService If you run EAM WSHub core within a Java EE container, you need to give InforClient the ManagedExecutorService coming from your container. No
dataSource To improve performance, EAM WSHub core may execute SQL requests directly on the database. Passing a datasource activates this option. No

InforContext

To execute an operation on Infor, you also need an InforContext instance, that contains the configuration specific to your operation. InforContext instance are also thread-safe, and can therefore be reused if needed.

InforContext context = new InforContext.Builder()
    .withCredentials(new Credentials("<username>", "<password>"))
    .build();
InforContext Options
Option Description Required?
credentials username/password of the Infor user who executes the request. Yes 1
sessionID id of the current session. Yes 1
organizationCode Code of the organization on which the request should be executed. No 2

1 You should provide either credentials, or a sessionID.

2 If the organization code is not provided in inforContext, the default value provided in inforClient will be used. The organization code should be provided in at least one of these two objets.

Example

Here is a complete example, in which we update a work order with EAM WSHub Core:

import ch.cern.eam.wshub.core.aisws.InforClient;
import ch.cern.eam.wshub.core.aisws.InforContext;
import ch.cern.eam.wshub.core.services.entities.Credentials;
import ch.cern.eam.wshub.core.services.workorders.WorkOrderService;
import ch.cern.eam.wshub.core.services.workorders.entities.WorkOrder;
import ch.cern.eam.wshub.core.tools.InforException;

public class UpdateWorkOrderExample {

    public static void main(String[] args) throws InforException {

        String inforEndpointUrl = "{YOUR-ENDPOINT-URL}";
        String organizationCode = "{YOUR-ORGANIZATION-CODE}";
        String tenant = "{YOUR-TENANT}";
        String username = "{YOUR-USERNAME}";
        String password = "{YOUR-PASSWORD}";
        String workOrderNumber = "{YOUR-WORK-ORDER-NUMBER}";

        InforClient inforClient = new InforClient.Builder(
                inforEndpointUrl,
                tenant)
                .withDefaultOrganizationCode(organizationCode)
                .build();

        InforContext context = new InforContext.Builder()
                .withCredentials(new Credentials(username, password))
                .build();

        WorkOrderService workOrderService = inforClient.getWorkOrderService();

        // Fetch workorder
        WorkOrder workOrder = workOrderService.readWorkOrder(context, workOrderNumber);

        // Let's update the description
        workOrder.setDescription("New workOrder description");

        // And synchronize the workorder in Infor
        workOrderService.updateWorkOrder(context, workOrder);

    }
}

License

This software is published under the GNU General Public License v3.0 or later.

eam-wshub-core's People

Contributors

lukaszpater avatar pedroamarocern avatar preller avatar ricardo-j-almeida avatar miguelv-dev avatar booua avatar phigne avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.