How to Set Resource Work Zones in the Oracle Field Service Cloud with the Resource Management API

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.SetResourcesZonesElement;
import toatech.resourcemanagement._1.TextPropertiesElement;
import toatech.resourcemanagement._1.TextPropertyElement;
import toatech.resourcemanagement._1.ZoneElement;
import toatech.resourcemanagement._1.ZoneList;

public final class OfscSample {

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

    final ResourceManagementPort port = service.getResourceManagementPort();

    final SetResourcesZonesElement req = new SetResourcesZonesElement();

    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 ZoneList zones = new ZoneList();

    final ZoneElement zone = new ZoneElement();

    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 zone2 = new TextPropertyElement();

    zone2.setName("zone");

    zone2.setValue("Sample Work Zone");

    props.getProperty().add(zone2);

    final TextPropertyElement ratio = new TextPropertyElement();

    ratio.setName("ratio");

    ratio.setValue("1");

    props.getProperty().add(ratio);

    zone.setProperties(props);

    zones.getZone().add(zone);

    req.setZones(zones);

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

}

Node.js

Python

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s