Skip to content

Commit

Permalink
KRACOEUS-7969: truncating long department names
Browse files Browse the repository at this point in the history
  • Loading branch information
leoherbie committed Feb 17, 2015
1 parent 21693a5 commit 3a66bce
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public abstract class RRKeyPersonBase extends S2SBaseFormGenerator{
protected static final int DIVISION_NAME_MAX_LENGTH = 30;
protected static final String NIH_CO_INVESTIGATOR = "Co-Investigator";
protected static final String ERROR_ERA_COMMON_USER_NAME="eRA Commons User Name is missing for ";
protected static final int DEPARTMENT_NAME_MAX_LENGTH = 30;

@Autowired
@Qualifier("unitRepositoryService")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
*/
package org.kuali.coeus.s2sgen.impl.generate.support;

import org.kuali.coeus.s2sgen.impl.person.S2SProposalPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

/**
* This abstract class has methods that are common to all the versions of RRKeyPerson form.
*
Expand All @@ -31,7 +27,6 @@ public abstract class RRKeyPersonBaseGenerator extends RRKeyPersonBase {

protected static final String BIOSKETCH_TYPE = "1";
protected static final String CURRENT_PENDING_TYPE = "2";
protected static final String CO_INVESTIGATOR = "COI";
protected static final int MAX_KEY_PERSON_COUNT = 8;
protected static final int DIRECTORY_TITLE_MAX_LENGTH = 45;
protected static final int ROLE_DESCRIPTION_MAX_LENGTH = 40;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
package org.kuali.coeus.s2sgen.impl.generate.support;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

/**
* This abstract class has methods that are common to all the versions of
* RRKeyPersonExpanded form.
Expand All @@ -32,7 +29,6 @@ public abstract class RRKeyPersonExpandedBaseGenerator extends


protected static final int PROFILE_TYPE = 18;
protected static final String CO_INVESTIGATOR = "COI";
protected static final int MAX_KEY_PERSON_COUNT = 40;
protected static final int DIRECTORY_TITLE_MAX_LENGTH = 45;
protected static final int ROLE_DESCRIPTION_MAX_LENGTH = 40;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ else if (PI.getRolodexId() != null) {
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profile.setDepartmentName(departmentName);
profile.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profile.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profile.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
String divisionName = PI.getDivision();
if (divisionName != null) {
Expand Down Expand Up @@ -253,12 +253,12 @@ else if ((keyPerson.getRolodexId() != null) && pIPersonOrRolodexId.equals(keyPer
if(keyPerson.getHomeUnit() != null) {
KcPersonContract kcPerson = keyPerson.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profileKeyPerson.setDepartmentName(departmentName);
profileKeyPerson.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profileKeyPerson.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profileKeyPerson.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
String divisionName = keyPerson.getDivision();
if (divisionName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ private PersonProfileDataType getPersonProfilePI() {
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profile.setDepartmentName(departmentName);
profile.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profile.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profile.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
String divisionName = PI.getDivision();
if (divisionName != null) {
Expand Down Expand Up @@ -293,12 +293,12 @@ private PersonProfileDataType[] getpersonProfileKeyPerson() {
if(keyPerson.getHomeUnit() != null) {
KcPersonContract kcPerson = keyPerson.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profileKeyPerson.setDepartmentName(departmentName);
profileKeyPerson.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profileKeyPerson.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profileKeyPerson.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
String divisionName = keyPerson.getDivision();
if (divisionName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ private void setDepartmentNameToProfile(Profile profile, ProposalPersonContract
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profile.setDepartmentName(departmentName);
profile.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profile.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profile.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ private void setDepartmentNameToProfile(Profile profile, ProposalPersonContract
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getUnit().getUnitName();
profile.setDepartmentName(departmentName);
profile.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profile.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profile.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ else if (PI.getRolodexId() != null) {
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profile.setDepartmentName(departmentName);
profile.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profile.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profile.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
String divisionName = PI.getDivision();
if (divisionName != null) {
Expand Down Expand Up @@ -240,12 +240,12 @@ else if ((keyPerson.getRolodexId() != null) && pIPersonOrRolodexId.equals(keyPer
if(keyPerson.getHomeUnit() != null) {
KcPersonContract kcPerson = keyPerson.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profileKeyPerson.setDepartmentName(departmentName);
profileKeyPerson.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profileKeyPerson.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profileKeyPerson.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
String divisionName = keyPerson.getDivision();
if (divisionName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ else if (PI.getRolodexId() != null) {
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profile.setDepartmentName(departmentName);
profile.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profile.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profile.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
String divisionName = PI.getDivision();
if (divisionName != null) {
Expand Down Expand Up @@ -272,12 +272,12 @@ else if (keyPerson.getRolodexId() != null) {
if(keyPerson.getHomeUnit() != null) {
KcPersonContract kcPerson = keyPerson.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
profileKeyPerson.setDepartmentName(departmentName);
profileKeyPerson.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
profileKeyPerson.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
profileKeyPerson.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
String divisionName = keyPerson.getDivision();
if (divisionName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ private ApplicantInfo getApplicationInfo() {
*
* This method is used to get Contact person information
*
* @param rolodexOrganization
* @return ContactPersonInfo corresponding to the Rolodex object.
*/
private ContactPersonInfo getContactInfo(RolodexContract rolodexOrganization) {
Expand Down Expand Up @@ -567,12 +566,12 @@ private OrganizationContactPersonDataType getPDPI() {
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
PDPI.setDepartmentName(departmentName);
PDPI.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
PDPI.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
PDPI.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}

// divisionName
Expand Down Expand Up @@ -619,7 +618,7 @@ private AORInfoType getAORInfoType() {
if (StringUtils.isNotEmpty(departmentalPerson.getFaxNumber())) {
aorInfoType.setFax(departmentalPerson.getFaxNumber());
}
aorInfoType.setDepartmentName(departmentalPerson.getDirDept());
aorInfoType.setDepartmentName(departmentalPerson.getDirDept().substring(0, DEPARTMENT_NAME_MAX_LENGTH));
aorInfoType.setEmail(departmentalPerson.getEmailAddress());
if (departmentalPerson.getHomeUnit() != null) {
aorInfoType.setDivisionName(StringUtils.substring(departmentalPerson.getHomeUnit(), 0, DIVISION_NAME_MAX_LENGTH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ private ApplicantInfo getApplicationInfo() {
*
* This method is used to get Contact person information
*
* @param rolodex(Rolodex)
* @param rolodex Rolodex
* @return ContactPersonInfo corresponding to the Rolodex object.
*/
private ContactPersonInfo getContactInfo(RolodexContract rolodex) {
Expand Down Expand Up @@ -554,12 +554,12 @@ private OrganizationContactPersonDataType getPDPI() {
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
PDPI.setDepartmentName(departmentName);
PDPI.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
PDPI.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
PDPI.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
// divisionName
String divisionName = proposalPerson.getDivision();
Expand Down Expand Up @@ -617,7 +617,7 @@ private AORInfoType getAORInfoType() {
if (StringUtils.isNotEmpty(departmentalPerson.getFaxNumber())) {
aorInfoType.setFax(departmentalPerson.getFaxNumber());
}
aorInfoType.setDepartmentName(departmentalPerson.getDirDept());
aorInfoType.setDepartmentName(departmentalPerson.getDirDept().substring(0, DEPARTMENT_NAME_MAX_LENGTH));
aorInfoType.setEmail(departmentalPerson.getEmailAddress());
if (departmentalPerson.getHomeUnit() != null) {
aorInfoType.setDivisionName(StringUtils.substring(departmentalPerson.getHomeUnit(), 0, DIVISION_NAME_MAX_LENGTH));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private OrganizationDataType getOrganizationDataType() {
*
* This method is used to get Contact person information
*
* @param rolodex(Rolodex)
* @param rolodex Rolodex
* @return ContactPersonInfo corresponding to the Rolodex object.
*/
private ContactPersonInfo getContactInfo(RolodexContract rolodex) {
Expand Down Expand Up @@ -519,12 +519,12 @@ private void setDepartmentName(OrganizationContactPersonDataType PDPI,ProposalPe
if(PI.getHomeUnit() != null) {
KcPersonContract kcPerson = PI.getPerson();
String departmentName = kcPerson.getOrganizationIdentifier();
PDPI.setDepartmentName(departmentName);
PDPI.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
PDPI.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
PDPI.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private OrganizationDataType getOrganizationDataType() {
*
* This method is used to get Contact person information
*
* @param rolodex(Rolodex)
* @param rolodex Rolodex
* @return ContactPersonInfo corresponding to the Rolodex object.
*/
private ContactPersonInfo getContactInfo(RolodexContract rolodex) {
Expand Down Expand Up @@ -569,12 +569,12 @@ private void setDepartmentName(OrganizationContactPersonDataType PDPI,ProposalPe
if(PI.getHomeUnit() != null) {
String personId = PI.getPersonId();
String departmentName = getPrimaryDepartment(personId);
PDPI.setDepartmentName(departmentName);
PDPI.setDepartmentName(StringUtils.substring(departmentName, 0, DEPARTMENT_NAME_MAX_LENGTH));
}
else
{
DevelopmentProposalContract developmentProposal = pdDoc.getDevelopmentProposal();
PDPI.setDepartmentName(developmentProposal.getOwnedByUnit().getUnitName());
PDPI.setDepartmentName(StringUtils.substring(developmentProposal.getOwnedByUnit().getUnitName(), 0, DEPARTMENT_NAME_MAX_LENGTH));
}
}

Expand Down
Loading

0 comments on commit 3a66bce

Please sign in to comment.