Package org.jboss.mbui.gui.behaviour

Examples of org.jboss.mbui.gui.behaviour.StatementContext


        private void addStep(InteractionUnit interactionUnit)
        {
            InteractionCoordinator coordinator = context.get(ContextKey.COORDINATOR);

            final StatementContext delegate = coordinator.getStatementScope().getContext(interactionUnit.getId());
            assert delegate != null : "StatementContext not provided";

            DMRMapping mapping = (DMRMapping) interactionUnit.findMapping(DMR, new Predicate<DMRMapping>()
            {
                @Override
                public boolean appliesTo(final DMRMapping candidate)
                {
                    // the read-resource operation only needs the address of a resource
                    // hence we can skip mapping without address declarations (i.e. just attributes)
                    return candidate.getAddress() != null;
                }
            });
            if (mapping != null)
            {
                String address = mapping.getAddress();
                if (!resolvedAdresses.contains(address))
                {
                    AddressMapping addressMapping = AddressMapping.fromString(address);
                    ModelNode op = addressMapping.asResource(new DelegatingStatementContext()
                    {
                        @Override
                        public String resolve(String key)
                        {
                            // fallback strategy for values that are created at runtime, i.e. datasource={selected.entity}
                            String resolved = delegate.resolve(key);
                            if (null == resolved) { resolved = "*"; }
                            return resolved;
                        }

                        @Override
                        public String[] resolveTuple(String key)
                        {
                            return delegate.resolveTuple(key);
                        }

                        @Override
                        public LinkedList<String> collect(String key) {
                            LinkedList<String> items = new LinkedList<String>();
View Full Code Here


        private void addStep(Trigger<StereoTypes> interactionUnit)
        {
            InteractionCoordinator coordinator = context.get(ContextKey.COORDINATOR);

            final StatementContext delegate = coordinator.getStatementScope().getContext(interactionUnit.getId());
            assert delegate != null : "StatementContext not provided";
            assert interactionUnit.doesProduce();

            Resource<ResourceType> output = interactionUnit.getOutputs().iterator().next();

            // skip unqualified trigger that don't point to a resource operation
            if(!output.getId().equalsIgnoreSuffix(RESOURCE_OP))
                return;

            String operationName = output.getId().getSuffix();
            if(operationName==null)
                throw new IllegalArgumentException("Illegal operation name mapping: "+ output.getId()+ " (suffix required)");

            DMRMapping mapping = interactionUnit.findMapping(DMR);
            String address = mapping.getAddress();

            if (!resolvedOperations.contains(output.getId()))
            {
                AddressMapping addressMapping = AddressMapping.fromString(address);
                ModelNode op = addressMapping.asResource(new DelegatingStatementContext()
                {
                    @Override
                    public String resolve(String key)
                    {
                        // fallback strategy for values that are created at runtime, i.e. datasource={selected.entity}
                        String resolved = delegate.resolve(key);
                        if (null == resolved) { resolved = "*"; }
                        return resolved;
                    }

                    @Override
                    public String[] resolveTuple(String key)
                    {
                        return delegate.resolveTuple(key);
                    }

                    @Override
                    public LinkedList<String> collect(String key) {
                        LinkedList<String> items = new LinkedList<String>();
View Full Code Here

    }

    private void saveResource(final String name, AddressMapping address, HashMap<String, Object> changeset) {

        StatementContext statementContext = statementScope.getContext(unit.getId());

        ModelNodeAdapter adapter = new ModelNodeAdapter();

        ModelNode operation = adapter.fromChangeset(
                changeset,
View Full Code Here

    }

    private void loadResource(final String name, AddressMapping address) {

        // TODO: resolve once and re-use
        StatementContext statementContext = statementScope.getContext(unit.getId());

        final ModelNode operation = address.asResource(statementContext);
        operation.get(OP).set(READ_RESOURCE_OPERATION);
        operation.get(INCLUDE_RUNTIME).set(true);
View Full Code Here

TOP

Related Classes of org.jboss.mbui.gui.behaviour.StatementContext

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.