Remove Relationship rule via SDK
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);
}