Package org.useware.kernel.model.structure

Examples of org.useware.kernel.model.structure.QName


            eventBus.addHandler(SystemEvent.TYPE,
                    new SystemEvent.Handler() {
                        @Override
                        public boolean accepts(SystemEvent event) {

                            QName id = (QName)event.getPayload();
                            if(id!=null)
                            {
                                boolean childTarget = index2child.containsValue(id);
                                boolean relativeNav = id.getSuffix()!=null;

                                return event.getId().equals(CommonQNames.ACTIVATION_ID)
                                        && (childTarget||relativeNav);
                            }
                            else
                            {
                                return false;   // TODO: how can this happen?
                            }
                        }


                        @Override
                        public void onSystemEvent(SystemEvent event) {
                            QName id = (QName)event.getPayload();
                            String suffix = id.getSuffix();

                            if(suffix!=null)
                            {
                                // relative nav
                                if("next".equals(suffix))
View Full Code Here


            this.button.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent clickEvent) {

                    QName trigger = interactionUnit.getOutputs().iterator().next().getId();
                    QName justification = interactionUnit.getId();

                    InteractionEvent triggerEvent = new InteractionEvent(trigger);
                    triggerEvent.setPayload(trigger);

                    eventBus.fireEventFromSource(
View Full Code Here

     *
     * @param event
     */
    @Override
    public void onInteractionEvent(final InteractionEvent event) {
        QName id = event.getId();
        QName source = (QName)event.getSource();

        final Set<Procedure> collection = procedures.get(id);
        Procedure execution = null;

        if(collection!=null)
        {
            for(Procedure consumer : collection) {

                // TODO: This isn't optimal (creation of new resource with every comparison)
                Resource<ResourceType> resource = new Resource<ResourceType>(id, ResourceType.Interaction);
                resource.setSource(source);

                boolean justified = consumer.getJustification() == null
                        || source.equals(consumer.getJustification());

                if(consumer.doesConsume(resource) && justified)
                {
                    execution = consumer;
                    break;
View Full Code Here

     * @param event
     */
    @Override
    public void onNavigationEvent(NavigationEvent event) {

        QName source = (QName)event.getSource();
        QName target = event.getTarget();

        //System.out.println("Navigate to " + target);

        InteractionUnit targetUnit = dialog.findUnit(target);
        if(targetUnit!=null// local to dialog
View Full Code Here

        Map<QName, ModelNode> descriptions = context.get (ContextKey.MODEL_DESCRIPTIONS);

        // TODO (BUG): After the first reification the behaviour is modified,
        // so the predicate might apply to a different unit. As a result the correlation id is different!

        QName correlationId = interactionUnit.findMapping(MappingType.DMR, new Predicate<DMRMapping>() {
            @Override
            public boolean appliesTo(DMRMapping candidate) {
                return candidate.getAddress()!=null;
            }
        }).getCorrelationId();
View Full Code Here

    private InteractionUnit createUnitByName(String name, Node node)
    {
        InteractionUnit unit = null;

        //QName.valueOf(node.getAttributes().getNamedItem("id").getNodeValue());
        QName id = new QName(node.getNamespaceURI(), node.getAttributes().getNamedItem("id").getNodeValue());
        String label = ParseUtils.IDOrLabel(node);

        if("container".equals(name))
        {
            String op = ParseUtils.failSafe(node.getAttributes().getNamedItem("operator"), TemporalOperator.Concurrency.toString());
            unit = new Container(
                    id.getNamespaceURI(), id.getLocalPart(),
                    label,
                    TemporalOperator.valueOf(op)
            );

        }
        else if("input".equals(name))
        {
            unit = new Input(id.getNamespaceURI(), id.getLocalPart(),
                    label);

        }
        else if("output".equals(name))
        {

            unit = new Output(id.getNamespaceURI(), id.getLocalPart(),
                    label);
        }
        else if("select".equals(name))
        {
            unit = new Select(id.getNamespaceURI(), id.getLocalPart(),
                    label);
        }
        else if("trigger".equals(name))
        {
            unit = new Trigger(id.getNamespaceURI(), id.getLocalPart(),
                    QName.valueOf(ParseUtils.failSafe(node.getAttributes().getNamedItem("type"), "")),
                    label);
        }
        else if("link".equals(name))
        {
            unit = new Link(id.getNamespaceURI(), id.getLocalPart(),
                    QName.valueOf(ParseUtils.failSafe(node.getAttributes().getNamedItem("target"), "")),
                    label);
        }
        return unit;
    }
View Full Code Here

        Map<QName, ModelNode> descriptions = context.get (ContextKey.MODEL_DESCRIPTIONS);

         // TODO (BUG): After the first reification the behaviour is modified,
        // so the predicate might apply to a different unit. As a result the correlation id is different!

        QName correlationId = interactionUnit.findMapping(MappingType.DMR, new Predicate<DMRMapping>() {
            @Override
            public boolean appliesTo(DMRMapping candidate) {
                return candidate.getAddress()!=null;
            }
        }).getCorrelationId();
View Full Code Here

        assert context.getUnit().doesProduce() : "The unit associated with a command needs to be a producer";

        InteractionUnit<StereoTypes> unit = context.getUnit();
        Resource<ResourceType> output = unit.getOutputs().iterator().next();

        final QName operationRef = new QName(
                output.getSource().getNamespaceURI(),
                output.getSource().getLocalPart(),
                output.getId().getSuffix()
        );
View Full Code Here

                            );
                        }

                        @Override
                        public void onSystemEvent(SystemEvent event) {
                            QName id = (QName) event.getPayload();

                            Set<Integer> keys = childUnits.keySet();
                            for (Integer key : keys) {
                                if (childUnits.get(key).equals(id)) {
                                    tabLayoutpanel.selectTab(key, false);
View Full Code Here

    @Override
    public InteractionUnit fromXML(Node node) {

        String label = ParseUtils.IDOrLabel(node);

        QName id = new QName(node.getNamespaceURI(), node.getAttributes().getNamedItem("id").getNodeValue());
        Container form = new Container(
                id.getNamespaceURI(), id.getLocalPart(),
                label,
                StereoTypes.PullDown);
        return form;
    }
View Full Code Here

TOP

Related Classes of org.useware.kernel.model.structure.QName

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.