Remove Relationship rule via SDK

Hi Guys,

is there any way we can remove the relationship object rule via SDK?

Thanks,
Anand

Add Comment
1 Answer(s)

i got the answer.

try {
           //Get program
           IProgram pgm = (IProgram)session.getObject(ProgramConstants.CLASS_PROGRAM,”PGM00016″);
           
           //Get relationship table
           ITable table = pgm.getTable(ProgramConstants.TABLE_RELATIONSHIPS);
           Iterator it = table.getTableIterator();
           
           //Delete rule on all relationships
           while (it.hasNext()){
               IRow row = (IRow)it.next();
               IAgileObject obj = row.getReferent();
               System.out.println(“Relationship rule: ” + row.getCell(CommonConstants.ATT_RELATIONSHIPS_RULE));
               HashMap map = new HashMap();
               map.put(CommonConstants.ATT_RELATIONSHIPS_RULE_CONTROLOBJECT, pgm);
               map.put(CommonConstants.ATT_RELATIONSHIPS_RULE_AFFECTEDOBJECT, obj);
               row.setValue(CommonConstants.ATT_RELATIONSHIPS_RULE, map);
               System.out.println(“Relationship rule: ” + row.getCell(CommonConstants.ATT_RELATIONSHIPS_RULE));

           }
       } catch (APIException ex) {
           System.out.println(ex);
       }

Agile User Answered on March 28, 2017.
Add Comment

Your Answer

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