Defines the functionality of a work object.
A work object is the technical persistence mechanism used for storing work items and other runtime information
in edoras one. Many different types of work object are used, please refer to
WorkObjectTypes
for details.
Work objects are organized in a hierarchy, where a work object may have multiple children and a single parent.
Work objects have fields (a fixed set of predefined values with dedicated API support) and variables. Both
fields and variables can be accessed and modified through a unified value interface, allowing generic manipulation
of all work object data. For more information on the supported value types please refer to the
documentation for the package com.edorasware.api.value
.
Work objects provide the following ways to access values that are stored in the work object:
Accessor methods
Certain values have specific accessor methods (e.g. workObject.getName()
), either because the value is
a fundamental part of the work object implementation or to provide easier migration from the legacy
edoras gear API.
Generic value interface
Code that works with values in a generic way can simply access or set variables using the variable name as
a string, e.g. workObject.getValue("name", Object.class)
. If you have more information about the type
in a particular use case then a more specific type may also be specified, e.g.
workObject.getValue("name", String.class)
.
Value accessor interface
When application code needs to access a specific work object value then a value accessor for that value
can be declared:
public static final StringValue<String> MEMBER_ID =
newStringValue("memberId");
public static final StringValue<TelephoneNumber> MOBILE_NUMBER =
newStringValue("mobileNumber", new TelephoneNumberConverter());
String memberId = workObject.getValue(MOBILE_NUMBER);
TelephoneNumber memberId = workObject.getValue(MOBILE_NUMBER);
Predicate mobilePredicate = MOBILE_NUMBER.eq(expectedMobileNumber);
The advantages of this approach are:
-
the value is type checked by the compiler
-
converters may be used to support application-specific types in the application code but persist the values
correctly using one of the supported value types
-
query predicates can be created much more easily using the value constant