Tuesday, 28 June 2011

Accessing <dmfx:docbaseattribute > in javascript or JS

To get the html rendering of the docbaseattributes,Right click on the jsp to know the name of the attribute

Example:
<dmfx:docbaseattribute name="object_name" id="object_name" object="obj" attribute="object_name" col1="</th><th>: </th> <td>" size="60"/>

In view source the above attribute is rendered with name=attributes_contents_attributes_contents_object_name_value_1_0

To access this attribute in Javascript
var obj=document.all.attributes_contents_attributes_contents_object_name_value_1_0.value;

Wednesday, 18 May 2011

What is a Virtual Document?

What is a Virtual Document
Simplistically speaking Virtual document is a document that can contain another documents.

After reading the above statement first question that might arise to all is if it can contain documents how is it different from a folder?

Let me make few bullet points about Virtual Document here, which will clear most of the confusions that you might have about virtual documents.



· A Virtual Document is a Document which can contain the type or the sub type of SysObjects with an exception given below

· A Virtual Document cannot contain any folders or cabinets, or any sub types of these.

· A Virtual Document object may or may not have a content (dmr_content) attached to it but a folder or a cabinet will never have any content attached to it. Though most of the time a Virtual Document might not be having a Content file attached to it.

· Any Object type that extents from SysObject can be converted as a Virtual Document. The Attribute r_is_virtual_doc (integer not a Boolean) of SysObject determines whether that object is a virtual document or not. If the value is 1 then it’s a Virtual document. If its value is 0 and the property r_link_cnt value is not higher than 0 then that object is not a Virtual Document
The Content Server Fundamental is misleading in this aspect, Page number 199 of guide says it’s a Boolean property but in reality its not

· The Contents of the Virtual document can be of different object types.

· The Virtual Documents can be versioned and managed in the same way as you do with any other objects.

Wednesday, 11 May 2011

Useful Dql queries

Query To get users and groups of an acl

select distinct grl.users_names, gr2.i_supergroups_names
from dm_group_r grl, dm_group_r gr2
where grl.r_object_id = gr2.r_object_id and gr2.i_supergroups_names IN (SELECT r_accessor_name from dm_acl where object_name = 'ge_og_tm_rlst_int_ref_acl')
**************************************************************
Query to fetch users in an acl

select user_name from dm_user where user_name in (SELECT r_accessor_name from dm_acl where object_name like 'ge_og_pm%')

Query to fetch groups in an acl

select group_name from dm_group where group_name in (SELECT r_accessor_name from dm_acl where object_name like 'ge_og_pm%')


***************************************************************
To select folders and their permission details within a given folder:

SELECT DISTINCT s.object_name, ar.r_accessor_name, ar.r_accessor_permit, ar.r_accessor_xpermit, sr.r_folder_path
FROM dm_acl_s a, dm_acl_r ar, dm_folder s, dm_folder_r sr
WHERE a.r_object_id = ar.r_object_id
AND s.r_object_id=sr.r_object_id
AND a.object_name = s.acl_name
AND sr.r_folder_path like '/XXX%'
AND sr.i_position = -1


***************************************************************
Query to fetch latest update from set of records

select object_name,owner_name, r_creation_date,r_modify_date,r_modifier from dm_sysobject where FOLDER('/Oil & Gas Comm Ops (Finance & Legal)/Sales/Pre-qualification/GE O&G
Reference Lists/Internal use only/Confidential Agreements (ordered by legal entity)',descend) order by r_modify_date desc ENABLE(RETURN_TOP 1)
*************************************************************************
Query to fetch first record from a set of records

select * from dm_sysobject ENABLE(RETURN_TOP 1) which
will give you the first row..
*************************************************************************
Query to fetch group names of a user

Select group_name from dm_group where any i_all_users_names='Matucci, Alberto'

**************************************************************************
Query to get subfolders of a folder

Select * from dm_folder WHERE Folder('/Oil & Gas Comm Ops (Finance & Legal)/Sales/Commercial Documentum/Sites/Massa/Test1/Link To PM Docm/Test1012', descend);

**************************************************************************
QUERY TO CREATE OBJECT TYPE

CREATE TYPE large_string_test (large_string CHAR(255)) WITH SUPERTYPE dm_document
For altering the attributes of an object

ALTER TYPE large_string_test MODIFY large_string CHAR(2000)

Examples :

CREATE TYPE "mycustomtype" (firstname string(64),
country string(64) ,
age int,
height double,
phone string(10) REPEATING)
WITH SUPERTYPE "dm_document" PUBLISH

Modify a Simple Object Type (Adding new Attributes)
ALTER TYPE "mycustomtype"
Add lastname string (64),
height double,
weight double
PUBLISH

Modify a Simple Object type (Modify existing attribute)
ALTER TYPE mycustomtype
MODIFY firstname string (121)

To Drop object type:

DELETE type_name (ALL) OBJECTS
after that
DROP TYPE type_name

**************************************************************************

To give top ten results of a query

SELECT * FROM dm_sysobject ENABLE (RETURN_TOP 10)

*************************************************************************
Query to check particular user is present in a particular acl

select object_name from dm_acl where any r_accessor_name='Bechi, Alessandro' and object_name='ge_og_pm_acl_105711011'

*************************************************************************
Query to get the parent folder of folder

select r_folder_path, object_name from dm_folder where r_object_id in (select All i_folder_id from dm_folder where r_object_id = '0b00138a80355b55')
*************************************************************************
Query to get the object name and folder path of ge_og_pm_project object type which is modified after a given date.

select r_object_id,object_name,r_folder_path from ge_og_pm_project where r_modify_date>'31/jan/2011'
**************************************************************************
Query to fetch the object types under a particular folder

select distinct r_object_type from dm_folder where folder('/Oil & Gas Comm Ops (Finance & Legal)/Sales',descend) and r_object_type not in ('ge_og_pm_project','ge_og_pm_subfolder','dm_folder')
**************************************************************************
Query to update a object

update ge_og_pm_project object set ge_mat_plannibg_mgr='' where object_name='Test Project'
**************************************************************************
DQL to find all the folders in a Cabinet, where the folders are contentless

SELECT f1.object_name, f1.r_object_id, f1.r_folder_path
FROM dm_folder f1
WHERE FOLDER(’/Cabinetname’,descend)
AND NOT EXISTS (SELECT f2.object_name FROM dm_sysobject f2 WHERE ANY f2.i_folder_id = f1.r_object_id)
ORDER BY object_name
*************************************************************************
Query to find out objects with lock or checked out

Select r_object_id, r_lock_owner from ge_og_pm_document where r_lock_owner is not
nullstring

**************************************************************************
Query to find path of the checked out document

select r_object_id,r_folder_path from dm_folder where r_object_id in (select i_folder_id from dm_document where r_object_id in (Select r_object_id from ge_og_pm_document where r_lock_owner is not
nullstring)) order by r_folder_path
**************************************************************************
Query to add user to many groups

UPDATE dm_group OBJECTS APPEND users_names = 'SR, Karthik' WHERE group_name IN ('fe_general', 'enterprise');
***************************************************************************
DQL on Dates

To Get The Current Day and time

select DATETOSTRING(DATE(NOW),'dd/mm/yyyy') as systime from dm_server_config

To Get Todays Date

select DATETOSTRING(DATE(TODAY),'dd/mm/yyyy') as systime from dm_server_config

Query to Get the names of acls having a particlar user

***********************************************************

select object_name from dm_acl where any r_accessor_name like 'Krishna%'

************************************************************