See: Description
Interface | Description |
---|---|
BatchOperation<S,E> |
A sequence of instructions that can be chained together,
building up a final operation which can be
executed with
BatchOperation.execute() . |
BatchOperationError |
Retrieves batch operation errors for a particular input List position.
|
BatchOperationResponse<R extends PositionalResult> |
Base interface to be used as a response to batch operations.
|
ErrorResult |
Represents an error.
|
FieldType |
Common interface for all field types.
|
LogService |
Send messages to the Debug Log, available in Admin > Logs > Debug Log.
|
PositionalResult |
Represents the result of processing an input item in a batch operation.
|
RequestContext |
Provides access to the context in which the current request is made.
|
RequestContextValue |
An interface for implementing a user-defined class to store data in a request context.
|
RequestContextValueType<T> |
Type of data supported by the request context.
|
RuntimeService |
Provides methods for handling the Java SDK runtime.
|
Service |
Marker interface for Vault Java SDK services.
|
UserDefinedModel |
Common interface for all UserDefinedModel objects.
|
UserDefinedModelService |
Service for handling UserDefinedModel instances.
|
UserDefinedService |
Marker interface for Vault Java SDK user-defined services.
|
ValueType<T> |
Type of data supported by the Vault Java SDK.
|
Class | Description |
---|---|
ServiceLocator |
Retrieves an instance of a Vault Java SDK service.
|
StringUtils |
A utility to access String pattern matching functionality.
|
VaultCollections |
A utility to create JDK Collections and Arrays.
|
VaultCollectors |
A utility to create
Collector . |
Enum | Description |
---|---|
EventSegment |
For internal Veeva use only.
|
TriggerOrder |
Contains valid values for specifying trigger execution order.
|
UserDefinedPropertyInclude |
The Include enum specifies the serialization behavior of a user-defined model.
|
Exception | Description |
---|---|
RollbackException |
Exception which, when thrown from Vault Java SDK code, aborts and rolls-back the in-progress transaction.
|
VaultRuntimeException | Deprecated
as of 20R3.4
|
Annotation Type | Description |
---|---|
UserDefinedClassInfo |
Indicates a class is a user-defined class (UDC).
|
UserDefinedModelInfo |
Indicates an interface is a user-defined model (UDM).
|
UserDefinedProperty |
This annotation is to be used on a getter/setter method of an interface that has been annotated with
UserDefinedModelInfo
and indicates that the field in its getter/setter is to be serialized/deserialized using JsonService . |
UserDefinedServiceInfo |
Indicates an interface is a user-defined service (UDS).
|
A UDM is a Java interface that extends the UserDefinedModel
interface
and has the UserDefinedModelInfo
annotation as shown below:
@UserDefinedModelInfo(include = UserDefinedPropertyInclude.NON_NULL)
public interface DocumentModel extends UserDefinedModel {
@UserDefinedProperty(include = UserDefinedPropertyInclude.ALWAYS)
BigDecimal getId();
void setId(BigDecimal id);
@UserDefinedProperty(name = "name__v", aliases = {"docName", "documentName"})
String getName();
void setName(String name);
@UserDefinedProperty(defaultValue = "true")
Boolean getActive();
void setActive(Boolean active);
@UserDefinedProperty(defaultValues = {"prod1", "prod2"})
List<String> getProducts();
void setProducts(List<String> products);
}
The UDM above contains four properties: id
, name
(which has been renamed to name__v
with the name
attribute), active
, and products
. For more detail about the attributes
of a user-defined property, please refer to the UserDefinedProperty
documentation.
Once a UDM has been defined, create instances of it by using UserDefinedModelService
,
as shown below:
UserDefinedModelService userDefinedModelService = ServiceLocator.locate(UserDefinedModelService.class);
DocumentModel documentModel = userDefinedModelService.newUserDefinedModel(DocumentModel.class);
documentModel.setId(new BigDecimal(1));
documentModel.setName("newDoc");
The code above instantiates an empty DocumentModel
, and sets its id
and name
.
Note that even though the active
property was not explicitly set, it will have been automatically set to
true
because in its UserDefinedProperty
annotation, the defaultValue
attribute was used. Similarly, products
will have been set to {"prod1", "prod2"}
because of
the use of the defaultValues
attribute.
Now that we have instantiated a DocumentModel
, we can send it in JSON form as the body of a
HttpRequest
by using the
HttpRequest.setBody(com.veeva.vault.sdk.api.core.UserDefinedModel)
method (see
the package-info in com.veeva.vault.sdk.api.http
for an example of how HttpRequest
is used).
There are several ways that UDMs can be used for deserialization of JSON data. Please refer to the documentation of
HttpService.send(com.veeva.vault.sdk.api.http.HttpRequest, java.lang.Class)
,
JsonService.convertToUserDefinedModel(com.veeva.vault.sdk.api.json.JsonObject, java.lang.Class)
,
and the other UDM-related methods in JsonService
for more information.
Copyright © Veeva Systems 2017–2021. All rights reserved.