handlers/kinetic_submission_update_attribute_v1/handler/vendor/ars-models-0.0.7/lib/ars_models/form.rb
# Internal JAPI representation of the com.kd.ars.models.structure.ArsForm object
Internal JAPI representation of the com.kd.ars.models.structure.ArsForm object
Internal JAPI representation of the com . kd . ars . models . structure . ArsForm object
def build(options={})
      validate_options(
        options,
        :required => [:name],
        :optional => [:context, :fields, :indexes, :permissions, :sort_fields]
      )
      @ars_form = ArsForm.new(options[:name])
      (options[:fields] || []).collect! do |field|
        if field.is_a?(::Hash)
          field = DEFAULT_FIELDS[DEFAULT_FIELD_NAMES[field[:name]]].merge(field) if DEFAULT_FIELD_NAMES.has_key?(field[:name])
          field = DEFAULT_FIELDS[field[:id]].merge(field) if DEFAULT_FIELDS.has_key?(field[:id])
          Field.new(field)
        elsif field.is_a?(Field)
          field
        else
          raise ArgumentException.new("Bad field definition: #{field}")
        end
      end
      [:context, :fields, :indexes, :permissions, :sort_fields].each do |key|
        self.send("#{key}=", options[key]) if options.has_key?(key)
      end
    end
def build ( options = { } ) validate_options ( options , :required => [ :name ] , :optional => [ :context , :fields , :indexes , :permissions , :sort_fields ] ) @ars_form = ArsForm . new ( options [ :name ] ) ( options [ :fields ] || [ ] ) . collect! do | field | if field . is_a? ( :: Hash ) field = DEFAULT_FIELDS [ DEFAULT_FIELD_NAMES [ field [ :name ] ] ] . merge ( field ) if DEFAULT_FIELD_NAMES . has_key? ( field [ :name ] ) field = DEFAULT_FIELDS [ field [ :id ] ] . merge ( field ) if DEFAULT_FIELDS . has_key? ( field [ :id ] ) Field . new ( field ) elsif field . is_a? ( Field ) field else raise ArgumentException . new ( "Bad field definition: #{field}" ) end end [ :context , :fields , :indexes , :permissions , :sort_fields ] . each do | key | self . send ( "#{key}=" , options [ key ] ) if options . has_key? ( key ) end end
Internal JAPI representation of the com.kd.ars.models.structure.ArsForm object
Internal JAPI representation of the com . kd . ars . models . structure . ArsForm object
# Validate the passed options # Store a new JAPI ArsForm object # Convert any hash defined fields as fields
options
<not_specific>