Manage custom types with DQL

 

Manage custom types with DQL

I. Create custom type
CREATE TYPE "custom_document"
("booleanAttr" bool REPEATING,
"integerAttr" integer,
"commentAttr" string(10),
"numberAttr" string(20),
"idAttr" id,
"dateAttr" date,
"doubleAttr" double,
"charAttr" CHAR(20))
WITH SUPERTYPE dm_document
publish;

II. Modify custom type
General tab settings
alter type custom_type
set label_text = 'Title' ,
set help_text = 'some hint' ,
set comment_text = 'some comment'
set DEFAULT BUSINESS POLICY='dm_policy.r_object_id' VERSION 'NONE'
SET DEFAULT STORAGE='filestore_01'
Display configuration
a) “Display Configuration” tab (for webtop application)
Get type configuration for webtop application (tabs and position)
select distinct r_object_id, display_config, i_is_replica, i_vstamp, parent_id, scope_class, scope_value from dm_scope_config where r_object_id in (select distinct scope_config from dmi_dd_type_info where type_name='myType') and any scope_value = 'webtop'
Get the position and display mode of the attributes on all tabs
select r_object_id, attribute_display_hint, attribute_name, attribute_source, fixed_display, i_config_identifier, i_is_replica, i_vstamp, object_name from dm_display_config
where r_object_id in (select display_config from dm_scope_config where r_object_id in (select distinct scope_config from dmi_dd_type_info where type_name='type_name')
and any scope_value = 'webtop')
b) Modify display config for custom type
update dm_display_config objects
set attribute_source='custom_type'
set attribute_name[0]='r_object_id'
set attribute_display_hint[0]=1
set attribute_name[1]='attr_name'
set attribute_display_hint[1]=1
where r_object_id = '6bab413080033559'
c) Create a new display configuration (a new tab on properties page)
create dm_display_config object
set "object_name"='newTab'
set "attribute_source"='custom_type'
set "fixed_display"=0
append attribute_name='attr_name'
append attribute_display_hint=1
d) Add the new display config to the application (desktop, webtop, etc.)
UPDATE dm_scope_config OBJECTS
INSERT "display_config"[0] = (select r_object_id from dm_display_config where attribute_source='myType' and object_name='newTab') WHERE r_object_id in (select distinct scope_config from dmi_dd_type_info where type_name='custom_type') and any scope_value='webtop'
e) Remove a display configuration
UPDATE dm_scope_config OBJECTS
REMOVE "display_config"[index]
WHERE r_object_id in (select distinct scope_config from dmi_dd_type_info where type_name='myType') and any scope_value='webtop'
*The index must be known
Security tab
Set default ACL
ALTER TYPE type_name SET DEFAULT ACL acl_name [IN acl_domain]
ALTER TYPE type_name SET DEFAULT ACL NULL
Constraints tab
ALTER TYPE type_name [FOR POLICY policy_id STATE state_name] ADD constraint_specification
a) Primary Key
ALTER TYPE type_name
add PRIMARY KEY ("notnullAttr1")
REPORT 'TEXT'
ENFORCE BY APPLICATION
publish;
ALTER TYPE type_name
drop PRIMARY KEY
publish;
b) Unique Key
ALTER TYPE type_name
ADD UNIQUE ("notnullAttr4")
REPORT 'TEXT'
ENFORCE BY APPLICATION
publish;
ALTER TYPE type_name
DROP UNIQUE ("notnullAttr4")
publish;
c) Foreign Key
ALTER TYPE type_name1
ADD FOREIGN KEY("notnullAttr4") REFERENCES type_name2 ("pk2")
REPORT 'TEXT'
ENFORCE BY APPLICATION
publish;
ALTER TYPE type_name1
DROP FOREIGN KEY("notnullAttr4") REFERENCES type_name2 ("pk2")
publish;
Events tab
Add application events:
ALTER TYPE type_name
APPEND auditable_appevents = 'dm_ev0',
APPEND auditable_appevents = 'dm_ev1'
publish;
Add system events:
ALTER TYPE type_name
APPEND auditable_sysevents = 'dm_sysev0',
APPEND auditable_sysevents = 'dm_sysev1'
publish;

III. Modify custom type attributes settings
General tab
alter type typeName
modify (“rg_contry” (
set label_text='Country Name:',
set help_text = 'The name of the country' ,
set comment_text = 'comment',
set ignore_immutable = TRUE,
set is_hidden = TRUE,
set is_required = TRUE,
set not_null = TRUE,
set not_null_msg = 'L’attributo deve essere valorizzato',
set read_only = TRUE,
DEFAULT='DEFAULT VALUE'
))
Advanced tab
alter type typeName
modify “rg_contry” (
set is_searchable = TRUE,
append allowed_search_ops = 1,
append allowed_search_ops = 2,
append allowed_search_ops = 3,
set format_pattern = 'pattern',
set format_pattern_tag = 1,
set category_name = 'categorie',
set default_search_arg = 'somevalue',
set default_search_op = 3
)
Constraints tab
alter type type_name
modify “rg_contry” (
set ignore_constraints = TRUE,
set val_constraint='expression',
set val_constraint_dep = '????',
set val_constraint_enf = '????',
set val_constraint_msg = 'Error message for constraint violation'
)
ALTER TYPE type_name
MODIFY "pk" (
ADD PRIMARY KEY | UNIQUE KEY | NOT NULL
REPORT 'error message' on violation
ENFORCE BY APPLICATION
)
ALTER TYPE type_name
MODIFY "pk" (
DROP PRIMARY KEY
)
publish;
ALTER TYPE type_name1
MODIFY "pk" (ADD FOREIGN KEY REFERENCES type_name2("pk2")
REPORT 'message_string' ON VIOLATION ENFORCE BY APPLICATION)
ALTER TYPE type_name1
MODIFY "pk" (DROP FOREIGN KEY REFERENCES type_name2("pk2"))

Value Assistance tab
a) Set query
ALTER TYPE type_name
MODIFY “rg_country” (
VALUE ASSISTANCE IS QRY 'select distinct attribute_name from type_name order by 1'
qry attr = attribute_name allow caching is complete)
b) Set list
ALTER TYPE type_name
modify "countrycode" (VALUE ASSISTANCE is LIST ('ONE', 'TWO', 'THREE') IS COMPLETE)
c) Drop
ALTER TYPE type_name MODIFY "countrycode" (DROP VALUE ASSISTANCE)

Value Mapping tab
Add mapping
ALTER TYPE type_name
MODIFY "countrycode" (
MAPPING TABLE (
VALUE='UK'
DISPLAY='United Kingdom'
COMMENT='comment1',
VALUE='US'
DISPLAY='United States'
COMMENT='comment2'
))
publish;
Drop mapping
ALTER TYPE type_name MODIFY "countrycode" (DROP MAPPING TABLE)

Comments

Popular posts from this blog

Using Java reflection to reduce Code and Development time in DFS

Virtual Documents in Documentum

Few Important Object Types in Documentum