![]() |
Infohub JS API
|
Service Class for COLNEO infohub objects/nodes.
Public Member Functions | |
| constructor (ctx) | |
| async | createObject (object_data, parent_sid, cb) |
| async | deleteObject (object_id, parent_sid=null, cb=null) |
| async | deleteObjectByShortId (node_sid, cb) |
| async | getObject (object_id, cb, members=null, properties=null, context_sid=null, object_data=null) |
| async | getObjects (query, cb, context_sid=null) |
| newObjectFromJson (node_json, members=null) | |
| async | patchObject (cnObj) |
| async | postObject (object_data, parent_sid) |
| async | putObject (cnObj) |
| async | saveObject (cnObj, members, cb) |
| async | setPropertyValues (node_sid, propertylist, cb) |
| constructor | ( | ctx | ) |
| {Context} | ctx Infohub Context |
| async createObject | ( | object_data, | |
| parent_sid, | |||
| cb ) |
Create new object on infohub.
Create a new object if object_id (in 'info') does not exist, create a new version if object_id exist.
Function uses endpoint POST .../{scope}/nodes/{node} on service 'hub'.
| {object} | object_data Object in GOM format. Contains object_id in info block. |
| {string} | parent_sid |
| {function} | cb Returns AüiResponse object with an cnObject as data if REST call has been sucessful |
| async deleteObject | ( | object_id, | |
| parent_sid = null, | |||
| cb = null ) |
Delete Object including all its versions from parent object 'parent_sid' or project.
| {string} | object_id Delete this object |
| {string} | parent_sid Delete object from this parent object, if null delete object from project |
| {function} | cb If null return Promise |
| async deleteObjectByShortId | ( | node_sid, | |
| cb ) |
Delete node and all its versions in its parent folder.
| {*} | node_sid Object ShortId |
| async getObject | ( | object_id, | |
| cb, | |||
| members = null, | |||
| properties = null, | |||
| context_sid = null, | |||
| object_data = null ) |
Fetch an object by ID and (optional) context from infohub.
If context node is null the current project is used as context (root node for search).
If object does not exist and context_sid and object_data is given, a new object is created by using 'object_data'.
| {string} | object_id - The ID of the object to be looked up |
| {function} | cb - Callback function that receives the result object, { data: cnObject } |
| {String[]|null} | members - Optional members to retrieve (info, properties, properties_comments, geometry, etc.), if null info only is retrieved |
| {String[]|null} | properties - Optional properties to retrieve, if null all properties are retrieved |
| {String|null} | context_sid Search in this context (root) object. If null use current project. Create a new object with this parent if object could not be found. |
| {Object|null} | object_data If object could not be found use this object data to create new object |
| async getObjects | ( | query, | |
| cb, | |||
| context_sid = null ) |
Fetch objects by query and (optional) context.
If context node is null use project as a context (root node for search).
Endpoint : ..hub../<scope>/objects
| {object} | query - Query for search Example: query = {
"object_list" : [ 'objid1' , 'objid2' , ... ] // optional
// parameters to be passed to webservice
"filter" :
"members" :
"properties" :
"geometry" :
"nodes" :
"relations" :
"relations_right" :
}
|
| {function} | cb - Callback function that receives the result object |
| {string} | [context_sid=null] - Optional context node for search, if null the context for search is set to project shortid. |
| newObjectFromJson | ( | node_json, | |
| members = null ) |
Factory method to instantiate a new object of class cnObject.
The object is not created or written to infohub. To save the object on infohub use method saveObject().
| {object} | node_json Object as json in GOM format |
| async patchObject | ( | cnObj | ) |
Partially update an existing object on infohub.
The parent is resolved from parent_shortid, project_shortid, or catalogue_shortid in the object's info block. If none is available, the current project from the service context is used.
PATCH - /{scope}/objects/{parent}/object
| {cnObject} | cnObj Object containing the members to update. |
cnObject on success.| async postObject | ( | object_data, | |
| parent_sid ) |
Create a new object or object version below a parent node.
This Promise-based convenience method delegates to createObject.
POST - /{scope}/nodes/{parent_sid}
| {object} | object_data Object in Generic Object Model format. |
| {string} | parent_sid Short ID of the parent node. |
cnObject on success.| async putObject | ( | cnObj | ) |
Replace or create an object on infohub using its complete GOM data.
This Promise-based convenience method delegates to saveObject and writes all object members.
PUT - /{scope}/objects/{parent}/object
| {cnObject} | cnObj Complete object to write. |
cnObject on success.| async saveObject | ( | cnObj, | |
| members, | |||
| cb ) |
Save object on infohub.
Take 'info' block of object (GOM) into account.
Use object_id to create a new or update an existing object,
Use parent_shortid as parent to create a new object or identify an existing object.
If also parent_shortid is missing, use project_shortid or catalogue_shortid as parent.
In any other cases the object is created in the current project stored in the Context object of this object service.
PUT - /{scope}/objects/{parent}/object
| {cnObject} | cnObj |
| {Array|null} | members Save/Write these members which is one of [ 'info' , 'properties' , etc. ] If null, write all members |
| {function} | cb |
| async setPropertyValues | ( | node_sid, | |
| propertylist, | |||
| cb ) |
Set property values in propertylist for node (shortid) on infohub.
| {*} | node_sid Node ShortID |
| {*} | propertylist = [ { 'typeid' : "abc##xs:string", 'value' : "123 abc", 'comment' : "Gesetzt durch xyz" } ] |
| {*} | cb Call Back { ApiResponse<> } |
| {*} | cmt Comment (optional) |