com.ibm.maximo.oslc.AnotherTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maximo-restclient Show documentation
Show all versions of maximo-restclient Show documentation
The Maximo REST client library provides a set of driver API's which can be consumed by an JAVA based web component that would like to interface with a Maximo instance
package com.ibm.maximo.oslc;
import java.io.IOException;
import java.net.URL;
public class AnotherTest {
public static void main(String[] args) throws IOException, OslcException
{
MaximoConnector mc = new MaximoConnector(new Options().user("wilson")
.password("wilson").mt(false).lean(true).auth("maxauth")
.host("localhost").port(7001)).debug(true);
mc.connect();
ResourceSet selectSet = mc.resourceSet("REP_PO")
.select("ponum", "status", "statusdate")
.pageSize(10).fetch(null);
int i=0;
Resource r = selectSet.member(i).load();
while(r != null)
{
r.reload();
Util.jsonPrettyPrinter(r.toJSON());
r = selectSet.member(++i);
}
Util.jsonPrettyPrinter(selectSet.count());
Resource resource = selectSet.member(0).load();
Util.jsonPrettyPrinter(resource.toJSON());
URL polineHref = new URL(resource.toJSON().getString("poline_collectionref"));
System.out.println(polineHref);
ResourceSet polineSet = new ResourceSet(polineHref,mc).fetch();
Resource polineRes = polineSet.member(0);
Util.jsonPrettyPrinter(polineRes.toJSON());
}
}