How DFC Document Type Info Cached?

ilkaykoseli
edited December 23, 2008 in Documentum #1

Hello,

I change document type to a subtype via DQL "change ... object to .. " command.

When I try to see and change the object properties from webtop I see that the object type is old type.

If no one open the properties window for a long time the problem disapered.

I think,

DFC caching document type properties when it is retrived via DFC.

Same problem exist for DFC. If I retrieve the document via IDfSession.getObjectByQualification(), and change the object type. I cannot change the attributes of new subtype and I get the fallowing exception. If I don't retreive the object previously, everything is fine.

Sample Code

        try{

             String query = "my_doc_type1 where my_new_field = '" + value + "'";
             IDfDocument document = (IDfDocument)session.getObjectByQualification(query);

             String updateQuery="change my_doc_type1 object to my_doc_type2 where evrak_no = '"+ evrakNo + "'";
             IDfQuery query = new DfQuery();
             query.setDQL(updateQuery); 

             IDfCollection collection = query.execute(session, DfQuery.DF_QUERY); 

             collection.close();

             IDFDocument changedDocument = (IDfDocument)session.getObjectByQualification(query);

            changedDocument.setString("musavirlik_no", "test value");
        }catch (Exception e) {
            e.printStackTrace();
        }

Exception

Caused by: DfTypedObjectException:: THREAD: main; MSG: [DM_API_E_BADATTRNAME]error:  "Bad attribute name 'musavirlik_no' for document/object."; ERRORCODE: 100; NEXT: null
    at com.documentum.fc.client.impl.typeddata.LiteType.getAttr(LiteType.java:170)
    at com.documentum.fc.client.impl.typeddata.AbstractTypedData.setString(AbstractTypedData.java:290)
    at com.documentum.fc.client.DfTypedObject.setStringInternal(DfTypedObject.java:1477)
    at com.documentum.fc.client.DfTypedObject.setStringRaw(DfTypedObject.java:1463)
    at com.documentum.fc.client.DfTypedObject.doSetString(DfTypedObject.java:1445)
    at com.documentum.fc.client.DfTypedObject.setString(DfTypedObject.java:1418)
    at com.documentum.fc.client.DfDocument___PROXY.setString(DfDocument___PROXY.java)
    at evrak.iski.gov.tr.dfc.lawaction.AddDocumentToCase.save(AddDocumentToCase.java:114)
    ... 1 more

Best Answer

  • aflowers001
    edited December 23, 2008 #2 Answer ✓

    Hi,

    You need to remove the 'old' version from the cache held within the session.

    You can use the flushCache method of IdfSession, but this is potentially overkill. We have had to do this in an application we have been using but it wasn't the most optimal solution, but it did work.

    There is also flushObject available that will flush by object id, whcih might be a better solution.

    As already mentioned you might need to also use the fetch method as well.

    When we have done this in DFC in the past we have always encountered problems that meant major amounts of code had to be written around changing the object type, re fetching, checking if the object is of the new type and if not doing a whole host of lushing and other stuff that wasn't really necessary in our opinion.

    you might also rethink using the getObjectByQualifification as that, if I recall right, has issues with change...object, might be better with a simple getObject call?

Answers

  • Antal Bos
    edited December 22, 2008 #3

    Hi,

    When you change a Type/Attribute this is done in the cache.

    You can use the API fetch command to retrieve the new data.

    When you create/alter or drop a TYPE you need to PUBLISH it.

    This can be done with the PUBLISH command in DQL.

    It will be done automaticly with the DataDictionaryPublisher Job in DA.

    This PUBLISH will create/update the dmi_dd_type_info, dmi_dd_attr_info objects!

    Hopefully this helps.

    Best regards,

    Antal

  • ilkaykoseli
    edited December 23, 2008 #4

    Thanks for your answer Antal

    But Unfortunanately I think I have been misunderstood.

    I don't change the type but I change the type of a document from super type to subtype.

  • aflowers001
    edited December 23, 2008 #5 Answer ✓

    Hi,

    You need to remove the 'old' version from the cache held within the session.

    You can use the flushCache method of IdfSession, but this is potentially overkill. We have had to do this in an application we have been using but it wasn't the most optimal solution, but it did work.

    There is also flushObject available that will flush by object id, whcih might be a better solution.

    As already mentioned you might need to also use the fetch method as well.

    When we have done this in DFC in the past we have always encountered problems that meant major amounts of code had to be written around changing the object type, re fetching, checking if the object is of the new type and if not doing a whole host of lushing and other stuff that wasn't really necessary in our opinion.

    you might also rethink using the getObjectByQualifification as that, if I recall right, has issues with change...object, might be better with a simple getObject call?