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


Java BusinessObjectService.findBySinglePrimaryKey方法代码示例

本文整理汇总了Java中org.kuali.rice.krad.service.BusinessObjectService.findBySinglePrimaryKey方法的典型用法代码示例。如果您正苦于以下问题:Java BusinessObjectService.findBySinglePrimaryKey方法的具体用法?Java BusinessObjectService.findBySinglePrimaryKey怎么用?Java BusinessObjectService.findBySinglePrimaryKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.krad.service.BusinessObjectService的用法示例。


在下文中一共展示了BusinessObjectService.findBySinglePrimaryKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPrincipalSecurityRecords

import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
/**
 * Creates security principal records for model members (if necessary) so that they will appear on security principal lookup for
 * editing
 * 
 * @param memberId String member id of model role
 * @param memberTypeCode String member type code for member
 */
protected void createPrincipalSecurityRecords(String memberId, String memberTypeCode) {
    Collection<String> principalIds = new HashSet<String>();

    if (MemberType.PRINCIPAL.getCode().equals(memberTypeCode)) {
        principalIds.add(memberId);
    }
    else if (MemberType.ROLE.getCode().equals(memberTypeCode)) {
        Role roleInfo = KimApiServiceLocator.getRoleService().getRole(memberId);
        Collection<String> rolePrincipalIds = KimApiServiceLocator.getRoleService().getRoleMemberPrincipalIds(roleInfo.getNamespaceCode(), roleInfo.getName(), null);
        principalIds.addAll(rolePrincipalIds);
    }
    else if (MemberType.GROUP.getCode().equals(memberTypeCode)) {
        List<String> groupPrincipalIds = KimApiServiceLocator.getGroupService().getMemberPrincipalIds(memberId);
        principalIds.addAll(groupPrincipalIds);
    }

    BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
    for (String principalId : principalIds) {
        SecurityPrincipal securityPrincipal = businessObjectService.findBySinglePrimaryKey(SecurityPrincipal.class, principalId);
        if (securityPrincipal == null) {
            SecurityPrincipal newSecurityPrincipal = new SecurityPrincipal();
            newSecurityPrincipal.setPrincipalId(principalId);

            businessObjectService.save(newSecurityPrincipal);
        }
    }
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:35,代码来源:SecurityModelMaintainableImpl.java

示例2: assignExpense

import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
public static void assignExpense(Long historicalTravelExpenseId, String tripId, String documentNumber, String documentType, boolean isAssigned){
    BusinessObjectService service = SpringContext.getBean(BusinessObjectService.class);
    HistoricalTravelExpense historicalTravelExpense = service.findBySinglePrimaryKey(HistoricalTravelExpense.class, historicalTravelExpenseId);
    historicalTravelExpense.setAssigned(isAssigned);
    historicalTravelExpense.setTripId(tripId);
    historicalTravelExpense.setDocumentNumber(documentNumber);
    historicalTravelExpense.setDocumentType(documentType);
    service.save(historicalTravelExpense);
}
 
开发者ID:kuali,项目名称:kfs,代码行数:10,代码来源:ExpenseUtils.java

示例3: createPrincipalSecurityRecords

import org.kuali.rice.krad.service.BusinessObjectService; //导入方法依赖的package包/类
/**
 * Creates security principal records for model members (if necessary) so that they will appear on security principal lookup for
 * editing
 *
 * @param memberId String member id of model role
 * @param memberTypeCode String member type code for member
 */
protected void createPrincipalSecurityRecords(String memberId, String memberTypeCode) {
    Collection<String> principalIds = new HashSet<String>();

    if (MemberType.PRINCIPAL.getCode().equals(memberTypeCode)) {
        principalIds.add(memberId);
    }
    else if (MemberType.ROLE.getCode().equals(memberTypeCode)) {
        Role roleInfo = KimApiServiceLocator.getRoleService().getRole(memberId);
        Collection<String> rolePrincipalIds = KimApiServiceLocator.getRoleService().getRoleMemberPrincipalIds(roleInfo.getNamespaceCode(), roleInfo.getName(), null);
        principalIds.addAll(rolePrincipalIds);
    }
    else if (MemberType.GROUP.getCode().equals(memberTypeCode)) {
        List<String> groupPrincipalIds = KimApiServiceLocator.getGroupService().getMemberPrincipalIds(memberId);
        principalIds.addAll(groupPrincipalIds);
    }

    BusinessObjectService businessObjectService = SpringContext.getBean(BusinessObjectService.class);
    for (String principalId : principalIds) {
        SecurityPrincipal securityPrincipal = businessObjectService.findBySinglePrimaryKey(SecurityPrincipal.class, principalId);
        if (securityPrincipal == null) {
            SecurityPrincipal newSecurityPrincipal = new SecurityPrincipal();
            newSecurityPrincipal.setPrincipalId(principalId);

            businessObjectService.save(newSecurityPrincipal);
        }
    }
}
 
开发者ID:kuali,项目名称:kfs,代码行数:35,代码来源:SecurityModelMaintainableImpl.java


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