Example usage for org.apache.commons.lang StringUtils defaultIfEmpty

List of usage examples for org.apache.commons.lang StringUtils defaultIfEmpty

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils defaultIfEmpty.

Prototype

public static String defaultIfEmpty(String str, String defaultStr) 

Source Link

Document

Returns either the passed in String, or if the String is empty or null, the value of defaultStr.

Usage

From source file:org.mifosplatform.organisation.dsa.domain.Dsa.java

private Dsa(final Office dsaOffice, final String firstname, final String lastname, final String mobileNo,
        final Boolean isActive) {
    this.office = dsaOffice;
    this.firstname = StringUtils.defaultIfEmpty(firstname, null);
    this.lastname = StringUtils.defaultIfEmpty(lastname, null);
    this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null);
    this.active = (isActive == null) ? true : isActive;
    deriveDisplayName(firstname);/*from  www  .  ja va  2 s. c o m*/

}

From source file:org.mifosplatform.organisation.dsa.domain.Dsa.java

public Map<String, Object> update(final JsonCommand command) {

    final Map<String, Object> actualChanges = new LinkedHashMap<>(7);

    final String officeIdParamName = "officeId";
    if (command.isChangeInLongParameterNamed(officeIdParamName, this.office.getId())) {
        final Long newValue = command.longValueOfParameterNamed(officeIdParamName);
        actualChanges.put(officeIdParamName, newValue);
    }/*w  w  w. ja  va 2 s . c  o  m*/

    boolean firstnameChanged = false;
    final String firstnameParamName = "firstname";
    if (command.isChangeInStringParameterNamed(firstnameParamName, this.firstname)) {
        final String newValue = command.stringValueOfParameterNamed(firstnameParamName);
        actualChanges.put(firstnameParamName, newValue);
        this.firstname = newValue;
        firstnameChanged = true;
    }

    boolean lastnameChanged = false;
    final String lastnameParamName = "lastname";
    if (command.isChangeInStringParameterNamed(lastnameParamName, this.lastname)) {
        final String newValue = command.stringValueOfParameterNamed(lastnameParamName);
        actualChanges.put(lastnameParamName, newValue);
        this.lastname = newValue;
        lastnameChanged = true;
    }

    if (firstnameChanged || lastnameChanged) {
        deriveDisplayName(this.firstname);
    }

    final String mobileNoParamName = "mobileNo";
    if (command.isChangeInStringParameterNamed(mobileNoParamName, this.mobileNo)) {
        final String newValue = command.stringValueOfParameterNamed(mobileNoParamName);
        actualChanges.put(mobileNoParamName, newValue);
        this.mobileNo = StringUtils.defaultIfEmpty(newValue, null);
    }

    final String isActiveParamName = "isActive";
    if (command.isChangeInBooleanParameterNamed(isActiveParamName, this.active)) {
        final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(isActiveParamName);
        actualChanges.put(isActiveParamName, newValue);
        this.active = newValue;
    }

    return actualChanges;
}

From source file:org.mifosplatform.organisation.holiday.domain.Holiday.java

