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


Java PropositionBo.getCompoundComponents方法代码示例

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


在下文中一共展示了PropositionBo.getCompoundComponents方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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:aapotts,项目名称:kuali_rice,代码行数:44,代码来源:AgendaEditorController.java

示例12: 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 (ObjectUtils.isNotNull(parentNode)) {
            parentNode.getChildren().clear();
            agendaEditor.getAgendaItemLine().getRule().getPropositionTree().setRootElement(null);
            agendaEditor.getAgendaItemLine().getRule().setPropId(null);
            agendaEditor.getAgendaItemLine().getRule().setProposition(null);
        } else {
            GlobalVariables.getMessageMap().putError(KRMSPropertyConstants.Rule.PROPOSITION_TREE_GROUP_ID,
                    "error.rule.proposition.noneHighlighted");
        }
    }

    agendaEditor.getAgendaItemLine().getRule().refreshPropositionTree(false);
    return getUIFModelAndView(form);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:38,代码来源:AgendaEditorController.java

示例13: togglePropositionSimpleCompound

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入方法依赖的package包/类
/**
 * introduces a new compound proposition between the selected proposition and its parent.
 * Additionally, it puts a new blank simple proposition underneath the compound proposition
 * as a sibling to the selected proposition.
 */
@RequestMapping(params = "methodToCall=" + "togglePropositionSimpleCompound")
public ModelAndView togglePropositionSimpleCompound(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    AgendaEditor agendaEditor = getAgendaEditor(form);
    RuleBo rule = agendaEditor.getAgendaItemLine().getRule();
    String selectedPropId = agendaEditor.getSelectedPropositionId();

    resetEditModeOnPropositionTree(rule.getPropositionTree().getRootElement());

    if (!StringUtils.isBlank(selectedPropId)) {
        // find parent
        Node<RuleTreeNode,String> parent = findParentPropositionNode(
                rule.getPropositionTree().getRootElement(), selectedPropId);
        if (parent != null){

            int index = findChildIndex(parent, selectedPropId);

            PropositionBo propBo = parent.getChildren().get(index).getData().getProposition();

            // create a new compound proposition
            PropositionBo compound = PropositionBo.createCompoundPropositionBoStub(propBo, true);
            compound.setDescription("New Compound Proposition");
            compound.setEditMode(false);

            if (parent.getData() == null) { // SPECIAL CASE: this is the only proposition in the tree
                rule.setProposition(compound);
            } else {
                PropositionBo parentBo = parent.getData().getProposition();
                List<PropositionBo> siblings = parentBo.getCompoundComponents();

                int propIndex = -1;
                for (int i=0; i<siblings.size(); i++) {
                    if (propBo.getId().equals(siblings.get(i).getId())) {
                        propIndex = i;
                        break;
                    }
                }

                parentBo.getCompoundComponents().set(propIndex, compound);
            }
        }
    }

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

示例14: togglePropositionSimpleCompound

import org.kuali.rice.krms.impl.repository.PropositionBo; //导入方法依赖的package包/类
/**
 * introduces a new compound proposition between the selected proposition and its parent.
 * Additionally, it puts a new blank simple proposition underneath the compound proposition
 * as a sibling to the selected proposition.
 */
@RequestMapping(params = "methodToCall=" + "togglePropositionSimpleCompound")
public ModelAndView togglePropositionSimpleCompound(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    AgendaEditor agendaEditor = getAgendaEditor(form);
    RuleBo rule = agendaEditor.getAgendaItemLine().getRule();
    String selectedPropId = agendaEditor.getSelectedPropositionId();

    resetEditModeOnPropositionTree(rule.getPropositionTree().getRootElement());

    if (!StringUtils.isBlank(selectedPropId)) {
        // find parent
        Node<RuleTreeNode,String> parent = findParentPropositionNode(
                rule.getPropositionTree().getRootElement(), selectedPropId);
        if (parent != null){

            int index = findChildIndex(parent, selectedPropId);

            PropositionBo propBo = parent.getChildren().get(index).getData().getProposition();

            // create a new compound proposition
            PropositionBo compound = PropositionBo.createCompoundPropositionBoStub(propBo, true);
            compound.setDescription("New Compound Proposition");
            compound.setEditMode(false);

            if (parent.getData() == null) { // SPECIAL CASE: this is the only proposition in the tree
                rule.setProposition(compound);
            } else {
                PropositionBo parentBo = parent.getData().getProposition();
                List<PropositionBo> siblings = parentBo.getCompoundComponents();

                int propIndex = -1;
                for (int i=0; i<siblings.size(); i++) {
                    if (propBo.getId().equals(siblings.get(i).getId())) {
                        propIndex = i;
                        break;
                    }
                }

                parentBo.getCompoundComponents().set(propIndex, compound);
            }
        }
    }

    agendaEditor.getAgendaItemLine().getRule().refreshPropositionTree(true);
    return getUIFModelAndView(form);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:54,代码来源:AgendaEditorController.java


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