--
-- Component: <component name>
--
-- File:      ConnectConfigCustomDef.ins
--
-- Purpose:   Install custom parameters in IFS Connect Config DEF tables
--
SET SERVEROUTPUT ON FORMAT WRAPPED
SET DEFINE OFF

DECLARE
   ctx_ Ins_Util_API.Ins_Context;

   PROCEDURE Init IS
   BEGIN
      Ins_Util_API.Set_Debug(FALSE, ctx_);
      Ins_Util_API.Modify_Existing_Rows(ctx_);
      Ins_Util_API.Set_Lu_Package('CONFIG_INSTANCE_TYPE_DEF_API', ctx_);
      Ins_Util_API.Set_Table('CONFIG_INSTANCE_TYPE_DEF', ctx_);
      Ins_Util_API.Add_Column('AREA_NAME'     , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('GROUP_NAME'    , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('INSTANCE_TYPE' , 'VARCHAR2' , ctx_);
      Ins_Util_API.Set_Primary_Key(Ins_Util_API.Pos_List(1, 2, 3), ctx_);
   END Init;

   PROCEDURE Ins (
      recreate$      IN BOOLEAN DEFAULT FALSE,
      area_name_     IN VARCHAR2,
      group_name_    IN VARCHAR2,
      instance_type_ IN VARCHAR2)
   IS
      values_ Ins_Util_API.Value_List;
   BEGIN
      values_(1) := area_name_;
      values_(2) := group_name_;
      values_(3) := instance_type_;
      Ins_Util_API.Ins_Row(values_, recreate$, ctx_);
   END Ins;

BEGIN
   Init;

   -- Definition of custom readers and senders
   Ins( area_name_ => 'Integration', group_name_ => 'ConnectorReaders', instance_type_ => 'Custom-<reader name>' );
   Ins( area_name_ => 'Integration', group_name_ => 'ConnectorSenders', instance_type_ => 'Custom-<sender name>' );

   Ins_Util_API.Summary(ctx_);
   Ins_Util_API.Close(ctx_);
EXCEPTION
   WHEN OTHERS THEN
      Ins_Util_API.Close(ctx_);
      RAISE;
END;
/


DECLARE
   ctx_ Ins_Util_API.Ins_Context;

   PROCEDURE Init IS
   BEGIN
      Ins_Util_API.Set_Debug(FALSE, ctx_);
      Ins_Util_API.Modify_Existing_Rows(ctx_);
      Ins_Util_API.Set_Lu_Package('CONFIG_PARAMETER_DEF_API', ctx_);
      Ins_Util_API.Set_Table('CONFIG_PARAMETER_DEF', ctx_);
      Ins_Util_API.Add_Column('AREA_NAME'       , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('GROUP_NAME'      , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('INSTANCE_TYPE'   , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('PARAMETER_NAME'  , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('DEFAULT_VALUE'   , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('HELP_TEXT'       , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('ORDINAL'         , 'NUMBER'   , ctx_);
      Ins_Util_API.Add_Column('PARAMETER_TYPE'  , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('VALUE_LIST'      , 'VARCHAR2' , ctx_);
      Ins_Util_API.Add_Column('WRITE_PROTECTED' , 'NUMBER'   , ctx_);
      Ins_Util_API.Set_Primary_Key(Ins_Util_API.Pos_List(1, 2, 3, 4), ctx_);
   END Init;

   PROCEDURE Ins (
      recreate$        IN BOOLEAN DEFAULT FALSE,
      area_name_       IN VARCHAR2,
      group_name_      IN VARCHAR2,
      instance_type_   IN VARCHAR2,
      parameter_name_  IN VARCHAR2,
      default_value_   IN VARCHAR2,
      help_text_       IN VARCHAR2,
      ordinal_         IN VARCHAR2,
      parameter_type_  IN VARCHAR2,
      value_list_      IN VARCHAR2,
      write_protected_ IN VARCHAR2)
   IS
      values_ Ins_Util_API.Value_List;
   BEGIN
      values_(1) := area_name_;
      values_(2) := group_name_;
      values_(3) := instance_type_;
      values_(4) := parameter_name_;
      values_(5) := default_value_;
      values_(6) := help_text_;
      values_(7) := ordinal_;
      values_(8) := parameter_type_;
      values_(9) := value_list_;
      values_(10) := write_protected_;
      Ins_Util_API.Ins_Row(values_, recreate$, ctx_);
   END Ins;

BEGIN
   Init;

   -- Custom reader parameters
   Ins( area_name_ => 'Integration', group_name_ => 'ConnectorReaders', instance_type_ => 'Custom-<reader name>', parameter_name_ => 'FACTORY_CLASS'   , default_value_ => '<fully qualified class name>', help_text_ => 'Fully qualified class name', ordinal_ => '101' , parameter_type_ => 'TypeText', value_list_ => '', write_protected_ => '1' );
   Ins( area_name_ => 'Integration', group_name_ => 'ConnectorReaders', instance_type_ => 'Custom-<reader name>', parameter_name_ => '<PARAMETER_NAME>', default_value_ => ''                            , help_text_ => '<parameter's help text>'   , ordinal_ => '102' , parameter_type_ => 'TypeText', value_list_ => '', write_protected_ => ''  );

   -- Custom sender parameters
   Ins( area_name_ => 'Integration', group_name_ => 'ConnectorSenders', instance_type_ => 'Custom-<sender name>', parameter_name_ => 'FACTORY_CLASS'   , default_value_ => '<fully qualified class name>', help_text_ => 'Fully qualified class name', ordinal_ => '101' , parameter_type_ => 'TypeText', value_list_ => '', write_protected_ => '1' );
   Ins( area_name_ => 'Integration', group_name_ => 'ConnectorSenders', instance_type_ => 'Custom-<sender name>', parameter_name_ => '<PARAMETER_NAME>', default_value_ => ''                            , help_text_ => '<parameter's help text>'   , ordinal_ => '102' , parameter_type_ => 'TypeText', value_list_ => '', write_protected_ => ''  );

   Ins_Util_API.Summary(ctx_);
   Ins_Util_API.Close(ctx_);
EXCEPTION
   WHEN OTHERS THEN
      Ins_Util_API.Close(ctx_);
      RAISE;
END;
/

COMMIT
/

SET DEFINE &