public Map<String, Object> update(final JsonCommand command) {
    final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(7);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
            .resource("holiday" + ".update");

    final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status);

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

    if (command.isChangeInStringParameterNamed(nameParamName, this.name)) {
        final String newValue = command.stringValueOfParameterNamed(nameParamName);
        actualChanges.put(nameParamName, newValue);
        this.name = StringUtils.defaultIfEmpty(newValue, null);
    }// www  .  j  ava2s.co  m

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

    if (currentStatus.isPendingActivation()) {
        if (command.isChangeInLocalDateParameterNamed(fromDateParamName, getFromDateLocalDate())) {
            final String valueAsInput = command.stringValueOfParameterNamed(fromDateParamName);
            actualChanges.put(fromDateParamName, valueAsInput);
            actualChanges.put(dateFormatParamName, dateFormatAsInput);
            actualChanges.put(localeParamName, localeAsInput);
            final LocalDate newValue = command.localDateValueOfParameterNamed(fromDateParamName);
            this.fromDate = newValue.toDate();
        }

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

            final LocalDate newValue = command.localDateValueOfParameterNamed(toDateParamName);
            this.toDate = newValue.toDate();
        }

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

            final LocalDate newValue = command.localDateValueOfParameterNamed(repaymentsRescheduledToParamName);
            this.repaymentsRescheduledTo = newValue.toDate();
        }

        if (command.hasParameter(officesParamName)) {
            final JsonArray jsonArray = command.arrayOfParameterNamed(officesParamName);
            if (jsonArray != null) {
                actualChanges.put(officesParamName, command.jsonFragment(officesParamName));
            }
        }
    } else {
        if (command.isChangeInLocalDateParameterNamed(fromDateParamName, getFromDateLocalDate())) {
            baseDataValidator.reset().parameter(fromDateParamName)
                    .failWithCode("cannot.edit.holiday.in.active.state");
        }

        if (command.isChangeInLocalDateParameterNamed(toDateParamName, getToDateLocalDate())) {
            baseDataValidator.reset().parameter(toDateParamName)
                    .failWithCode("cannot.edit.holiday.in.active.state");
        }

        if (command.isChangeInLocalDateParameterNamed(repaymentsRescheduledToParamName,
                getRepaymentsRescheduledToLocalDate())) {
            baseDataValidator.reset().parameter(repaymentsRescheduledToParamName)
                    .failWithCode("cannot.edit.holiday.in.active.state");
        }

        if (command.hasParameter(officesParamName)) {
            baseDataValidator.reset().parameter(repaymentsRescheduledToParamName)
                    .failWithCode("cannot.edit.holiday.in.active.state");
        }

        if (!dataValidationErrors.isEmpty()) {
            throw new PlatformApiDataValidationException(dataValidationErrors);
        }
    }

    return actualChanges;
}

From source file:org.mifosplatform.organisation.monetary.domain.ApplicationCurrency.java

public Map<String, Object> update(final JsonCommand command) {
    final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(1);
    final String code = "code";
    if (command.isChangeInStringParameterNamed(code, this.code)) {
        final String newValue = command.stringValueOfParameterNamed(code);
        actualChanges.put(code, newValue);
        this.code = StringUtils.defaultIfEmpty(newValue, null);
    }//from   w  w w . j ava 2  s  .  c om

    final String name = "name";
    if (command.isChangeInStringParameterNamed(name, this.name)) {
        final String newValue = command.stringValueOfParameterNamed(name);
        actualChanges.put(name, newValue);
        this.name = newValue;
    }

    final String decimal_places = "decimal_places";
    if (command.isChangeInIntegerParameterNamed(decimal_places, this.decimal_places)) {
        final Integer newValue = command.integerValueOfParameterNamed(decimal_places);
        actualChanges.put(decimal_places, newValue);
        this.decimal_places = newValue;
    }

    final String internationalized_name_code = "internationalized_name_code";
    if (command.isChangeInStringParameterNamed(internationalized_name_code, this.internationalized_name_code)) {
        final String newValue = command.stringValueOfParameterNamed(decimal_places);
        actualChanges.put(decimal_places, newValue);
        this.internationalized_name_code = newValue;
    }
    final String display_symbol = "display_symbol";
    if (command.isChangeInStringParameterNamed(display_symbol, this.display_symbol)) {
        final String newValue = command.stringValueOfParameterNamed(display_symbol);
        actualChanges.put(display_symbol, newValue);
        this.display_symbol = newValue;
    }

    final String ResourceId = "ResourceId";
    if (command.isChangeInIntegerParameterNamed(ResourceId, this.ResourceId)) {
        final Integer newValue = command.integerValueOfParameterNamed(ResourceId);
        actualChanges.put(ResourceId, newValue);
        this.decimal_places = newValue;
    }

    final String Type = "Type";
    if (command.isChangeInIntegerParameterNamed(Type, this.Type)) {
        final Integer newValue = command.integerValueOfParameterNamed(Type);
        actualChanges.put(Type, newValue);
        this.Type = newValue;
    }
    return actualChanges;
}

