Search in sources :

Example 1 with OrganizationGlobalDetail

use of edu.cornell.kfs.coa.businessobject.OrganizationGlobalDetail in project cu-kfs by CU-CommunityApps.

the class OrganizationGlobalMaintainableImpl method generateMaintenanceLocks.

@Override
public List<MaintenanceLock> generateMaintenanceLocks() {
    /*
         * Generate the maintenance locks in a similar manner as the account global maintainable.
         */
    OrganizationGlobal orgGlobal = (OrganizationGlobal) getBusinessObject();
    List<MaintenanceLock> maintenanceLocks = new ArrayList<MaintenanceLock>();
    final int BUILDER_SIZE = 100;
    for (OrganizationGlobalDetail detail : orgGlobal.getOrganizationGlobalDetails()) {
        MaintenanceLock maintenanceLock = new MaintenanceLock();
        maintenanceLock.setDocumentNumber(orgGlobal.getDocumentNumber());
        maintenanceLock.setLockingRepresentation(new StringBuilder(BUILDER_SIZE).append(Organization.class.getName()).append(KFSConstants.Maintenance.AFTER_CLASS_DELIM).append("chartOfAccountsCode").append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM).append(detail.getChartOfAccountsCode()).append(KFSConstants.Maintenance.AFTER_VALUE_DELIM).append("organizationCode").append(KFSConstants.Maintenance.AFTER_FIELDNAME_DELIM).append(detail.getOrganizationCode()).toString());
        maintenanceLocks.add(maintenanceLock);
    }
    return maintenanceLocks;
}
Also used : Organization(org.kuali.kfs.coa.businessobject.Organization) OrganizationGlobal(edu.cornell.kfs.coa.businessobject.OrganizationGlobal) ArrayList(java.util.ArrayList) OrganizationGlobalDetail(edu.cornell.kfs.coa.businessobject.OrganizationGlobalDetail) MaintenanceLock(org.kuali.kfs.krad.maintenance.MaintenanceLock)

Example 2 with OrganizationGlobalDetail

use of edu.cornell.kfs.coa.businessobject.OrganizationGlobalDetail in project cu-kfs by CU-CommunityApps.

the class OrganizationGlobalRule method checkOrganizationDetails.

/**
 * Validates the organization details, similar to how AccountGlobalRule
 * validates its account details.
 *
 * @param document The current document.
 * @param details The organization details to validate.
 * @return true if validation succeeds, false otherwise.
 */
protected boolean checkOrganizationDetails(MaintenanceDocument document, List<OrganizationGlobalDetail> details) {
    // This method is a modified copy of a related method on AccountGlobalRule.
    boolean success = true;
    if (details.isEmpty()) {
        putFieldError(KFSConstants.MAINTENANCE_ADD_PREFIX + "organizationGlobalDetails.organizationCode", CUKFSKeyConstants.ERROR_DOCUMENT_GLOBAL_ORGANIZATION_NO_ORGANIZATIONS);
        success = false;
    } else {
        final int BUILDER_SIZE = 75;
        int i = 0;
        for (OrganizationGlobalDetail detail : details) {
            String errorPath = new StringBuilder(BUILDER_SIZE).append(MAINTAINABLE_ERROR_PREFIX).append("organizationGlobalDetails[").append(i).append(']').toString();
            GlobalVariables.getMessageMap().addToErrorPath(errorPath);
            success &= checkOrganizationDetail(detail);
            GlobalVariables.getMessageMap().removeFromErrorPath(errorPath);
            i++;
        }
    }
    return success;
}
Also used : OrganizationGlobalDetail(edu.cornell.kfs.coa.businessobject.OrganizationGlobalDetail)

Aggregations

OrganizationGlobalDetail (edu.cornell.kfs.coa.businessobject.OrganizationGlobalDetail)2 OrganizationGlobal (edu.cornell.kfs.coa.businessobject.OrganizationGlobal)1 ArrayList (java.util.ArrayList)1 Organization (org.kuali.kfs.coa.businessobject.Organization)1 MaintenanceLock (org.kuali.kfs.krad.maintenance.MaintenanceLock)1