コード例 #1
0
  public void fromDTO(StateChange stateChange) {

    super.fromDTO(stateChange);

    List<Object> orphansToDelete = new ArrayList<Object>();
    setEffectiveDate(stateChange.getEffectiveDate());
    setExpirationDate(stateChange.getExpirationDate());
    setFromStateKey(stateChange.getFromStateKey());
    setToStateKey(stateChange.getToStateKey());

    if (stateChange.getStateConstraintIds() != null) {
      stateConstraintIds = new ArrayList<String>(stateChange.getStateConstraintIds());
    } else {
      stateConstraintIds = null;
    }

    if (stateChange.getStatePropagationIds() != null) {
      statePropagationIds = new ArrayList<String>(stateChange.getStatePropagationIds());
    } else {
      statePropagationIds = null;
    }

    // Merge attributes into entity and add leftovers to be deleted
    orphansToDelete.addAll(
        TransformUtility.mergeToEntityAttributes(
            StateChangeAttributeEntity.class, stateChange, this));
  }
コード例 #2
0
  public StateChangeInfo toDto() {
    StateChangeInfo info = new StateChangeInfo();
    info.setId(getId());
    info.setFromStateKey(getFromStateKey());
    info.setToStateKey(getToStateKey());
    info.setEffectiveDate(getEffectiveDate());
    info.setExpirationDate(getExpirationDate());
    info.setStateKey(getStateKey());
    info.setTypeKey(getTypeKey());
    info.setMeta(super.toDTO());
    info.setAttributes(TransformUtility.toAttributeInfoList(this));

    info.getStateConstraintIds().clear();
    if (stateConstraintIds != null) {
      info.getStateConstraintIds().addAll(stateConstraintIds);
    }

    info.getStatePropagationIds().clear();
    if (statePropagationIds != null) {
      info.getStatePropagationIds().addAll(statePropagationIds);
    }

    return info;
  }