From source file:org.mifosplatform.organisation.office.domain.Office.java

public Map<String, Object> update(final JsonCommand command) {

    final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(7);

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

    final String parentIdParamName = "parentId";

    if (command.parameterExists(parentIdParamName) && this.parent == null) {
        throw new RootOfficeParentCannotBeUpdated();
    }/*ww w.j  a  v a 2  s  .c o m*/

    if (this.parent != null && command.isChangeInLongParameterNamed(parentIdParamName, this.parent.getId())) {
        final Long newValue = command.longValueOfParameterNamed(parentIdParamName);
        actualChanges.put(parentIdParamName, newValue);
    }

    final String openingDateParamName = "openingDate";
    if (command.isChangeInLocalDateParameterNamed(openingDateParamName, getOpeningLocalDate())) {
        final String valueAsInput = command.stringValueOfParameterNamed(openingDateParamName);
        actualChanges.put(openingDateParamName, valueAsInput);
        actualChanges.put("dateFormat", dateFormatAsInput);
        actualChanges.put("locale", localeAsInput);

        final LocalDate newValue = command.localDateValueOfParameterNamed(openingDateParamName);
        this.openingDate = newValue.toDate();
    }

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

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

    return actualChanges;
}

From source file:org.mifosplatform.organisation.staff.domain.Staff.java

private Staff(final Office staffOffice, final String firstname, final String lastname, final String externalId,
        final String mobileNo, final boolean isLoanOfficer) {
    this.office = staffOffice;
    this.firstname = StringUtils.defaultIfEmpty(firstname, null);
    this.lastname = StringUtils.defaultIfEmpty(lastname, null);
    this.externalId = StringUtils.defaultIfEmpty(externalId, null);
    this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null);
    this.loanOfficer = isLoanOfficer;
    deriveDisplayName(firstname);// ww  w .ja v a  2  s.  co m
}

From source file:org.mifosplatform.organisation.staff.domain.Staff.java

public Map<String, Object> update(final JsonCommand command) {

    final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(7);

    final String officeIdParamName = "officeId";
    if (command.isChangeInLongParameterNamed(officeIdParamName, this.office.getId())) {
        final Long newValue = command.longValueOfParameterNamed(officeIdParamName);
        actualChanges.put(officeIdParamName, newValue);
    }//from w w w . j  av a2 s  .co  m

    boolean firstnameChanged = false;
    final String firstnameParamName = "firstname";
    if (command.isChangeInStringParameterNamed(firstnameParamName, this.firstname)) {
        final String newValue = command.stringValueOfParameterNamed(firstnameParamName);
        actualChanges.put(firstnameParamName, newValue);
        this.firstname = newValue;
        firstnameChanged = true;
    }

    boolean lastnameChanged = false;
    final String lastnameParamName = "lastname";
    if (command.isChangeInStringParameterNamed(lastnameParamName, this.lastname)) {
        final String newValue = command.stringValueOfParameterNamed(lastnameParamName);
        actualChanges.put(lastnameParamName, newValue);
        this.lastname = newValue;
        lastnameChanged = true;
    }

    if (firstnameChanged || lastnameChanged) {
        deriveDisplayName(this.firstname);
    }

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

    final String mobileNoParamName = "mobileNo";
    if (command.isChangeInStringParameterNamed(mobileNoParamName, this.mobileNo)) {
        final String newValue = command.stringValueOfParameterNamed(mobileNoParamName);
        actualChanges.put(mobileNoParamName, newValue);
        this.mobileNo = StringUtils.defaultIfEmpty(newValue, null);
    }

    final String isLoanOfficerParamName = "isLoanOfficer";
    if (command.isChangeInBooleanParameterNamed(isLoanOfficerParamName, this.loanOfficer)) {
        final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(isLoanOfficerParamName);
        actualChanges.put(isLoanOfficerParamName, newValue);
        this.loanOfficer = newValue;
    }

    return actualChanges;
}

