Module: UU::ImageCatalog::ImageCatalog

Extended by:
ImageCatalog
Included in:
ImageCatalog
Defined in:
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog.rb,
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog/image_catalog_create.rb,
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog/image_catalog_exception.rb,
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog/image_catalog_attributes.rb,
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog/image_catalog_set_attributes.rb,
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog/image_catalog_get_image_list.rb,
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog/image_catalog_fatal_exception.rb,
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog/image_catalog_import_catalog_data.rb,
uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog/image_catalog_image_entry_attributes.rb

Overview

Image catalog service.

Defined Under Namespace

Classes: ImageCatalogAttributes, ImageCatalogCreate, ImageCatalogException, ImageCatalogFatalException, ImageCatalogGetImageList, ImageCatalogImageEntryAttributes, ImageCatalogImportCatalogData, ImageCatalogSetAttributes

Constant Summary

PATH =

Service path.

'uu/imagecatalog/ImageCatalog'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) create(location_uri, catalog)

Creates specified image catalog.

Parameters:

Returns:



28
29
30
31
32
33
34
35
# File 'uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog.rb', line 28

def create(location_uri, catalog)
  svc = UU::OS::REST::RemoteClient.new(ImageCatalog)
  payload = ImageCatalogCreate.new(catalog).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('create', location_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end

- (Object) delete(catalog_uri)

Deletes the specified image catalog.

Parameters:

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

    URI of the catalog to delete.



66
67
68
69
70
71
# File 'uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog.rb', line 66

def delete(catalog_uri)
  svc = UU::OS::REST::RemoteClient.new(ImageCatalog)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('delete', catalog_uri)
  end
end

- (ImageCatalogAttributes) get_attributes(catalog_uri)

Returns attributes of the image catalog specified by the catalog URI.

Parameters:

Returns:



41
42
43
44
45
46
47
# File 'uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog.rb', line 41

def get_attributes(catalog_uri)
  svc = UU::OS::REST::RemoteClient.new(ImageCatalog)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getAttributes', catalog_uri)
    return ImageCatalogAttributes.new(res)
  end
end

- (UU::OS::REST::ResultList<ImageCatalog::ImageCatalogGetImageList, ImageCatalog::ImageCatalogImageEntryAttributes>) get_image_list(catalog_uri, criteria = nil)

Returns list of images from a catalog. By default, the list is sorted by image names (and codes in case names are equal). The list can be filtered using "query" parameter in criteria using uuQuery 2.0 syntax.

Examples:

# get 3rd page of images using default ordering
image_list = UU::ImageCatalog::ImageCatalog.get_image_list('ues:TERRITORY:CATALOG', :page_size => 50, :page_index => 2)

# get all icons whose codes start with ICON/ and use custom ordering
image_list = UU::ImageCatalog::ImageCatalog.get_image_list('ues:TERRITORY:CATALOG', :query => 'code LIKE ${var} ORDER BY code DESC',
    :query_parameters => { :var => 'ICON/%' })

Parameters:

Returns:



102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog.rb', line 102

def get_image_list(catalog_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(ImageCatalog)
  dto = ImageCatalog::ImageCatalogGetImageList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)
  svc.add_parameter('query', dto.query)
  if ((dto.query_parameters.kind_of?Hash) && (dto.query_parameters.size > 0))
    svc.add_parameter(:queryParameters, dto.query_parameters.to_json)
  end
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getImageList', catalog_uri)
    return UU::OS::REST::ResultList.new(ImageCatalog::ImageCatalogGetImageList, ImageCatalog::ImageCatalogImageEntryAttributes, res)
  end
end

- (Object) import_catalog_data(catalog_uri, catalog_data)

Imports image catalog content data.

Parameters:



77
78
79
80
81
82
83
# File 'uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog.rb', line 77

def import_catalog_data(catalog_uri, catalog_data)
  svc = UU::OS::REST::RemoteClient.new(ImageCatalog)
  payload = ImageCatalogImportCatalogData.new(catalog_data).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('importCatalogData', catalog_uri, payload)
  end
end

- (UESURI) set_attributes(catalog_uri, attrs)

Sets attributes of the image catalog specified by the catalog URI.

Parameters:

Returns:

  • (UESURI)

    URI of the catalog.



54
55
56
57
58
59
60
61
# File 'uu_imagecatalog-0.4.1/lib/uu/image_catalog/image_catalog.rb', line 54

def set_attributes(catalog_uri, attrs)
  svc = UU::OS::REST::RemoteClient.new(ImageCatalog)
  payload = ImageCatalogSetAttributes.new(attrs).to_json
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setAttributes', catalog_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end