How to Set Resource Calendars in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.CalendarElement;
import toatech.resourcemanagement._1.CalendarList;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.SetResourcesCalendarsElement;
import toatech.resourcemanagement._1.TextPropertiesElement;
import toatech.resourcemanagement._1.TextPropertyElement;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final SetResourcesCalendarsElement req = new SetResourcesCalendarsElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final CalendarList calendars = new CalendarList();

    final CalendarElement calendar = new CalendarElement();

    final TextPropertiesElement props = new TextPropertiesElement();

    final TextPropertyElement date = new TextPropertyElement();

    date.setName("date");

    date.setValue("2017-01-01");

    props.getProperty().add(date);

    final TextPropertyElement resourceId = new TextPropertyElement();

    resourceId.setName("resource_id");

    resourceId.setValue("1");

    props.getProperty().add(resourceId);

    final TextPropertyElement schedule = new TextPropertyElement();

    schedule.setName("schedule");

    schedule.setValue("Sample Work Schedule");

    props.getProperty().add(schedule);

    calendar.setProperties(props);

    calendars.getCalendar().add(calendar);

    req.setCalendars(calendars);

    out.println(port.setResourcesCalendars(req));
  }

}
Advertisements

How to List Resources in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.GetResourcesListElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final GetResourcesListElement req = new GetResourcesListElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    out.println(port.getResourcesList(req));
  }

}

How to Get a Resource in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.GetResourceElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final GetResourceElement req = new GetResourceElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    req.setId("SampleResource");

    out.println(port.getResource(req));
  }

}

How to Update a Resource in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.PropertiesElement;
import toatech.resourcemanagement._1.PropertyElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.UpdateResourceElement;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final UpdateResourceElement req = new UpdateResourceElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    req.setId("SampleResource");

    final PropertiesElement props = new PropertiesElement();

    final PropertyElement status = new PropertyElement();

    status.setName("status");

    status.setValue("inactive");

    props.getProperty().add(status);

    req.setProperties(props);

    out.println(port.updateResource(req));
  }

}

How to Insert a Resource in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.InsertResourceElement;
import toatech.resourcemanagement._1.PropertiesElement;
import toatech.resourcemanagement._1.PropertyElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final InsertResourceElement req = new InsertResourceElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    req.setId("SampleResource");

    final PropertiesElement props = new PropertiesElement();

    final PropertyElement status = new PropertyElement();

    status.setName("status");

    status.setValue("active");

    props.getProperty().add(status);

    final PropertyElement parentId = new PropertyElement();

    parentId.setName("parent_id");

    parentId.setValue("1");

    props.getProperty().add(parentId);

    final PropertyElement type = new PropertyElement();

    type.setName("type");

    type.setValue("SampleType");

    props.getProperty().add(type);

    final PropertyElement name = new PropertyElement();

    name.setName("name");

    name.setValue("Sample Resource");

    props.getProperty().add(name);

    final PropertyElement language = new PropertyElement();

    language.setName("language");

    language.setValue("br");

    props.getProperty().add(language);

    final PropertyElement timeZone = new PropertyElement();

    timeZone.setName("time_zone");

    timeZone.setValue("Brasilia");

    props.getProperty().add(timeZone);

    req.setProperties(props);

    out.println(port.insertResource(req));
  }

}

How to List Users in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.UserListItemElement;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final GetUsersListElement req = new GetUsersListElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    req.setRootResourceId("1");

    out.println(port.getUsersList(req));
  }

}

How to Get an User in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.GetUserElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final GetUserElement req = new GetUserElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    req.setLogin("SampleLogin2");

    out.println(port.getUser(req));
  }

}

How to Delete an User in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.DeleteUserElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final DeleteUserElement req = new DeleteUserElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    req.setLogin("SampleLogin2");

    out.println(port.deleteUser(req));
  }

}

How to Update an User in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.PropertiesElement;
import toatech.resourcemanagement._1.PropertyElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.UpdateUserElement;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final UpdateUserElement req = new UpdateUserElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    req.setLogin("SampleLogin2");

    final PropertiesElement props = new PropertiesElement();

    final PropertyElement status = new PropertyElement();

    status.setName("status");

    status.setValue("inactive");

    props.getProperty().add(status);

    req.setProperties(props);

    out.println(port.updateUser(req));
  }

}

How to Insert an User in the Oracle Field Service Cloud with the Resource Management API with Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.InsertUserElement;
import toatech.resourcemanagement._1.PropertiesElement;
import toatech.resourcemanagement._1.PropertyElement;
import toatech.resourcemanagement._1.ResourceIdListElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final InsertUserElement req = new InsertUserElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    req.setLogin("SampleLogin2");

    final PropertiesElement props = new PropertiesElement();

    final PropertyElement status = new PropertyElement();

    status.setName("status");

    status.setValue("active");

    props.getProperty().add(status);

    final PropertyElement name = new PropertyElement();

    name.setName("name");

    name.setValue("Sample User");

    props.getProperty().add(name);

    final PropertyElement password = new PropertyElement();

    password.setName("password");

    password.setValue("5f4dcc3b5aa765d61d8327deb882cf99"); // MD5 hash

    props.getProperty().add(password);

    final PropertyElement type = new PropertyElement();

    type.setName("type");

    type.setValue("Technician");

    props.getProperty().add(type);

    final PropertyElement language = new PropertyElement();

    language.setName("language");

    language.setValue("br");

    props.getProperty().add(language);

    final PropertyElement timeZone = new PropertyElement();

    timeZone.setName("time_zone");

    timeZone.setValue("Brasilia");

    props.getProperty().add(timeZone);

    req.setProperties(props);

    final ResourceIdListElement resources = new ResourceIdListElement();

    resources.getId().add("1");

    req.setResources(resources);

    out.println(port.insertUser(req));
  }

}