0

How to create next ItemRevision for exists Item?

I'm looks docs and see that I cant use CreateItems function, I must use CreateObject.

TCSession session = (TCSession) AIFUtility.getDefaultSession();
DataManagementService dmservice = DataManagementService.getService(session);

CreateInput irev = new CreateInput();
irev.boName = "ItemRevision";
irev.stringProps.put( "object_desc", "object_desc" );
irev.stringProps.put( "object_name", "object_name_test" );
irev.stringProps.put( "item_revision_id", "01" );

CreateIn[] ci = new CreateIn[1];
ci[0] = new CreateIn();
ci[0].data = irev;
ci[0].clientId = Integer.valueOf(1).toString();

CreateResponse cr = dmservice.createObjects(ci);

But the error dissappers: "Wrong symbol NULL object (in object) - required object not exists"

It means that I must set some attribute to revision which must be link to existing Item.

How can I do it? Thanks

Trying to create ItemRevision without creating Item

Vladjkaaa
  • 11
  • 3

1 Answers1

0

You are looking at the wrong SOA API for a revise usecase. The SOA API reviseObject from DataManagement is what you should be using instead. You would specify the base item revision on which you are deriving a new revision and the API would hand you over the created revision in the output container - reviseOutputMap to be more precise.

DEBUG: 18:43:46,297 - CommunicationMonitorView.callMade:-1
[Call]  XXXXXXXXX.62715.03.600019154.00093 Internal-Core-2008-06-DataManagement:reviseObject (549 bytes)
<?xml version="1.0" encoding="UTF-8"?>
<ReviseObjectInput xmlns="http://teamcenter.com/Schemas/Internal/Core/2008-06/DataManagement" deepCopyRequired="1">        
    <info clientId="Ro8ASD1fL_4pcBAAAAAAAAAAAAA" description="" name="Test OOTB" newRevId="B" xmlns="http://teamcenter.com/Schemas/Core/2008-06/DataManagement">    <baseItemRevision uid="Ro8ASD1fL_4pcB"/>                
        <newItemRevisionMasterProperties>                        
            <form uid="AAAAAAAAAAAAAA"/>                    
        </newItemRevisionMasterProperties>            
    </info>
</ReviseObjectInput>

The sample response:

<?xml version="1.0" encoding="UTF-8"?>
<ns1:ReviseResponse2 xmlns:ns1="http://teamcenter.com/Schemas/Core/2008-06/DataManagement" xmlns:ns0="http://teamcenter.com/Schemas/Soa/2006-03/Base">
    <ns1:reviseOutputMap key="RoKASD1fL_4pcBAAAAAAAAAAAAA">
        <ns1:value>
            <ns1:newItemRev uid="wnBASD3ML_4pcB" className="ItemRevision" type="ItemRevision"/>
            <ns1:relatedObjects action="0" isSecondary="0">
                <ns1:relatedObject uid="wLLASD3ML_4pcB" className="Form" type="ItemRevision Master"/>
            </ns1:relatedObjects>
        </ns1:value>
    </ns1:reviseOutputMap>
    <ns0:ServiceData>
.
.
.
Pavan Dittakavi
  • 3,013
  • 5
  • 27
  • 47