failure.setPerformative(ACLMessage.FAILURE);
send(failure);
try {
ArrayList<Commitment> arrComm = new ArrayList<Commitment>();
for (Commitment com : interactionState.retrieveCommitmentsByDebtorRoleId(participant)) {
if (com.getConsequent().equals(new CompositeExpression(LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))) {
arrComm.add(com);
}
}
for (Commitment com :arrComm) {
if (com.getConsequent().equals(new CompositeExpression(LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))) {
Commitment cToAdd = new Commitment(com.getDebtor(), com.getCreditor(), com.getAntecedent(), com.getConsequent(), LifeCycleState.DISCHARGED);
interactionState.removeCommitment(com);
logger.debug("Commitment da rimuovere: "+com);
createCommitment(cToAdd);
}