Search in sources :

Example 1 with Principal

use of org.kuali.rice.kim.api.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class PurchaseOrderDocument method setAssignedUserPrincipalName.

public void setAssignedUserPrincipalName(String assignedUserPrincipalName) {
    this.assignedUserPrincipalName = assignedUserPrincipalName;
    // each time this field changes we need to update the assigned user ID and ref obj to keep consistent
    // this code can be moved to where PO is saved and with validation too, which may be more appropriate
    Principal assignedUser = null;
    if (assignedUserPrincipalName != null) {
        assignedUser = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(assignedUserPrincipalName);
    }
    if (assignedUser != null) {
        assignedUserPrincipalId = assignedUser.getPrincipalId();
    } else {
        assignedUserPrincipalId = null;
    }
}
Also used : Principal(org.kuali.rice.kim.api.identity.principal.Principal)

Example 2 with Principal

use of org.kuali.rice.kim.api.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class PurchaseOrderDocument method getAssignedUserPrincipalName.

public String getAssignedUserPrincipalName() {
    // init this field when PO is first loaded and assigned user exists in PO
    if (assignedUserPrincipalName == null && assignedUserPrincipalId != null) {
        // extra caution in case ref obj didn't get refreshed
        // if (assignedUser == null)
        // this.refreshReferenceObject("assignedUser");
        Principal assignedUser = KimApiServiceLocator.getIdentityService().getPrincipal(assignedUserPrincipalId);
        this.assignedUserPrincipalName = assignedUser.getPrincipalName();
    }
    // otherwise return its current value directly
    return assignedUserPrincipalName;
}
Also used : Principal(org.kuali.rice.kim.api.identity.principal.Principal)

Example 3 with Principal

use of org.kuali.rice.kim.api.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class CuAssetLookupableHelperServiceImpl method getSearchResultsHelper.

@Override
protected List<? extends BusinessObject> getSearchResultsHelper(Map<String, String> fieldValues, boolean unbounded) {
    // perform the lookup on the asset representative first
    String principalName = fieldValues.get(CamsPropertyConstants.Asset.REP_USER_AUTH_ID);
    if (StringUtils.isNotBlank(principalName)) {
        Principal principal = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(principalName);
        if (principal == null) {
            return Collections.EMPTY_LIST;
        }
        // place the universal ID into the fieldValues map and remove the dummy attribute
        fieldValues.put(CamsPropertyConstants.Asset.REPRESENTATIVE_UNIVERSAL_IDENTIFIER, principal.getPrincipalId());
        fieldValues.remove(CamsPropertyConstants.Asset.REP_USER_AUTH_ID);
    }
    List<? extends BusinessObject> results;
    if (StringUtils.isNotBlank(fieldValues.get(CuCamsPropertyConstants.Asset.ASSET_LOCATION_TYPE_CODE))) {
        unbounded = true;
        results = excludeBlankOffCampusLocations(super.getSearchResultsHelper(fieldValues, unbounded));
    } else {
        results = super.getSearchResultsHelper(fieldValues, unbounded);
    }
    return results;
}
Also used : Principal(org.kuali.rice.kim.api.identity.principal.Principal)

Example 4 with Principal

use of org.kuali.rice.kim.api.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class AccountGlobalSearchLookupableHelperServiceImpl method fixPrincipalNameParameters.

private boolean fixPrincipalNameParameters(Map<String, String> parameters, String userPrefix, String userIdentifierKey) {
    final String principalName = parameters.get(userPrefix + CUKFSConstants.DELIMITER + KFSPropertyConstants.KUALI_USER_PERSON_USER_IDENTIFIER);
    if (StringUtils.isNotBlank(principalName)) {
        final Principal principal = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(principalName);
        if (principal == null) {
            return false;
        }
        parameters.put(userIdentifierKey, principal.getPrincipalId());
        parameters.remove(userPrefix + CUKFSConstants.DELIMITER + KFSPropertyConstants.KUALI_USER_PERSON_USER_IDENTIFIER);
    }
    return true;
}
Also used : Principal(org.kuali.rice.kim.api.identity.principal.Principal)

Example 5 with Principal

use of org.kuali.rice.kim.api.identity.principal.Principal in project cu-kfs by CU-CommunityApps.

the class PaymentSourceExtractionServiceImpl method extractImmediatePayments.

/**
 * Pulls all disbursement vouchers with status of "A" and marked for immediate payment from the database and builds payment records for them
 *
 * @see org.kuali.kfs.fp.batch.service.DisbursementVoucherExtractService#extractImmediatePayments()
 */
@Override
public void extractImmediatePayments() {
    if (LOG.isDebugEnabled()) {
        LOG.debug("extractImmediatePayments() started");
    }
    final Date processRunDate = dateTimeService.getCurrentDate();
    final Principal uuser = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(KFSConstants.SYSTEM_USER);
    if (uuser == null) {
        LOG.debug("extractPayments() Unable to find user " + KFSConstants.SYSTEM_USER);
        throw new IllegalArgumentException("Unable to find user " + KFSConstants.SYSTEM_USER);
    }
    // Get a list of campuses that have documents with an 'A' (approved) status.
    Map<String, List<PaymentSource>> documentsByCampus = paymentSourceToExtractService.retrievePaymentSourcesByCampus(true);
    // Process each campus one at a time
    for (String campusCode : documentsByCampus.keySet()) {
        extractImmediatePaymentsForCampus(campusCode, uuser.getPrincipalId(), processRunDate, documentsByCampus.get(campusCode));
    }
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) Date(java.util.Date) Principal(org.kuali.rice.kim.api.identity.principal.Principal)

Aggregations

Principal (org.kuali.rice.kim.api.identity.principal.Principal)9 Date (java.util.Date)3 IWantDocUserOptions (edu.cornell.kfs.module.purap.businessobject.IWantDocUserOptions)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 IWantDocument (edu.cornell.kfs.module.purap.document.IWantDocument)1 IWantDocumentService (edu.cornell.kfs.module.purap.document.service.IWantDocumentService)1 PurApFavoriteAccountLineBuilderForIWantDocument (edu.cornell.kfs.module.purap.util.PurApFavoriteAccountLineBuilderForIWantDocument)1 ActionForward (org.apache.struts.action.ActionForward)1 Batch (org.kuali.kfs.pdp.businessobject.Batch)1 KualiDecimal (org.kuali.rice.core.api.util.type.KualiDecimal)1 KualiInteger (org.kuali.rice.core.api.util.type.KualiInteger)1 Person (org.kuali.rice.kim.api.identity.Person)1 EntityEmployment (org.kuali.rice.kim.api.identity.employment.EntityEmployment)1 Entity (org.kuali.rice.kim.api.identity.entity.Entity)1