Skip to content
Praveen edited this page Jan 24, 2018 · 1 revision

The com.whd.WhdServerObjects is responsible for querying Locations, PriorityTypes, RequestTypes, Statuses and CustomFields from the WHD server.

Note: The WHD Rest API has a limitation of returning only 20 locations, by default, so if your WHD instance has more than 20 locations, this API wrapper provides an alternate constructor, explained below

The com.whd.WhdServerObjects needs a valid com.whd.WhdAuth object, to be able to connect to the WHD Server.

On instanstiation of a com.whd.WhdServerObjects, it will automatically try to retreive all the above mentioned Server Objects.

com.whd.WhdServerObjects has two valid constructors:

  • public WhdServerObjects(WhdAuth auth);
  • public WhdServerObjects(WhdAuth auth, List<String> locationPrefixes);

The first one will retreive only a maximum of 20 Locations from the WHD Server. The second one will loop through each locationPrefix string and retreive locations that start with that Prefix.

For Example:

ImmutableList<String> whdLocationPrefix =
            new ImmutableList.Builder<String>()
                    .addAll(Arrays.asList(
                            "Company1-",
                            "Company2-",
                            // Cpmpany3 Locations
                            "Company3-US-",
                            "Company3-UK-",
                            "Company3-Aus-"))
                    .build();

WhdServerObjects serverObjects = new WhdServerObjects(whdAuth, whdLocationPrefix);

/* serverObjects.getLocations() will now hold all locations that starte with the prefixes
mentioned in whdLocationPrefix */

Note: Above example uses com.google.common.collect.ImmutableList to build the whdLocationPrefix list.

Clone this wiki locally