Search in sources :

Example 1 with Organization

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;
}
Also used : PersistableBusinessObject(org.kuali.kfs.krad.bo.PersistableBusinessObject) Organization(org.kuali.kfs.coa.businessobject.Organization) ArrayList(java.util.ArrayList) BusinessObjectService(org.kuali.kfs.krad.service.BusinessObjectService)

Example 2 with Organization

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));
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) Organization(org.kuali.kfs.coa.businessobject.Organization) Criteria(org.apache.ojb.broker.query.Criteria)

Example 3 with Organization

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;
}
Also used : Organization(org.kuali.kfs.coa.businessobject.Organization) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 4 with Organization

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;
}
Also used : ProposalOrganization(org.kuali.kfs.module.cg.businessobject.ProposalOrganization) AwardOrganization(org.kuali.kfs.module.cg.businessobject.AwardOrganization) ProposalOrganization(org.kuali.kfs.module.cg.businessobject.ProposalOrganization) Organization(org.kuali.kfs.coa.businessobject.Organization) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Organization (org.kuali.kfs.coa.businessobject.Organization)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)2 List (java.util.List)1 Map (java.util.Map)1 Criteria (org.apache.ojb.broker.query.Criteria)1 Account (org.kuali.kfs.coa.businessobject.Account)1 PersistableBusinessObject (org.kuali.kfs.krad.bo.PersistableBusinessObject)1 BusinessObjectService (org.kuali.kfs.krad.service.BusinessObjectService)1 AwardOrganization (org.kuali.kfs.module.cg.businessobject.AwardOrganization)1 ProposalOrganization (org.kuali.kfs.module.cg.businessobject.ProposalOrganization)1