
rem -----------------------------------------------------+
prompt Creating version-resolved views (repos 1)...
rem -----------------------------------------------------+

rem -----------------------------------------------------+
prompt View : RM$ELEMENT_TYPE_EXTENSIONS
rem -----------------------------------------------------+
rem
create or replace view RM$ELEMENT_TYPE_EXTENSIONS (
  irid           
 ,ivid           
 ,ETID
 ,HELP_TAG
) as
select
  irid
 ,1
 ,ETID
 ,HELP_TAG
from i$RM$ELEMENT_TYPE_EXTENSIONS
/

rem -----------------------------------------------------+
prompt View : RM$NLS_DATA_TYPE_VALUES
rem -----------------------------------------------------+
rem
create or replace view RM$NLS_DATA_TYPE_VALUES (
  irid           
 ,ivid           
 ,NLS_LANGUAGE
 ,DID
 ,SEQ
 ,DEV_VALUE
 ,NLS_VALUE
) as
select
  irid
 ,1
 ,NLS_LANGUAGE
 ,DID
 ,SEQ
 ,DEV_VALUE
 ,NLS_VALUE
from i$RM$NLS_DATA_TYPE_VALUES
/

rem -----------------------------------------------------+
prompt View : RM$NLS_ELEMENT_TYPES
rem -----------------------------------------------------+
rem
create or replace view RM$NLS_ELEMENT_TYPES (
  irid           
 ,ivid           
 ,NLS_LANGUAGE
 ,ETID
 ,NLS_NAME
 ,NLS_PLURAL_NAME
) as
select
  irid
 ,1
 ,NLS_LANGUAGE
 ,ETID
 ,NLS_NAME
 ,NLS_PLURAL_NAME
from i$RM$NLS_ELEMENT_TYPES
/

rem -----------------------------------------------------+
prompt View : RM$NLS_LANGUAGES
rem -----------------------------------------------------+
rem
create or replace view RM$NLS_LANGUAGES (
  irid           
 ,ivid           
 ,LANG_ID
 ,NAME
 ,DESCRIPTION
) as
select
  irid
 ,1
 ,LANG_ID
 ,NAME
 ,DESCRIPTION
from i$RM$NLS_LANGUAGES
/

rem -----------------------------------------------------+
prompt View : RM$NLS_MESSAGES
rem -----------------------------------------------------+
rem
create or replace view RM$NLS_MESSAGES (
  irid           
 ,ivid           
 ,LANG_ID
 ,UTILITY
 ,CODE
 ,SEVERITY
 ,TEXT
) as
select
  irid
 ,1
 ,LANG_ID
 ,UTILITY
 ,CODE
 ,SEVERITY
 ,TEXT
from i$RM$NLS_MESSAGES
/

rem -----------------------------------------------------+
prompt View : RM$NLS_MESSAGE_GROUPS
rem -----------------------------------------------------+
rem
create or replace view RM$NLS_MESSAGE_GROUPS (
  irid           
 ,ivid           
 ,UTILITY
 ,DESCRIPTION
 ,FROM_MESSAGE
 ,TO_MESSAGE
) as
select
  irid
 ,1
 ,UTILITY
 ,DESCRIPTION
 ,FROM_MESSAGE
 ,TO_MESSAGE
from i$RM$NLS_MESSAGE_GROUPS
/

rem -----------------------------------------------------+
prompt View : RM$NLS_PROPERTIES
rem -----------------------------------------------------+
rem
create or replace view RM$NLS_PROPERTIES (
  irid           
 ,ivid           
 ,NLS_LANGUAGE
 ,PID
 ,NLS_NAME
 ,NLS_DEFAULT
 ,NLS_HINT
) as
select
  irid
 ,1
 ,NLS_LANGUAGE
 ,PID
 ,NLS_NAME
 ,NLS_DEFAULT
 ,NLS_HINT
from i$RM$NLS_PROPERTIES
/

