/**
     * Creates a builder by populating it with data from the given {@link
     * AgendaItemDefinitionContract}.
     *
     * @param contract the contract from which to populate this builder
     * @return an instance of the builder populated with data from the contract
     * @throws IllegalArgumentException if the contract is null
     */
    public static Builder create(AgendaItemDefinitionContract contract) {
      if (contract == null) {
        throw new IllegalArgumentException("contract is null");
      }
      Builder builder = new Builder(contract.getId(), contract.getAgendaId());
      builder.setRuleId(contract.getRuleId());
      builder.setSubAgendaId(contract.getSubAgendaId());
      builder.setWhenTrueId(contract.getWhenTrueId());
      builder.setWhenFalseId(contract.getWhenFalseId());
      builder.setAlwaysId(contract.getAlwaysId());

      if (contract.getRule() != null) {
        builder.setRule(RuleDefinition.Builder.create(contract.getRule()));
      }
      if (contract.getSubAgenda() != null) {
        builder.setSubAgenda(AgendaDefinition.Builder.create(contract.getSubAgenda()));
      }
      if (contract.getWhenTrue() != null) {
        builder.setWhenTrue(AgendaItemDefinition.Builder.create(contract.getWhenTrue()));
      }
      if (contract.getWhenFalse() != null) {
        builder.setWhenFalse(AgendaItemDefinition.Builder.create(contract.getWhenFalse()));
      }
      if (contract.getAlways() != null) {
        builder.setAlways(AgendaItemDefinition.Builder.create(contract.getAlways()));
      }
      builder.setVersionNumber(contract.getVersionNumber());
      return builder;
    }
 /**
  * Set the value of the agenda item for the "always" condition on this builder to the given
  * value. Has the additional side effect of setting {{whenTrueId}} to the ID value of the always
  * argument.
  *
  * @param always the agenda item for the "always" condition of the agenda item to set
  */
 public void setAlways(AgendaItemDefinition.Builder always) {
   this.always = always;
   this.alwaysId = (always != null) ? always.getId() : null;
 }
 /**
  * Set the value of the agenda item for the "when false" condition on this builder to the given
  * value. Has the additional side effect of setting whenTrueId to the ID value of the
  * {{whenFalse}} argument.
  *
  * @param whenFalse the agenda item for the "when false" condition of the agenda item to set
  */
 public void setWhenFalse(AgendaItemDefinition.Builder whenFalse) {
   this.whenFalse = whenFalse;
   this.whenFalseId = (whenFalse != null) ? whenFalse.getId() : null;
 }
 /**
  * Set the value of the agenda item for the "when true" condition on this builder to the given
  * value. Has the additional side effect of setting whenTrueId to the ID value of the
  * {{whenTrue}} argument.
  *
  * @param whenTrue the agenda item for the "when true" condition of the agenda item to set
  */
 public void setWhenTrue(AgendaItemDefinition.Builder whenTrue) {
   this.whenTrue = whenTrue;
   this.whenTrueId = (whenTrue != null) ? whenTrue.getId() : null;
 }