Unsupported ObjectIdentity type: "STRING_URI" when creating Object

JasonGoltermann
edited May 16, 2016 in Documentum #1

When using the Java Productivity Layer from emc-dfs-sdk-7.2, I'm coming across a strange error.

I'm attempting to invoke IObjectService.create and pass in the DataPackage, which contains a DataObject with the id, content and properties set according to the reference material.  I set the id as follows:


@SuppressWarnings("rawtypes")
ObjectIdentity identity = new ObjectIdentity(repository);
DataObject dataObject = new DataObject(identity, "dm_document");

According to the javadocs for ObjectIdentity:


An ObjectIdentity instance contains a repository name and a unique identifier that can take various forms, specified by ObjectIdentityType enum constants. When constructing a DataObject to pass to the create operation, or in any case when the DataObject represents a repository object that does not yet exist, the ObjectIdentity need only be populated with a repository name.

Indeed, if I print out identity.getType it shows the type to be UNDEFINED, as one would expect.  However, UNDEFINED is not a supported type and neither is STRING_URI (I found this by reading other posts on this forum).  The exact error is:


Message: "Create" operation failed for object: [Test.txt] [id =null] PROPERTIES [object_name=Test.txt]. Unsupported ObjectIdentity type: "STRING_URI".
CauseCode: [E_UNSUPPORTED_OBJECT_TYPE] Unsupported ObjectIdentity type: "STRING_URI".>

I'm not sure how the ObjectIdentity type went from UNDEFINED to STRING_URI, but there you have it.  Sort of a catch 22 situation.  You'd think the PL wouldn't care what the type is on creation, but apparently it does.

Anyone have a fix?

Tagged:

Comments

  • Haroon_A
    edited May 12, 2016 #2

    Try this:


    ObjectId objectId = new ObjectId("0912abcd6a8caade");
    ObjectIdentity identity = new ObjectIdentity(objectId, repository);
  • JorgKrause
    edited May 13, 2016 #3

    Hi,

    Creating a new object (not having a valid id yet), can be done like this


    DataObject newDoc = new DataObject(new ObjectIdentity<Object>(), "dm_document");

    Updating an existing document (having a valid id), it using the exact same code


    DataObject newDoc = new DataObject(new ObjectIdentity<Object>(new ObjectId("<id>"), "<reponame>")), "dm_document");

    Plz note the ObjectIdentity is a raw type, and you should use the <Object> qualifier, or others.

    Regards

    Jørg

  • JasonGoltermann
    edited May 16, 2016 #4

    Try this:


    ObjectId objectId = new ObjectId("0912abcd6a8caade"); 
    ObjectIdentity identity = new ObjectIdentity(objectId, repository); 

    Doing this returns an error concerning how the docbase number is not found.  Upon further research, I found that the docbase ID is included in each ObjectID, and Documentum looks for this.  I suppose that I could find the specific ID number of the relevant docbase each time I'm trying to create a new object, but somehow that seems like a lot of overhead and I'm not sure that this is what was intended by the productivity layer.

  • JasonGoltermann
    edited May 16, 2016 #5

    Hi,

    Creating a new object (not having a valid id yet), can be done like this


    DataObject newDoc = new DataObject(new ObjectIdentity<Object>(), "dm_document"); 

    Updating an existing document (having a valid id), it using the exact same code

    DataObject newDoc = new DataObject(new ObjectIdentity<Object>(new ObjectId("<id>"), "<reponame>")), "dm_document"); 



    Plz note the ObjectIdentity is a raw type, and you should use the <Object> qualifier, or others.


    Regards

    Jørg

    I had already tried the above using


    new ObjectIdentity<ObjectId>()

    since ObjectID is one of the supported "ObjectIdentityType enum constants" mentioned in the documentation, however, that produced the same error.  I tried it with Object just to make sure I had tried everything, but still received the same error.


    The productivity layer should really have a constructor for DataObject that accepts only the repository name without an ID for those situations where an object is being created. This would remove the silliness of having a generic for which you can't know the type, as it doesn't exist yet.  Simply putting Object as the type variable negates the whole purpose of using generics in the first place.


    Perhaps, I have a configuration issue and this is a red herring....

  • Haroon_A
    edited May 16, 2016 #6

    In case of creating new object, you should be able to do so, without providing an ID (ObjectId). i.e.

    ObjectIdentity objIdentity = new ObjectIdentity("repository");

    DataObject dataObject = new DataObject(objIdentity, "dm_document");

    You need to set properties as well:

    PropertySet properties = dataObject.getProperties();

    properties.set("title", "Doc Title");

    properties.set("object_name", "Doc Name");

    Can you probably share your code, and let us know where it fails?