From a946e207da7bd75f84b7aae005717b54f337f67c Mon Sep 17 00:00:00 2001 From: John Woodlock Date: Mon, 29 Oct 2012 01:05:54 +0000 Subject: [PATCH] recommiting to give clean git status after pull --- .../mifosng/platform/api/data/ClientData.java | 312 +++++++++--------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/ClientData.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/ClientData.java index cc23535c2..911b3f1ab 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/data/ClientData.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/data/ClientData.java @@ -1,157 +1,157 @@ -package org.mifosng.platform.api.data; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.joda.time.LocalDate; - -/** - * FIXME - KW - make ClientData immutable without needs for getter/setters as is mostly intended for conversion back to JSON. - */ -public class ClientData { - - private final Long id; - private final String firstname; - private final String lastname; - private final String clientOrBusinessName; - private final String displayName; - private final Long officeId; - private final String officeName; - private final String externalId; - private final LocalDate joinedDate; - private final String imageKey; - private boolean imagePresent; - - private List allowedOffices = new ArrayList(); - - public static ClientData clientIdentifier( - final Long id, - final String firstname, - final String lastname, - final Long officeId, - final String officeName) { - - StringBuilder displayNameBuilder = new StringBuilder(firstname); - if (StringUtils.isNotBlank(displayNameBuilder.toString())) { - displayNameBuilder.append(' '); - } - displayNameBuilder.append(lastname); - - return new ClientData(officeId, officeName, id, firstname, lastname, displayNameBuilder.toString(), null, null, null); - } - - public ClientData(final Long officeId, final String officeName, - final Long id, final String firstname, final String lastname, - final String displayName, final String externalId, - final LocalDate joinedDate, - final String imageKey) { - this.officeId = officeId; - this.officeName = officeName; - this.id = id; - this.firstname = firstname; - this.displayName = displayName; - - /*** unset last name for business name **/ - if (StringUtils.isBlank(this.firstname)) { - this.lastname = null; - this.clientOrBusinessName = lastname; - } else { - this.lastname = lastname; - this.clientOrBusinessName = null; - } - - this.externalId = externalId; - this.joinedDate = joinedDate; - this.imageKey = imageKey; - if (imageKey == null) { - imagePresent = false; - }else{ - imagePresent = true; - } - - } - - public ClientData(final Long officeId, final LocalDate joinedDate, - final List offices) { - this.id = null; - this.officeId = officeId; - this.officeName = null; - this.firstname = null; - this.lastname = null; - this.clientOrBusinessName = null; - this.displayName = null; - this.externalId = null; - this.joinedDate = joinedDate; - this.allowedOffices = offices; - this.imageKey = null; - } - - public Long getId() { - return id; - } - - public Long getOfficeId() { - return officeId; - } - - public String getOfficeName() { - return officeName; - } - - public String getFirstname() { - return firstname; - } - - public String getLastname() { - return lastname; - } - - public String getClientOrBusinessName() { - return clientOrBusinessName; - } - - public String getDisplayName() { - return displayName; - } - - public String getExternalId() { - return externalId; - } - - public LocalDate getJoinedDate() { - return joinedDate; - } - - public List getAllowedOffices() { - return allowedOffices; - } - - public void setAllowedOffices(List allowedOffices) { - this.allowedOffices = allowedOffices; - } - - public String displayName() { - return this.displayName; - } - - public String officeName() { - return this.officeName; - } - - public String getImageKey() { - return imageKey; - } - - public boolean isImagePresent() { - return imagePresent; - } - - public void setImagePresent(boolean imagePresent) { - this.imagePresent = imagePresent; - } - - - - +package org.mifosng.platform.api.data; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.joda.time.LocalDate; + +/** + * FIXME - KW - make ClientData immutable without needs for getter/setters as is mostly intended for conversion back to JSON. + */ +public class ClientData { + + private final Long id; + private final String firstname; + private final String lastname; + private final String clientOrBusinessName; + private final String displayName; + private final Long officeId; + private final String officeName; + private final String externalId; + private final LocalDate joinedDate; + private final String imageKey; + private boolean imagePresent; + + private List allowedOffices = new ArrayList(); + + public static ClientData clientIdentifier( + final Long id, + final String firstname, + final String lastname, + final Long officeId, + final String officeName) { + + StringBuilder displayNameBuilder = new StringBuilder(firstname); + if (StringUtils.isNotBlank(displayNameBuilder.toString())) { + displayNameBuilder.append(' '); + } + displayNameBuilder.append(lastname); + + return new ClientData(officeId, officeName, id, firstname, lastname, displayNameBuilder.toString(), null, null, null); + } + + public ClientData(final Long officeId, final String officeName, + final Long id, final String firstname, final String lastname, + final String displayName, final String externalId, + final LocalDate joinedDate, + final String imageKey) { + this.officeId = officeId; + this.officeName = officeName; + this.id = id; + this.firstname = firstname; + this.displayName = displayName; + + /*** unset last name for business name **/ + if (StringUtils.isBlank(this.firstname)) { + this.lastname = null; + this.clientOrBusinessName = lastname; + } else { + this.lastname = lastname; + this.clientOrBusinessName = null; + } + + this.externalId = externalId; + this.joinedDate = joinedDate; + this.imageKey = imageKey; + if (imageKey == null) { + imagePresent = false; + }else{ + imagePresent = true; + } + + } + + public ClientData(final Long officeId, final LocalDate joinedDate, + final List offices) { + this.id = null; + this.officeId = officeId; + this.officeName = null; + this.firstname = null; + this.lastname = null; + this.clientOrBusinessName = null; + this.displayName = null; + this.externalId = null; + this.joinedDate = joinedDate; + this.allowedOffices = offices; + this.imageKey = null; + } + + public Long getId() { + return id; + } + + public Long getOfficeId() { + return officeId; + } + + public String getOfficeName() { + return officeName; + } + + public String getFirstname() { + return firstname; + } + + public String getLastname() { + return lastname; + } + + public String getClientOrBusinessName() { + return clientOrBusinessName; + } + + public String getDisplayName() { + return displayName; + } + + public String getExternalId() { + return externalId; + } + + public LocalDate getJoinedDate() { + return joinedDate; + } + + public List getAllowedOffices() { + return allowedOffices; + } + + public void setAllowedOffices(List allowedOffices) { + this.allowedOffices = allowedOffices; + } + + public String displayName() { + return this.displayName; + } + + public String officeName() { + return this.officeName; + } + + public String getImageKey() { + return imageKey; + } + + public boolean isImagePresent() { + return imagePresent; + } + + public void setImagePresent(boolean imagePresent) { + this.imagePresent = imagePresent; + } + + + + } \ No newline at end of file