How to get lifecycle associated with Part Type?

I want to get/check the lifecycle phases associated with Part Type. Please let me know how to get all lifecycle phases associated with Part Type or how to validate the lifecycle phase which we are using to rev up (through code) is actual lifecycle and also belongs to the part.

Thanks,
Vaibhav

No Files Were Attached
Add Comment
5 Answer(s)

Am I to understand that there is are specific lifecycles phases depending on the subclass?  Please provide examples.

Patrick Lawrence Agile Angel Answered on May 7, 2019.
Add Comment

Yes the design was made to have additional lifecycles other than OTB Preliminary, Prototype and Production released. We have lifecycle phases like concept and others which are specific to part subclasses.

michaeldargis Agile Angel Answered on May 7, 2019.
Add Comment

So they are not specific to part type…. need to go into the PART class and look under lifecycle phases there… you can add and deactivate options there.

Patrick Lawrence Agile Angel Answered on May 7, 2019.

Hi Patrick,

As for configuration, we know how to check/add/remove lifecycle phase for Part Subclass. We need to know how to do this validation programatically.  In our scenario, we are creating ECO, adding part to affected items tab and adding all other required info like Lifecycle as provided in file. But in order to validate lifecycle provided, is correct (the name is correct) and also is associated with the part subclass, we need to access the lifecycle associated with part subclass.

Thanks,
Vaibhav

on May 7, 2019.
Add Comment

 Lifecycle values are always in the NODETABLE table. To check if an LCP value is linked to a specific subclass, you would need to follow the hierarchy in NODETABLE. Each class has a defined node underneath it for “LifeCycle Phases” (select id, description from nodetable where parentid=10000), it is 1514 for Items, 9043 for Documents and 9045 for Parts. Each class also has a node for “User-Defined Subclasses” (10141 is the ID for the Part subclass). If you look in NODETABLE using that value as the PARENTID, you will see a node defined as “LifeCycle Phases” for the subclass. This is the parent ID for the LCP values defined specifically for that subclass.

 If you are using SQL, just get the ID for the subclass, find the ID for the “LifeCycle Phases” node, and then check to see if it has a record with the lifecycle value you want to use under it. If you are using the SDK, it should work something like this :

private static void checkLifecyclePhase(IItem item, String lcp) throws APIException {
// Get the Lifecycle Phase cell
   ICell cell = item.getCell(ItemConstants.ATT_TITLE_BLOCK_LIFECYCLE_PHASE);

// Get available list values for Lifecycle Phase
   IAgileList values = cell.getAvailableValues();

// Run through the LCP list to verify we are using a good one
   int cval := -1;
   for (int i = 0; i < values.length; i++) {
      if ( values[i] = lcp ) {
         cval = i;
      }
   }

   if (cval >= 0) {
// Set the attribute to the value we got as an argument which was found in the LCP list
      values.setSelection(new Object[] { cval });
      cell.setValue(values);
   } else {

      throw new Exception(“Could not find ” + lcp + ” in the life cycle values”);
   }

}

 My apologies if my Java isn’t correct, I am a bit rusty…..  But the above should give the general idea of what to do. When you get the list of lifecycle values, it will include the base Item LCP values, the class LCP values  *and* the subclass LCP values. So every valid LCP value for the item in question will be in the array. You find which one matches the value given as the argument, and then set it. If it is not found, then throw an exception or handle as needed.

Kevin Cummings Agile Angel Answered on May 8, 2019.

Hi Kevin,

Thanks for your input.

1. We are aware of the tables and how to get the lifecycle phases for subclass using SQL. But that is our last resort
2. The code above doesn’t work. Because =>

  1. IAgileList is not array so we can not iterate through it that way. 
  2. We can get the collection object using values.getChildNodes(), but still I do not see any value in the list. I can see the length values.getChildNodes().size() as 9 which is exact length of number of LCP for subclass. But when we iterate through it, it just have blank values which are actually sepearated by comma ([, , , , , , , , ]). So this object is not empty but at the same time it does not have values.
  3. I tried other methods like (Affected itme tab row object) row.getValue(Cell ID), cell.getAvailableValues() (which you also suggested). But still I do not see the values.

Please suggest the ideas or your input on how can we achieve this. Even you can direct me in right direction without providing code that will be great help.

Thanks again for your valuable input.

Thanks,
Vaibhav

on May 8, 2019.

I am just guessing but I think we can not get values for LCP by regular method to access list, because there is nothing in the list associated with it. Subclass and LCP relationship is configurred at subclass level i.e. it is part of configuration and I am not sure how to access that at this moment.

I may be wrong but just giving my observation here.

Thanks,
Vaibhav

on May 8, 2019.

Unfortunately, I nearly exhausted my SDK knowledge with the above. And you are probably correct, in that LCP is not like a normal list attribute, and so it must be handled differently.
 From the SDK guide : “If you use IAttribute.getAvailableValues() to retrieve the available values for a Lifecycle Phase attribute instead of a subclass-specific cell, the method returns an empty IAgileList object.”.

 I have yet to find an SDK example that loops through the lifecycle values, but I think you can use “values.getSelection()[i].getValue()” instead of “values[i]” in the loop above.

 Let me know if that works.

on May 13, 2019.
Add Comment
Best answer

Finally after all the research I got the answer for my question.

We have to use INode to get the part sub class node then get it child nodes. One of child node is LifeCycle Phases, for this node you can get the child nodes which are our lifecylce associated with the part sub class.

Steps to achieve it:
1. Get part sub classs using IAgileClass
2. Get level 1 node for part sub class
3. Get all childs for level1 node in Collection object
4. Iterate through it to look for LCP
5. Get Child Nodes of  LCP in another Colleciton object and here you go

I am fairly new to Agile PLM SDK developement but I think for all configuration related data we need to refer using INode which is also stored in nodetable in database.

Thanks,
Vaibhav

Vaibhav Sangle Agile Angel Answered 6 days ago.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.