本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}
}
}