Class: UU::OS::Content::Sheet

Inherits:
ContentClient
  • Object
show all
Defined in:
lib/uu/os/content/sheet.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ Sheet

Creates a new instance of Sheet.

Parameters:

  • session (UU::OS::Security::Session)

    Session to use for remote calls.



14
15
16
# File 'lib/uu/os/content/sheet.rb', line 14

def initialize(session)
  @cmd = UU::OS::CMD::CommandClient.new('uu-os-content', session)
end

Class Method Details

.create(artifact_uri, dto = nil) ⇒ Object

#create convenience self-instantiating shortcut



78
79
80
81
# File 'lib/uu/os/content/sheet.rb', line 78

def self.create(artifact_uri, dto = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).create(artifact_uri, dto)
end

.delete(sheet_uri) ⇒ Object

#delete convenience self-instantiating shortcut



94
95
96
97
# File 'lib/uu/os/content/sheet.rb', line 94

def self.delete(sheet_uri)
  session = UU::OS::Security::Session.current_session
  self.new(session).delete(sheet_uri)
end

.export(sheet_uri) ⇒ Object

#export convenience self-instantiating shortcut



412
413
414
415
# File 'lib/uu/os/content/sheet.rb', line 412

def self.export(sheet_uri)
  session = UU::OS::Security::Session.current_session
  self.new(session).export(sheet_uri)
end

.get_attributes(sheet_uri) ⇒ Object

#get_attributes convenience self-instantiating shortcut



130
131
132
133
# File 'lib/uu/os/content/sheet.rb', line 130

def self.get_attributes(sheet_uri)
  session = UU::OS::Security::Session.current_session
  self.new(session).get_attributes(sheet_uri)
end

.get_data(sheet_uri, version_id = nil) ⇒ Object

#get_data convenience self-instantiating shortcut



189
190
191
192
# File 'lib/uu/os/content/sheet.rb', line 189

def self.get_data(sheet_uri, version_id = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).get_data(sheet_uri , version_id)
end

.get_sheet_list(artifact_uri, query = nil) ⇒ Object

#get_sheet_list convenience self-instantiating shortcut



221
222
223
224
# File 'lib/uu/os/content/sheet.rb', line 221

def self.get_sheet_list(artifact_uri, query = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).get_sheet_list(artifact_uri, query)
end

.get_sheet_template_list(artifact_uri, query = nil) ⇒ Object

#get_sheet_template_list convenience self-instantiating shortcut



253
254
255
256
# File 'lib/uu/os/content/sheet.rb', line 253

def self.get_sheet_template_list(artifact_uri, query = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).get_sheet_template_list(artifact_uri, query)
end

.import(sheet_uri, data = nil) ⇒ Object

#import convenience self-instantiating shortcut



440
441
442
443
# File 'lib/uu/os/content/sheet.rb', line 440

def self.import(sheet_uri, data=nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).import(sheet_uri, data)
end

.lock(sheet_uri, sheet = nil) ⇒ Object

#lock convenience self-instantiating shortcut



271
272
273
274
# File 'lib/uu/os/content/sheet.rb', line 271

def self.lock(sheet_uri, sheet=nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).lock(sheet_uri, sheet)
end

.set_attributes(sheet_uri, sheet = nil) ⇒ Object

#set_attributes convenience self-instantiating shortcut



314
315
316
317
# File 'lib/uu/os/content/sheet.rb', line 314

def self.set_attributes(sheet_uri, sheet = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).set_attributes(sheet_uri, sheet)
end

.set_constraints(sheet_uri, constraints = nil) ⇒ Object

#set_constraints convenience self-instantiating shortcut



332
333
334
335
# File 'lib/uu/os/content/sheet.rb', line 332

def self.set_constraints(sheet_uri, constraints = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).set_constraints(sheet_uri, constraints)
end

.set_data(sheet_uri, data = nil) ⇒ Object

#set_data convenience self-instantiating shortcut



390
391
392
393
# File 'lib/uu/os/content/sheet.rb', line 390

def self.set_data(sheet_uri, data = nil)
  session = UU::OS::Security::Session.current_session
  self.new(session).set_data(sheet_uri, data)
end