From source file:org.mifosplatform.portfolio.calendar.domain.Calendar.java

public Calendar(final String title, final String description, final String location, final LocalDate startDate,
        final LocalDate endDate, final Integer duration, final Integer typeId, final boolean repeating,
        final String recurrence, final Integer remindById, final Integer firstReminder,
        final Integer secondReminder) {

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
            .resource(CALENDAR_RESOURCE_NAME);

    final CalendarType calendarType = CalendarType.fromInt(typeId);
    if (calendarType.isCollection() && !repeating) {
        baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue())
                .failWithCodeNoParameterAddedToErrorCode("must.repeat.for.collection.calendar");
        if (!dataValidationErrors.isEmpty()) {
            throw new PlatformApiDataValidationException(dataValidationErrors);
        }//from www. jav  a  2s  .co m
    }

    this.title = StringUtils.defaultIfEmpty(title, null);
    this.description = StringUtils.defaultIfEmpty(description, null);
    this.location = StringUtils.defaultIfEmpty(location, null);

    if (null != startDate) {
        this.startDate = startDate.toDateTimeAtStartOfDay().toDate();
    } else {
        this.startDate = null;
    }

    if (null != endDate) {
        this.endDate = endDate.toDateTimeAtStartOfDay().toDate();
    } else {
        this.endDate = null;
    }

    this.duration = duration;
    this.typeId = typeId;
    this.repeating = repeating;
    this.recurrence = StringUtils.defaultIfEmpty(recurrence, null);
    this.remindById = remindById;
    this.firstReminder = firstReminder;
    this.secondReminder = secondReminder;
}

From source file:org.mifosplatform.portfolio.calendar.domain.Calendar.java