rem -----------------------------------------------------+
prompt View : RM$NLS_TEXT_TYPES
rem -----------------------------------------------------+
rem
create or replace view RM$NLS_TEXT_TYPES (
  irid           
 ,ivid           
 ,NLS_LANGUAGE
 ,TEXT_TYPE
 ,NLS_DESC
) as
select
  irid
 ,1
 ,NLS_LANGUAGE
 ,TEXT_TYPE
 ,NLS_DESC
from i$RM$NLS_TEXT_TYPES
/

rem -----------------------------------------------------+
prompt View : RM$NLS_UTILITIES
rem -----------------------------------------------------+
rem
create or replace view RM$NLS_UTILITIES (
  irid           
 ,ivid           
 ,PRODUCT
 ,UTILITY
 ,VERSION
 ,DESCRIPTION
 ,PATH
) as
select
  irid
 ,1
 ,PRODUCT
 ,UTILITY
 ,VERSION
 ,DESCRIPTION
 ,PATH
from i$RM$NLS_UTILITIES
/

rem -----------------------------------------------------+
prompt View : RM$PROPERTY_EXTENSIONS
rem -----------------------------------------------------+
rem
create or replace view RM$PROPERTY_EXTENSIONS (
  irid           
 ,ivid           
 ,PID
 ,DISPLAY_SEQUENCE
 ,DEV_DEFAULT
 ,HELP_TAG
 ,PROPERTY_GROUP
 ,DATA_TYPE
 ,LENGTH
 ,PRECISION
 ,SCALE
) as
select
  irid
 ,1
 ,PID
 ,DISPLAY_SEQUENCE
 ,DEV_DEFAULT
 ,HELP_TAG
 ,PROPERTY_GROUP
 ,DATA_TYPE
 ,LENGTH
 ,PRECISION
 ,SCALE
from i$RM$PROPERTY_EXTENSIONS
/

rem -----------------------------------------------------+
prompt View : RM$PROPERTY_RANGES
rem -----------------------------------------------------+
rem
create or replace view RM$PROPERTY_RANGES (
  irid           
 ,ivid           
 ,PID
 ,LO_VALUE
 ,HI_VALUE
) as
select
  irid
 ,1
 ,PID
 ,LO_VALUE
 ,HI_VALUE
from i$RM$PROPERTY_RANGES
/

rem -----------------------------------------------------+
prompt View : RM$TEXT_TYPES
rem -----------------------------------------------------+
rem
create or replace view RM$TEXT_TYPES (
  irid           
 ,ivid           
 ,TEXT_TYPE
 ,MAX_LENGTH
 ,IS_EXTENDED
 ,IS_PUBLISHED
 ,EDITOR_TYPE
) as
select
  irid
 ,1
 ,TEXT_TYPE
 ,MAX_LENGTH
 ,IS_EXTENDED
 ,IS_PUBLISHED
 ,EDITOR_TYPE
from i$RM$TEXT_TYPES
/

rem -----------------------------------------------------+
prompt View : RM$TEXT_USAGES
rem -----------------------------------------------------+
rem
create or replace view RM$TEXT_USAGES (
  irid           
 ,ivid           
 ,ETID
 ,EL_TYPE
 ,EL_OCCUR_TYPE
 ,SEQ
 ,TEXT_TYPE
 ,IS_EXTENDED
 ,IS_PUBLISHED
) as
select
  irid
 ,1
 ,ETID
 ,EL_TYPE
 ,EL_OCCUR_TYPE
 ,SEQ
 ,TEXT_TYPE
 ,IS_EXTENDED
 ,IS_PUBLISHED
from i$RM$TEXT_USAGES
/

