Converting object id to guid (filenet ce-pe-db)

A short one i figured is shareable;

After being spooked by the solutions i found on the developerworks forums to translate object id’s to guid’s, i figured there should be a OOTB api way of doing so.

Eventually i found the following:

String objectID = “{304C605E-0000-CE17-BD18-E0B728DC0483}”;
String guid = new filenet.vw.api.VWGuid(objectID).toByteString();

Cheers

2 thoughts on “Converting object id to guid (filenet ce-pe-db)

  1. Try this … it is usefull when you need work with DB object ids

    public static String guidToHex(String guid) {
    //A8 62 DD 74 87 F9 2D 46 82 C8 88 2E 15 33 EC DB
    //0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
    //74 DD 62 A8 -F 98 7- 46 2D -8 2C 8- 88 2E 15 33 EC DB
    //0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34
    guid = guid.replaceAll(“\\{“, “”).replaceAll(“\\}”, “”);

    return
    guid.substring( 6, 8)+
    guid.substring( 4, 6)+
    guid.substring( 2, 4)+
    guid.substring( 0, 2)+
    guid.substring(11,13)+
    guid.substring( 9,11)+
    guid.substring(16,18)+
    guid.substring(14,16)+
    guid.substring(19,21)+
    guid.substring(21,23)+
    guid.substring(24,26)+
    guid.substring(26,28)+
    guid.substring(28,30)+
    guid.substring(30,32)+
    guid.substring(32,34)+
    guid.substring(34,36)
    ;
    }

    public static String hexToGUID(String hex) {
    //A8 62 DD 74 87 F9 2D 46 82 C8 88 2E 15 33 EC DB
    //0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
    //{74DD62A8-F987-462D-82C8-882E1533ECDB}

    return “{” +
    hex.substring(6, 8)+
    hex.substring(4, 6)+
    hex.substring(2, 4)+
    hex.substring(0, 2)+
    “-“+
    hex.substring(10,12)+
    hex.substring(8, 10)+
    “-“+
    hex.substring(14,16)+
    hex.substring(12,14)+
    “-“+
    hex.substring(16,18)+
    hex.substring(18,20)+
    “-“+
    hex.substring(20,22)+
    hex.substring(22,24)+
    hex.substring(24,26)+
    hex.substring(26,28)+
    hex.substring(28,30)+
    hex.substring(30,32)+
    “}”;
    }

Leave a Reply to Sachin Cancel reply

Your email address will not be published. Required fields are marked *