本文整理汇总了Java中org.kuali.rice.kim.api.services.KimApiServiceLocator类的典型用法代码示例。如果您正苦于以下问题:Java KimApiServiceLocator类的具体用法?Java KimApiServiceLocator怎么用?Java KimApiServiceLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KimApiServiceLocator类属于org.kuali.rice.kim.api.services包,在下文中一共展示了KimApiServiceLocator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkAuthorization
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
@Override
protected void checkAuthorization(ActionForm form, String methodToCall) throws AuthorizationException {
if (!(form instanceof LookupForm)) {
super.checkAuthorization(form, methodToCall);
} else {
try {
Class businessObjectClass = Class.forName(((LookupForm) form).getBusinessObjectClassName());
if (!KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(
GlobalVariables.getUserSession().getPrincipalId(), KRADConstants.KNS_NAMESPACE,
KimConstants.PermissionTemplateNames.LOOK_UP_RECORDS,
KRADUtils.getNamespaceAndComponentSimpleName(businessObjectClass),
Collections.<String, String>emptyMap())) {
throw new AuthorizationException(GlobalVariables.getUserSession().getPerson().getPrincipalName(),
KimConstants.PermissionTemplateNames.LOOK_UP_RECORDS,
businessObjectClass.getSimpleName());
}
}
catch (ClassNotFoundException e) {
LOG.warn("Unable to load BusinessObject class: " + ((LookupForm) form).getBusinessObjectClassName(), e);
super.checkAuthorization(form, methodToCall);
}
}
}
示例2: testLoadToPersonDocument
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
@Test
public void testLoadToPersonDocument() {
Entity entity = KimApiServiceLocator.getIdentityService().getEntity("entity123eId");
assertNotNull(entity);
IdentityManagementPersonDocument personDoc = new IdentityManagementPersonDocument();
uiDocumentService.loadEntityToPersonDoc(personDoc, "entity123pId");
EntityTypeContactInfo entityType = entity.getEntityTypeContactInfos().get(0);
personDoc.getExternalIdentifiers();
assertAddressTrue(personDoc.getAddrs().get(0), entityType.getAddresses().get(0));
assertPhoneTrue(personDoc.getPhones().get(0), entityType.getPhoneNumbers().get(0));
assertEmailTrue(personDoc.getEmails().get(0), entityType.getEmailAddresses().get(0));
assertNameTrue(personDoc.getNames().get(0), entity.getNames().get(0));
//assertPrincipalTrue(personDoc, identity.getPrincipals().get(0));
assertAffiliationTrue(personDoc.getAffiliations().get(0), entity.getAffiliations().get(0));
assertEmpInfoTrue(personDoc.getAffiliations().get(0).getEmpInfos().get(0), entity.getEmploymentInformation().get(0));
}
示例3: testGetWebFriendlyRecipientsWithGroup
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
/**
* KULRICE-7615
* bmcgough is a secondary delegate *for* the NonSIT group; getWebFriendlyRecipients should handle this
*/
@Test
public void testGetWebFriendlyRecipientsWithGroup() {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("jhopf"), "ActionListDocumentType_PrimaryDelegate");
document.route("");
Person bmcgough = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("bmcgough");
Collection<Recipient> delegators = getActionListService().findUserSecondaryDelegators(bmcgough.getPrincipalId());
String nonSITGroupId = getGroupIdForName("KR-WKFLW", "NonSIT");
assertFalse(delegators.isEmpty());
boolean nonSITGroupFound = false;
for (Recipient d: delegators) {
if (d instanceof KimGroupRecipient) {
if (nonSITGroupId.equals(((KimGroupRecipient) d).getGroupId())) {
nonSITGroupFound = true;
}
}
}
assertTrue("NonSIT group was not found as a delegator to bmcgough (has test config changed?)", nonSITGroupFound);
// now test that it can actually deal with the KimGroupRecipient
ActionListUtil.getWebFriendlyRecipients(delegators);
}
示例4: getErrorMessage
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
@Override
public String getErrorMessage(Element originalConfigElement, RequestParser requestParser, MatchingParam param) {
if (!getEdlContext().getUserAction().isValidatableAction()) {
return null;
} else if (StringUtils.isBlank(param.getParamValue()) && required ) {
// empty or whitespaces and required so send error
return ("Network ID is a required field");
} else if (StringUtils.isBlank(param.getParamValue()) && !required ) {
// empty or whitespaces and not required so ignore
return null;
} else {
//not blank validate as normal whether required or not
Principal principal = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName(param.getParamValue());
if (principal == null) {
return ("The value " + param.getParamValue() + " is an invalid principal name");
}
}
return null;
}
示例5: testIngesterPermissionExampleLikeRice
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
@Test
/**
* tests {@link NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImpl#getMatchingPermissions(java.util.Map, java.util.List)}
*/
public void testIngesterPermissionExampleLikeRice() {
Map<String, String> requestedDetails = getUseIngesterRequestedDetails();
List<PermissionBo> permissionsList = new ArrayList<PermissionBo>();
Template template = KimApiServiceLocator.getPermissionService().findPermTemplateByNamespaceCodeAndName("KR-NS",
"Use Screen");
permissionsList.add(createPermission(template, "Use All Screens", "KR-SYS", "namespaceCode=KR*"));
PermissionBo exactMatch = createPermission(template, "Use Ingester Screen", "KR-WKFLW", "actionClass=" + INGESTER_ACTION, "namespaceCode=KR-WKFLW");
permissionsList.add(exactMatch);
List<Permission> immutablePermissionList = new ArrayList<Permission>();
for (PermissionBo bo : permissionsList) {
immutablePermissionList.add(PermissionBo.to(bo));
}
List<Permission> returnedPermissions = permissionService.getMatchingPermissions(requestedDetails, immutablePermissionList);
assertTrue(returnedPermissions.size() == 1);
assertTrue(returnedPermissions.get(0).equals(PermissionBo.to(exactMatch)));
}
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImplTest.java
示例6: sendPeriodicReminder
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
protected void sendPeriodicReminder(String principalId, Collection<ActionItem> actionItems, String emailSetting) {
String emailBody = null;
actionItems = filterActionItemsToNotify(principalId, actionItems, emailSetting);
// if there are no action items after being filtered, there's no
// reason to send the email
if (actionItems.isEmpty()) {
return;
}
if (KewApiConstants.EMAIL_RMNDR_DAY_VAL.equals(emailSetting)) {
emailBody = buildDailyReminderBody(actionItems);
} else if (KewApiConstants.EMAIL_RMNDR_WEEK_VAL.equals(emailSetting)) {
emailBody = buildWeeklyReminderBody(actionItems);
}
Person person = KimApiServiceLocator.getPersonService().getPerson(principalId);
sendEmail(person, getEmailSubject(), new EmailBody(emailBody));
}
示例7: testUserDelegator
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
/**
* This method tests that delegation doesn't break the email
*
* @throws Exception
*/
@Test
public void testUserDelegator() throws Exception {
RuleTestUtils.createDelegationToUser("EmailTestUserDocType", "WorkflowDocumentTemplate", "user1");
String user1PrincipalId = getPrincipalIdForName("user1");
// this document type has a group responsibility
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "EmailTestUserDocType");
doc.route("");
ActionListFilter actionListFilter = new ActionListFilter();
actionListFilter.setDocumentType(doc.getDocumentTypeName());
Collection<ActionItem> actionItems = KEWServiceLocator.getActionListService().getActionList(user1PrincipalId, actionListFilter);
EmailContentService emailContentService = KEWServiceLocator.getEmailContentService();
Person person = KimApiServiceLocator.getPersonService().getPerson(user1PrincipalId);
EmailContent emailContent = emailContentService.generateDailyReminder(person, ActionItem.to(new ArrayList<ActionItem>(actionItems)));
}
示例8: getGroupNameByNamespaceAndName
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
protected String getGroupNameByNamespaceAndName(String namespaceCode, String groupName) {
Group group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(namespaceCode, groupName);
if (group == null) {
// disable link
setDisableLink(true);
if (isNamespaceInLinkText()){
return this.groupNamespaceCode + " " + this.groupName;
} else {
return this.groupName;
}
}
if (isNamespaceInLinkText()){
return group.getNamespaceCode() + " " + group.getName();
}
return group.getName();
}
示例9: testDocSearch
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
@Test public void testDocSearch() throws Exception {
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("bmcgough");
DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
DocumentSearchResults results = null;
criteria.setTitle("*IN");
criteria.setSaveName("bytitle");
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setTitle("*IN-CFSG");
criteria.setSaveName("for in accounts");
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
criteria = DocumentSearchCriteria.Builder.create();
criteria.setDateApprovedFrom(new DateTime(2004, 9, 16, 0, 0));
results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
criteria = DocumentSearchCriteria.Builder.create();
user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("bmcgough");
DocumentSearchCriteria savedCriteria = docSearchService.getNamedSearchCriteria(user.getPrincipalId(), "bytitle");
assertNotNull(savedCriteria);
assertEquals("bytitle", savedCriteria.getSaveName());
savedCriteria = docSearchService.getNamedSearchCriteria(user.getPrincipalId(), "for in accounts");
assertNotNull(savedCriteria);
assertEquals("for in accounts", savedCriteria.getSaveName());
}
示例10: copy
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
/**
* Executes a deep copy of the BaseWorkgroup
*/
/* private BaseWorkgroup copy(BaseWorkgroup workgroup) throws Exception {
BaseWorkgroup workgroupCopy = (BaseWorkgroup)KEWServiceLocator.getWorkgroupService().copy(workgroup);
// copy above does a shallow copy so we need to deep copy members
List<BaseWorkgroupMember> members = workgroupCopy.getWorkgroupMembers();
List<BaseWorkgroupMember> membersCopy = new ArrayList<BaseWorkgroupMember>();
for (BaseWorkgroupMember member : members) {
membersCopy.add(copy(member));
}
workgroupCopy.setWorkgroupMembers(membersCopy);
workgroupCopy.setMembers(new ArrayList<Recipient>());
workgroupCopy.materializeMembers();
return workgroupCopy;
}
private BaseWorkgroupMember copy(BaseWorkgroupMember member) throws Exception {
return (BaseWorkgroupMember)BeanUtils.cloneBean(member);
}
*/
protected Group getGroup(String groupId) {
return KimApiServiceLocator.getGroupService().getGroup(groupId);
}
示例11: testGenerateRemindersCustomStyleSheet
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
/**
* tests custom stylesheet
* @throws Exception
*/
@Test
public void testGenerateRemindersCustomStyleSheet() throws Exception {
loadXmlFile("customEmailStyleData.xml");
assertNotNull(CoreServiceApiServiceLocator.getStyleService().getStyle("kew.email.style"));
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("arh14");
int count = generateDocs(new String[] { "PingDocument", "PingDocumentWithEmailAttrib" }, user);
Collection<ActionItem> actionItems = org.kuali.rice.kew.actionitem.ActionItem.to(new ArrayList<org.kuali.rice.kew.actionitem.ActionItem>(KEWServiceLocator.getActionListService().getActionList(user.getPrincipalId(), null)));
assertEquals("user should have " + count + " items in his action list.", count, actionItems.size());
EmailContent content = styleableContentService.generateImmediateReminder(user, actionItems.iterator().next(), KEWServiceLocator.getDocumentTypeService().findByName(actionItems.iterator().next().getDocName()));
assertTrue("Unexpected subject", content.getSubject().startsWith("CUSTOM:"));
assertTrue("Unexpected body", content.getBody().startsWith("CUSTOM:"));
content = styleableContentService.generateDailyReminder(user, actionItems);
assertTrue("Unexpected subject", content.getSubject().startsWith("CUSTOM:"));
assertTrue("Unexpected body", content.getBody().startsWith("CUSTOM:"));
content = styleableContentService.generateWeeklyReminder(user, actionItems);
assertTrue("Unexpected subject", content.getSubject().startsWith("CUSTOM:"));
assertTrue("Unexpected body", content.getBody().startsWith("CUSTOM:"));
}
示例12: loadWebValues
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
private void loadWebValues() throws Exception {
if (!org.apache.commons.lang.StringUtils.isEmpty(getRuleResponsibilityName())) {
if (KewApiConstants.RULE_RESPONSIBILITY_WORKFLOW_ID.equals(getRuleResponsibilityType())) {
// setReviewer(getUserService().getWorkflowUser(new
// WorkflowUserId(getRuleResponsibilityName())).getPrincipalName().getAuthenticationId());
Principal principal = KEWServiceLocator.getIdentityHelperService().getPrincipal(getRuleResponsibilityName());
setReviewer(principal.getPrincipalName());
setReviewerId(principal.getPrincipalId());
} else if (KewApiConstants.RULE_RESPONSIBILITY_GROUP_ID.equals(getRuleResponsibilityType())) {
// setReviewer(getWorkgroupService().getWorkgroup(new
// WorkflowGroupId(new
// Long(getRuleResponsibilityName()))).getGroupNameId().getNameId());
Group group = KimApiServiceLocator.getGroupService().
getGroup(getRuleResponsibilityName());
setReviewer(group.getName());
setReviewerId(group.getId());
} else if (KewApiConstants.RULE_RESPONSIBILITY_ROLE_ID.equals(getRuleResponsibilityType())) {
setRoleReviewer(getRuleResponsibilityName());
setReviewer(getResolvedRoleName());
}
}
}
示例13: findUserSecondaryDelegators
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
@Override
public Collection<Recipient> findUserSecondaryDelegators(String principalId) {
QueryByCriteria query = QueryByCriteria.Builder.fromPredicates(
equal("principalId", principalId),
equal("delegationType", DelegationType.SECONDARY.getCode()),
or(isNotNull("delegatorPrincipalId"), isNotNull("delegatorGroupId")));
QueryResults<ActionItem> results = dataObjectService.findMatching(ActionItem.class, query);
Map<Object, Recipient> delegators = new HashMap<Object, Recipient>(results.getResults().size());
for ( ActionItem actionItem : results.getResults() ) {
String delegatorPrincipalId = actionItem.getDelegatorPrincipalId();
String delegatorGroupId = actionItem.getDelegatorGroupId();
if (delegatorPrincipalId != null && !delegators.containsKey(delegatorPrincipalId)) {
delegators.put(delegatorPrincipalId,new WebFriendlyRecipient(KimApiServiceLocator.getPersonService().getPerson(delegatorPrincipalId)));
} else if (delegatorGroupId != null && !delegators.containsKey(delegatorGroupId)) {
delegators.put(delegatorGroupId, new KimGroupRecipient(KimApiServiceLocator.getGroupService().getGroup(delegatorGroupId)));
}
}
return delegators.values();
}
示例14: viewResults
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
public ActionForward viewResults(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LookupForm lookupForm = (LookupForm) form;
if (lookupForm.isSearchUsingOnlyPrimaryKeyValues()) {
lookupForm.setPrimaryKeyFieldLabels(lookupForm.getLookupable().getPrimaryKeyFieldLabels());
}
// KULRICE-12281- Turn off the ability to export results from certain lookups
if(StringUtils.isNotBlank(request.getParameter(KRADConstants.Lookup.VIEW_RESULTS_EXPORT_OPTION))) {
String componentName = Class.forName(lookupForm.getBusinessObjectClassName()).getSimpleName();
String principalId = GlobalVariables.getUserSession().getPrincipalId();
String principalUserName = GlobalVariables.getUserSession().getPrincipalName();
Map<String, String> permissionDetails = new HashMap<String,String>();
permissionDetails.put(KRADConstants.COMPONENT_NAME, componentName);
boolean isAuthorized = KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(
principalId,KRADConstants.KNS_NAMESPACE,KimConstants.PermissionTemplateNames.VIEW_RESULTS_EXPORT_ACTION,
permissionDetails,new HashMap<String,String>());
if(!isAuthorized){
throw new AuthorizationException(principalUserName, "Exporting the Lookup Results", componentName);
}
}
request.setAttribute(KRADConstants.SEARCH_LIST_REQUEST_KEY, request.getParameter(KRADConstants.SEARCH_LIST_REQUEST_KEY));
request.setAttribute("reqSearchResults", GlobalVariables.getUserSession().retrieveObject(request.getParameter(
KRADConstants.SEARCH_LIST_REQUEST_KEY)));
request.setAttribute("reqSearchResultsActualSize", request.getParameter("reqSearchResultsActualSize"));
return mapping.findForward(RiceConstants.MAPPING_BASIC);
}
示例15: getAuthorData
import org.kuali.rice.kim.api.services.KimApiServiceLocator; //导入依赖的package包/类
/**
* Method added for notes editing function. Called by retrieveNoteList method
* @param note
* @throws Exception
*/
private void getAuthorData(Note note) throws Exception {
Person workflowUser = null;
String id = "";
if (note != null && note.getNoteAuthorWorkflowId() != null
&& !"".equalsIgnoreCase(note.getNoteAuthorWorkflowId())) {
workflowUser = KimApiServiceLocator.getPersonService().getPerson(note.getNoteAuthorWorkflowId());
id = note.getNoteAuthorWorkflowId();
}
if (workflowUser != null) {
note.setNoteAuthorFullName(workflowUser.getName());
note.setNoteAuthorEmailAddress(workflowUser.getEmailAddress());
note.setNoteAuthorNetworkId(workflowUser.getPrincipalName());
} else {
note.setNoteAuthorFullName(id + " (Name not Available)");
note.setNoteAuthorEmailAddress("Not Available");
note.setNoteAuthorNetworkId("Not Available");
}
}