当前位置: 首页>>代码示例>>Java>>正文


Java Person类代码示例

本文整理汇总了Java中org.kuali.rice.kim.api.identity.Person的典型用法代码示例。如果您正苦于以下问题:Java Person类的具体用法?Java Person怎么用?Java Person使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Person类属于org.kuali.rice.kim.api.identity包,在下文中一共展示了Person类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDummyActionTaken

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
private ActionTakenValue createDummyActionTaken(DocumentRouteHeaderValue routeHeader, Person userToPerformAction, String actionToPerform, Recipient delegator) {
      ActionTakenValue val = new ActionTakenValue();
      val.setActionTaken(actionToPerform);
      if (KewApiConstants.ACTION_TAKEN_ROUTED_CD.equals(actionToPerform)) {
          val.setActionTaken(KewApiConstants.ACTION_TAKEN_COMPLETED_CD);
      }
val.setAnnotation("");
val.setDocVersion(routeHeader.getDocVersion());
val.setDocumentId(routeHeader.getDocumentId());
val.setPrincipalId(userToPerformAction.getPrincipalId());

if (delegator != null) {
	if (delegator instanceof KimPrincipalRecipient) {
		val.setDelegatorPrincipalId(((KimPrincipalRecipient) delegator).getPrincipalId());
	} else if (delegator instanceof KimGroupRecipient) {
		Group group = ((KimGroupRecipient) delegator).getGroup();
		val.setDelegatorGroupId(group.getId());
	} else{
		throw new IllegalArgumentException("Invalid Recipient type received: " + delegator.getClass().getName());
	}
}
val.setCurrentIndicator(Boolean.TRUE);
return val;
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:SimulationEngine.java

示例2: transform

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
private void transform(EDLContext edlContext, Document dom, HttpServletResponse response) throws Exception {
	if (StringUtils.isNotBlank(edlContext.getRedirectUrl())) {
		response.sendRedirect(edlContext.getRedirectUrl());
		return;
	}
    response.setContentType("text/html; charset=UTF-8");
	Transformer transformer = edlContext.getTransformer();

       transformer.setOutputProperty("indent", "yes");
       transformer.setOutputProperty(OutputKeys.INDENT, "yes");
       String user = null;
       String loggedInUser = null;
       if (edlContext.getUserSession() != null) {
           Person wu = edlContext.getUserSession().getPerson();
           if (wu != null) user = wu.getPrincipalId();
           wu = edlContext.getUserSession().getPerson();
           if (wu != null) loggedInUser = wu.getPrincipalId();
       }
       transformer.setParameter("user", user);
       transformer.setParameter("loggedInUser", loggedInUser);
       if (LOG.isDebugEnabled()) {
       	LOG.debug("Transforming dom " + XmlJotter.jotNode(dom, true));
       }
       transformer.transform(new DOMSource(dom), new StreamResult(response.getOutputStream()));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:EDLControllerChain.java

示例3: getPerson

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
/**
 * Gets the person attribute.
 * @return Returns the person.
 */
public Person getPerson() {
    if( (StringUtils.isNotEmpty(principalMemberPrincipalId)
            || StringUtils.isNotEmpty(principalMemberPrincipalName))
            &&
            (person==null || !StringUtils.equals(person.getPrincipalId(), principalMemberPrincipalId) ) ) {
        if ( StringUtils.isNotEmpty(principalMemberPrincipalId) ) {
            person = KimApiServiceLocator.getPersonService().getPerson(principalMemberPrincipalId);
        } else if ( StringUtils.isNotEmpty(principalMemberPrincipalName) ) {
            person = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(principalMemberPrincipalName);
        } else {
            person = null;
        }
        if ( person != null ) {
            principalMemberPrincipalId = person.getPrincipalId();
            principalMemberPrincipalName = person.getPrincipalName();
            principalMemberName = person.getName();
        } else {
            principalMemberPrincipalId = "";
            principalMemberName = "";
        }
    }
    return person;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:TestReviewRole.java

示例4: testDocSearch_MissingInitiator

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
/**
 * Test for https://test.kuali.org/jira/browse/KULRICE-1968 - Document search fails when users are missing
 * Tests that we can safely search on docs whose initiator no longer exists in the identity management system
 * This test searches by doc type name criteria.
 * @throws Exception
 */
@Test public void testDocSearch_MissingInitiator() throws Exception {
    String documentTypeName = "SearchDocType";
    DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
    String userNetworkId = "arh14";
    // route a document to enroute and route one to final
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalId(userNetworkId), documentTypeName);
    workflowDocument.setTitle("testDocSearch_MissingInitiator");
    workflowDocument.route("routing this document.");

    // verify the document is enroute for jhopf
    workflowDocument = WorkflowDocumentFactory.loadDocument(getPrincipalId("jhopf"),workflowDocument.getDocumentId());
    assertTrue(workflowDocument.isEnroute());
    assertTrue(workflowDocument.isApprovalRequested());

    // now nuke the initiator...
    new JdbcTemplate(TestHarnessServiceLocator.getDataSource()).execute("update " + KREW_DOC_HDR_T + " set " + INITIATOR_COL + " = 'bogus user' where DOC_HDR_ID = " + workflowDocument.getDocumentId());


    Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("jhopf");
    DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
    assertEquals("Search returned invalid number of documents", 1, results.getSearchResults().size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:DocumentSearchTest.java

示例5: getPersonInquiryUrlLink

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
protected String getPersonInquiryUrlLink(Person user, String linkBody) {
    StringBuffer urlBuffer = new StringBuffer();
    
    if(user != null && StringUtils.isNotEmpty(linkBody) ) {
    	ModuleService moduleService = KRADServiceLocatorWeb.getKualiModuleService().getResponsibleModuleService(Person.class);
    	Map<String, String[]> parameters = new HashMap<String, String[]>();
    	parameters.put(KimConstants.AttributeConstants.PRINCIPAL_ID, new String[] { user.getPrincipalId() });
    	String inquiryUrl = moduleService.getExternalizableBusinessObjectInquiryUrl(Person.class, parameters);
        if(!StringUtils.equals(KimConstants.EntityTypes.SYSTEM, user.getEntityTypeCode())){
         urlBuffer.append("<a href='");
         urlBuffer.append(inquiryUrl);
         urlBuffer.append("' ");
         urlBuffer.append("target='_blank'");
         urlBuffer.append("title='Person Inquiry'>");
         urlBuffer.append(linkBody);
         urlBuffer.append("</a>");
        } else{
        	urlBuffer.append(linkBody);
        }
    }
    
    return urlBuffer.toString();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:KualiDocumentFormBase.java

示例6: generatePessimisticLockMessages

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
/**
 * Generates the messages that warn users that the document has been locked for editing by another user.
 *
 * @param form form instance containing the transactional document data
 */
protected void generatePessimisticLockMessages(TransactionalDocumentFormBase form) {
    Document document = form.getDocument();
    Person user = GlobalVariables.getUserSession().getPerson();

    for (PessimisticLock lock : document.getPessimisticLocks()) {
        if (!lock.isOwnedByUser(user)) {
            String lockDescriptor = StringUtils.defaultIfBlank(lock.getLockDescriptor(), "full");
            String lockOwner = lock.getOwnedByUser().getName();
            String lockTime = RiceConstants.getDefaultTimeFormat().format(lock.getGeneratedTimestamp());
            String lockDate = RiceConstants.getDefaultDateFormat().format(lock.getGeneratedTimestamp());

            GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,
                    RiceKeyConstants.ERROR_TRANSACTIONAL_LOCKED, lockDescriptor, lockOwner, lockTime, lockDate);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:TransactionalDocumentView.java

示例7: canMaintain

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
public boolean canMaintain(Object dataObject, Person user) {
	Map<String, String> permissionDetails = new HashMap<String, String>(2);
	permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME,
			getDocumentDictionaryService().getMaintenanceDocumentTypeName(
					dataObject.getClass()));
	permissionDetails.put(KRADConstants.MAINTENANCE_ACTN,
			KRADConstants.MAINTENANCE_EDIT_ACTION);
	return !permissionExistsByTemplate(KRADConstants.KNS_NAMESPACE,
			KimConstants.PermissionTemplateNames.CREATE_MAINTAIN_RECORDS,
			permissionDetails)
			|| isAuthorizedByTemplate(
					dataObject,
					KRADConstants.KNS_NAMESPACE,
					KimConstants.PermissionTemplateNames.CREATE_MAINTAIN_RECORDS,
					user.getPrincipalId(), permissionDetails, null);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:MaintenanceDocumentAuthorizerBase.java

示例8: canSuperUserTakeAction

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
public boolean canSuperUserTakeAction(Document document, Person user) {
    if (!document.getDocumentHeader().hasWorkflowDocument()) {
        return false;
    }

    String principalId = user.getPrincipalId();

    String documentTypeId = document.getDocumentHeader().getWorkflowDocument().getDocumentTypeId();
    if (KewApiServiceLocator.getDocumentTypeService().isSuperUserForDocumentTypeId(principalId, documentTypeId)) {
        return true;
    }

    String documentTypeName = document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName();
    List<RouteNodeInstance> routeNodeInstances = document.getDocumentHeader().getWorkflowDocument().getRouteNodeInstances();
    String documentStatus =  document.getDocumentHeader().getWorkflowDocument().getStatus().getCode();
    return KewApiServiceLocator.getDocumentTypeService().canSuperUserApproveSingleActionRequest(
            principalId, documentTypeName, routeNodeInstances, documentStatus);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:DocumentAuthorizerBase.java

示例9: releaseAllLocksForUser

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
/**
    * @see org.kuali.rice.krad.service.PessimisticLockService#releaseAllLocksForUser(java.util.List, org.kuali.rice.kim.api.identity.Person)
    */
   @Override
public void releaseAllLocksForUser(List<PessimisticLock> locks, Person user) {
       for (Iterator<PessimisticLock> iterator = locks.iterator(); iterator.hasNext();) {
           PessimisticLock lock = iterator.next();
           if (lock.isOwnedByUser(user)) {
               try {
                   delete(lock);
               } catch ( RuntimeException ex ) {
               	if ( ex.getCause() != null && ex.getCause().getClass().equals( LegacyDataAdapter.OPTIMISTIC_LOCK_OJB_EXCEPTION_CLASS ) ) {
                       LOG.warn( "Suppressing Optimistic Lock Exception. Document Num: " +  lock.getDocumentNumber());
                   } else {
                       throw ex;
                   }
               }
           }
       }
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:PessimisticLockServiceImpl.java

示例10: considerBusinessObjectFieldUnmaskAuthorization

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
protected void considerBusinessObjectFieldUnmaskAuthorization(Object dataObject, Person user, BusinessObjectRestrictions businessObjectRestrictions, String propertyPrefix, Document document) {
	DataObjectEntry objectEntry = getDataDictionaryService().getDataDictionary().getDataObjectEntry(dataObject.getClass().getName());
	for (String attributeName : objectEntry.getAttributeNames()) {
		AttributeDefinition attributeDefinition = objectEntry.getAttributeDefinition(attributeName);
		if (attributeDefinition.getAttributeSecurity() != null) {
			if (attributeDefinition.getAttributeSecurity().isMask() &&
					!canFullyUnmaskField(user, dataObject.getClass(), attributeName, document)) {
				businessObjectRestrictions.addFullyMaskedField(propertyPrefix + attributeName, attributeDefinition.getAttributeSecurity().getMaskFormatter());
			}
			if (attributeDefinition.getAttributeSecurity().isPartialMask() &&
					!canPartiallyUnmaskField(user, dataObject.getClass(), attributeName, document)) {
				businessObjectRestrictions.addPartiallyMaskedField(propertyPrefix + attributeName, attributeDefinition.getAttributeSecurity().getPartialMaskFormatter());
			}
		}
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:BusinessObjectAuthorizationServiceImpl.java

示例11: testDocSearch

import org.kuali.rice.kim.api.identity.Person; //导入依赖的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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:DocumentSearchTest.java

示例12: from

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
public static SimulationActionToTake from(RoutingReportActionToTake actionToTake) {
    if (actionToTake == null) {
        return null;
    }
    SimulationActionToTake simActionToTake = new SimulationActionToTake();
    simActionToTake.setNodeName(actionToTake.getNodeName());
    if (StringUtils.isBlank(actionToTake.getActionToPerform())) {
        throw new IllegalArgumentException("ReportActionToTakeVO must contain an action taken code and does not");
    }
    simActionToTake.setActionToPerform(actionToTake.getActionToPerform());
    if (actionToTake.getPrincipalId() == null) {
        throw new IllegalArgumentException("ReportActionToTakeVO must contain a principalId and does not");
    }
    Principal kPrinc = KEWServiceLocator.getIdentityHelperService().getPrincipal(actionToTake.getPrincipalId());
    Person user = KimApiServiceLocator.getPersonService().getPerson(kPrinc.getPrincipalId());
    if (user == null) {
        throw new IllegalStateException("Could not locate Person for the given id: " + actionToTake.getPrincipalId());
    }
    simActionToTake.setUser(user);
    return simActionToTake;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:SimulationActionToTake.java

示例13: WebFriendlyRecipient

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
public WebFriendlyRecipient(Object recipient) {
 if (recipient instanceof WebFriendlyRecipient) {
        recipientId = ((WebFriendlyRecipient) recipient).getRecipientId();
        displayName = ((WebFriendlyRecipient) recipient).getDisplayName();

    // NOTE: ActionItemDAO code is constructing WebFriendlyRecipient directly w/ Person objects
    // this should probably be changed to return only Recipients from DAO tier to web tier
    } else if(recipient instanceof Person){
    	recipientId = ((Person)recipient).getPrincipalId();
   	displayName = ((Person)recipient).getLastName() + ", " + ((Person)recipient).getFirstName();

    } else if(recipient instanceof KimGroupRecipient){
        recipientId = ((KimGroupRecipient)recipient).getGroupId();
        displayName = ((KimGroupRecipient)recipient).getGroup().getNamespaceCode() + ":" + ((KimGroupRecipient)recipient).getGroup().getName();

    }else {
   	throw new IllegalArgumentException("Must pass in type Recipient or Person");
   }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:WebFriendlyRecipient.java

示例14: testDocSearchSecurityPermissionDocType

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
/**
 * Test for https://test.kuali.org/jira/browse/KULRICE-1968 - Document search fails when users are missing
 * Tests that we can safely search on docs whose initiator no longer exists in the identity management system
 * This test searches by doc type name criteria.
 * @throws Exception
 */
@Test public void testDocSearchSecurityPermissionDocType() throws Exception {
    String documentTypeName = "SecurityDoc_PermissionOnly";
    String userNetworkId = "arh14";
    // route a document to enroute and route one to final
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalId(userNetworkId), documentTypeName);
    workflowDocument.setTitle("testDocSearch_PermissionSecurity");
    workflowDocument.route("routing this document.");

    Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("edna");
    DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
    assertEquals(0, results.getNumberOfSecurityFilteredResults());
    assertEquals("Search returned invalid number of documents", 1, results.getSearchResults().size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:DocumentSearchSecurityTest.java

示例15: testGetPersonByExternalIdentifier

import org.kuali.rice.kim.api.identity.Person; //导入依赖的package包/类
/**
 * Test method for {@link org.kuali.rice.kim.impl.identity.PersonServiceImpl#getPersonByExternalIdentifier(java.lang.String, java.lang.String)}.
 */
@Test
public void testGetPersonByExternalIdentifier() {
	//insert external identifier
	Principal principal = KimApiServiceLocator.getIdentityService().getPrincipal("p1");

       EntityExternalIdentifierBo externalIdentifier = new EntityExternalIdentifierBo();
	externalIdentifier.setId("externalIdentifierId");
	externalIdentifier.setEntityId(principal.getEntityId());
	externalIdentifier.setExternalId("000-00-0000");
	externalIdentifier.setExternalIdentifierTypeCode("SSN");
       KradDataServiceLocator.getDataObjectService().save(externalIdentifier);
	
	List<Person> people = personService.getPersonByExternalIdentifier( "SSN", "000-00-0000" );
	assertNotNull( "result object must not be null", people );
	assertEquals( "exactly one record should be returned", 1, people.size() );
	assertEquals( "the returned principal is not correct", "p1", people.get(0).getPrincipalId() );
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:PersonServiceImplTest.java


注:本文中的org.kuali.rice.kim.api.identity.Person类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。