Package com.tinkerpop.frames

Examples of com.tinkerpop.frames.FramedGraph


public class FramedGraphQueryImplTest {
 
  @Test
  public void testDelegation() {
    GraphQuery mockGraphQuery = mock(GraphQuery.class);
    FramedGraph framedGraph = new FramedGraphFactory().create(null);
   
    FramedGraphQueryImpl query = new FramedGraphQueryImpl(framedGraph, mockGraphQuery);
    stub(mockGraphQuery.has("")).toReturn(mockGraphQuery);
    query.has("");
    verify(mockGraphQuery).has("");
View Full Code Here


        if (element instanceof Edge && direction == null) {
            throw new IllegalArgumentException("Direction cannot be null");
        }

        ExtensionResponse extensionResponse;
        FramedGraph framedGraph = factory.create(graph);

        ExtensionConfiguration extensionConfig = rexsterResourceContext.getRexsterApplicationGraph()
                .findExtensionConfiguration(EXTENSION_NAMESPACE, EXTENSION_NAME);
        Map<String, String> mapFrames = extensionConfig.tryGetMapFromConfiguration();

        if (mapFrames != null && !mapFrames.isEmpty()) {
            UriInfo uriInfo = rexsterResourceContext.getUriInfo();
            List<PathSegment> pathSegmentList = uriInfo.getPathSegments();

            String domainObjectMappingName = "";
            if (pathSegmentList.size() > 6) {
                domainObjectMappingName = pathSegmentList.get(6).getPath();
            }

            if (domainObjectMappingName.isEmpty()) {
                return ExtensionResponse.error(
                        "A Frames class was not specified in the URI", generateErrorJson());
            }

            String frameClassName = mapFrames.get(domainObjectMappingName);
            if (frameClassName == null || frameClassName.isEmpty()) {
                return ExtensionResponse.error(
                        "Frames configuration does not contain a Frames class for " + domainObjectMappingName, generateErrorJson());
            }

            try {
                Class clazz = Class.forName(frameClassName);
                Object obj = null;

                if (element instanceof Vertex) {
                    obj = framedGraph.frame((Vertex) element, clazz);
                } else if (element instanceof Edge) {
                    obj = framedGraph.frame((Edge) element, Direction.BOTH, clazz);
                }

                Map map = new HashMap();

                Method[] methods = clazz.getMethods();
View Full Code Here

TOP

Related Classes of com.tinkerpop.frames.FramedGraph

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.