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


Java ContextValidTermBo类代码示例

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


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

示例1: getTermSpecificationById

import org.kuali.rice.krms.impl.repository.ContextValidTermBo; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krms.impl.repository.TermBoService#getTermSpecificationById(java.lang.String)
 */
@Override
public TermSpecificationDefinition getTermSpecificationById(String id) {
	TermSpecificationBo termSpecificationBo = 
		businessObjectService.findBySinglePrimaryKey(TermSpecificationBo.class, id);

       // avoid the expense of loading ContextBos by directly looking at ContextValidTermBo reln
       Collection<ContextValidTermBo> contextValidTerms =
               businessObjectService.findMatching(ContextValidTermBo.class, Collections.singletonMap("termSpecificationId", id));

       // populate TermSpecificationBo.contextIds collection
       if (contextValidTerms != null) for (ContextValidTermBo contextValidTerm : contextValidTerms) {
           termSpecificationBo.getContextIds().add(contextValidTerm.getContextId());
       }

	return TermSpecificationDefinition.Builder.create(termSpecificationBo).build();
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:20,代码来源:TermBoServiceImpl.java

示例2: createTermSpecification

import org.kuali.rice.krms.impl.repository.ContextValidTermBo; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krms.impl.repository.TermBoService#createTermSpecification(org.kuali.rice.krms.api.repository.term.TermSpecificationDefinition)
 */
@Override
public TermSpecificationDefinition createTermSpecification(TermSpecificationDefinition termSpec) {
	if (!StringUtils.isBlank(termSpec.getId())) {
		throw new RiceIllegalArgumentException("for creation, TermSpecification.id must be null");
	}
	
	TermSpecificationBo termSpecBo = TermSpecificationBo.from(termSpec);
	
	termSpecBo = businessObjectService.save(termSpecBo);

       // save relations to the contexts on the BO
       if (!CollectionUtils.isEmpty(termSpec.getContextIds())) for (String contextId : termSpec.getContextIds()) {
           ContextValidTermBo contextValidTerm = new ContextValidTermBo();
           contextValidTerm.setContextId(contextId);
           contextValidTerm.setTermSpecificationId(termSpecBo.getId());
           businessObjectService.save(contextValidTerm);
       }
	
	return TermSpecificationBo.to(termSpecBo);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:24,代码来源:TermBoServiceImpl.java

示例3: findAllTermSpecificationsByContextId

import org.kuali.rice.krms.impl.repository.ContextValidTermBo; //导入依赖的package包/类
@Override
public List<TermSpecificationDefinition> findAllTermSpecificationsByContextId(String contextId){
    List<TermSpecificationDefinition> results = null;
    
    if (StringUtils.isBlank(contextId)){
        throw new RiceIllegalArgumentException("contextId must not be blank or null");        
    }
    
    Collection<ContextValidTermBo> contextValidTerms = 
                businessObjectService.findMatching(ContextValidTermBo.class, 
                                Collections.singletonMap("contextId", contextId));
    
    if (!CollectionUtils.isEmpty(contextValidTerms)) {
        results = new ArrayList<TermSpecificationDefinition>(contextValidTerms.size());
        for (ContextValidTermBo validTerm : contextValidTerms) {
            results.add(TermSpecificationBo.to(validTerm.getTermSpecification()));
        }        
    } else {
        results = Collections.emptyList();
    }

    return results;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:24,代码来源:TermBoServiceImpl.java

示例4: saveDataObject

import org.kuali.rice.krms.impl.repository.ContextValidTermBo; //导入依赖的package包/类
@Override
public void saveDataObject() {
    TermSpecificationBo termSpec = (TermSpecificationBo) getDataObject();

    super.saveDataObject();    // save it, it should get an id assigned

    if (termSpec.getId() != null) {
        // clear all context valid term mappings
        getBoService().deleteMatching(ContextValidTermBo.class,
                Collections.singletonMap("termSpecificationId", termSpec.getId()));

        // add a new mapping for each context in the collection
        for (String contextId : termSpec.getContextIds()) {
            ContextValidTermBo contextValidTerm = new ContextValidTermBo();
            contextValidTerm.setContextId(contextId);
            contextValidTerm.setTermSpecificationId(termSpec.getId());
            getBoService().save(contextValidTerm);
        }
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:21,代码来源:TermSpecificationMaintainable.java

示例5: setNewContextValidTermsNewBO

import org.kuali.rice.krms.impl.repository.ContextValidTermBo; //导入依赖的package包/类
private void setNewContextValidTermsNewBO(MaintenanceDocument document) {
    TermSpecificationBo newTermSpec = (TermSpecificationBo) document.getNewMaintainableObject().getDataObject();
    for (ContextValidTermBo contextValidTermBo : newTermSpec.getContextValidTerms()) {
        contextValidTermBo.setId(null);
        contextValidTermBo.setTermSpecification(newTermSpec);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:TermSpecificationMaintainable.java

示例6: processCollectionDeleteLine

import org.kuali.rice.krms.impl.repository.ContextValidTermBo; //导入依赖的package包/类
/**
 * For context removal, removes the given item from the persisted contextValidTerms collection on the data object.
 *
 * <p>Without this step, the context is only removed from a transient collection and the severed relationship will
 * never be persisted. </p>
 */
@Override
public void processCollectionDeleteLine(ViewModel viewModel, String collectionId, String collectionPath,
        int lineIndex) {
    List collection = ObjectPropertyUtils.getPropertyValue(viewModel, collectionPath);
    Object deletedItem = collection.get(lineIndex);

    // we only want to do our custom processing if a context has been deleted
    if (deletedItem == null || !(deletedItem instanceof ContextBo)) {
        super.processCollectionDeleteLine(viewModel, collectionId, collectionPath, lineIndex);
        return;
    }

    ContextBo context = (ContextBo) deletedItem;
    TermSpecificationBo termSpec = getDataObjectFromForm(viewModel);

    // find the context and remove it using the special powers of ListIterator
    ListIterator<ContextValidTermBo> contextValidTermListIter = termSpec.getContextValidTerms().listIterator();
    while (contextValidTermListIter.hasNext()) {
        ContextValidTermBo contextValidTerm = contextValidTermListIter.next();

        if (contextValidTerm.getContextId().equals(context.getId())) {
            contextValidTerm.setTermSpecification(null);
            contextValidTermListIter.remove();
            termSpec.getContexts().remove(context);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:34,代码来源:TermSpecificationMaintainable.java

示例7: getContextValidTerms

import org.kuali.rice.krms.impl.repository.ContextValidTermBo; //导入依赖的package包/类
/**
 * Get all of the valid terms for the Context that we're in.  This is a bit of a process since we're starting
 * from the proposition and there is a lot of indirection to get the context ID.
 *
 * @param ruleId
 * @return the mappings from the context(s) to the valid terms
 */
private List<ContextValidTermBo> getContextValidTerms(String ruleId) {
    RuleDefinition rule = KrmsRepositoryServiceLocator
        .getRuleBoService().getRuleByRuleId(ruleId);

    QueryByCriteria agendaItemCriteria = QueryByCriteria.Builder.forAttribute("ruleId", rule.getId()).build();
    QueryResults<AgendaItemBo> agendaItems =
            KRADServiceLocator.getDataObjectService().findMatching(AgendaItemBo.class, agendaItemCriteria);

    Set<String> agendaIds = new HashSet<String>();
    if (!CollectionUtils.isEmpty(agendaItems.getResults())) for (AgendaItemBo agendaItem : agendaItems.getResults()) {
        agendaIds.add(agendaItem.getAgendaId());
    }

    Set<String> contextIds = new HashSet<String>();
    for (String agendaId : agendaIds) {
        AgendaDefinition agenda = KrmsRepositoryServiceLocator.getAgendaBoService().getAgendaByAgendaId(agendaId);

        if (agenda != null) {
            contextIds.add(agenda.getContextId());
        }
    }

    List<ContextValidTermBo> contextValidTerms = new ArrayList<ContextValidTermBo>();

    for (String contextId : contextIds) {
        QueryResults<ContextValidTermBo> queryResults =
                KRADServiceLocator.getDataObjectService().findMatching(ContextValidTermBo.class,
                        QueryByCriteria.Builder.forAttribute("contextId", contextId).build());

        if (!CollectionUtils.isEmpty(queryResults.getResults())) {
            contextValidTerms.addAll(queryResults.getResults());
        }
    }
    return contextValidTerms;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:43,代码来源:ValidTermsForPropositionValuesFinder.java

示例8: findContexts

import org.kuali.rice.krms.impl.repository.ContextValidTermBo; //导入依赖的package包/类
/**
 * Add the Term Specification's Context to the given termSpecificationBo.  Note that there is no check for the Context
 * already having been added to the Term Specification.
 * @param termSpecificationBo with
 */
private void findContexts(TermSpecificationBo termSpecificationBo) {
    Collection<ContextValidTermBo> validContextMappings =
        getBoService().findMatching(ContextValidTermBo.class,
                Collections.singletonMap("termSpecificationId", termSpecificationBo.getId()));

    if (!CollectionUtils.isEmpty(validContextMappings)) for (ContextValidTermBo validContextMapping : validContextMappings) {
        termSpecificationBo.getContextIds().add(validContextMapping.getContextId());
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:15,代码来源:TermSpecificationMaintainable.java


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