DQL 收集

取得文件名和所属文件夹

select distinct s.object_name, f.r_folder_path from
 dm_sysobject_s s,
dm_sysobject_r r,
dm_folder_r f
 where
r.i_folder_id = f.r_object_id
and s.r_object_id = r.r_object_id
and  s.object_name like '%tes%'
and
 (
  s.r_object_type =  'dm_document' or s.r_object_id in (select r_object_id from dm_document_s)  //替代dql中的 type("dm_document")
)
and f.r_folder_path <> ''

 

创建一个Type

//1. The DQL to create custom type: employee.
//   This DQL also creates a display configuration
//   named 'dm_info' (see line 60: VALUE='dm_info' DISPLAY='Info')
 CREATE TYPE employee
 (
   emp_ssn string(18)
   (
     PRIMARY KEY,
     CHECK ('Len(emp_ssn)=18' LANGUAGE docbasic)
     REPORT 'The SSN must have exactly 18 digits.'
     ENFORCE BY APPLICATION,
     SET label_text='Social Security Number'
   ),
   emp_first_name string(32)
   (
     SET label_text='First Name',
     NOT NULL
   ),
   emp_last_name string(32)
   (
     SET label_text='Last Name',
     NOT NULL
   ),
   emp_gender integer
   (
     SET label_text='Gender',
     MAPPING TABLE (
       VALUE=1 DISPLAY='female' COMMENT='female',
       VALUE=2 DISPLAY='male' COMMENT='male'),
     NOT NULL
   ),
   emp_department string(32)
   (
     SET label_text='Department Name',
     VALUE ASSISTANCE IS LIST ('engineering','marketing'),
     NOT NULL
   ),
   emp_role string(64)
   (
     SET label_text='Role',
     VALUE ASSISTANCE IS
       IF ( 'emp_department="marketing"' LANGUAGE docbasic)
         LIST ('marketing manager', 'marketing sales')
       ELSE
         LIST ('QA engineer', 'QA engineer leader','Software Architect','Software Engineer') ,
     NOT NULL
   ),
   em_personal_interest string(50) REPEATING
   (
     SET label_text='Person favorite'
   ),
   emp_create_time date
   (
     DEFAULT=DATE(NOW),
     SET label_text='Create time'
   )
 )
 WITH SUPERTYPE dm_document
 UNIQUE (emp_first_name,emp_last_name),
 SET label_text='Employee Record',
 MAPPING TABLE (
   VALUE='dm_info' DISPLAY='Info'
 )

 

修改或添加一个Type的的displayconfig。

//2. Detail attributes in display configure.
//   After created successful, we need to record dm_display_config.r_object_id,
//   which will be used in following steps.
 create dm_display_config object
   set attribute_display_hint[0]=0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 0
   append attribute_display_hint = 2
   append attribute_display_hint = 2
   append attribute_display_hint = 2
   append attribute_display_hint = 2
   append attribute_display_hint = 2
   append attribute_display_hint = 2
   append attribute_display_hint = 2
   append attribute_display_hint = 2,
   set attribute_name[0]='object_name'
   append attribute_name ='title'
   append attribute_name ='subject'
   append attribute_name ='keywords'
   append attribute_name = 'emp_ssn'
   append attribute_name = 'emp_first_name'
   append attribute_name = 'emp_last_name'
   append attribute_name = 'emp_gender'
   append attribute_name = 'emp_department'
   append attribute_name = 'emp_role'
   append attribute_name = 'em_personal_interest'
   append attribute_name = 'authors'
   append attribute_name = 'r_content_size'
   append attribute_name = 'owner_name'
   append attribute_name = 'r_version_label'
   append attribute_name = 'r_lock_date'
   append attribute_name = 'r_lock_owner'
   append attribute_name = 'r_policy_id'
   append attribute_name = 'r_current_state'
   append attribute_name = 'log_entry'
   append attribute_name = 'r_creation_date'
   append attribute_name = 'r_creator_name'
   append attribute_name = 'r_modify_date'
   append attribute_name = 'r_modifier'
   append attribute_name = 'r_access_date'
   append attribute_name = 'a_storage_type'
   append attribute_name = 'i_retain_until',
   set attribute_source='employee',
   set fixed_display=false,
   set object_name='dm_info'


//3. Query dm_aggr_domain.r_object_id for the newly created custom type.
 select r_object_id from dm_aggr_domain where type_name='employee'

//4. Create scope config for the newly create custom type.
//   After created successful, we need to record dm_scope_config.r_object_id,
//   which will be used later.
//   dm_display_config.r_object_id should be replaced with the id recorded during step 2.
//   dm_aggr_domain.r_object_id should be replaced with the id recorded during step 3.
 
         create dm_scope_config object
   set display_config='dm_display_config.r_object_id',
   set scope_class='application',
   set scope_value='webtop',
   set parent_id='dm_aggr_domain.r_object_id'

//5. Change the type's scope config id to our created before.
//   dm_scope_config.r_object_id should be replaced with the id recorded during step 4.
 alter type employee
   set scope_config[0]='dm_scope_config.r_object_id'
   publish

 

关于displayconfig我写了一个函数:

  

Code
posted @ 2008-08-19 11:52  彷徨......  阅读(536)  评论(1编辑  收藏  举报