Beispiel #1
0
  public Map<String, Object> update(final JsonCommand command) {
    final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(9);

    if (command.isChangeInIntegerParameterNamed(
        GroupingTypesApiConstants.statusParamName, this.status)) {
      final Integer newValue =
          command.integerValueOfParameterNamed(GroupingTypesApiConstants.statusParamName);
      actualChanges.put(
          GroupingTypesApiConstants.statusParamName, GroupingTypeEnumerations.status(newValue));
      this.status = GroupingTypeStatus.fromInt(newValue).getValue();
    }

    if (command.isChangeInStringParameterNamed(
        GroupingTypesApiConstants.externalIdParamName, this.externalId)) {
      final String newValue =
          command.stringValueOfParameterNamed(GroupingTypesApiConstants.externalIdParamName);
      actualChanges.put(GroupingTypesApiConstants.externalIdParamName, newValue);
      this.externalId = StringUtils.defaultIfEmpty(newValue, null);
    }

    if (command.isChangeInLongParameterNamed(
        GroupingTypesApiConstants.officeIdParamName, this.office.getId())) {
      final Long newValue =
          command.longValueOfParameterNamed(GroupingTypesApiConstants.officeIdParamName);
      actualChanges.put(GroupingTypesApiConstants.officeIdParamName, newValue);
    }

    if (command.isChangeInLongParameterNamed(
        GroupingTypesApiConstants.staffIdParamName, staffId())) {
      final Long newValue =
          command.longValueOfParameterNamed(GroupingTypesApiConstants.staffIdParamName);
      actualChanges.put(GroupingTypesApiConstants.staffIdParamName, newValue);
    }

    if (command.isChangeInStringParameterNamed(
        GroupingTypesApiConstants.nameParamName, this.name)) {
      final String newValue =
          command.stringValueOfParameterNamed(GroupingTypesApiConstants.nameParamName);
      actualChanges.put(GroupingTypesApiConstants.nameParamName, newValue);
      this.name = StringUtils.defaultIfEmpty(newValue, null);
    }

    final String dateFormatAsInput = command.dateFormat();
    final String localeAsInput = command.locale();

    if (command.isChangeInLocalDateParameterNamed(
        GroupingTypesApiConstants.activationDateParamName, getActivationLocalDate())) {
      final String valueAsInput =
          command.stringValueOfParameterNamed(GroupingTypesApiConstants.activationDateParamName);
      actualChanges.put(GroupingTypesApiConstants.activationDateParamName, valueAsInput);
      actualChanges.put(GroupingTypesApiConstants.dateFormatParamName, dateFormatAsInput);
      actualChanges.put(GroupingTypesApiConstants.localeParamName, localeAsInput);

      final LocalDate newValue =
          command.localDateValueOfParameterNamed(GroupingTypesApiConstants.activationDateParamName);
      this.activationDate = newValue.toDate();
    }

    return actualChanges;
  }
Beispiel #2
0
 public boolean isTransferOnHold() {
   return GroupingTypeStatus.fromInt(this.status).isTransferOnHold();
 }
Beispiel #3
0
 public boolean isTransferInProgress() {
   return GroupingTypeStatus.fromInt(this.status).isTransferInProgress();
 }
Beispiel #4
0
 public boolean isPending() {
   return GroupingTypeStatus.fromInt(this.status).isPending();
 }
Beispiel #5
0
 public boolean isActive() {
   return GroupingTypeStatus.fromInt(this.status).isActive();
 }