use of edu.cornell.kfs.module.purap.businessobject.LevelOrganization in project cu-kfs by CU-CommunityApps.
the class LevelOrganizationDaoJdbc method getDLevelOrganizations.
/**
* This overridden method ...
*
* @see edu.cornell.kfs.module.purap.dataaccess.LevelOrganizationDao#getDLevelOrganizations(java.lang.String)
*/
public List<LevelOrganization> getDLevelOrganizations(String cLevelOrg) {
if (StringUtils.isNotEmpty(cLevelOrg) && cLevelOrg.contains("-")) {
String chart = cLevelOrg.substring(0, cLevelOrg.lastIndexOf("-"));
String cOrg = cLevelOrg.substring(cLevelOrg.lastIndexOf("-") + 1, cLevelOrg.length());
try {
// Build the SQL
StringBuilder sqlBuilder = new StringBuilder(3500);
sqlBuilder.append(" select D_Level_Code, D_Level_Name from ( select ");
sqlBuilder.append(" org_cd,");
sqlBuilder.append(" ( select org_cd ");
sqlBuilder.append(" from ca_org_t where org_typ_cd='C' and ROWNUM=1 ");
sqlBuilder.append(" start with org_cd=t2.org_cd and fin_coa_cd= ? ");
sqlBuilder.append(" connect by prior rpts_to_org_cd = org_cd and rpts_to_org_cd not in ('UNIV') and fin_coa_cd=?) C_Level_Code, ");
sqlBuilder.append(" ( select org_nm ");
sqlBuilder.append(" from ca_org_t where org_typ_cd='C' and ROWNUM=1 ");
sqlBuilder.append(" start with org_cd=t2.org_cd and fin_coa_cd=? ");
sqlBuilder.append(" connect by prior rpts_to_org_cd = org_cd and rpts_to_org_cd not in ('UNIV') and fin_coa_cd=?) C_Level_Name, ");
sqlBuilder.append(" ( select org_cd from ca_org_t where org_typ_cd='D' and ROWNUM=1 ");
sqlBuilder.append(" start with org_cd=t2.org_cd and fin_coa_cd=?");
sqlBuilder.append(" connect by prior rpts_to_org_cd = org_cd and rpts_to_org_cd not in ('UNIV') and fin_coa_cd=?) D_Level_Code,");
sqlBuilder.append(" ( select org_nm from ca_org_t where org_typ_cd='D' and ROWNUM=1 ");
sqlBuilder.append(" start with org_cd=t2.org_cd and fin_coa_cd=?");
sqlBuilder.append(" connect by prior rpts_to_org_cd = org_cd and rpts_to_org_cd not in ('UNIV') and fin_coa_cd=?) D_Level_Name ");
sqlBuilder.append(" from ca_org_t t2 where t2.org_typ_cd = 'D' and ORG_ACTIVE_CD = 'Y' ");
sqlBuilder.append(" ) t where t.C_Level_Code = ? order by D_Level_Name");
String sqlString = sqlBuilder.toString();
// Get the SIP data from the data base, map it to the object and build a result set of objects to be returned to the user.
RowMapper<LevelOrganization> mapper = new RowMapper<LevelOrganization>() {
public LevelOrganization mapRow(ResultSet rs, int rowNum) throws SQLException {
LevelOrganization cLevelOrganization = new LevelOrganization();
cLevelOrganization.setCode(rs.getString("D_Level_Code"));
cLevelOrganization.setName(rs.getString("D_Level_Name"));
return cLevelOrganization;
}
};
return this.getJdbcTemplate().query(sqlString, mapper, chart, chart, chart, chart, chart, chart, chart, chart, cOrg);
} catch (Exception ex) {
LOG.info("LevelOrganizationDaoJdbc Exception: " + ex.getMessage());
return null;
}
} else
return null;
}
use of edu.cornell.kfs.module.purap.businessobject.LevelOrganization in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method setCollegeAndDepartmentBasedOnPrimaryDepartment.
/**
* Sets the College and Department based on the initiator primary department.
*
* @param documentForm
*/
private void setCollegeAndDepartmentBasedOnPrimaryDepartment(IWantDocumentForm documentForm) {
IWantDocumentService iWantDocumentService = SpringContext.getBean(IWantDocumentService.class);
String primaryDeptOrg = null;
IWantDocument iWantDocument = null;
if (documentForm != null && documentForm.getDocument() != null) {
iWantDocument = (IWantDocument) documentForm.getDocument();
}
if (iWantDocument != null && StringUtils.isEmpty(iWantDocument.getCollegeLevelOrganization())) {
Person currentUser = GlobalVariables.getUserSession().getPerson();
Entity entityInfo = KimApiServiceLocator.getIdentityService().getEntityByPrincipalId(currentUser.getPrincipalId());
if (ObjectUtils.isNotNull(entityInfo)) {
if (ObjectUtils.isNotNull(entityInfo.getEmploymentInformation()) && entityInfo.getEmploymentInformation().size() > 0) {
EntityEmployment employmentInformation = entityInfo.getEmploymentInformation().get(0);
String primaryDepartment = employmentInformation.getPrimaryDepartmentCode();
primaryDeptOrg = primaryDepartment.substring(primaryDepartment.lastIndexOf('-') + 1, primaryDepartment.length());
String cLevelOrg = iWantDocumentService.getCLevelOrganizationForDLevelOrg(primaryDepartment);
((IWantDocument) documentForm.getDocument()).setCollegeLevelOrganization(cLevelOrg);
}
}
}
if (iWantDocument != null && StringUtils.isNotEmpty(iWantDocument.getCollegeLevelOrganization())) {
String cLevelOrg = iWantDocument.getCollegeLevelOrganization();
documentForm.getDeptOrgKeyLabels().clear();
documentForm.getDeptOrgKeyLabels().add(new ConcreteKeyValue("", "Please Select"));
List<LevelOrganization> dLevelOrgs = iWantDocumentService.getDLevelOrganizations(cLevelOrg);
for (LevelOrganization levelOrganization : dLevelOrgs) {
documentForm.getDeptOrgKeyLabels().add(new ConcreteKeyValue(levelOrganization.getCode(), levelOrganization.getCodeAndDescription()));
}
if (primaryDeptOrg != null) {
iWantDocument.setDepartmentLevelOrganization(primaryDeptOrg);
}
}
}
use of edu.cornell.kfs.module.purap.businessobject.LevelOrganization in project cu-kfs by CU-CommunityApps.
the class CollegeLevelOrganizationValuesFinder method getKeyValues.
public List<KeyValue> getKeyValues() {
List<KeyValue> keyValues = new ArrayList<KeyValue>();
IWantDocumentService iWantDocumentService = SpringContext.getBean(IWantDocumentService.class);
List<LevelOrganization> cLevelOrganizations = iWantDocumentService.getCLevelOrganizations();
keyValues.add(new ConcreteKeyValue("", ""));
if (cLevelOrganizations != null) {
for (LevelOrganization cLevelOrganization : cLevelOrganizations) {
keyValues.add(new ConcreteKeyValue(cLevelOrganization.getCode(), cLevelOrganization.getCodeAndDescription()));
}
}
return keyValues;
}
use of edu.cornell.kfs.module.purap.businessobject.LevelOrganization in project cu-kfs by CU-CommunityApps.
the class LevelOrganizationDaoJdbc method getCLevelOrganizations.
/**
* This overridden method ...
*
* @see edu.cornell.kfs.module.purap.dataaccess.LevelOrganizationDao#getCLevelOrganizations()
*/
public List<LevelOrganization> getCLevelOrganizations() {
try {
// Build the SQL
StringBuilder sqlBuilder = new StringBuilder(3500);
sqlBuilder.append("select fin_coa_cd, org_cd, org_nm from ca_org_t where fin_coa_cd in('IT') and ORG_ACTIVE_CD = 'Y' and org_cd <> 'XXXX' and org_typ_cd = 'C' order by fin_coa_cd desc, org_nm");
String sqlString = sqlBuilder.toString();
RowMapper<LevelOrganization> mapper = new RowMapper<LevelOrganization>() {
public LevelOrganization mapRow(ResultSet rs, int rowNum) throws SQLException {
LevelOrganization cLevelOrganization = new LevelOrganization();
cLevelOrganization.setCode(rs.getString("fin_coa_cd") + "-" + rs.getString("org_cd"));
cLevelOrganization.setName(rs.getString("org_nm"));
return cLevelOrganization;
}
};
return this.getJdbcTemplate().query(sqlString, mapper);
} catch (Exception ex) {
LOG.info("LevelOrganizationDaoJdbc Exception: " + ex.getMessage());
return null;
}
}
use of edu.cornell.kfs.module.purap.businessobject.LevelOrganization in project cu-kfs by CU-CommunityApps.
the class IWantDocumentServiceImpl method getDLevelOrganizationsString.
/**
* @see edu.cornell.kfs.module.purap.document.service.IWantDocumentService#getDLevelOrganizationsString(java.lang.String)
*/
public String getDLevelOrganizationsString(String cLevelOrg) {
List<LevelOrganization> dLevelOrgs = getDLevelOrganizations(cLevelOrg);
StringBuilder dLevelOrgsString = new StringBuilder();
for (LevelOrganization organization : dLevelOrgs) {
dLevelOrgsString.append(organization.getCode()).append(' ').append(organization.getCodeAndDescription()).append('#');
}
return dLevelOrgsString.toString();
}
Aggregations