use of org.kuali.kfs.coa.businessobject.Organization in project cu-kfs by CU-CommunityApps.
the class OrganizationGlobal method generateGlobalChangesToPersist.
@Override
public List<PersistableBusinessObject> generateGlobalChangesToPersist() {
/*
* The logic below is based on that from the AccountGlobal class.
*/
List<PersistableBusinessObject> globalChanges = new ArrayList<PersistableBusinessObject>();
BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
for (OrganizationGlobalDetail detail : organizationGlobalDetails) {
Organization org = boService.findByPrimaryKey(Organization.class, detail.getPrimaryKeys());
if (org != null) {
// ORGANIZATION MANAGER UNIVERSAL ID
if (StringUtils.isNotBlank(organizationManagerUniversalId)) {
org.setOrganizationManagerUniversalId(organizationManagerUniversalId);
}
// ORGANIZATION PHYSICAL CAMPUS CODE
if (StringUtils.isNotBlank(organizationPhysicalCampusCode)) {
org.setOrganizationPhysicalCampusCode(organizationPhysicalCampusCode);
}
// ORGANIZATION LINE 1 ADDRESS
if (StringUtils.isNotBlank(organizationLine1Address)) {
org.setOrganizationLine1Address(organizationLine1Address);
}
// ORGANIZATION LINE 2 ADDRESS
if (StringUtils.isNotBlank(organizationLine2Address)) {
org.setOrganizationLine2Address(organizationLine2Address);
}
// ORGANIZATION CITY NAME
if (StringUtils.isNotBlank(organizationCityName)) {
org.setOrganizationCityName(organizationCityName);
}
// ORGANIZATION STATE CODE
if (StringUtils.isNotBlank(organizationStateCode)) {
org.setOrganizationStateCode(organizationStateCode);
}
// ORGANIZATION ZIP CODE
if (StringUtils.isNotBlank(organizationZipCode)) {
org.setOrganizationZipCode(organizationZipCode);
}
// ORGANIZATION COUNTRY CODE
if (StringUtils.isNotBlank(organizationCountryCode)) {
org.setOrganizationCountryCode(organizationCountryCode);
}
globalChanges.add(org);
}
}
return globalChanges;
}
use of org.kuali.kfs.coa.businessobject.Organization in project cu-kfs by CU-CommunityApps.
the class AccountGlobalSearchDaoOjb method getAccountsByOrgHierarchy.
public Collection getAccountsByOrgHierarchy(String chartOfAccountsCode, String organizationCode, Map<String, String> parameters) {
Criteria criteria = new Criteria();
Criteria orgCriteria = new Criteria();
orgCriteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
orgCriteria.addEqualTo(KFSPropertyConstants.ORGANIZATION_CODE, organizationCode);
criteria.addOrCriteria(orgCriteria);
List<Organization> reportingOrgs = getReportingOrgs(chartOfAccountsCode, organizationCode, new HashSet<Organization>());
for (Organization reportingOrg : reportingOrgs) {
orgCriteria = new Criteria();
orgCriteria.addEqualTo(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, reportingOrg.getChartOfAccountsCode());
orgCriteria.addEqualTo(KFSPropertyConstants.ORGANIZATION_CODE, reportingOrg.getOrganizationCode());
criteria.addOrCriteria(orgCriteria);
}
// Add the rest of the criteria for the lookup
parameters.remove(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE);
parameters.remove(KFSPropertyConstants.ORGANIZATION_CODE);
criteria.addAndCriteria(lookupDao.getCollectionCriteriaFromMap(new Account(), parameters));
return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(Account.class, criteria));
}
use of org.kuali.kfs.coa.businessobject.Organization in project cu-kfs by CU-CommunityApps.
the class AccountGlobalSearchDaoOjb method getReportingOrgs.
protected List<Organization> getReportingOrgs(String chartOfAccountsCode, String organizationCode, Set<Organization> seenOrgs) {
List<Organization> reportingOrgs = new ArrayList<Organization>();
Map<String, String> reportsToCriteria = new HashMap<String, String>();
reportsToCriteria.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
reportsToCriteria.put(KFSPropertyConstants.REPORTS_TO_ORGANIZATION_CODE, organizationCode);
Collection<Organization> childOrgs = businessObjectDao.findMatching(Organization.class, reportsToCriteria);
for (Organization childOrg : childOrgs) {
if (!seenOrgs.contains(childOrg)) {
seenOrgs.add(childOrg);
reportingOrgs.add(childOrg);
reportingOrgs.addAll(getReportingOrgs(childOrg.getChartOfAccountsCode(), childOrg.getOrganizationCode(), seenOrgs));
}
}
return reportingOrgs;
}
use of org.kuali.kfs.coa.businessobject.Organization in project cu-kfs by CU-CommunityApps.
the class EzraServiceImpl method createProposalOrganizations.
private List<ProposalOrganization> createProposalOrganizations(String projectId, EzraProject project) {
// EzraProject ep = (EzraProject)businessObjectService.findBySinglePrimaryKey(EzraProject.class, projectId);
String orgCode = project.getProjectDepartmentId();
Map deptFields = new HashMap();
deptFields.put("organizationCode", orgCode);
List<Organization> orgs = (List<Organization>) businessObjectService.findMatching(Organization.class, deptFields);
LOG.info("Retrieved Orgs :" + orgs.size() + " for Proposal " + projectId);
List<ProposalOrganization> propOrgs = new ArrayList<ProposalOrganization>();
for (Organization org : orgs) {
Map primaryKeys = new HashMap();
primaryKeys.put("chartOfAccountsCode", org.getChartOfAccountsCode());
primaryKeys.put("organizationCode", org.getOrganizationCode());
primaryKeys.put("proposalNumber", projectId);
ProposalOrganization po = (ProposalOrganization) businessObjectService.findByPrimaryKey(ProposalOrganization.class, primaryKeys);
if (ObjectUtils.isNull(po)) {
po = new ProposalOrganization();
} else {
po.setVersionNumber(po.getVersionNumber() + 1);
}
po.setChartOfAccountsCode("IT");
po.setOrganizationCode(org.getOrganizationCode());
// EzraProject ep = (EzraProject)businessObjectService.findBySinglePrimaryKey(EzraProject.class, projectId);
if (org.getOrganizationCode().equals(project.getProjectDepartmentId())) {
po.setProposalPrimaryOrganizationIndicator(true);
}
po.setActive(true);
propOrgs.add(po);
}
return propOrgs;
}
Aggregations