public class IGCRestClient extends Object
registerPOJO(Class)| Modifier | Constructor and Description |
|---|---|
protected |
IGCRestClient(String baseURL,
String authorization)
Creates a new session on the server and retains the cookies to re-use the same session for the life
of the client (or until the session times out); whichever occurs first.
|
|
IGCRestClient(String baseURL,
String user,
String password)
Creates a new session on the server and retains the cookies to re-use the same session for the life
of the client (or until the session times out); whichever occurs first.
|
|
IGCRestClient(String host,
String port,
String user,
String password)
Default constructor used by the IGCRestClient.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cacheTypeDetails(String typeName)
Cache detailed information about the IGC object type.
|
String |
create(IGCCreate igcCreate)
Create the object described by the provided create object.
|
File |
createOpenIgcBundleFile(File directory)
Generates an OpenIGC bundle zip file from the provided directory path, and returns the temporary file it creates.
|
boolean |
delete(String rid)
Delete the object specified by the provided RID.
|
boolean |
deleteOpenIgcAsset(String assetXML)
Delete using the provided OpenIGC asset XML: deleting the asset(s) specified within it.
|
void |
disconnect()
Disconnect from IGC REST API and invalidate the session.
|
<T extends Reference> |
getAllPages(String propertyName,
ItemList<T> list)
Retrieve all pages of results from a set of Paging details and items, or if there is no next page return the
items provided.
|
List<String> |
getAllPropertiesForType(String typeName)
Retrieve the names of all properties for the provided IGC object type, or null if the type is unknown.
|
List<String> |
getAllStringPropertiesForType(String typeName)
Retrieve the names of all string properties for the provided IGC object type, or null if the type is unknown.
|
Reference |
getAssetById(String rid)
Retrieve all information about an asset from IGC.
|
Reference |
getAssetRefById(String rid)
Retrieve only the minimal unique properties of an asset from IGC.
|
<T extends Reference> |
getAssetWithSubsetOfProperties(String rid,
String assetType,
List<String> properties)
This will generally be the most performant method by which to retrieve asset information, when only
some subset of properties is required
|
<T extends Reference> |
getAssetWithSubsetOfProperties(String rid,
String assetType,
List<String> properties,
int pageSize)
This will generally be the most performant method by which to retrieve asset information, when only
some subset of properties is required
|
<T extends Reference> |
getAssetWithSubsetOfProperties(String rid,
String assetType,
String[] properties)
This will generally be the most performant method by which to retrieve asset information, when only
some subset of properties is required
|
<T extends Reference> |
getAssetWithSubsetOfProperties(String rid,
String assetType,
String[] properties,
int pageSize)
This will generally be the most performant method by which to retrieve asset information, when only
some subset of properties is required
|
String |
getBaseURL()
Retrieve the base URL of this IGC REST API connection.
|
int |
getDefaultPageSize()
Retrieve the default page size for this IGC REST API connection.
|
String |
getDisplayNameForType(String typeName)
Retrieve the display name of this IGC object type.
|
IGCVersionEnum |
getIgcVersion()
Retrieve the version of the IGC environment (static member VERSION_115 or VERSION_117).
|
<T extends Reference> |
getModificationDetails(T object)
Ensures that the modification details of the asset are populated (takes no action if already populated or
the asset does not support them).
|
<T extends Reference> |
getNextPage(String propertyName,
ItemList<T> list)
Retrieve the next page of results for the provided parameters.
|
List<String> |
getNonRelationshipPropertiesForType(String typeName)
Retrieve the names of all non-relationship properties for the provided IGC object type, or null if the type is
unknown.
|
List<String> |
getOpenIgcBundles()
Retrieve the set of OpenIGC bundles already defined in the environment.
|
List<String> |
getPagedRelationshipPropertiesForType(String typeName)
Retrieve the names of all paged relationship properties for the provided IGC object type, or null if the type is
unknown.
|
Class<?> |
getPOJOForType(String assetType)
Returns the POJO that is registered to serde the provided IGC asset type, preferring any that have been
registered or defaulting to the out-of-the-box ones if there are no overrides.
|
Object |
getPropertyByName(Reference object,
String property)
Retrieve a property of an IGC object based on the property's name.
|
TypeDetails |
getTypeDetails(String typeName)
Retrieves the type details (all properties and their details) for the provided type name in IGC.
|
TypeDetails |
getTypeDetails(String typeName,
boolean view,
boolean create,
boolean edit)
Retrieves the type details (requested properties and their details) for the provided type name in IGC.
|
List<TypeHeader> |
getTypes(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Retrieves the list of metadata types supported by IGC.
|
String |
getValueAsJSON(Reference asset)
Attempt to convert the provided IGC object into JSON, based on the registered POJOs.
|
boolean |
hasModificationDetails(String typeName)
Indicates whether assets of this type include modification details (true) or not (false).
|
boolean |
isCreatable(String typeName)
Indicates whether the IGC object type can be created (true) or not (false).
|
static boolean |
isVirtualAssetRid(String rid)
Indicates whether the provided Repository ID (RID) represents a virtual asset (true) or not (false).
|
Boolean |
isWorkflowEnabled()
Returns true iff the workflow is enabled in the environment against which the REST connection is defined.
|
String |
makeCreateRequest(String endpoint,
org.springframework.http.HttpMethod method,
org.springframework.http.MediaType contentType,
String payload)
General utility for making creation requests.
|
String |
makeRequest(String endpoint,
org.springframework.http.HttpMethod method,
org.springframework.http.MediaType contentType,
String payload)
General utility for making requests.
|
<T extends Reference> |
readJSONIntoItemList(String json)
Attempt to convert the JSON string into an ItemList.
|
<T extends Reference> |
readJSONIntoPOJO(String json)
Attempt to convert the JSON string into a Java object.
|
void |
registerPOJO(Class<?> clazz)
Register a POJO as an object to handle serde of JSON objects.
Note that this MUST be done BEFORE any object mapping (translation) is done! In general, you'll want your POJO to extend at least the Reference object, and more likely the InformationAsset (for your own OpenIGC object), or if you are adding custom attributes to one of the native asset types, consider directly changing that bean. |
<T extends Reference> |
search(IGCSearch igcSearch)
Retrieve all assets that match the provided search criteria from IGC.
|
void |
setDefaultPageSize(int pageSize)
Set the default page size for this IGC REST API connection.
|
boolean |
start()
Start the client by trying to connect based on the configured parameters.
|
boolean |
update(IGCUpdate igcUpdate)
Apply the update described by the provided update object.
|
boolean |
uploadFile(String endpoint,
org.springframework.http.HttpMethod method,
org.springframework.core.io.AbstractResource file)
General utility for uploading binary files.
|
String |
upsertOpenIgcAsset(String assetXML)
Upload the provided OpenIGC asset XML: creating the asset(s) if they do not exist, updating if they do.
|
boolean |
upsertOpenIgcBundle(String name,
org.springframework.core.io.AbstractResource file)
Upload the specified bundle, creating it if it does not already exist or updating it if it does.
|
public IGCRestClient(String host, String port, String user, String password)
host - the services (domain) tier hostport - the services (domain) tier port numberuser - the username with which to open and retain the sessionpassword - the password for the userpublic IGCRestClient(String baseURL, String user, String password)
baseURL - the base URL of the domain tier of Information Serveruser - the username with which to open and retain the sessionpassword - the password of the userprotected IGCRestClient(String baseURL, String authorization)
baseURL - the base URL of the domain tier of Information Serverauthorization - the Basic-encoded authorization string to use to login to Information Serverpublic boolean start()
public <T extends Reference> T readJSONIntoPOJO(String json)
T - the type of POJO into which to readjson - the JSON string to convertpublic <T extends Reference> ItemList<T> readJSONIntoItemList(String json)
T - the type of items that should be in the ItemListjson - the JSON string to convertItemList<T>public String getValueAsJSON(Reference asset)
asset - the IGC asset to convertpublic IGCVersionEnum getIgcVersion()
public String getBaseURL()
public int getDefaultPageSize()
public void setDefaultPageSize(int pageSize)
pageSize - the new default page size to usepublic static boolean isVirtualAssetRid(String rid)
rid - the Repository ID (RID) to checkpublic boolean uploadFile(String endpoint, org.springframework.http.HttpMethod method, org.springframework.core.io.AbstractResource file)
endpoint - the REST resource against which to upload the filemethod - HttpMethod (POST, PUT, etc)file - the Spring FileSystemResource or ClassPathResource containing the file to be uploadedpublic String makeRequest(String endpoint, org.springframework.http.HttpMethod method, org.springframework.http.MediaType contentType, String payload)
endpoint - the REST resource against which to make the requestmethod - HttpMethod (GET, POST, etc)contentType - the type of content to expect in the payload (if any)payload - if POSTing some content, the JSON structure providing what should be POSTedpublic String makeCreateRequest(String endpoint, org.springframework.http.HttpMethod method, org.springframework.http.MediaType contentType, String payload)
endpoint - the REST resource against which to make the requestmethod - HttpMethod (POST, PUT, etc)contentType - the type of content to expect in the payloadpayload - the data that should be createdpublic List<TypeHeader> getTypes(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper - an ObjectMapper to use for translating the types listList<TypeHeader> the list of types supported by IGCpublic TypeDetails getTypeDetails(String typeName)
typeName - the IGC type name for which to retrieve detailspublic TypeDetails getTypeDetails(String typeName, boolean view, boolean create, boolean edit)
typeName - the IGC type name for which to retrieve detailsview - whether to include the viewable propertiescreate - whether to include the properties that can be included during creationedit - whether to include editable propertiespublic Reference getAssetById(String rid)
rid - the Repository ID of the assetgetAssetRefById(String)public Reference getAssetRefById(String rid)
rid - the Repository ID of the assetpublic <T extends Reference> T getAssetWithSubsetOfProperties(String rid, String assetType, List<String> properties)
T - the type of Reference to returnrid - the repository ID (RID) of the asset to retrieveassetType - the IGC asset type of the asset to retrieveproperties - a list of the properties to retrievepublic <T extends Reference> T getAssetWithSubsetOfProperties(String rid, String assetType, String[] properties)
T - the type of Reference to returnrid - the repository ID (RID) of the asset to retrieveassetType - the IGC asset type of the asset to retrieveproperties - a list of the properties to retrievepublic <T extends Reference> T getAssetWithSubsetOfProperties(String rid, String assetType, String[] properties, int pageSize)
T - the type of Reference to returnrid - the repository ID (RID) of the asset to retrieveassetType - the IGC asset type of the asset to retrieveproperties - a list of the properties to retrievepageSize - the maximum number of each of the asset's relationships to return on this requestpublic <T extends Reference> T getAssetWithSubsetOfProperties(String rid, String assetType, List<String> properties, int pageSize)
T - the type of Reference to returnrid - the repository ID (RID) of the asset to retrieveassetType - the IGC asset type of the asset to retrieveproperties - a list of the properties to retrievepageSize - the maximum number of each of the asset's relationships to return on this requestpublic <T extends Reference> ItemList<T> search(IGCSearch igcSearch)
T - the type of items that should be in the ItemListigcSearch - search conditions and criteria to useItemList<T> - the first page of results from the searchpublic boolean update(IGCUpdate igcUpdate)
igcUpdate - update criteria to usepublic String create(IGCCreate igcCreate)
igcCreate - creation criteria to usepublic boolean delete(String rid)
rid - the RID of the asset to deletepublic boolean upsertOpenIgcBundle(String name, org.springframework.core.io.AbstractResource file)
name - the bundleId of the bundlefile - the Spring FileSystemResource or ClassPathResource containing the file to be uploadedpublic File createOpenIgcBundleFile(File directory)
directory - the directory under which the OpenIGC bundle is defined (ie. including an
'asset_type_descriptor.xml', an 'i18n' subdirectory and an 'icons' subdirectory)public List<String> getOpenIgcBundles()
List<String>public String upsertOpenIgcAsset(String assetXML)
assetXML - the XML string defining the OpenIGC assetpublic boolean deleteOpenIgcAsset(String assetXML)
assetXML - the XML string defining the OpenIGC asset deletionpublic <T extends Reference> ItemList<T> getNextPage(String propertyName, ItemList<T> list)
T - the type of items to expect in the ItemListpropertyName - the name of the property for which the list provides items (or null if the result of a search)list - the list of items from which to retrieve the next pageItemList<T> - the next page of resultspublic <T extends Reference> List<T> getAllPages(String propertyName, ItemList<T> list)
T - the type of items to expect in the ItemListpropertyName - the name of the property for which the list provides items (or null if the result of a search)list - the ItemList for which to retrieve all pagesList<T> - a List containing all items from all pages of resultspublic void disconnect()
public void cacheTypeDetails(String typeName)
typeName - name of the IGC object type to cachepublic String getDisplayNameForType(String typeName)
typeName - the name of the IGC object typepublic boolean isCreatable(String typeName)
typeName - the name of the IGC object typepublic boolean hasModificationDetails(String typeName)
typeName - the name of the IGC asset type for which to check whether it tracks modification detailspublic List<String> getAllPropertiesForType(String typeName)
typeName - the name of the IGC object typeList<String>public List<String> getNonRelationshipPropertiesForType(String typeName)
typeName - the name of the IGC object typeList<String>public List<String> getAllStringPropertiesForType(String typeName)
typeName - the name of the IGC object typeList<String>public List<String> getPagedRelationshipPropertiesForType(String typeName)
typeName - the name of the IGC object typeList<String>public void registerPOJO(Class<?> clazz)
clazz - the Java Class (POJO) object to registerpublic Class<?> getPOJOForType(String assetType)
assetType - name of the IGC assetregisterPOJO(Class)public Boolean isWorkflowEnabled()
public Object getPropertyByName(Reference object, String property)
object - the IGC object from which to retrieve the property's valueproperty - the name of the property for which to retrieve the valuepublic <T extends Reference> T getModificationDetails(T object)
T - the type of IGC object (minimally a Reference)object - the IGC object for which to populate modification detailsCopyright © 2018–2020 ODPi. All rights reserved.