public Map<String, Object> update(final JsonCommand command) {

    final Map<String, Object> actualChanges = new LinkedHashMap<String, Object>(9);

    if (command.isChangeInStringParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), this.title)) {
        final String newValue = command
                .stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue());
        actualChanges.put(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), newValue);
        this.title = StringUtils.defaultIfEmpty(newValue, null);
    }//from  ww  w .j ava  2  s  . c  o  m

    if (command.isChangeInStringParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(),
            this.description)) {
        final String newValue = command
                .stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue());
        actualChanges.put(CALENDAR_SUPPORTED_PARAMETERS.DESCRIPTION.getValue(), newValue);
        this.description = StringUtils.defaultIfEmpty(newValue, null);
    }

    if (command.isChangeInStringParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(),
            this.location)) {
        final String newValue = command
                .stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue());
        actualChanges.put(CALENDAR_SUPPORTED_PARAMETERS.LOCATION.getValue(), newValue);
        this.location = StringUtils.defaultIfEmpty(newValue, null);
    }

    final String dateFormatAsInput = command.dateFormat();
    final String localeAsInput = command.locale();
    final String startDateParamName = CALENDAR_SUPPORTED_PARAMETERS.START_DATE.getValue();
    if (command.isChangeInLocalDateParameterNamed(startDateParamName, getStartDateLocalDate())) {

        final String valueAsInput = command.stringValueOfParameterNamed(startDateParamName);
        final LocalDate newValue = command.localDateValueOfParameterNamed(startDateParamName);
        final LocalDate currentDate = DateUtils.getLocalDateOfTenant();

        if (newValue.isBefore(currentDate)) {
            final String defaultUserMessage = "New meeting effective from date cannot be in past";
            throw new CalendarDateException("new.start.date.cannot.be.in.past", defaultUserMessage, newValue,
                    getStartDateLocalDate());
        } else if (isStartDateAfter(newValue) && isStartDateBeforeOrEqual(currentDate)) {
            //new meeting date should be on or after start date or current date
            final String defaultUserMessage = "New meeting effective from date cannot be a date before existing meeting start date";
            throw new CalendarDateException("new.start.date.before.existing.date", defaultUserMessage, newValue,
                    getStartDateLocalDate());
        } else {
            actualChanges.put(startDateParamName, valueAsInput);
            actualChanges.put("dateFormat", dateFormatAsInput);
            actualChanges.put("locale", localeAsInput);
            this.startDate = newValue.toDate();
        }
    }

    final String endDateParamName = CALENDAR_SUPPORTED_PARAMETERS.END_DATE.getValue();
    if (command.isChangeInLocalDateParameterNamed(endDateParamName, getEndDateLocalDate())) {
        final String valueAsInput = command.stringValueOfParameterNamed(endDateParamName);
        actualChanges.put(endDateParamName, valueAsInput);
        actualChanges.put("dateFormat", dateFormatAsInput);
        actualChanges.put("locale", localeAsInput);

        final LocalDate newValue = command.localDateValueOfParameterNamed(endDateParamName);
        this.endDate = newValue.toDate();
    }

    final String durationParamName = CALENDAR_SUPPORTED_PARAMETERS.DURATION.getValue();
    if (command.isChangeInIntegerSansLocaleParameterNamed(durationParamName, this.duration)) {
        final Integer newValue = command.integerValueSansLocaleOfParameterNamed(durationParamName);
        actualChanges.put(durationParamName, newValue);
        this.duration = newValue;
    }

    // Do not allow to change calendar type
    // TODO: AA Instead of throwing an exception, do not allow meeting
    // calendar type to update.
    final String typeParamName = CALENDAR_SUPPORTED_PARAMETERS.TYPE_ID.getValue();
    if (command.isChangeInIntegerSansLocaleParameterNamed(typeParamName, this.typeId)) {
        final Integer newValue = command.integerValueSansLocaleOfParameterNamed(typeParamName);
        final String defaultUserMessage = "Meeting calendar type update is not supported";
        final String oldMeeingType = CalendarType.fromInt(this.typeId).name();
        final String newMeetingType = CalendarType.fromInt(newValue).name();

        throw new CalendarParameterUpdateNotSupportedException("meeting.type", defaultUserMessage,
                newMeetingType, oldMeeingType);
        /*
         * final Integer newValue =
         * command.integerValueSansLocaleOfParameterNamed(typeParamName);
         * actualChanges.put(typeParamName, newValue); this.typeId =
         * newValue;
         */
    }

    final String repeatingParamName = CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue();
    if (command.isChangeInBooleanParameterNamed(repeatingParamName, this.repeating)) {
        final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(repeatingParamName);
        actualChanges.put(repeatingParamName, newValue);
        this.repeating = newValue;
    }

    //if repeating is false then update recurrence to NULL
    if (!this.repeating)
        this.recurrence = null;

    final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
    final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
            .resource(CALENDAR_RESOURCE_NAME);

    final CalendarType calendarType = CalendarType.fromInt(this.typeId);
    if (calendarType.isCollection() && !this.repeating) {
        baseDataValidator.reset().parameter(CALENDAR_SUPPORTED_PARAMETERS.REPEATING.getValue())
                .failWithCodeNoParameterAddedToErrorCode("must.repeat.for.collection.calendar");
        if (!dataValidationErrors.isEmpty()) {
            throw new PlatformApiDataValidationException(dataValidationErrors);
        }
    }

    final String newRecurrence = Calendar.constructRecurrence(command, this);
    if (!StringUtils.isBlank(this.recurrence) && !newRecurrence.equalsIgnoreCase(this.recurrence)) {

        // FIXME: AA - Is this restriction required only for collection type
        // meetings or for all?.
        // Do not allow to change meeting frequency

        if (!CalendarUtils.isFrequencySame(this.recurrence, newRecurrence)) {
            final String defaultUserMessage = "Update of meeting frequency is not supported";
            throw new CalendarParameterUpdateNotSupportedException("meeting.frequency", defaultUserMessage);
        }

        // Do not allow to change meeting interval
        if (!CalendarUtils.isIntervalSame(this.recurrence, newRecurrence)) {
            final String defaultUserMessage = "Update of meeting interval is not supported";
            throw new CalendarParameterUpdateNotSupportedException("meeting.interval", defaultUserMessage);
        }
        actualChanges.put("recurrence", newRecurrence);
        this.recurrence = StringUtils.defaultIfEmpty(newRecurrence, null);
    }

    final String remindByParamName = CALENDAR_SUPPORTED_PARAMETERS.REMIND_BY_ID.getValue();
    if (command.isChangeInIntegerSansLocaleParameterNamed(remindByParamName, this.remindById)) {
        final Integer newValue = command.integerValueSansLocaleOfParameterNamed(remindByParamName);
        actualChanges.put(remindByParamName, newValue);
        this.remindById = newValue;
    }

    final String firstRemindarParamName = CALENDAR_SUPPORTED_PARAMETERS.FIRST_REMINDER.getValue();
    if (command.isChangeInIntegerSansLocaleParameterNamed(firstRemindarParamName, this.firstReminder)) {
        final Integer newValue = command.integerValueSansLocaleOfParameterNamed(firstRemindarParamName);
        actualChanges.put(firstRemindarParamName, newValue);
        this.firstReminder = newValue;
    }

    final String secondRemindarParamName = CALENDAR_SUPPORTED_PARAMETERS.SECOND_REMINDER.getValue();
    if (command.isChangeInIntegerSansLocaleParameterNamed(secondRemindarParamName, this.secondReminder)) {
        final Integer newValue = command.integerValueSansLocaleOfParameterNamed(secondRemindarParamName);
        actualChanges.put(secondRemindarParamName, newValue);
        this.secondReminder = newValue;
    }

    return actualChanges;
}

