本文整理汇总了Java中org.kuali.rice.kim.api.responsibility.Responsibility类的典型用法代码示例。如果您正苦于以下问题:Java Responsibility类的具体用法?Java Responsibility怎么用?Java Responsibility使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Responsibility类属于org.kuali.rice.kim.api.responsibility包,在下文中一共展示了Responsibility类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createResponsibility
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public Responsibility createResponsibility(final Responsibility responsibility)
throws RiceIllegalArgumentException, RiceIllegalStateException {
incomingParamCheck(responsibility, "responsibility");
if (StringUtils.isNotBlank(responsibility.getId()) && getResponsibility(responsibility.getId()) != null) {
throw new RiceIllegalStateException("the responsibility to create already exists: " + responsibility);
}
List<ResponsibilityAttributeBo> attrBos = Collections.emptyList();
if (responsibility.getTemplate() != null) {
attrBos = KimAttributeDataBo.createFrom(ResponsibilityAttributeBo.class, responsibility.getAttributes(), responsibility.getTemplate().getKimTypeId());
}
ResponsibilityBo bo = ResponsibilityBo.from(responsibility);
bo.setAttributeDetails(attrBos);
return ResponsibilityBo.to(getDataObjectService().save(bo));
}
示例2: updateResponsibility
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public Responsibility updateResponsibility(final Responsibility responsibility)
throws RiceIllegalArgumentException, RiceIllegalStateException {
incomingParamCheck(responsibility, "responsibility");
if (StringUtils.isBlank(responsibility.getId()) || getResponsibility(responsibility.getId()) == null) {
throw new RiceIllegalStateException("the responsibility does not exist: " + responsibility);
}
List<ResponsibilityAttributeBo> attrBos = Collections.emptyList();
if (responsibility.getTemplate() != null) {
attrBos = KimAttributeDataBo.createFrom(ResponsibilityAttributeBo.class, responsibility.getAttributes(), responsibility.getTemplate().getKimTypeId());
}
ResponsibilityBo bo = ResponsibilityBo.from(responsibility);
if (bo.getAttributeDetails() != null) {
bo.getAttributeDetails().clear();
bo.setAttributeDetails(attrBos);
}
return ResponsibilityBo.to(getDataObjectService().save(bo));
}
示例3: findRespByNamespaceCodeAndName
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public Responsibility findRespByNamespaceCodeAndName(final String namespaceCode, final String name)
throws RiceIllegalArgumentException {
incomingParamCheck(namespaceCode, "namespaceCode");
incomingParamCheck(name, "name");
final Map<String, Object> criteria = new HashMap<String, Object>();
criteria.put("namespaceCode", namespaceCode);
criteria.put("name", name);
criteria.put("active", Boolean.TRUE);
QueryResults<ResponsibilityBo> bos =
getDataObjectService().findMatching(ResponsibilityBo.class,
QueryByCriteria.Builder.andAttributes(criteria).build());
if (bos != null && bos.getResults() != null) {
if (bos.getResults().size() > 1) {
throw new RiceIllegalStateException("more than one Responsibility found with namespace code: " + namespaceCode + " and name: " + name);
}
final Iterator<ResponsibilityBo> i = bos.getResults().iterator();
return i.hasNext() ? ResponsibilityBo.to(i.next()) : null;
}
return null;
}
示例4: getResponsibilityActionsByTemplate
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public List<ResponsibilityAction> getResponsibilityActionsByTemplate(final String namespaceCode,
final String respTemplateName, final Map<String, String> qualification,
final Map<String, String> responsibilityDetails) throws RiceIllegalArgumentException {
incomingParamCheck(namespaceCode, "namespaceCode");
incomingParamCheck(respTemplateName, "respTemplateName");
incomingParamCheck(qualification, "qualification");
if ( LOG.isDebugEnabled() ) {
logResponsibilityCheck( namespaceCode, respTemplateName, qualification, responsibilityDetails );
}
// get all the responsibility objects whose name match that requested
List<Responsibility> responsibilities = findResponsibilitiesByTemplate(namespaceCode, respTemplateName);
return getRespActions(namespaceCode, responsibilities, qualification, responsibilityDetails);
}
示例5: getRespActions
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
private List<ResponsibilityAction> getRespActions(final String namespaceCode,
final List<Responsibility> responsibilities,
final Map<String, String> qualification,
final Map<String, String> responsibilityDetails) {
// now, filter the full list by the detail passed
List<Responsibility> applicableResponsibilities = getMatchingResponsibilities(responsibilities, responsibilityDetails);
List<ResponsibilityAction> results = new ArrayList<ResponsibilityAction>();
for (Responsibility r : applicableResponsibilities) {
List<String> roleIds = getRoleIdsForResponsibility(r.getId());
results.addAll(getActionsForResponsibilityRoles(r, roleIds, qualification));
}
if ( LOG.isDebugEnabled() ) {
LOG.debug("Found " + results.size() + " matching ResponsibilityAction objects");
if ( LOG.isTraceEnabled() ) {
LOG.trace( results );
}
}
return results;
}
示例6: findResponsibilities
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public ResponsibilityQueryResults findResponsibilities(final QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException {
incomingParamCheck(queryByCriteria, "queryByCriteria");
QueryResults<ResponsibilityBo> results = getDataObjectService().findMatching(ResponsibilityBo.class,
AttributeTransform.getInstance().apply(queryByCriteria));
ResponsibilityQueryResults.Builder builder = ResponsibilityQueryResults.Builder.create();
builder.setMoreResultsAvailable(results.isMoreResultsAvailable());
builder.setTotalRowCount(results.getTotalRowCount());
final List<Responsibility.Builder> ims = new ArrayList<Responsibility.Builder>();
for (ResponsibilityBo bo : results.getResults()) {
ims.add(Responsibility.Builder.create(bo));
}
builder.setResults(ims);
return builder.build();
}
示例7: getMatchingResponsibilities
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
/**
* Compare each of the passed in responsibilities with the given responsibilityDetails. Those that
* match are added to the result list.
*/
private List<Responsibility> getMatchingResponsibilities(List<Responsibility> responsibilities, Map<String, String> responsibilityDetails) {
// if no details passed, assume that all match
if (responsibilityDetails == null || responsibilityDetails.isEmpty()) {
return responsibilities;
}
final List<Responsibility> applicableResponsibilities = new ArrayList<Responsibility>();
// otherwise, attempt to match the permission details
// build a map of the template IDs to the type services
Map<String, ResponsibilityTypeService> responsibilityTypeServices = getResponsibilityTypeServicesByTemplateId(responsibilities);
// build a map of permissions by template ID
Map<String, List<Responsibility>> responsibilityMap = groupResponsibilitiesByTemplate(responsibilities);
// loop over the different templates, matching all of the same template against the type
// service at once
for (Map.Entry<String, List<Responsibility>> respEntry : responsibilityMap.entrySet()) {
ResponsibilityTypeService responsibilityTypeService = responsibilityTypeServices.get(respEntry.getKey());
List<Responsibility> responsibilityInfos = respEntry.getValue();
if (responsibilityTypeService == null) {
responsibilityTypeService = defaultResponsibilityTypeService;
}
applicableResponsibilities.addAll(responsibilityTypeService.getMatchingResponsibilities(responsibilityDetails, responsibilityInfos));
}
return Collections.unmodifiableList(applicableResponsibilities);
}
示例8: getResponsibilityTypeServicesByTemplateId
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
private Map<String, ResponsibilityTypeService> getResponsibilityTypeServicesByTemplateId(Collection<Responsibility> responsibilities) {
Map<String, ResponsibilityTypeService> responsibilityTypeServices = new HashMap<String, ResponsibilityTypeService>(responsibilities.size());
for (Responsibility responsibility : responsibilities) {
final Template t = responsibility.getTemplate();
final KimType type = kimTypeInfoService.getKimType(t.getKimTypeId());
final String serviceName = type.getServiceName();
if (serviceName != null) {
ResponsibilityTypeService responsibiltyTypeService = GlobalResourceLoader.getService(QName.valueOf(serviceName));
if (responsibiltyTypeService != null) {
responsibilityTypeServices.put(responsibility.getTemplate().getId(), responsibiltyTypeService);
} else {
responsibilityTypeServices.put(responsibility.getTemplate().getId(), defaultResponsibilityTypeService);
}
}
}
return Collections.unmodifiableMap(responsibilityTypeServices);
}
示例9: findResponsibilitiesByTemplate
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public List<Responsibility> findResponsibilitiesByTemplate(String namespaceCode, String templateName) {
final Map<String, Object> criteria = new HashMap<String, Object>();
criteria.put("template.namespaceCode", namespaceCode);
criteria.put("template.name", templateName);
criteria.put("active", Boolean.TRUE);
QueryResults<ResponsibilityBo> bos =
getDataObjectService().findMatching(ResponsibilityBo.class,
QueryByCriteria.Builder.andAttributes(criteria).build());
final List<Responsibility> ims = new ArrayList<Responsibility>();
if (bos != null && bos.getResults() != null) {
for (ResponsibilityBo bo : bos.getResults()) {
if (bo != null) {
ims.add(ResponsibilityBo.to(bo));
}
}
}
return Collections.unmodifiableList(ims);
}
示例10: from
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
/**
* Converts a immutable object to its mutable counterpart
*
* @param im immutable object
* @return the mutable bo
*/
public static ResponsibilityBo from(Responsibility im) {
if (im == null) {
return null;
}
ResponsibilityBo bo = new ResponsibilityBo();
bo.id = im.getId();
bo.namespaceCode = im.getNamespaceCode();
bo.name = im.getName();
bo.description = im.getDescription();
bo.active = im.isActive();
bo.templateId = im.getTemplate() != null ? im.getTemplate().getId() : null;
bo.template = ResponsibilityTemplateBo.from(im.getTemplate());
bo.attributes = im.getAttributes();
bo.setVersionNumber(im.getVersionNumber());
bo.setObjectId(im.getObjectId());
return bo;
}
示例11: performResponsibilityMatches
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
protected List<Responsibility> performResponsibilityMatches(
Map<String, String> requestedDetails,
List<Responsibility> responsibilitiesList) {
// get the base responsibility matches based on the route level and document type
List<Responsibility> baseMatches = super.performResponsibilityMatches(requestedDetails,
responsibilitiesList);
// now, if any of the responsibilities have the "qualifierResolverProvidedIdentifier" detail property
// perform an exact match on the property with the requested details
// if the property does not match or does not exist in the requestedDetails, remove
// the responsibility from the list
Iterator<Responsibility> respIter = baseMatches.iterator();
while ( respIter.hasNext() ) {
Map<String, String> respDetails = respIter.next().getAttributes();
if ( respDetails.containsKey( KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER ) && StringUtils.isNotBlank( respDetails.get(KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER) ) ) {
if ( !requestedDetails.containsKey( KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER )
|| !StringUtils.equals( respDetails.get(KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER)
, requestedDetails.get(KimConstants.AttributeConstants.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER))) {
respIter.remove();
}
}
}
return baseMatches;
}
示例12: checkForDuplicateResponsibility
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
protected boolean checkForDuplicateResponsibility( ReviewResponsibilityBo resp ) {
QueryByCriteria.Builder builder = QueryByCriteria.Builder.create();
Predicate p = and(
equal("template.namespaceCode", KewApiConstants.KEW_NAMESPACE ),
equal("template.name", KewApiConstants.DEFAULT_RESPONSIBILITY_TEMPLATE_NAME),
equal("attributes[documentTypeName]", resp.getDocumentTypeName())
// KULRICE-8538 -- Check the route node by looping through the results below. If it is added
// into the predicate, no rows are ever returned.
//equal("attributes[routeNodeName]", resp.getRouteNodeName())
);
builder.setPredicates(p);
ResponsibilityQueryResults results = KimApiServiceLocator.getResponsibilityService().findResponsibilities(builder.build());
List<Responsibility> responsibilities = new ArrayList<Responsibility>();
if ( !results.getResults().isEmpty() ) {
for ( Responsibility responsibility : results.getResults() ) {
String routeNodeName = responsibility.getAttributes().get( KimConstants.AttributeConstants.ROUTE_NODE_NAME);
if (StringUtils.isNotEmpty(routeNodeName) && StringUtils.equals(routeNodeName, resp.getRouteNodeName())){
responsibilities.add(responsibility);
}
}
}
return responsibilities.isEmpty();
}
示例13: createResponsibility
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public Responsibility createResponsibility(final Responsibility responsibility)
throws RiceIllegalArgumentException, RiceIllegalStateException {
incomingParamCheck(responsibility, "responsibility");
if (StringUtils.isNotBlank(responsibility.getId()) && getResponsibility(responsibility.getId()) != null) {
throw new RiceIllegalStateException("the responsibility to create already exists: " + responsibility);
}
List<ResponsibilityAttributeBo> attrBos = Collections.emptyList();
if (responsibility.getTemplate() != null) {
attrBos = KimAttributeDataBo.createFrom(ResponsibilityAttributeBo.class, responsibility.getAttributes(), responsibility.getTemplate().getKimTypeId());
}
ResponsibilityBo bo = ResponsibilityBo.from(responsibility);
bo.setAttributeDetails(attrBos);
return ResponsibilityBo.to(businessObjectService.save(bo));
}
示例14: updateResponsibility
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public Responsibility updateResponsibility(final Responsibility responsibility)
throws RiceIllegalArgumentException, RiceIllegalStateException {
incomingParamCheck(responsibility, "responsibility");
if (StringUtils.isBlank(responsibility.getId()) || getResponsibility(responsibility.getId()) == null) {
throw new RiceIllegalStateException("the responsibility does not exist: " + responsibility);
}
List<ResponsibilityAttributeBo> attrBos = Collections.emptyList();
if (responsibility.getTemplate() != null) {
attrBos = KimAttributeDataBo.createFrom(ResponsibilityAttributeBo.class, responsibility.getAttributes(), responsibility.getTemplate().getKimTypeId());
}
ResponsibilityBo bo = ResponsibilityBo.from(responsibility);
if (bo.getAttributeDetails() != null) {
bo.getAttributeDetails().clear();
bo.setAttributeDetails(attrBos);
}
return ResponsibilityBo.to(businessObjectService.save(bo));
}
示例15: findRespByNamespaceCodeAndName
import org.kuali.rice.kim.api.responsibility.Responsibility; //导入依赖的package包/类
@Override
public Responsibility findRespByNamespaceCodeAndName(final String namespaceCode, final String name)
throws RiceIllegalArgumentException {
incomingParamCheck(namespaceCode, "namespaceCode");
incomingParamCheck(name, "name");
final Map<String, String> crit = new HashMap<String, String>();
crit.put("namespaceCode", namespaceCode);
crit.put("name", name);
crit.put("active", "Y");
final Collection<ResponsibilityBo> bos = businessObjectService.findMatching(ResponsibilityBo.class, Collections.unmodifiableMap(crit));
if (bos != null) {
if (bos.size() > 1) {
throw new RiceIllegalStateException("more than one Responsibility found with namespace code: " + namespaceCode + " and name: " + name);
}
final Iterator<ResponsibilityBo> i = bos.iterator();
return i.hasNext() ? ResponsibilityBo.to(i.next()) : null;
}
return null;
}