Package org.qi4j.library.rest.common.link

Examples of org.qi4j.library.rest.common.link.Link


        } ).onQuery( "commandwithvalue", new ResultHandler<Links>()
        {
            @Override
            public HandlerCommand handleResult( Links result, ContextResourceClient client )
            {
                Link link = LinksUtil.withId( "right", result );

                return command( link );
            }
        } ).onCommand( "commandwithvalue", new ResponseHandler()
        {
View Full Code Here


                return query( "commandwithvalue" ).onSuccess( new ResultHandler<Links>()
                {
                    @Override
                    public HandlerCommand handleResult( Links result, ContextResourceClient client )
                    {
                        Link link = LinksUtil.withId( "right", result );

                        return command( link ).onSuccess( new ResponseHandler()
                        {
                            @Override
                            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
View Full Code Here

        for( Method query : resourceQueries )
        {
            if( constraints.isValid( query, objectSelection, module ) )
            {
                ValueBuilder<Link> linkBuilder = module.newValueBuilder( Link.class );
                Link prototype = linkBuilder.prototype();
                prototype.classes().set( "query" );
                prototype.text().set( humanReadable( query.getName() ) );
                prototype.href().set( query.getName().toLowerCase() );
                prototype.rel().set( query.getName().toLowerCase() );
                prototype.id().set( query.getName().toLowerCase() );
                queriesProperty.add( linkBuilder.newInstance() );
            }
        }

        List<Link> commandsProperty = builder.prototype().commands().get();
        for( Method command : resourceCommands )
        {
            if( constraints.isValid( command, objectSelection, module ) )
            {
                ValueBuilder<Link> linkBuilder = module.newValueBuilder( Link.class );
                Link prototype = linkBuilder.prototype();
                prototype.classes().set( "command" );
                prototype.text().set( humanReadable( command.getName() ) );
                prototype.href().set( command.getName().toLowerCase() );
                prototype.rel().set( command.getName().toLowerCase() );
                prototype.id().set( command.getName().toLowerCase() );
                commandsProperty.add( linkBuilder.newInstance() );
            }
        }

        List<Link> resourcesProperty = builder.prototype().resources().get();
        for( Method subResource : subResources.values() )
        {
            if( constraints.isValid( subResource, objectSelection, module ) )
            {
                ValueBuilder<Link> linkBuilder = module.newValueBuilder( Link.class );
                Link prototype = linkBuilder.prototype();
                prototype.classes().set( "resource" );
                prototype.text().set( humanReadable( subResource.getName() ) );
                prototype.href().set( subResource.getName().toLowerCase() + "/" );
                prototype.rel().set( subResource.getName().toLowerCase() );
                prototype.id().set( subResource.getName().toLowerCase() );
                resourcesProperty.add( linkBuilder.newInstance() );
            }
        }

        try
View Full Code Here

                return true;
            }
            else
            {
                response.setStatus( Status.REDIRECTION_TEMPORARY );
                Link link = (Link) result;
                Reference reference = new Reference( response.getRequest().getResourceRef(), link.href().get() );
                response.setLocationRef( reference );
                return true;
            }
        }
        else if( result instanceof Links )
View Full Code Here

        } ).onQuery( "runbuild", new ResultHandler<Links>()
        {
            @Override
            public HandlerCommand handleResult( Links result, ContextResourceClient client )
            {
                Link link = LinksUtil.withId( "any", result );

                return command( link );
            }
        } ).onCommand( "runbuild", new ResponseHandler()
        {
View Full Code Here

                return query( "runbuild" ).onSuccess( new ResultHandler<Links>()
                {
                    @Override
                    public HandlerCommand handleResult( Links result, ContextResourceClient client )
                    {
                        Link link = LinksUtil.withId( "any", result );

                        return command( link ).onSuccess( new ResponseHandler()
                        {
                            @Override
                            public HandlerCommand handleResponse( Response response, ContextResourceClient client )
View Full Code Here

TOP

Related Classes of org.qi4j.library.rest.common.link.Link

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.