From source file:org.mifosplatform.portfolio.client.data.ClientData.java

private ClientData(final String accountNo, final EnumOptionData status, final Long officeId,
        final String officeName, final Long transferToOfficeId, final String transferToOfficeName,
        final Long id, final String firstname, final String middlename, final String lastname,
        final String fullname, final String displayName, final String externalId, final String mobileNo,
        final LocalDate activationDate, final Long imageId, final Long staffId, final String staffName,
        final Collection<OfficeData> allowedOffices, final Collection<GroupGeneralData> groups,
        final Collection<StaffData> staffOptions, final Collection<CodeValueData> closureReasons,
        final ClientTimelineData timeline, final String emailId, final String address,
        final String taxIdentificationNumber) {
    this.accountNo = accountNo;
    this.status = status;
    if (status != null) {
        this.active = status.getId().equals(300L);
    } else {/*w w w  . j a  v a  2 s . c  o m*/
        this.active = null;
    }
    this.officeId = officeId;
    this.officeName = officeName;
    this.transferToOfficeId = transferToOfficeId;
    this.transferToOfficeName = transferToOfficeName;
    this.id = id;
    this.firstname = StringUtils.defaultIfEmpty(firstname, null);
    this.middlename = StringUtils.defaultIfEmpty(middlename, null);
    this.lastname = StringUtils.defaultIfEmpty(lastname, null);
    this.fullname = StringUtils.defaultIfEmpty(fullname, null);
    this.displayName = StringUtils.defaultIfEmpty(displayName, null);
    this.externalId = StringUtils.defaultIfEmpty(externalId, null);
    this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null);
    this.emailId = StringUtils.defaultIfEmpty(emailId, null);
    this.address = StringUtils.defaultIfEmpty(address, null);
    this.TIN = StringUtils.defaultIfEmpty(taxIdentificationNumber, null);
    this.activationDate = activationDate;
    this.imageId = imageId;
    if (imageId != null) {
        this.imagePresent = Boolean.TRUE;
    } else {
        this.imagePresent = null;
    }
    this.staffId = staffId;
    this.staffName = staffName;

    // associations
    this.groups = groups;

    // template
    this.officeOptions = allowedOffices;
    this.staffOptions = staffOptions;
    this.closureReasons = closureReasons;

    this.timeline = timeline;
}