use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class IWantDocumentAction method approverEnteredOwnNetidAsApprover.
private boolean approverEnteredOwnNetidAsApprover(ActionForm form) {
IWantDocumentForm iWantDocForm = (IWantDocumentForm) form;
String enteredApproverNetID = iWantDocForm.getNewAdHocRoutePersonNetId();
Person currentUser = GlobalVariables.getUserSession().getPerson();
String currentUserNetID = currentUser.getPrincipalName();
if (StringUtils.equalsIgnoreCase(currentUserNetID, enteredApproverNetID)) {
GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, CUPurapKeyConstants.ERROR_IWNT_APPROVER_CANNOT_ROUTE_TO_SELF);
return true;
}
return false;
}
use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class CuSimpleChartValuesFinder method getKeyValues.
public List<KeyValue> getKeyValues() {
String defaultChartCode = "";
String defaultChartCodeMethod = "";
try {
defaultChartCode = parameterService.getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, CUKFSParameterKeyConstants.DEFAULT_CHART_CODE);
defaultChartCodeMethod = parameterService.getParameterValueAsString(KfsParameterConstants.FINANCIAL_SYSTEM_DOCUMENT.class, CUKFSParameterKeyConstants.DEFAULT_CHART_CODE_METHOD);
} catch (Exception e) {
// Do nothing
}
Collection<Chart> chartCodes = keyValuesService.findAll(Chart.class);
List<KeyValue> chartKeyLabels = new ArrayList<>();
// If the DEFAULT_CHART_CODE_METHOD parameter DNE or has no value assigned to it, no default
if (defaultChartCodeMethod.equals("")) {
chartKeyLabels.add(new ConcreteKeyValue("", ""));
for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
Chart element = (Chart) iter.next();
if (element.isActive()) {
// only show active charts
chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
}
}
}
// populate with the default chart
if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_CHART_METHOD)) {
chartKeyLabels.add(new ConcreteKeyValue(defaultChartCode, defaultChartCode));
for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
Chart element = (Chart) iter.next();
if (element.isActive() && !element.getChartOfAccountsCode().equals(defaultChartCode)) {
// only show active charts
chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
}
}
}
// populate with chart code of the user's primary department
if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_PRIMARY_DEPT_METHOD)) {
Person currentUser = GlobalVariables.getUserSession().getPerson();
String primaryDepartmentChartCode = financialSystemUserService.getPrimaryOrganization(currentUser, "KFS-SYS").getChartOfAccountsCode();
chartKeyLabels.add(new ConcreteKeyValue(primaryDepartmentChartCode, primaryDepartmentChartCode));
for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
Chart element = (Chart) iter.next();
if (element.isActive() && !element.getChartOfAccountsCode().equals(primaryDepartmentChartCode)) {
chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
}
}
}
// populate with the default chart unless user's primary department has been defined
if (StringUtils.equals(defaultChartCodeMethod, DEFAULT_PRIMARY_DEPT_CHART_METHOD)) {
Person currentUser = GlobalVariables.getUserSession().getPerson();
String primaryDepartmentChartCode = financialSystemUserService.getPrimaryOrganization(currentUser, "KFS-SYS").getChartOfAccountsCode();
String chartUsed = null;
if (primaryDepartmentChartCode != null && !primaryDepartmentChartCode.equals("")) {
chartUsed = primaryDepartmentChartCode;
} else {
chartUsed = defaultChartCode;
}
chartKeyLabels.add(new ConcreteKeyValue(chartUsed, chartUsed));
for (Iterator<Chart> iter = chartCodes.iterator(); iter.hasNext(); ) {
Chart element = (Chart) iter.next();
if (element.isActive() && !element.getChartOfAccountsCode().equals(chartUsed)) {
chartKeyLabels.add(new ConcreteKeyValue(element.getChartOfAccountsCode(), element.getChartOfAccountsCode()));
}
}
}
return chartKeyLabels;
}
use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class AccountingDocumentGeneratorBase method buildDocumentNote.
protected Note buildDocumentNote(AccountingXmlDocumentNote xmlNote) {
Person systemUser = personService.getPersonByPrincipalName(KFSConstants.SYSTEM_USER);
Note note = emptyNoteGenerator.get();
note.setNoteText(xmlNote.getDescription());
note.setAuthorUniversalIdentifier(systemUser.getPrincipalId());
note.setNotePostedTimestampToCurrent();
return note;
}
use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class RassProjectDirectorConverter method buildProjectDirector.
protected CGProjectDirector buildProjectDirector(RassXMLAwardPiCoPiEntry rassAwardPiCoPi) {
CGProjectDirector projectDirector = createNewProjectDirectorInstance();
Person projectDirectorPerson = personService.getPersonByPrincipalName(rassAwardPiCoPi.getProjectDirectorPrincipalName());
if (ObjectUtils.isNull(projectDirectorPerson)) {
throw new RuntimeException("Cannot find person with principal name \"" + rassAwardPiCoPi.getProjectDirectorPrincipalName() + "\"");
}
if (!doesPersonHaveProjectDirectorRole(projectDirectorPerson)) {
LOG.info("buildProjectDirector, " + projectDirectorPerson.getPrincipalName() + " needs to be added to the project director role");
roleService.assignPrincipalToRole(projectDirectorPerson.getPrincipalId(), KFSConstants.CoreModuleNamespaces.KFS, KFSConstants.SysKimApiConstants.CONTRACTS_AND_GRANTS_PROJECT_DIRECTOR, new HashMap<String, String>());
}
projectDirector.setPrincipalId(projectDirectorPerson.getPrincipalId());
ObjectPropertyUtils.setPropertyValue(projectDirector, projectDirectorPrimaryIndicatorPropertyName, getNullSafePrimaryDirectorFlag(rassAwardPiCoPi));
return projectDirector;
}
use of org.kuali.kfs.kim.api.identity.Person in project cu-kfs by CU-CommunityApps.
the class PayeeACHAccountExtractServiceImplTest method processACHBatchDetailsInNewUserSession.
private boolean processACHBatchDetailsInNewUserSession() throws Exception {
Person systemUser = MockPersonUtil.createMockPerson(UserNameFixture.kfs);
UserSession systemUserSession = MockPersonUtil.createMockUserSession(systemUser);
return GlobalVariables.doInNewGlobalVariables(systemUserSession, payeeACHAccountExtractService::processACHBatchDetails);
}
Aggregations