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;
}
}
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;
}
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;
}
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;
}
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));
}
}
Aggregations