Cancel
Showing results for 
Search instead for 
Did you mean: 

JAVA API and Naming Rule for item_id

Legend
Legend

How to use item_id generation when Naming Rule appied with TC JAVA API( or may be SOA) ?

 

I have a naming rule with 2 patterns for example:

 

A-nnnnnn

B-nnnnnn

 

I use Java API function tccomponent_item_type.create(item_id,rev_id,item_type, item_name,item_desc,uom_tag)

 

If we need item_id generated by TC we just set item_id parameter as NULL.

But how to get new Item_ID if the Naming Rule with two patterns exist for this item?

5 REPLIES 5

Re: JAVA API and Naming Rule for item_id

Solution Partner Legend Solution Partner Legend
Solution Partner Legend
In SOA C# we use API "DataManagementService.GenerateItemIdsAndInitialRevisionIds". (Should be similar in Java)
But I have not tested how this works in case of naming rules.
Highlighted

Re: JAVA API and Naming Rule for item_id

Phenom
Phenom

Hello,

 

I havent tried it but this SOA API DataManagementService.getNextIds can be used for generating ID based on pattern

Before using this API, you will have to find the naming rule associated with the ITEM_ID property for that business object type. Pattern is also one of the arguments to the getNextIds API.

 

So i believe, you can generate your next ID with right input parameters

Once you have the new ITEM_ID generated, you can use it in your create API

 

Regards

Mahendra

Re: JAVA API and Naming Rule for item_id

Legend
Legend

Yes, the SOA getNextIds method solved this problem

Re: JAVA API and Naming Rule for item_id

Pioneer
Pioneer

Hi Alex, @alex_c

 

I have similar requirement to generate item ids based on set of differnt naming rules (which vary based on 'one' createInput argument.)
ex if input argument has value 'A', pick naming rule pattern 'pattern1'
if value is 'B', pick naming rule pattern 'pattern2'

 

I am plannnig to write a pre-action and generate item id based on applicable naming rule using getNextIds.

 

Could you please share on which function you added this logic? and as pre or post? was it pre-action on create operation?

 

Re: JAVA API and Naming Rule for item_id

Legend
Legend

@Gunjan wrote:

 

Could you please share on which function you added this logic? and as pre or post? was it pre-action on create operation?

 


I didn't use pre-action operation. I used this API directly in my custom function in java plugin