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


Java PropositionBo类代码示例

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


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

示例1: processCustomOperators

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * walk the proposition tree and process any custom operators found, converting them to custom function invocations.
 *
 * @param propositionBo the root proposition from which to search and convert
 */
private void processCustomOperators(PropositionBo propositionBo) {
    if (StringUtils.isBlank(propositionBo.getCompoundOpCode())) {
        // if it is a simple proposition with a custom operator
        if (!propositionBo.getParameters().isEmpty() && propositionBo.getParameters().get(2).getValue().startsWith(
                KrmsImplConstants.CUSTOM_OPERATOR_PREFIX)) {
            PropositionParameterBo operatorParam = propositionBo.getParameters().get(2);

            CustomOperator customOperator =
                    KrmsServiceLocatorInternal.getCustomOperatorUiTranslator().getCustomOperator(operatorParam.getValue());

            FunctionDefinition operatorFunctionDefinition = customOperator.getOperatorFunctionDefinition();

            operatorParam.setParameterType(PropositionParameterType.FUNCTION.getCode());
            operatorParam.setValue(operatorFunctionDefinition.getId());
        }
    } else {
        // recurse
        for (PropositionBo childProp : propositionBo.getCompoundComponents()) {
            processCustomOperators(childProp);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:AgendaEditorMaintainable.java

示例2: preprocessCustomOperators

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * Looks for any custom function calls within simple propositions and attempts to convert them to custom
 * operator keys.
 *
 * @param proposition the proposition to search within and convert
 * @param customOperatorValuesMap a map from function ID to custom operator key, used for the conversion
 */
protected void preprocessCustomOperators(PropositionBo proposition, Map<String, String> customOperatorValuesMap) {
    if (proposition == null) { return; }

    if (proposition.getParameters() != null && proposition.getParameters().size() > 0) {
        for (PropositionParameterBo param : proposition.getParameters()) {
            if (PropositionParameterType.FUNCTION.getCode().equals(param.getParameterType())) {
                // convert to our convention of customOperator:<functionNamespace>:<functionName>
                String convertedValue = customOperatorValuesMap.get(param.getValue());
                if (!StringUtils.isEmpty(convertedValue)) {
                    param.setValue(convertedValue);
                }
            }
        }
    } else if (proposition.getCompoundComponents() != null && proposition.getCompoundComponents().size() > 0) {
        for (PropositionBo childProposition : proposition.getCompoundComponents()) {
            // recurse
            preprocessCustomOperators(childProposition, customOperatorValuesMap);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:AgendaEditorController.java

示例3: findPropositionUnderEdit

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * helper method to find the proposition under edit
 */
private PropositionBo findPropositionUnderEdit(PropositionBo currentProposition) {
    PropositionBo result = null;
    if (currentProposition.getEditMode()) {
        result = currentProposition;
    } else {
        if (currentProposition.getCompoundComponents() != null) {
            for (PropositionBo child : currentProposition.getCompoundComponents()) {
                result = findPropositionUnderEdit(child);
                if (result != null) break;
            }
        }
    }

    return result;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:ValidTermsValuesFinder.java

示例4: saveDataObject

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
@Override
public void saveDataObject() {
    AgendaBo agendaBo = ((AgendaEditor) getDataObject()).getAgenda();

    // handle saving new parameterized terms
    for (AgendaItemBo agendaItem : agendaBo.getItems()) {
        PropositionBo propositionBo = agendaItem.getRule().getProposition();
        if (propositionBo != null) {
            saveNewParameterizedTerms(propositionBo);
        }
    }

    if (agendaBo instanceof PersistableBusinessObject) {
        Map<String, String> primaryKeys = new HashMap<String, String>();
        primaryKeys.put("id", agendaBo.getId());
        AgendaBo blah = getBusinessObjectService().findByPrimaryKey(AgendaBo.class, primaryKeys);
        getBusinessObjectService().delete(blah);

        getBusinessObjectService().linkAndSave(agendaBo);
    } else {
        throw new RuntimeException("Cannot save object of type: " + agendaBo + " with business object service");
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:24,代码来源:AgendaEditorMaintainable.java

示例5: walkPropositionTree

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
private void walkPropositionTree(PropositionBo prop) {
    if (prop == null) { return; }

    if (prop.getParameters() != null) for (PropositionParameterBo param : prop.getParameters()) {
        param.getPropId();
    }

    if (prop.getCompoundComponents() != null) for (PropositionBo childProp : prop.getCompoundComponents()) {
        walkPropositionTree(childProp);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:AgendaEditorMaintainable.java

示例6: saveNewParameterizedTerms

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * walk the proposition tree and save any new parameterized terms that are contained therein
 *
 * @param propositionBo the root proposition from which to search
 */
private void saveNewParameterizedTerms(PropositionBo propositionBo) {
    if (StringUtils.isBlank(propositionBo.getCompoundOpCode())) {
        // it is a simple proposition
        if (!propositionBo.getParameters().isEmpty() && propositionBo.getParameters().get(0).getValue().startsWith(
                KrmsImplConstants.PARAMETERIZED_TERM_PREFIX)) {
            String termId = propositionBo.getParameters().get(0).getValue();
            String termSpecId = termId.substring(KrmsImplConstants.PARAMETERIZED_TERM_PREFIX.length());
            // create new term
            TermBo newTerm = new TermBo();
            newTerm.setDescription(propositionBo.getNewTermDescription());
            newTerm.setSpecificationId(termSpecId);
            newTerm.setId(termIdIncrementer.getNewId());
            newTerm.getSpecification().setId(newTerm.getSpecificationId());

            List<TermParameterBo> params = new ArrayList<TermParameterBo>();
            for (Map.Entry<String, String> entry : propositionBo.getTermParameters().entrySet()) {
                TermParameterBo param = new TermParameterBo();
                param.setTerm(newTerm);
                param.setName(entry.getKey());
                param.setValue(entry.getValue());
                param.setId(termParameterIdIncrementer.getNewId());

                params.add(param);
            }

            newTerm.setParameters(params);

            getLegacyDataAdapter().linkAndSave(newTerm);
            propositionBo.getParameters().get(0).setValue(newTerm.getId());
        }
    } else {
        // recurse
        for (PropositionBo childProp : propositionBo.getCompoundComponents()) {
            saveNewParameterizedTerms(childProp);
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:43,代码来源:AgendaEditorMaintainable.java

示例7: findPropositionUnderEdit

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * helper method to find the proposition under edit
 */
private PropositionBo findPropositionUnderEdit(PropositionBo currentProposition) {
    PropositionBo result = null;
    if (currentProposition.getEditMode()) {
        result = currentProposition;
    } else {
        if (currentProposition.getCompoundComponents() != null) {
            for (PropositionBo child : currentProposition.getCompoundComponents()) {
                result = findPropositionUnderEdit(child);
                if (result != null) break;
            }
        }
    }
    return result;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:ValidTermsForPropositionValuesFinder.java

示例8: validateProposition

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * Validate the given proposition and its children.  Note that this method is side-effecting,
 * when errors are detected with the proposition, errors are added to the error map.
 * @param proposition the proposition to validate
 * @param namespace the namespace of the parent rule
 * @return true if the proposition and its children (if any) are considered valid
 */
// TODO also wire up to proposition for faster feedback to the user
private boolean validateProposition(PropositionBo proposition, String namespace) {
    boolean result = true;

    if (proposition != null) { // Null props are allowed.

        if (StringUtils.isBlank(proposition.getDescription())) {
            GlobalVariables.getMessageMap().putError(KRMSPropertyConstants.Rule.PROPOSITION_TREE_GROUP_ID,
                    "error.rule.proposition.missingDescription");
            result &= false;
        }

        if (StringUtils.isBlank(proposition.getCompoundOpCode())) {
            // then this is a simple proposition, validate accordingly

            result &= validateSimpleProposition(proposition, namespace);

        } else {
            // this is a compound proposition (or it should be)
            List<PropositionBo> compoundComponents = proposition.getCompoundComponents();

            if (!CollectionUtils.isEmpty(proposition.getParameters())) {
                GlobalVariables.getMessageMap().putError(KRMSPropertyConstants.Rule.PROPOSITION_TREE_GROUP_ID,
                        "error.rule.proposition.compound.invalidParameter", proposition.getDescription());
                result &= false;
            }

            // recurse
            if (!CollectionUtils.isEmpty(compoundComponents)) {
                for (PropositionBo childProp : compoundComponents) {
                    result &= validateProposition(childProp, namespace);
                }
            }
        }
    }

    return result;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:46,代码来源:AgendaEditorController.java

示例9: goToEditProposition

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * This method starts an edit proposition.
 */
@RequestMapping(params = "methodToCall=" + "goToEditProposition")
public ModelAndView goToEditProposition(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    // open the selected node for editing
    AgendaEditor agendaEditor = getAgendaEditor(form);
    RuleBo rule = agendaEditor.getAgendaItemLine().getRule();
    String selectedPropId = agendaEditor.getSelectedPropositionId();

    Node<RuleTreeNode,String> root = rule.getPropositionTree().getRootElement();
    PropositionBo propositionToToggleEdit = null;
    boolean newEditMode = true;

    // find parent
    Node<RuleTreeNode,String> parent = findParentPropositionNode( root, selectedPropId);
    if (parent != null){
        List<Node<RuleTreeNode,String>> children = parent.getChildren();
        for( int index=0; index< children.size(); index++){
            Node<RuleTreeNode,String> child = children.get(index);
            if (propIdMatches(child, selectedPropId)){
                PropositionBo prop = child.getData().getProposition();
                propositionToToggleEdit = prop;
                newEditMode =  !prop.getEditMode();
                break;
            } else {
                child.getData().getProposition().setEditMode(false);
            }
        }
    }

    resetEditModeOnPropositionTree(root);
    if (propositionToToggleEdit != null) {
        propositionToToggleEdit.setEditMode(newEditMode);
        //refresh the tree
        rule.refreshPropositionTree(null);
    }

    return getModelAndView(form);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:43,代码来源:AgendaEditorController.java

示例10: addOpCodeNode

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 *
 * This method adds an opCode Node to separate components in a compound proposition.
 *
 * @param currentNode
 * @param prop
 * @return
 */
private void addOpCodeNode(Node currentNode, PropositionBo prop, int index){
    String opCodeLabel = "";

    if (LogicalOperator.AND.getCode().equalsIgnoreCase(prop.getCompoundOpCode())){
        opCodeLabel = "AND";
    } else if (LogicalOperator.OR.getCode().equalsIgnoreCase(prop.getCompoundOpCode())){
        opCodeLabel = "OR";
    }
    Node<RuleTreeNode, String> aNode = new Node<RuleTreeNode, String>();
    aNode.setNodeLabel("");
    aNode.setNodeType("ruleTreeNode compoundOpCodeNode");
    aNode.setData(new CompoundOpCodeNode(prop));
    currentNode.insertChildAt(index, aNode);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:AgendaEditorController.java

示例11: movePropositionLeft

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
@RequestMapping(params = "methodToCall=" + "movePropositionLeft")
public ModelAndView movePropositionLeft(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    /* Rough algorithm for moving a node up.
     *
     * find the following:
     *   node := the selected node
     *   parent := the selected node's parent, its containing node (via when true or when false relationship)
     *   parentsOlderCousin := the parent's level-order predecessor (sibling or cousin)
     *
     */
    AgendaEditor agendaEditor = getAgendaEditor(form);
    RuleBo rule = agendaEditor.getAgendaItemLine().getRule();
    String selectedPropId = agendaEditor.getSelectedPropositionId();

    // find agendaEditor.getAgendaItemLine().getRule().getPropositionTree().getRootElement()parent
    Node<RuleTreeNode,String> root = rule.getPropositionTree().getRootElement();
    Node<RuleTreeNode,String> parent = findParentPropositionNode(root, selectedPropId);
    if ((parent != null) && (RuleTreeNode.COMPOUND_NODE_TYPE.equalsIgnoreCase(parent.getNodeType()))){
        Node<RuleTreeNode,String> granny = findParentPropositionNode(root,parent.getData().getProposition().getId());
        if (granny != root){
            int oldIndex = findChildIndex(parent, selectedPropId);
            int newIndex = findChildIndex(granny, parent.getData().getProposition().getId());
            if (oldIndex >= 0 && newIndex >= 0){
                PropositionBo prop = parent.getData().getProposition().getCompoundComponents().remove(oldIndex/2);
                granny.getData().getProposition().getCompoundComponents().add((newIndex/2)+1, prop);
                rule.refreshPropositionTree(false);
            }
        } else {
            // TODO: do we allow moving up to the root?
            // we could add a new top level compound node, with current root as 1st child,
            // and move the node to the second child.
        }
    }
    return getModelAndView(form);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:39,代码来源:AgendaEditorController.java

示例12: movePropositionRight

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
@RequestMapping(params = "methodToCall=" + "movePropositionRight")
public ModelAndView movePropositionRight(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    /* Rough algorithm for moving a node Right
     * if the selected node is above a compound proposition, move it into the compound proposition as the first child
     * if the node is above a simple proposition, do nothing.
     * find the following:
     *   node := the selected node
     *   parent := the selected node's parent, its containing node
     *   nextSibling := the node after the selected node
     *
     */
    AgendaEditor agendaEditor = getAgendaEditor(form);
    RuleBo rule = agendaEditor.getAgendaItemLine().getRule();
    String selectedPropId = agendaEditor.getSelectedPropositionId();

    // find parent
    Node<RuleTreeNode,String> parent = findParentPropositionNode(
            rule.getPropositionTree().getRootElement(), selectedPropId);
    if (parent != null){
        int index = findChildIndex(parent, selectedPropId);
        // if we are the last child, do nothing, otherwise
        if (index >= 0 && index+1 < parent.getChildren().size()){
            Node<RuleTreeNode,String> child = parent.getChildren().get(index);
            Node<RuleTreeNode,String> nextSibling = parent.getChildren().get(index+2);
            // if selected node above a compound node, move it into it as first child
            if(RuleTreeNode.COMPOUND_NODE_TYPE.equalsIgnoreCase(nextSibling.getNodeType()) ){
                // remove selected node from it's current spot
                PropositionBo prop = parent.getData().getProposition().getCompoundComponents().remove(index/2);
                // add it to it's siblings children
                nextSibling.getData().getProposition().getCompoundComponents().add(0, prop);
                rule.refreshPropositionTree(false);
            }
        }
    }
    return getModelAndView(form);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:39,代码来源:AgendaEditorController.java

示例13: deleteProposition

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
@RequestMapping(params = "methodToCall=" + "deleteProposition")
public ModelAndView deleteProposition(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    AgendaEditor agendaEditor = getAgendaEditor(form);
    String selectedPropId = agendaEditor.getSelectedPropositionId();
    Node<RuleTreeNode, String> root = agendaEditor.getAgendaItemLine().getRule().getPropositionTree().getRootElement();

    Node<RuleTreeNode, String> parentNode = findParentPropositionNode(root, selectedPropId);

    // what if it is the root?
    if (parentNode != null && parentNode.getData() != null) { // it is not the root as there is a parent w/ a prop
        PropositionBo parent = parentNode.getData().getProposition();
        if (parent != null){
            List <PropositionBo> children = parent.getCompoundComponents();
            for( int index=0; index< children.size(); index++){
                if (selectedPropId.equalsIgnoreCase(children.get(index).getId())){
                    parent.getCompoundComponents().remove(index);
                    break;
                }
            }
        }
    } else { // no parent, it is the root
        if (KRADUtils.isNotNull(parentNode)) {
            parentNode.getChildren().clear();
            agendaEditor.getAgendaItemLine().getRule().getPropositionTree().setRootElement(null);
            agendaEditor.getAgendaItemLine().getRule().setProposition(null);
        } else {
            GlobalVariables.getMessageMap().putError(KRMSPropertyConstants.Rule.PROPOSITION_TREE_GROUP_ID,
                    "error.rule.proposition.noneHighlighted");
        }
    }

    agendaEditor.getDeletedPropositionIdsFromRule().add(selectedPropId);
    agendaEditor.getAgendaItemLine().getRule().refreshPropositionTree(false);

    return getModelAndView(form);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:39,代码来源:AgendaEditorController.java

示例14: saveNewParameterizedTerms

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * walk the proposition tree and save any new parameterized terms that are contained therein
 *
 * @param propositionBo the root proposition from which to search
 */
private void saveNewParameterizedTerms(PropositionBo propositionBo) {
    if (StringUtils.isBlank(propositionBo.getCompoundOpCode())) {
        // it is a simple proposition
        if (!propositionBo.getParameters().isEmpty() && propositionBo.getParameters().get(0).getValue().startsWith(
                KrmsImplConstants.PARAMETERIZED_TERM_PREFIX)) {
            String termId = propositionBo.getParameters().get(0).getValue();
            String termSpecId = termId.substring(KrmsImplConstants.PARAMETERIZED_TERM_PREFIX.length());
            // create new term
            TermBo newTerm = new TermBo();
            newTerm.setDescription(propositionBo.getNewTermDescription());
            newTerm.setSpecificationId(termSpecId);
            newTerm.setId(termIdIncrementer.getNewId());

            List<TermParameterBo> params = new ArrayList<TermParameterBo>();
            for (Map.Entry<String, String> entry : propositionBo.getTermParameters().entrySet()) {
                TermParameterBo param = new TermParameterBo();
                param.setTerm(newTerm);
                param.setName(entry.getKey());
                param.setValue(entry.getValue());
                param.setId(termParameterIdIncrementer.getNewId());

                params.add(param);
            }

            newTerm.setParameters(params);

            getLegacyDataAdapter().linkAndSave(newTerm);
            propositionBo.getParameters().get(0).setValue(newTerm.getId());
        }
    } else {
        // recurse
        for (PropositionBo childProp : propositionBo.getCompoundComponents()) {
            saveNewParameterizedTerms(childProp);
        }
    }
}
 
开发者ID:kuali,项目名称:rice,代码行数:42,代码来源:AgendaEditorMaintainable.java

示例15: saveNewParameterizedTerms

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入依赖的package包/类
/**
 * walk the proposition tree and save any new parameterized terms that are contained therein
 *
 * @param propositionBo the root proposition from which to search
 */
private void saveNewParameterizedTerms(PropositionBo propositionBo) {
    if (StringUtils.isBlank(propositionBo.getCompoundOpCode())) {
        // it is a simple proposition
        if (!propositionBo.getParameters().isEmpty() && propositionBo.getParameters().get(0).getValue().startsWith(
                KrmsImplConstants.PARAMETERIZED_TERM_PREFIX)) {
            String termId = propositionBo.getParameters().get(0).getValue();
            String termSpecId = termId.substring(KrmsImplConstants.PARAMETERIZED_TERM_PREFIX.length());
            // create new term
            TermBo newTerm = new TermBo();
            newTerm.setDescription(propositionBo.getNewTermDescription());
            newTerm.setSpecificationId(termSpecId);
            newTerm.setId(KRADServiceLocator.getSequenceAccessorService().getNextAvailableSequenceNumber(
                    KrmsMaintenanceConstants.Sequences.TERM_SPECIFICATION, TermBo.class).toString());

            List<TermParameterBo> params = new ArrayList<TermParameterBo>();
            for (Map.Entry<String, String> entry : propositionBo.getTermParameters().entrySet()) {
                TermParameterBo param = new TermParameterBo();
                param.setTermId(newTerm.getId());
                param.setName(entry.getKey());
                param.setValue(entry.getValue());
                param.setId(KRADServiceLocator.getSequenceAccessorService().getNextAvailableSequenceNumber(
                        KrmsMaintenanceConstants.Sequences.TERM_PARAMETER, TermParameterBo.class).toString());

                params.add(param);
            }

            newTerm.setParameters(params);

            KRADServiceLocator.getBusinessObjectService().linkAndSave(newTerm);
            propositionBo.getParameters().get(0).setValue(newTerm.getId());
        }
    } else {
        // recurse
        for (PropositionBo childProp : propositionBo.getCompoundComponents()) {
            saveNewParameterizedTerms(childProp);
        }
    }
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:44,代码来源:AgendaEditorMaintainable.java


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