rem -----------------------------------------------------+
prompt View : RM_DATA_TYPES
rem -----------------------------------------------------+
rem
create or replace view RM_DATA_TYPES (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,DATA_LENGTH
 ,DATA_PRECISION
 ,DATA_SCALE
 ,NUMBER_OF_TIMES_MODIFIED
 ,SOURCE_REF
 ,SUPERTYPES
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,DATA_TYPE
 ,HACK_DEFAULT
 ,MANDATORY
 ,NAME
 ,PLURAL_NAME
 ,PRODUCT
 ,SHORT_NAME
 ,TEXT_TYPE_CODE
 ,USER_EXTENSION
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,DATA_LENGTH
 ,DATA_PRECISION
 ,DATA_SCALE
 ,NUMBER_OF_TIMES_MODIFIED
 ,SOURCE_REF
 ,SUPERTYPES
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,DATA_TYPE
 ,HACK_DEFAULT
 ,MANDATORY
 ,NAME
 ,PLURAL_NAME
 ,PRODUCT
 ,SHORT_NAME
 ,TEXT_TYPE_CODE
 ,USER_EXTENSION
from i$RM_DATA_TYPES
/

rem -----------------------------------------------------+
prompt View : RM_DISPLAY_DETAILS
rem -----------------------------------------------------+
rem
create or replace view RM_DISPLAY_DETAILS (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,FOR_TYPE
 ,HEIGHT
 ,LENGTH
 ,NUMBER_OF_TIMES_MODIFIED
 ,PRECISION
 ,SEQUENCE
 ,SOURCE_REF
 ,WIDTH
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,DATA_TYPE
 ,HELP
 ,HINT
 ,JUSTIFY
 ,LABEL
 ,NAME
 ,PLURAL_NAME
 ,SHORT_NAME
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,FOR_TYPE
 ,HEIGHT
 ,LENGTH
 ,NUMBER_OF_TIMES_MODIFIED
 ,PRECISION
 ,SEQUENCE
 ,SOURCE_REF
 ,WIDTH
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,DATA_TYPE
 ,HELP
 ,HINT
 ,JUSTIFY
 ,LABEL
 ,NAME
 ,PLURAL_NAME
 ,SHORT_NAME
from i$RM_DISPLAY_DETAILS
/

rem -------------------------------------------------------------------------+
prompt View : rm_element_types
rem
rem CW 16-Feb-99
rem Fix bug 801758, additional columns required for cwm jol
rem
rem CW 6-May-1999
rem Fix bug 877835, add icon property to rm_element_types
rem
rem AM 15-Feb-00
rem Fix bug 1196233, add versionable property to identify independently versionable
rem types.
rem -------------------------------------------------------------------------+
rem
create or replace view RM_ELEMENT_TYPES (
  irid           
, ivid           
, id
, types
, number_of_times_modified
, primary_row_type
, source_ref
, supertypes
, date_changed
, date_created
, abstract
, changed_by
, created_by
, hack_default
, name
, plural_name
, product
, short_name
, user_extension
, icon
, jr_type
, java_full_name
, is_primary
, display_seq_within_supertype
, interface_flag
, versionable
) as
select
  id
, 1
, id
, types
, number_of_times_modified
, primary_row_type
, source_ref
, supertypes
, date_changed
, date_created
, abstract
, changed_by
, created_by
, hack_default
, name
, plural_name
, product
, short_name
, user_extension
, icon
, jr_type
, java_full_name
, is_primary
, display_seq_within_supertype
, interface_flag
, versionable
from i$rm_element_types
/

rem -----------------------------------------------------+
prompt View : RM_EXPRESSIONS
rem -----------------------------------------------------+
rem
create or replace view RM_EXPRESSIONS (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,ASSERTION
 ,BIND_CONTEXT
 ,MESSAGE_PARAMETER
 ,NUMBER_OF_TIMES_MODIFIED
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,SYNTAX
 ,TEXT
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,ASSERTION
 ,BIND_CONTEXT
 ,MESSAGE_PARAMETER
 ,NUMBER_OF_TIMES_MODIFIED
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,SYNTAX
 ,TEXT
from i$RM_EXPRESSIONS
/

rem -----------------------------------------------------+
prompt View : RM_EXPRESSION_PROPERTY_USAGES
rem -----------------------------------------------------+
rem
create or replace view RM_EXPRESSION_PROPERTY_USAGES (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,CONTEXT
 ,EXPRESSION
 ,EXP_SEQ
 ,NUMBER_OF_TIMES_MODIFIED
 ,PROPERTY
 ,TEMP
 ,TRV_SEQ
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,CONTEXT
 ,EXPRESSION
 ,EXP_SEQ
 ,NUMBER_OF_TIMES_MODIFIED
 ,PROPERTY
 ,TEMP
 ,TRV_SEQ
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
from i$RM_EXPRESSION_PROP_USAGES
/

rem -----------------------------------------------------+
prompt View : RM_LINK_PROPERTIES
rem
rem CW 24-Feb-99
rem Fix bug 801758, additional columns required for cwm jol
rem -----------------------------------------------------+
rem
create or replace view RM_LINK_PROPERTIES (
  irid           
, ivid           
, id
, types
, arc_no
, defined_against
, descriptor_sequence
, link_type
, max_cardinality
, min_cardinality
, number_of_times_modified
, of_domain
, property_group
, report_seq
, sequence_in_type
, sequence_in_link
, source_ref
, supertypes
, date_changed
, date_created
, case_mode
, changed_by
, created_by
, displayed
, enforce_lov
, friendly_name
, hack_default
, is_stored
, maintained
, mandatory
, name
, plural_name
, product
, short_name
, updateable
, update_mode
, user_extension
, is_owning_association
, can_create  
, customised_query
, navigable
, ordered_set
, transferable
, aggregation
, display_subtypes
, scope_name_lov
, hierarchy
) as
select
  id
, 1
, id
, types
, arc_no
, defined_against
, descriptor_sequence
, link_type
, max_cardinality
, min_cardinality
, number_of_times_modified
, of_domain
, property_group
, report_seq
, sequence_in_type
, sequence_in_link
, source_ref
, supertypes
, date_changed
, date_created
, case_mode
, changed_by
, created_by
, displayed
, enforce_lov
, friendly_name
, hack_default
, is_stored
, maintained
, mandatory
, name
, plural_name
, product
, short_name
, updateable
, update_mode
, user_extension
, is_owning_association
, can_create
, customised_query   
, navigable
, ordered_set
, transferable
, aggregation
, display_subtypes
, scope_name_lov
, hierarchy
from i$rm_link_properties
/

rem -----------------------------------------------------+
prompt View : RM_LINK_TYPES
rem -----------------------------------------------------+
rem
create or replace view RM_LINK_TYPES (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,NUMBER_OF_TIMES_MODIFIED
 ,SOURCE_REF
 ,SUPERTYPES
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,HACK_DEFAULT
 ,NAME
 ,PLURAL_NAME
 ,PRODUCT
 ,SHORT_NAME
 ,USER_EXTENSION
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,NUMBER_OF_TIMES_MODIFIED
 ,SOURCE_REF
 ,SUPERTYPES
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,HACK_DEFAULT
 ,NAME
 ,PLURAL_NAME
 ,PRODUCT
 ,SHORT_NAME
 ,USER_EXTENSION
from i$RM_LINK_TYPES
/

rem -----------------------------------------------------+
prompt View : RM_MESSAGE_USAGES
rem -----------------------------------------------------+
rem
create or replace view RM_MESSAGE_USAGES (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,NLS_CODE
 ,NUMBER_OF_TIMES_MODIFIED
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,NAME
 ,NLS_UTILITY
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,NLS_CODE
 ,NUMBER_OF_TIMES_MODIFIED
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,NAME
 ,NLS_UTILITY
from i$RM_MESSAGE_USAGES
/

rem -----------------------------------------------------+
prompt View : RM_PROPERTIES
rem -----------------------------------------------------+
rem
create or replace view RM_PROPERTIES (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,DEFINED_AGAINST
 ,DESCRIPTOR_SEQUENCE
 ,NUMBER_OF_TIMES_MODIFIED
 ,OF_DOMAIN
 ,PROPERTY_GROUP
 ,REPORT_SEQ
 ,SEQUENCE_IN_TYPE
 ,SOURCE_REF
 ,SUPERTYPES
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CASE_MODE
 ,CHANGED_BY
 ,CREATED_BY
 ,DISPLAYED
 ,ENFORCE_LOV
 ,HACK_DEFAULT
 ,IS_STORED
 ,MAINTAINED
 ,MANDATORY
 ,NAME
 ,PLURAL_NAME
 ,PRODUCT
 ,SHORT_NAME
 ,UPDATEABLE
 ,UPDATE_MODE
 ,USER_EXTENSION
 ,ARC_NO
 ,java_datatype
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,DEFINED_AGAINST
 ,DESCRIPTOR_SEQUENCE
 ,NUMBER_OF_TIMES_MODIFIED
 ,OF_DOMAIN
 ,PROPERTY_GROUP
 ,REPORT_SEQ
 ,SEQUENCE_IN_TYPE
 ,SOURCE_REF
 ,SUPERTYPES
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CASE_MODE
 ,CHANGED_BY
 ,CREATED_BY
 ,DISPLAYED
 ,ENFORCE_LOV
 ,HACK_DEFAULT
 ,IS_STORED
 ,MAINTAINED
 ,MANDATORY
 ,NAME
 ,PLURAL_NAME
 ,PRODUCT
 ,SHORT_NAME
 ,UPDATEABLE
 ,UPDATE_MODE
 ,USER_EXTENSION
 ,ARC_NO
 ,java_datatype
from i$RM_PROPERTIES
/

rem -----------------------------------------------------+
prompt View : RM_PROPERTY_MAPS
rem -----------------------------------------------------+
rem
create or replace view RM_PROPERTY_MAPS (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,CONTEXT
 ,IN_COLUMN
 ,NUMBER_OF_TIMES_MODIFIED
 ,PROPERTY
 ,ROW_TYPE
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,CONTEXT
 ,IN_COLUMN
 ,NUMBER_OF_TIMES_MODIFIED
 ,PROPERTY
 ,ROW_TYPE
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
from i$RM_PROPERTY_MAPS
/

rem -----------------------------------------------------+
prompt View : RM_SQL_ROW_TYPES
rem -----------------------------------------------------+
rem
create or replace view RM_SQL_ROW_TYPES (
  irid           
 ,ivid           
 ,ID
 ,TYPES
 ,NUMBER_OF_TIMES_MODIFIED
 ,SOURCE_REF
 ,TABLE_MAPPED
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,NAME
 ,PLURAL_NAME
 ,SHORT_NAME
) as
select
  ID
 ,1
 ,ID
 ,TYPES
 ,NUMBER_OF_TIMES_MODIFIED
 ,SOURCE_REF
 ,TABLE_MAPPED
 ,DATE_CHANGED
 ,DATE_CREATED
 ,CHANGED_BY
 ,CREATED_BY
 ,NAME
 ,PLURAL_NAME
 ,SHORT_NAME
from i$RM_SQL_ROW_TYPES
/

rem -------------------------------------------------------------------+
prompt View : RM_ELEMENT_TYPE_EXTENSIONS (only required by registration
prompt Copied from model\repman40\generated\cdapirvw.sql
rem -------------------------------------------------------------------+
CREATE OR REPLACE FORCE VIEW rm_element_type_extensions as
  ( select ex.etid            for_type,
           ne.nls_name        nls_name,
           ne.nls_plural_name nls_plural_name,
           ex.help_tag        help_tag
      from rm$nls_element_types       ne,
           rm$element_type_extensions ex,
           rm_repositories            r
     where ne.etid = ex.etid
           and ne.nls_language = r.nls_language
  )
/

