Module: UU::ObjectStore::ObjectSchema

Extended by:
ObjectSchema
Included in:
ObjectSchema
Defined in:
uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_create.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_delete.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_exception.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_attributes.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_delete_index.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_create_index.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_set_attributes.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_get_index_list.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_fatal_exception.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_get_schema_list.rb,
uu_objectstore-0.6.5/lib/uu/object_store/object_schema/object_schema_index_attributes.rb

Overview

Object schema service. Schemas are used to divide object store into smaller blocks with particular purpose. In future versions, schemas will provide validation of uuObject structure, and also allow creation of custom indexes providing faster uuObject queries.

Defined Under Namespace

Classes: ObjectSchemaAttributes, ObjectSchemaCreate, ObjectSchemaCreateIndex, ObjectSchemaDelete, ObjectSchemaDeleteIndex, ObjectSchemaException, ObjectSchemaFatalException, ObjectSchemaGetIndexList, ObjectSchemaGetSchemaList, ObjectSchemaIndexAttributes, ObjectSchemaSetAttributes

Constant Summary

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(object_store_uri, object_schema = nil)

Creates new object schema.

Parameters:

  • object_store_uri (String, UU::OS::UESURI)

    URI of object store for which to create object schema

  • object_schema (ObjectSchemaCreate) (defaults to: nil)

    Specific options

Returns:

Raises:

  • (ObjectSchemaException)

    Exception caused by wrong input or wrong usage of API. Specific cause can be determined based on error code.

  • (ObjectSchemaFatalException)

    Internal uuObjectStore exception. Specific cause can be determined based on error code.



39
40
41
42
43
44
# File 'uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb', line 39

def create(object_store_uri, object_schema = nil)
  svc = UU::OS::REST::RemoteClient.new(ObjectSchema)
  payload = ObjectSchema::ObjectSchemaCreate.new(object_schema).to_json
  res = svc.post(:create, object_store_uri, payload)
  return UU::OS::UESURI.new(res)
end

- (Object) create_index(object_schema_uri, index = nil)

Creates new index for object schema.

Parameters:



111
112
113
114
115
# File 'uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb', line 111

def create_index(object_schema_uri, index = nil)
  svc = UU::OS::REST::RemoteClient.new(ObjectSchema)
  payload = ObjectSchema::ObjectSchemaCreateIndex.new(index).to_json
  svc.post(:createIndex, object_schema_uri, payload)
end

- (Object) delete(object_schema_uri, options = nil)

Deletes object schema.

Parameters:

  • object_schema_uri (String, UU::OS::UESURI)

    URI of object schema

  • options (ObjectSchemaDelete) (defaults to: nil)

    Additional options for object schema delete

Raises:

  • (ObjectSchemaException)

    Exception caused by wrong input or wrong usage of API. Specific cause can be determined based on error code.

  • (ObjectSchemaFatalException)

    Internal uuObjectStore exception. Specific cause can be determined based on error code.



101
102
103
104
105
# File 'uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb', line 101

def delete(object_schema_uri, options = nil)
  svc = UU::OS::REST::RemoteClient.new(ObjectSchema)
  payload = ObjectSchema::ObjectSchemaDelete.new(options).to_json
  svc.post(:delete, object_schema_uri, payload)
end

- (Object) delete_index(object_schema_uri, index = nil)

Deletes existing index from object schema.

Parameters:

  • object_schema_uri (String, UU::OS::UESURI)

    URI of object schema from which to delete index

  • index (ObjectSchemaDeleteIndex) (defaults to: nil)

    Attributes for matching index to be deleted



121
122
123
124
125
# File 'uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb', line 121

def delete_index(object_schema_uri, index = nil)
  svc = UU::OS::REST::RemoteClient.new(ObjectSchema)
  payload = ObjectSchema::ObjectSchemaDeleteIndex.new(index).to_json
  svc.post(:deleteIndex, object_schema_uri, payload)