.unlock(sheet_uri) ⇒ Object

#unlock convenience self-instantiating shortcut



289
290
291
292
# File 'lib/uu/os/content/sheet.rb', line 289

def self.unlock(sheet_uri)
  session = UU::OS::Security::Session.current_session
  self.new(session).unlock(sheet_uri)
end

Instance Method Details

#create(artifact_uri, sheet = nil) ⇒ UU::OS::UESURI

Creates a new sheet on a given Artifact. The initial content of the sheet can be specified.

Examples:

UU::OS::Content::Sheet.create('ues:TER:ART',:code=>"sheetCode", :main=>true, :data=>{ :rows=>[ :code=>'rowcode', :order=>1, :data=> { :columns=>[ { :code=>"columncode",
:data=>{ :components=>[ { :code=>"componentcode", :component_code=>"UU.OS.RICHTEXT/RICHTEXT",
:opt=>{:readonly=>true, :mandatory=>false, :visible=>true, :add_before=>true, :add_after=>true}}]}}]}]})

Parameters:

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

    UESURI of the Artifact, where a new sheet will be created.

  • sheet (Hash) (defaults to: nil)

    Object containing the attributes and the content of the sheet.

Options Hash (sheet):

  • :code (String)

    The code of the created sheet. Code should be unique in a scope of the Artifact, where sheet is created. If nil or empty, unique code is automatically generated.

  • :name (String)

    The name of the created sheet. If nil or empty, name is generated from the sheet template name and sheet order.

  • :main (Boolean) — default: false

    Flag that determines whether the created sheet is main on the Artifact. Only one main sheet can exist on the Artifact. Main sheet should always be visible. If nil, default value is false.

  • :order (Integer)

    The order of the sheet in a scope of the Artifact, starting from 0. If nil, or the value is greater than the number of existing sheets on the Artifact, the sheet is positioned at the end of the list.

  • :readonly (Boolean) — default: false

    Defines whether the sheet content is readonly (cannot be modified, no content part can be added or deleted). Default value is false.

  • :is_template (Boolean) — default: false

    Flag that determines whether the created sheet is template. Template sheet can exist only on Meta Artifact. If nil, default value is false.

  • :implicit_creation (Boolean) — default: true

    Flag that determines whether the (template) sheet will be used during new artifact establishment. This flag can be used only on template sheet. This flag can't be set to false if flag main is set to true. If nil, default value is true.

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

    UESURI of the sheet template.

  • :data (Hash)

    Hash defines the sheet data structure.

    • :rows ([Array<Hash>]) - An array of rows contained in the content of the created sheet. If attribute is not defined or is empty, one empty row is created by default.

      • :code (String) - User-defined code of the row. Must be unique in a scope of the Content. If nil or empty, the code is automatically generated (and is the same as the id).

      • :opt (Hash) - Hash contains additional attributes of the row.

        • :readonly ([Boolean]) - default: false - Defines whether the row is readonly (no columns can be added to the row, row's attributes cannot be changed, row cannot be deleted). Readonly constraint on the row is propagated to all content parts contained in it

        • :mandatory ([Boolean]) - default: false - Defines whether the row is mandatory (cannot be deleted).

        • :visible ([Boolean]) - default: true - Defines whether the row is displayed in sheet content. The value of this attribute does not affect operating with the row through API.

        • :add_before ([Boolean]) - default: true - Defines, whether it is possible to create new row before the given one. The value of this attribute does not affect operating with the row through API.

        • :add_after ([Boolean]) - default: true - Defines, whether it is possible to create new row after the given one. The value of this attribute does not affect operating with the row through API.

        • :no_padding ([Boolean]) - default: false - False for default row view, true for extra width on the row - as if row had no vertical padding.

        • :html_attributes ([Hash]) - Contains the HTML attributes for the row.

      • :data (Hash) - Hash contains the internal structure of the row.

        • :columns ([Array<Hash>]) - An array of the columns contained in the row. Each object contains the attributes of the column.

          • :code (String) - User-defined code of the column. Must be unique in a scope of the Content. If nil or empty, the code is automatically generated (the same as id).

          • :opt (Hash) - Object contains the additional attributes of the column.

            • :readonly ([Boolean]) - default: false - Defines whether the column is readonly (no columns can be added to the row, row's attributes cannot be changed, row cannot be deleted). Readonly constraint on the column is propagated to all content parts contained in it

            • :mandatory ([Boolean]) - default: false - Defines whether the column is mandatory in sheet content (cannot be deleted). Mandatory constraint is propagated to the roe that contains the column.

            • :visible ([Boolean]) - default: true - Defines whether the column is displayed in sheet content. The value of this attribute does not affect operating with the column through API.

            • :add_before ([Boolean]) - default: true - Defines, whether it is possible to create new column before the given one. The value of this attribute does not affect operating with the column through API.

            • :add_after ([Boolean]) - default: true - Defines, whether it is possible to create new column after the given one. The value of this attribute does not affect operating with the column through API.

            • :html_attributes ([Hash]) - Contains the HTML attributes for the column.

            • :width ([Hash]) - Hash contains the definition of the column width for the different display area sizes. Possible attributes are: xs, sm, md, lg. The superior row can be edited only if the sum of xs, sm, md, lg is 12.

          • :data (Hash) - Object contains the internal structure of the column.

            • :components ([Array<Hash>]) - An array of the components contained in the column. Each object contains the attributes of the component.

              • :code (String) - User-defined code of the component. Must be unique in a scope of the Content. If nil or empty, the code is automatically generated.

              • :component_code (String) - The type of the component. If not set, default component is UU.OS.RICHTEXT/RICHTEXT.

              • :component_engine (String) - The attribute defines the engine of the component. Possible values are: COMPONENT_CONTENT (the only possible component code is UU.OS.RICHTEXT/RICHTEXT at the moment), UUOS8_WIDGET (for widgets registered using UU::OS::Widget) and UUOS9_WIDGET (for widgets in uuOS9). Default value is COMPONENT_CONTENT.

              • :opt (Hash) - Object contains the additional attributes of the component.

                • :readonly ([Boolean]) - default: false - Defines whether the component is readonly (component content cannot be modified, component attributes cannot be modified, component cannot be deleted).

                • :mandatory ([Boolean]) - default: false - Defines whether the component is mandatory in sheet content (component cannot be deleted). Mandatory constraint is propagated to the column and row, which contain the component.

                • :visible ([Boolean]) - default: true - Defines whether the component is displayed in sheet content. The value of this attribute does not affect operating with the component through API.

                • :add_before ([Boolean]) - default: true - Defines, whether it is possible to create new component before the given one. The value of this attribute does not affect operating with the component through API.

                • :add_after ([Boolean]) - default: true - Defines, whether it is possible to create new component after the given one. The value of this attribute does not affect operating with the component through API.

                • :html_attributes ([Hash]) - Contains the HTML attributes for the component.

                • :alignment (String) - default: left - Indicates how the widget will be aligned in content, default value is left. If component_engine is COMPONENT_CONTENT the attribute is ignored.

              • :props (Hash) - Contains the speciifc attributes for the component.

Returns:

  • (UU::OS::UESURI)

    The UESURI of the newly created sheet.



72
73
74
75
# File 'lib/uu/os/content/sheet.rb', line 72

def create(artifact_uri, sheet = nil)
  res = @cmd.invoke("Sheet/create", artifact_uri, prepare_params(sheet))
  return UU::OS::UESURI.new(res)
end

#delete(sheet_uri) ⇒ Object

Removes the given sheet from the system including its content.

Examples:

UU::OS::Content::Sheet.delete('ues:TER:ART:SHEET')

Parameters:

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

    UESURI of the sheet that will be removed.



89
90
91
# File 'lib/uu/os/content/sheet.rb', line 89

def delete(sheet_uri)
  @cmd.invoke("Sheet/delete", sheet_uri)
end

#export(sheet_uri) ⇒ BinaryValue

Exports the content of the sheet in the ZIP format. All the richtext elements are contained in the dedicated subfolders with richtext's id as the name

Examples:

data = UU::OS::Content::Sheet.export('ues:TER:ART:SHEET')
target_file = File.new("exported_sheet.zip","wb")
target_file.write(data.content.read)
target_file.close

Parameters:

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

    UESURI of the sheet which should be exported.

Returns:

  • (BinaryValue)

    Returns the data of the sheet in the ZIP format.



406
407
408
409
# File 'lib/uu/os/content/sheet.rb', line 406

def export(sheet_uri)
  binary_value = @cmd.invoke('Sheet/export', sheet_uri)
  return binary_value
end

#get_attributes(sheet_uri) ⇒ Hash

Retrieves the attributes of the given sheet.

Examples:

UU::OS::Content::Sheet.get_attributes('ues:TER:ART:SHEET')

Parameters:

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

    UESURI of the sheet, which attributes will be retrieved.

Returns:

  • (Hash)

    Object with the attributes of the specified sheet.

    • :uri (UU::OS::UESURI) - Not nil. Normalized UESURI of the sheet.

    • :revision (Integer) - Not nil. The number of sheet revision.

    • :creation_access_role_uri (UU::OS::UESURI) - Not nil. Normalized UESURI of the role that created the sheet.

    • :modification_access_role_uri (UU::OS::UESURI) - Not nil. Normalized UESURI of the role that last modified the sheet.

    • :creation_stamp (String) - Not nil. Time when the sheet was created in ISO 8601 format.

    • :modification_stamp (String) - Not nil. Time when the sheet was last modified in ISO 8601 format.

    • :readonly (Boolean) - Not nil. Defines, whether the sheet content is set as readonly.

    • :code (String) - Not nil. The code of the sheet.

    • :name (String) - Not nil. The name of the sheet.

    • :main (Boolean) - Not nil. Flag that indicates whether the sheet is main on the Artifact.

    • :order (Integer) - Not nil. Sheet order on the Artifact.

    • :lock_time (String) - Time when the sheet was locked (if locked) in ISO 8601 format.

    • :lock_role_uri (UU::OS::UESURI) - Normalized UESURI of the role that locked the sheet (if locked).

    • :lock_access_role_uri (UU::OS::UESURI) - Normalized UESURI of the access role that locked the sheet (if locked).

    • :is_template (Boolean) - Not nil. Flag that indicates whether the sheet is template.

    • :implicit_creation (Boolean) - Not nil. Flag that indicates whether the (template) sheet will be used during new artifact establishment.



123
124
125
126
127
# File 'lib/uu/os/content/sheet.rb', line 123

def get_attributes(sheet_uri)
  params = transform(@cmd.invoke('Sheet/getAttributes', sheet_uri)) #, invocation_method: 'get')
  params.delete(:comments_hidden)
  params
end

#get_data(sheet_uri, version_id = nil) ⇒ Array<Hash>

Retrieves the content structure of the given sheet. The data of each component in content is not returned.

Examples:

UU::OS::Content::Sheet.get_data('ues:TER:ART:SHEET')

Parameters:

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

    UESURI of the sheet, which content will be retrieved.

  • version_id (Integer) (defaults to: nil)

    ID of the sheet version

Returns:

  • (Array<Hash>)

    Object containing sheet content structure.

    • :id (String) - Unique identifier of the row generated by the system.

    • :code (String) - User-defined code of the row. Must be unique in a scope of the Content. If nil or empty, the code is automatically generated.

    • :revision (Integer) - The revision of the row.

    • :opt (Hash) - Object contains additional attributes of the row.

      • :readonly ([Boolean]) - Defines whether the row is readonly (no columns can be added to the row, row's attributes cannot be changed, row cannot be deleted). Readonly constraint on the row is propagated to all content parts contained in it.

      • :mandatory ([Boolean]) - Defines whether the row is mandatory (cannot be deleted).

      • :visible ([Boolean]) - Defines whether the row is displayed in sheet content. The value of this attribute does not affect operating with the row through API.

      • :add_before ([Boolean]) - Defines, whether it is possible to create new row before the given one. The value of this attribute does not affect operating with the row through API.

      • :add_after ([Boolean]) - Defines, whether it is possible to create new row after the given one. The value of this attribute does not affect operating with the row through API.

      • :no_padding ([Boolean]) - False for default row view, true for extra width on the row - as if row had no vertical padding.

      • :html_attributes ([Hash]) - Contains the HTML attributes for the row.

    • :data (Hash) - Object contains the internal structure of the row.

      • :columns ([Array<Hash>]) - An array of the columns contained in the row. Each object contains the attributes of the column.

        • :id (String) - Unique identifier of the column.

        • :code (String) User-defined code of the column. Must be unique in a scope of the Content. If nil or empty, the code is automatically generated.

        • :revision (Integer) - The revision of the column.

        • :opt (Hash) - Object contains the additional attributes of the column.

          • :readonly ([Boolean]) - Defines whether the column is readonly (no components can be added to the column, column's attributes cannot be modified, column cannot be deleted). Readonly constraint is propagated to all content parts contained in the column.

          • :mandatory ([Boolean]) - Defines whether the column is mandatory in sheet content (cannot be deleted). Mandatory constraint is propagated to the roe that contains the column.

          • :visible ([Boolean]) - Defines whether the column is displayed in sheet content. The value of this attribute does not affect operating with the column through API.

          • :add_before ([Boolean]) - Defines, whether it is possible to create new column before the given one. The value of this attribute does not affect operating with the column through API.

          • :add_after ([Boolean]) - Defines, whether it is possible to create new column after the given one. The value of this attribute does not affect operating with the column through API.

          • :html_attributes ([Hash]) - Contains the HTML attributes for the column.

          • :width ([Hash]) - Object contains the definition of the column width for the different display array sizes.

        • :data Hash) - Object contains the internal structure of the column.

          • :components ([Array<Hash>]) - An array of the components contained in the column. Each object contains the attributes of the component.

            • :id (String) - Unique identifier of the component.

            • :code (String) - User-defined code of the component. Must be unique in a scope of the Content. If nil or empty, the code is automatically generated.

            • :component_code (String) - The code of the component artifact.

            • :component_engine (String) - The engine of the component.

            • :revision (Integer) - The revision of the component.

            • :props (Hash) - Contains the specific attributes for the given component.

            • :opt (Hash) - Object contains the additional attributes of the component.

              • :readonly ([Boolean]) - Defines whether the component is readonly (component content cannot be modified, component attributes cannot be modified, component cannot be deleted).

              • :mandatory ([Boolean]) - Defines whether the component is mandatory in sheet content (component cannot be deleted). Mandatory constraint is propagated to the column and row, which contain the component.

              • :visible ([Boolean]) - Defines whether the component is displayed in sheet content. The value of this attribute does not affect operating with the component through API.

              • :add_before ([Boolean]) - Defines, whether it is possible to create new component before the given one. The value of this attribute does not affect operating with the component through API.

              • :add_after ([Boolean]) - Defines, whether it is possible to create new component after the given one. The value of this attribute does not affect operating with the component through API.

              • :html_attributes ([Hash]) - Contains the attributes defining HTML attributes for the component.

              • :alignment (String) - default: left - Indicates how the widget will be aligned in content, default value is left. If component_engine is COMPONENT_CONTENT the attribute is ignored.



184
185
186
# File 'lib/uu/os/content/sheet.rb', line 184

def get_data(sheet_uri, version_id = nil)
  transform(@cmd.invoke('Sheet/getData', sheet_uri, prepare_params(version_id))) #, invocation_method: 'get')
end

#get_sheet_list(artifact_uri, query = nil) ⇒ Array<Hash>

Retrieves a list of sheets on the specified Artifact. The list of the returned sheets can be filtered and ordered arbitrarily. The parameters available for customized filtering and ordering are the following: name, code, order, main, lock_time, lock_role_uri, lock_access_role_uri. The list is sorted by order of the sheet by default.

Examples:

UU::OS::Content::Sheet.get_sheet_list('ues:TER:ART')

Parameters:

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

    UESURI of the artifact, which sheets will be retrieved.

  • query (Hash) (defaults to: nil)

    Query containing filtering and ordering criteria for the resulting list. uuURI is only filtered as a String of a canonical uri. See uuQuery 2.0 documentation for further details.

Returns:

  • (Array<Hash>)

    The list of Objects containing sheet attributes. See get_attributes.

See Also:



209
210
211
212
213
214
215
216
217
218
# File 'lib/uu/os/content/sheet.rb', line 209

def get_sheet_list(artifact_uri, query = nil)
  list = @cmd.invoke('Sheet/getSheetList', artifact_uri, prepare_params(query))
  list.map! { |params|
    params.delete(:isTemplate)
    trParams = transform(params)
    trParams.delete(:comments_hidden)
    trParams
  }
  list
end

#get_sheet_template_list(artifact_uri, query = nil) ⇒ Array<Hash>

Retrieves a list of sheet templates on the specified Meta Artifact. The list of the returned sheets can be filtered and ordered arbitrarily. The parameters available for customized filtering and ordering are the following: name, code, order, main, lock_time, lock_role_uri, lock_access_role_uri. The list is sorted by order of the sheet by default.

Examples:

UU::OS::Content::Sheet.get_sheet_template_list('ues:TER:ART')

Parameters:

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

    UESURI of the artifact, which sheets will be retrieved.

  • query (Hash) (defaults to: nil)

    Query containing filtering and ordering criteria for the resulting list. uuURI is only filtered as a String of a canonical uri. See uuQuery 2.0 documentation for further details.

Returns:

  • (Array<Hash>)

    The list of Objects containing sheet attributes. See get_attributes.

See Also:



241
242
243
244
245
246
247
248
249
250
# File 'lib/uu/os/content/sheet.rb', line 241

def get_sheet_template_list(artifact_uri, query = nil)
  list = @cmd.invoke('Sheet/getSheetTemplateList', artifact_uri, prepare_params(query))
  list.map! { |params|
    params.delete(:isTemplate)
    trParams = transform(params)
    trParams.delete(:comments_hidden)
    trParams
  }
  list
end

#import(sheet_uri, data = nil) ⇒ Object

Imports the content of the sheet in the ZIP format.

Examples:

# Import data from a zip file
file =  File.open("import_sheet.zip", "rb")
UU::OS::Content::Sheet.import('ues:TER:ART:SHEET',
:data=>file)

Parameters:

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

    UESURI of the sheet which should be exported.

  • data (Hash) (defaults to: nil)

    Contains exported data.

Options Hash (data):

  • :data (UU::OS::Lang::BinaryValue, File, IO)

    Zip file of an exported data, including sheet structure and all components' data.



431
432
433
434
435
436
437
# File 'lib/uu/os/content/sheet.rb', line 431

def import(sheet_uri, data = nil)
  if data[:data].is_a?(UU::OS::Lang::BinaryValue)
    data[:data] = data[:data].content
  end
  params = {:parameters => data[:data], :content_type=>"application/octet-stream"}
  @cmd.invoke('Sheet/import', sheet_uri, params)
end

#lock(sheet_uri, sheet = nil) ⇒ Object

Locks sheet content. If successful, all inner content parts are considered locked as well.

Examples:

UU::OS::Content::Sheet.lock('ues:TER:ART:SHEET')

Parameters:

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

    UESURI of the sheet, which content will be locked.

  • sheet (Hash) (defaults to: nil)

    Object containing parameters for locking.

Options Hash (sheet):

  • :force (Boolean)

    If force flag is set to true, the lock is not blocked by the content modification in visual, has no timeout, can be unlocked by anyone with sufficiant rights. Otherwise the lock has 30 seconds timeout, can be unlocked only by the lock owner and is blocked by the content modification in visual. The default value is false, and it is recommended to use the default value in API.



266
267
268
# File 'lib/uu/os/content/sheet.rb', line 266

def lock(sheet_uri, sheet = nil)
  @cmd.invoke('Sheet/lock', sheet_uri, prepare_params(sheet))
end

#set_attributes(sheet_uri, sheet = nil) ⇒ UU::OS::UESURI

Updates basic attributes of the given sheet.

Examples:

UU::OS::Content::Sheet.set_attributes('ues:TER:ART:SHEET', :code=>"newcode", :order=>1)

Parameters:

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

    UESURI of the sheet, which attributes will be updated.

  • sheet (Hash) (defaults to: nil)

    Object containing basic attributes of the sheet that will be updated.

Options Hash (sheet):

  • :code (String)

    The new code of the sheet. If not set, code is not updated. Code must be unique in a scope of the Artifact.

  • :name (String)

    The new name of the sheet. If not set, name is not updated.

  • :main (Boolean)

    Flag specifies whether the sheet will be set as main. If not set, flag is not modified. If false is set and the sheet is currently main sheet of the Artifact, the first sheet on the Artifact is set as main. If the given sheet is the first, then the next sheet on the Artifact by order is set as main. In case the sheet is the only sheet on the Artifact, nothing happens.

  • :implicit_creation (Boolean)

    Flag that specifies whether the (template) sheet will be used during new artifact establishment. This flag can be used only on template sheet. This flag can't be set to false on a main sheet. If not set, flag is not modified.

  • :order (Integer)

    Specifies the order (or index) of the sheet on the specified artifact. All sheets in an artifact are ordered sequentially. The first sheet has index 0. If 0 or less is set, the sheet is inserted at the beginning of the sheet list. If nil is set, the order is not modified. Sheet currently at that position (if any) and any subsequent sheets are shifted to the right (adds one to their order).

Returns:

  • (UU::OS::UESURI)

    UESURI of the updated sheet.



308
309
310
311
# File 'lib/uu/os/content/sheet.rb', line 308

def set_attributes(sheet_uri, sheet = nil)
  res = @cmd.invoke('Sheet/setAttributes', sheet_uri, prepare_params(sheet))
  return UU::OS::UESURI.new(res)
end

#set_constraints(sheet_uri, constraints = nil) ⇒ Object

Sets constraints on the sheet. The only possible constraint is readonly.

Examples:

UU::OS::Content::Sheet.set_constraints('ues:TER:ART:SHEET', :readonly=>true)

Parameters:

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

    UESURI of the sheet, which constraints will be set.

  • constraints (Hash) (defaults to: nil)

    Object containing constraints definitions. The only possible constraint for the sheet is readonly.

Options Hash (constraints):

  • :readonly (Boolean)

    Defines that the sheet content is only for reading. Structure of the content cannot be changed (including adding new sections). If not specified, the parameter is not modified.



327
328
329
# File 'lib/uu/os/content/sheet.rb', line 327

def set_constraints(sheet_uri, constraints = nil)
  @cmd.invoke('Sheet/setConstraints', sheet_uri, prepare_params(constraints))
end

#set_data(sheet_uri, data = nil) ⇒ Object

Modifies content structure on the given sheet. In case input content contains part that is already defined on the list (recognized by its id) it is updated, otherwise replaced.

Examples:

UU::OS::Content::Sheet.set_data('ues:TER:ART:SHEET', :data=>{ :rows=>[ :code=>'rowcode', :order=>1, :data=> { :columns=>[ { :code=>"columncode",
:data=>{ :components=>[ { :code=>"componentcode", :component_code=>"UU.OS.RICHTEXT/RICHTEXT",
:opt=>{:readonly=>true, :mandatory=>false, :visible=>true, :add_before=>true, :add_after=>true}}]}}]}]})

Parameters:

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

    UESURI of the sheet, which content will be modified.

  • data (Hash) (defaults to: nil)

    Contains the structure of the sheet content.

Options Hash (data):

  • :rows (Array<Hash>)

    An array of the rows contained in the sheet. Each object contains the attributes of the row.

    • :id (String) - Unique identifier of the row generated by the system.

    • :code (String) - User-defined code of the row. Must be unique in a scope of the Content. If empty, the code is automatically generated.

    • :opt (Hash) - Object contains additional attributes of the row.

      • :readonly ([Boolean]) - Defines whether the row is readonly (no columns can be added to the row, row's attributes cannot be changed, row cannot be deleted). Readonly constraint on the row is propagated to all content parts contained in it.

      • :mandatory ([Boolean]) - Defines whether the row is mandatory (cannot be deleted).

      • :visible ([Boolean]) - Defines whether the row is displayed in sheet content. The value of this attribute does not affect operating with the row through API.

      • :add_before ([Boolean]) - Defines, whether it is possible to create new row before the given one. The value of this attribute does not affect operating with the row through API.

      • :add_after ([Boolean]) - Defines, whether it is possible to create new row after the given one. The value of this attribute does not affect operating with the row through API.

      • :no_padding ([Boolean]) - default: false - False for default row view, true for extra width on the row - as if row had no vertical padding.

      • :html_attributes ([Hash]) - Contains the HTML attributes for the row.

    • :data (Hash) - Object contains the internal structure of the row.

      • :columns ([Array<Hash>]) - An array of the columns contained in the row. Each object contains the attributes of the column.

        • :id (String) - Unique identifier of the column.

        • :code (String) - User-defined code of the column. Must be unique in a scope of the Content. If empty, the code is automatically generated.

        • :opt (Hash) - Object contains the additional attributes of the column.

          • :readonly ([Boolean]) - Defines whether the column is readonly (no components can be added to the column, column's attributes cannot be modified, column cannot be deleted). Readonly constraint is propagated to all content parts contained in the column.

          • :mandatory ([Boolean]) - Defines whether the column is mandatory in sheet content (cannot be deleted). Mandatory constraint is propagated to the roe that contains the column.

          • :visible ([Boolean]) - Defines whether the column is displayed in sheet content. The value of this attribute does not affect operating with the column through API.

          • :add_before ([Boolean]) - Defines, whether it is possible to create new column before the given one. The value of this attribute does not affect operating with the column through API.

          • :add_after ([Boolean]) - Defines, whether it is possible to create new column after the given one. The value of this attribute does not affect operating with the column through API.

          • :html_attributes ([Hash]) - Contains the HTML attributes for the column.

          • :width ([Hash]) - Object contains the definition of the column width for the different display areay sizes.

        • :data Hash) - Object contains the internal structure of the column.

          • :components ([Array<Hash>]) - An array of the components contained in the column. Each object contains the attributes of the component.

            • :id (String) - Unique identifier of the component.

            • :code (String) - User-defined code of the component. Must be unique in a scope of the Content. If empty, the code is automatically generated.

            • :component_code (String) - The address of the component. For the existing components in the content (already have id), the attribute cannot be changed (the new value will be ignored). If not set, defaults to UU.OS.RICHTEXT/RICHTEXT.

            • :component_engine(String) - The engine of the component. For the existing components in the content (already have id), the attribute cannot be changed (the new value will be ignored). Defaults to COMPONENT_CONTENT.

            • :props (Hash) - Contains the specific attributes for the given component.

            • :opt (Hash) - Object contains the additional attributes of the component.

              • :readonly ([Boolean]) - Defines whether the component is readonly (component content cannot be modified, component attributes cannot be modified, component cannot be deleted).

              • :mandatory ([Boolean]) - Defines whether the component is mandatory in sheet content (component cannot be deleted). Mandatory constraint is propagated to the column and row, which contain the component.

              • :visible ([Boolean]) - Defines whether the component is displayed in sheet content. The value of this attribute does not affect operating with the component through API.

              • :add_before ([Boolean]) - Defines, whether it is possible to create new component before the given one. The value of this attribute does not affect operating with the component through API.

              • :add_after ([Boolean]) - Defines, whether it is possible to create new component after the given one. The value of this attribute does not affect operating with the component through API.

              • :html_attributes ([Hash]) - Contains the attributes defining HTML attributes for the component.

              • :alignment (String) - default: left - IIndicates how the widget will be aligned in content, default value is left. If component_engine is COMPONENT_CONTENT the attribute is ignored.



385
386
387
# File 'lib/uu/os/content/sheet.rb', line 385

def set_data(sheet_uri, data = nil)
  @cmd.invoke('Sheet/setData', sheet_uri, prepare_params(data))
end

#unlock(sheet_uri) ⇒ Object

Unlocks the content of the given sheet. Locked sheet with flag force set to true can be unlocked by lock owner or anyone with sufficient rights. Locked sheet without flag force set to true can be unlocked only by lock owner.

Examples:

UU::OS::Content::Sheet.unlock('ues:TER:ART:SHEET')

Parameters:

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

    UESURI of the sheet.



284
285
286
# File 'lib/uu/os/content/sheet.rb', line 284

def unlock(sheet_uri)
  @cmd.invoke('Sheet/unlock', sheet_uri)
end