Package org.openengsb.core.workflow.api.model

Examples of org.openengsb.core.workflow.api.model.RuleBaseElementId


        String eventName = event.getName();
        String ruleName = String.format("_generated_ trigger %s on %s", Arrays.asList(flowIds), eventName);
        StringBuffer ruleCode = generateFlowTriggerRule(event, flowIds);
        LOGGER.info("adding new rule with id: {}", ruleName);
        try {
            rulemanager.add(new RuleBaseElementId(RuleBaseElementType.Rule, ruleName), ruleCode.toString());
        } catch (RuleBaseException e) {
            throw new WorkflowException(e);
        }
    }
View Full Code Here


        }
    }

    private synchronized void installRuleBaseElement(File artifact) throws RuleBaseException, IOException, SAXException,
        ParserConfigurationException {
        RuleBaseElementId id = getIdforFile(artifact);
        String code = FileUtils.readFileToString(artifact);
        ruleManager.addOrUpdate(id, code);
        if (id.getType().equals(RuleBaseElementType.Process)) {
            cache.put(artifact.getName(), id);
        }
        LOGGER.info("Successfully installed workflow file \"{}\"", artifact.getName());
    }
View Full Code Here

        LOGGER.info("Successfully updated workflow file \"{}\"", artifact.getName());
    }

    private synchronized void doUpdateArtifact(File artifact) throws SAXException, IOException,
        ParserConfigurationException {
        RuleBaseElementId id = getIdforFile(artifact);
        String code = FileUtils.readFileToString(artifact);
        boolean changed = false;
        if (id.getType().equals(RuleBaseElementType.Process)) {
            RuleBaseElementId cachedId = cache.get(artifact.getName());
            if (!id.equals(cachedId)) {
                ruleManager.delete(cachedId);
                changed = true;
            }
        }
View Full Code Here

    }

    private synchronized void doUninstall(File artifact) throws Exception {
        RuleBaseElementType type = getTypeFromFile(artifact);
        if (type != null) {
            RuleBaseElementId id = getIdforFile(artifact);
            if (id.getType().equals(RuleBaseElementType.Process)) {
                id = cache.remove(artifact.getName());
            }
            ruleManager.delete(id);
            return;
        }
View Full Code Here

    private RuleBaseElementId getIdforFile(File artifact) throws RuleBaseException, SAXException, IOException,
        ParserConfigurationException {
        RuleBaseElementType type = getTypeFromFile(artifact);
        String name = FilenameUtils.removeExtension(artifact.getName());
        RuleBaseElementId id = new RuleBaseElementId(type, name);
        if (artifact.exists() && type.equals(RuleBaseElementType.Process)) {
            id.setPackageName(readPackageNameFromProcessFile(artifact));
        }
        return id;
    }
View Full Code Here

    @Override
    public synchronized void registerEvent(RemoteEvent event, String portId, String returnAddress, String serviceId) {
        String name =
            String.format("Notify %s via %s when %s occurs", returnAddress.toString(), portId, event.getClassName());
        name = getUniqueRuleName(name);
        RuleBaseElementId id = new RuleBaseElementId(RuleBaseElementType.Rule, name);
        String eventMatcher = makeEventMatcher(event);
        try {
            String osgiHelperStatement;
            if (serviceId == null) {
                osgiHelperStatement = String.format(OSGI_HELPER_TEMPLATE1, portId, returnAddress);
View Full Code Here

        LOGGER.info("registering Event: {}", event);
    }

    private String getUniqueRuleName(String name) {
        Collection<RuleBaseElementId> list = ruleManager.listAll(RuleBaseElementType.Rule);
        while (list.contains(new RuleBaseElementId(RuleBaseElementType.Rule, name))) {
            name = name + "_";
        }
        return name;
    }
View Full Code Here

            new PaxWicketSpringBeanComponentInjector(tester.getApplication(), context);
        tester.getApplication().getComponentInstantiationListeners().add(defaultPaxWicketInjector);

        ruleManager = mock(RuleManager.class);
        Collection<RuleBaseElementId> value = new ArrayList<RuleBaseElementId>();
        value.add(new RuleBaseElementId(RuleBaseElementType.Process, "foo"));
        when(ruleManager.listAll(RuleBaseElementType.Process)).thenReturn(value);
        context.putBean("ruleManager", ruleManager);

        id = 0;
        workflowService = mock(WorkflowService.class);
View Full Code Here

    public void testStartPanel_shouldShowWorkflowList() throws Exception {
        tester.startComponentInPage(WorkflowStartPanel.class);
        DropDownChoice<RuleBaseElementId> selectBox =
            (DropDownChoice<RuleBaseElementId>) tester.getComponentFromLastRenderedPage("startFlowForm:startFlowBox");
        List<RuleBaseElementId> choices = (List<RuleBaseElementId>) selectBox.getChoices();
        assertThat(choices, hasItem(new RuleBaseElementId(RuleBaseElementType.Process, "foo")));
    }
View Full Code Here

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
                target.add(textArea);
                if (newRuleMode) {
                    boolean error = false;
                    RuleBaseElementId ruleBaseElementId = new RuleBaseElementId(typeChoice.getModelObject(),
                            newRuleTextField.getModelObject());
                    try {
                        ruleManagerProvider.getRuleManager().add(ruleBaseElementId, textArea.getModelObject());
                    } catch (RuleBaseException e) {
                        error = true;
View Full Code Here

TOP

Related Classes of org.openengsb.core.workflow.api.model.RuleBaseElementId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.