end

- (ObjectSchemaAttributes) get_attributes(object_schema_uri)

Returns attributes of the object schema.

Parameters:

Returns:

Raises:

  • (ObjectSchemaException)

    Exception caused by wrong input or wrong usage of API. Specific cause can be determined based on error code.

  • (ObjectSchemaFatalException)

    Internal uuObjectStore exception. Specific cause can be determined based on error code.



70
71
72
73
74
# File 'uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb', line 70

def get_attributes(object_schema_uri)
  svc = UU::OS::REST::RemoteClient.new(ObjectSchema)
  res = svc.get(:getAttributes, object_schema_uri)
  return ObjectSchema::ObjectSchemaAttributes.new(res)
end

- (UU::OS::REST::ResultList<ObjectSchemaGetIndexList, ObjectSchemaIndexAttributes>) get_index_list(object_schema_uri, criteria = nil)

Returns list of object schema indices.

Parameters:

Returns:

Raises:

  • (ObjectSchemaException)

    Exception caused by wrong input or wrong usage of API. Specific cause can be determined based on error code.

  • (ObjectSchemaFatalException)

    Internal uuObjectStore exception. Specific cause can be determined based on error code.



136
137
138
139
140
141
142
143
# File 'uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb', line 136

def get_index_list(object_schema_uri, criteria = nil)
  dto = ObjectSchema::ObjectSchemaGetIndexList.new(criteria)
  svc = UU::OS::REST::RemoteClient.new(ObjectSchema)
  svc.add_parameter(:pageIndex, dto.page_index)
  svc.add_parameter(:pageSize, dto.page_size)
  res = svc.get(:getIndexList, object_schema_uri)
  return UU::OS::REST::ResultList.new(ObjectSchema::ObjectSchemaGetIndexList, ObjectSchema::ObjectSchemaIndexAttributes, res)
end

- (UU::OS::REST::ResultList<ObjectSchemaGetSchemaList, ObjectSchemaAttributes>) get_schema_list(object_store_uri, criteria = nil)

Returns list of object schemas within given object store.

Parameters:

Returns:

Raises:

  • (ObjectSchemaException)

    Exception caused by wrong input or wrong usage of API. Specific cause can be determined based on error code.

  • (ObjectSchemaFatalException)

    Internal uuObjectStore exception. Specific cause can be determined based on error code.



85
86
87
88
89
90
91
92
# File 'uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb', line 85

def get_schema_list(object_store_uri, criteria = nil)
  dto = ObjectSchema::ObjectSchemaGetSchemaList.new(criteria)
  svc = UU::OS::REST::RemoteClient.new(ObjectSchema)
  svc.add_parameter(:pageIndex, dto.page_index)
  svc.add_parameter(:pageSize, dto.page_size)
  res = svc.get(:getSchemaList, object_store_uri)
  return UU::OS::REST::ResultList.new(ObjectSchema::ObjectSchemaGetSchemaList, ObjectSchema::ObjectSchemaAttributes, res)
end

- (UU::OS::UESURI) set_attributes(object_schema_uri, object_schema = nil)

Updates attributes of the object schema.

Parameters:

Returns:

Raises:

  • (ObjectSchemaException)

    Exception caused by wrong input or wrong usage of API. Specific cause can be determined based on error code.

  • (ObjectSchemaFatalException)

    Internal uuObjectStore exception. Specific cause can be determined based on error code.



55
56
57
58
59
60
# File 'uu_objectstore-0.6.5/lib/uu/object_store/object_schema.rb', line 55

def set_attributes(object_schema_uri, object_schema = nil)
  svc = UU::OS::REST::RemoteClient.new(ObjectSchema)
  payload = ObjectSchema::ObjectSchemaSetAttributes.new(object_schema).to_json
  res = svc.post(:setAttributes, object_schema_uri, payload)
  return UU::OS::UESURI.new(res)
end