Search in sources :

Example 16 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class FramedResource method processJsonObject.

@SuppressWarnings({ "resource", "unlikely-arg-type" })
private void processJsonObject(final JsonJavaObject jsonItems, final DFramedTransactionalGraph graph, final JsonGraphWriter writer, final ParamMap pm) /* , Map<Object, Object> resultMap */
{
    Map<CaseInsensitiveString, Object> cisMap = new HashMap<CaseInsensitiveString, Object>();
    for (String jsonKey : jsonItems.keySet()) {
        CaseInsensitiveString cis = new CaseInsensitiveString(jsonKey);
        cisMap.put(cis, jsonItems.get(jsonKey));
    }
    List<String> ids = pm.get(Parameters.ID);
    boolean commit = true;
    if (ids == null) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("error", "Cannot POST to frame without an id parameter");
        try {
            writer.outObject(map);
        } catch (JsonException e) {
            throw new WebApplicationException(ErrorHelper.createErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
        } catch (IOException e) {
            throw new WebApplicationException(ErrorHelper.createErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
        }
    } else {
        if (ids.size() == 0) {
            System.out.println("Cannot POST to frame without an id parameter");
            Map<String, String> map = new HashMap<String, String>();
            map.put("error", "Cannot POST to frame without an id parameter");
            try {
                writer.outObject(map);
            } catch (JsonException e) {
                throw new WebApplicationException(ErrorHelper.createErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
            } catch (IOException e) {
                throw new WebApplicationException(ErrorHelper.createErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
            }
        } else {
            for (String id : ids) {
                // System.out.println("TEMP DEBUG POSTing to " + id);
                Class<?> type = null;
                if (pm.getTypes() != null) {
                    List<CharSequence> types = pm.getTypes();
                    String typename = types.get(0).toString();
                    type = graph.getTypeRegistry().findClassByName(typename);
                }
                NoteCoordinate nc = NoteCoordinate.Utils.getNoteCoordinate(id.trim());
                Object element = graph.getElement(nc, type);
                if (element instanceof VertexFrame) {
                    VertexFrame parVertex = (VertexFrame) element;
                    Map<CaseInsensitiveString, Method> adders = graph.getTypeRegistry().getAdders(parVertex.getClass());
                    CaseInsensitiveString rawLabel = new CaseInsensitiveString(jsonItems.getAsString("@label"));
                    Method method = adders.get(rawLabel);
                    if (method == null) {
                        method = adders.get(rawLabel + "In");
                    }
                    if (method != null) {
                        String rawId = jsonItems.getAsString("@id");
                        NoteCoordinate othernc = NoteCoordinate.Utils.getNoteCoordinate(rawId);
                        Object otherElement = graph.getElement(othernc, null);
                        if (otherElement instanceof VertexFrame) {
                            VertexFrame otherVertex = (VertexFrame) otherElement;
                            try {
                                Object result = method.invoke(parVertex, otherVertex);
                                if (result == null) {
                                    System.out.println("Invokation of method " + method.getName() + " on a vertex of type " + DGraphUtils.findInterface(parVertex) + " with an argument of type " + DGraphUtils.findInterface(otherVertex) + " resulted in null when we expected an Edge");
                                }
                                JsonFrameAdapter adapter = new JsonFrameAdapter(graph, (EdgeFrame) result, null, false);
                                Iterator<String> frameProperties = adapter.getJsonProperties();
                                CaseInsensitiveString actionName = null;
                                CaseInsensitiveString preactionName = null;
                                for (CaseInsensitiveString cis : cisMap.keySet()) {
                                    if (cis.equals("%preaction")) {
                                        preactionName = new CaseInsensitiveString(String.valueOf(cisMap.get(cis)));
                                    }
                                }
                                if (preactionName != null) {
                                    commit = adapter.runAction(preactionName);
                                }
                                if (commit) {
                                    while (frameProperties.hasNext()) {
                                        CaseInsensitiveString key = new CaseInsensitiveString(frameProperties.next());
                                        if (!key.startsWith("@")) {
                                            Object value = cisMap.get(key);
                                            if (value != null) {
                                                adapter.putJsonProperty(key.toString(), value);
                                                cisMap.remove(key);
                                            }
                                        }
                                    }
                                    for (CaseInsensitiveString cis : cisMap.keySet()) {
                                        if (cis.equals("%action")) {
                                            actionName = new CaseInsensitiveString(String.valueOf(cisMap.get(cis)));
                                        } else if (!cis.startsWith("@")) {
                                            Object value = cisMap.get(cis);
                                            if (value != null) {
                                                adapter.putJsonProperty(cis.toString(), value);
                                            }
                                        }
                                    }
                                    adapter.updateReadOnlyProperties();
                                    if (actionName != null) {
                                        commit = adapter.runAction(actionName);
                                    }
                                }
                                writer.outObject(result);
                            } catch (Exception e) {
                                throw new WebApplicationException(ErrorHelper.createErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
                            }
                        } else {
                            throw new WebApplicationException(ErrorHelper.createErrorResponse("otherElement is not a VertexFrame. It's a " + (otherElement == null ? "null" : DGraphUtils.findInterface(otherElement).getName()), Response.Status.INTERNAL_SERVER_ERROR));
                        }
                    } else {
                        Class[] interfaces = element.getClass().getInterfaces();
                        String intList = "";
                        for (Class inter : interfaces) {
                            intList = intList + inter.getName() + ", ";
                        }
                        String methList = "";
                        for (CaseInsensitiveString key : adders.keySet()) {
                            methList = methList + key.toString() + ", ";
                        }
                        throw new WebApplicationException(ErrorHelper.createErrorResponse("No method found for " + rawLabel + " on element " + intList + ": " + ((VertexFrame) element).asVertex().getId() + " methods " + methList, Response.Status.INTERNAL_SERVER_ERROR));
                    }
                } else {
                    throw new WebApplicationException(ErrorHelper.createErrorResponse("Element is null", Response.Status.INTERNAL_SERVER_ERROR));
                }
            }
        }
        if (commit) {
            graph.commit();
        } else {
            graph.rollback();
        }
    }
}
Also used : JsonException(com.ibm.commons.util.io.json.JsonException) NoteCoordinate(org.openntf.domino.big.NoteCoordinate) WebApplicationException(javax.ws.rs.WebApplicationException) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) IOException(java.io.IOException) Method(java.lang.reflect.Method) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) KeyNotFoundException(org.openntf.domino.graph2.impl.DEdgeEntryList.KeyNotFoundException) JsonException(com.ibm.commons.util.io.json.JsonException) WebApplicationException(javax.ws.rs.WebApplicationException) UserAccessException(org.openntf.domino.exceptions.UserAccessException) IOException(java.io.IOException) DVertexFrame(org.openntf.domino.graph2.builtin.DVertexFrame) VertexFrame(com.tinkerpop.frames.VertexFrame) JsonJavaObject(com.ibm.commons.util.io.json.JsonJavaObject)

Example 17 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class SessionsByTrack method run.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void run() {
    HashMap<String, String> trackLkup = new HashMap<String, String>();
    trackLkup.put("Special", "Sp");
    trackLkup.put("Strategy/Deployment", "Str");
    trackLkup.put("Administration", "Adm");
    trackLkup.put("Development", "Dev");
    trackLkup.put("Business", "Bus");
    trackLkup.put("Commercial", "Comm");
    long testStartTime = System.nanoTime();
    marktime = System.nanoTime();
    try {
        timelog("Beginning Sessions By Track...");
        FramedGraph<DGraph> graph2 = new ConferenceGraph().getFramedGraph();
        Iterable<Sponsor> sponsors = graph2.getVertices("Level", Level.BRONZE, Sponsor.class);
        for (Sponsor s : sponsors) {
            System.out.println("Sponsor " + s.getName() + " - " + s.getUrl());
        }
        ConferenceGraph graph = new ConferenceGraph();
        for (Entry<String, String> track : trackLkup.entrySet()) {
            System.out.println("Outputting sessions ordered by ID for " + track.getKey());
            Track dev = graph.getFramedGraph().getVertex(track.getValue(), Track.class);
            System.out.println(dev.getDescription());
            Iterable<Presentation> presentations = dev.getIncludesSessions();
            Ordering<DVertexFrame> ord = Ordering.from(new DVertexFrameComparator("SessionID"));
            List<Presentation> presOrdered = ord.sortedCopy(presentations);
            for (Presentation pres : presOrdered) {
                Attendee att = pres.getPresentingAttendees().iterator().next();
                System.out.println(att.getFullname());
                System.out.println(pres.getSessionId() + ": " + pres.getTitle());
            }
        }
        for (Entry<String, String> track : trackLkup.entrySet()) {
            System.out.println("Outputting sessions ordered by Title for " + track.getKey());
            Track dev = graph.getFramedGraph().getVertex(track.getValue(), Track.class);
            Iterable<Presentation> presentations = dev.getIncludesSessions();
            Ordering<DVertexFrame> ord = Ordering.from(new DVertexFrameComparator("SessionTitle"));
            List<Presentation> presOrdered = ord.sortedCopy(presentations);
            for (Presentation pres : presOrdered) {
                System.out.println(pres.getSessionId() + ": " + pres.getTitle());
            }
        }
        System.out.println("OUTPUTTING SORTBY");
        FramedVertexList<Sponsor> sponsors2 = (FramedVertexList<Sponsor>) graph2.getVertices(null, null, Sponsor.class);
        List<CaseInsensitiveString> keys = new ArrayList<CaseInsensitiveString>();
        keys.add(new CaseInsensitiveString("Level"));
        keys.add(new CaseInsensitiveString("Name"));
        sponsors2.sortBy((List<CharSequence>) (List<?>) keys, true);
        for (Sponsor spon : sponsors2) {
            System.out.println(spon.getLevel().name() + " - " + spon.getName());
        }
        // Throws java.lang.ClassCastException: com.sun.proxy.$Proxy11 incompatible with com.tinkerpop.blueprints.Vertex
        // Yet to track down why
        List<Presentation> presentations = Lists.newArrayList(graph.getFramedGraph().getVertices(null, null, Presentation.class));
        // GremlinPipeline pipe = new GremlinPipeline(presentations).outE("PresentedBy").outV().dedup();
        GremlinPipeline pipe = new GremlinPipeline(presentations).outE("PresentedBy");
        List<DEdge> edges = pipe.toList();
        for (DEdge edge : edges) {
            System.out.println(edge.getVertex(Direction.OUT).getId());
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
    long testEndTime = System.nanoTime();
    System.out.println("Completed " + getClass().getSimpleName() + " run in " + ((testEndTime - testStartTime) / 1000000) + " ms");
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) DGraph(org.openntf.domino.graph2.impl.DGraph) FramedVertexList(org.openntf.domino.graph2.annotations.FramedVertexList) FramedVertexList(org.openntf.domino.graph2.annotations.FramedVertexList) ArrayList(java.util.ArrayList) List(java.util.List) GremlinPipeline(com.tinkerpop.gremlin.java.GremlinPipeline) DVertexFrameComparator(org.openntf.domino.graph2.builtin.DVertexFrameComparator) Sponsor(org.openntf.conference.graph.Sponsor) Presentation(org.openntf.conference.graph.Presentation) ConferenceGraph(org.openntf.conference.graph.ConferenceGraph) Attendee(org.openntf.conference.graph.Attendee) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) DVertexFrame(org.openntf.domino.graph2.builtin.DVertexFrame) Track(org.openntf.conference.graph.Track) DEdge(org.openntf.domino.graph2.DEdge)

Example 18 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class FramedResource method processJsonUpdate.

@SuppressWarnings("unlikely-arg-type")
private void processJsonUpdate(final JsonJavaObject jsonItems, final DFramedTransactionalGraph graph, final JsonGraphWriter writer, final ParamMap pm, final boolean isPut) throws JsonException, IOException {
    Map<CaseInsensitiveString, Object> cisMap = new HashMap<CaseInsensitiveString, Object>();
    for (String jsonKey : jsonItems.keySet()) {
        CaseInsensitiveString cis = new CaseInsensitiveString(jsonKey);
        cisMap.put(cis, jsonItems.get(jsonKey));
    }
    List<String> ids = pm.get(Parameters.ID);
    boolean commit = true;
    if (ids.size() == 0) {
    // TODO no id
    } else {
        JsonFrameAdapter adapter = null;
        for (String id : ids) {
            NoteCoordinate nc = NoteCoordinate.Utils.getNoteCoordinate(id.trim());
            Object element = graph.getElement(nc, null);
            if (element instanceof EdgeFrame) {
                adapter = new JsonFrameAdapter(graph, (EdgeFrame) element, null, false);
            } else if (element instanceof VertexFrame) {
                adapter = new JsonFrameAdapter(graph, (VertexFrame) element, null, false);
            } else if (element == null) {
                throw new RuntimeException("Cannot force a metaversalid through REST API. Requested URL: " + ODAGraphService.getCurrentRequest().getRequestURI());
            } else {
                throw new RuntimeException(// TODO
                "TODO. Requested URL: " + ODAGraphService.getCurrentRequest().getRequestURI());
            }
            Iterator<String> frameProperties = adapter.getJsonProperties();
            CaseInsensitiveString actionName = null;
            CaseInsensitiveString preactionName = null;
            List<Object> actionArguments = null;
            for (CaseInsensitiveString cis : cisMap.keySet()) {
                if (cis.equals("%preaction")) {
                    preactionName = new CaseInsensitiveString(String.valueOf(cisMap.get(cis)));
                }
                if (cis.equals("%args")) {
                    Object result = cisMap.get(cis);
                    if (result instanceof List) {
                        actionArguments = (List) result;
                    }
                }
            }
            if (preactionName != null) {
                if (actionArguments != null) {
                    commit = adapter.runAction(preactionName, actionArguments);
                } else {
                    commit = adapter.runAction(preactionName);
                }
            }
            if (commit) {
                while (frameProperties.hasNext()) {
                    CaseInsensitiveString key = new CaseInsensitiveString(frameProperties.next());
                    if (!key.startsWith("@") && !key.startsWith("%")) {
                        Object value = cisMap.get(key);
                        if (value != null) {
                            adapter.putJsonProperty(key.toString(), value);
                            cisMap.remove(key);
                        } else if (isPut) {
                            adapter.putJsonProperty(key.toString(), value);
                        }
                    }
                }
                for (CaseInsensitiveString cis : cisMap.keySet()) {
                    if (cis.equals("%action")) {
                        actionName = new CaseInsensitiveString(String.valueOf(cisMap.get(cis)));
                    } else if (!cis.startsWith("@") && !cis.startsWith("%")) {
                        Object value = cisMap.get(cis);
                        if (value != null) {
                            adapter.putJsonProperty(cis.toString(), value);
                        }
                    }
                }
                adapter.updateReadOnlyProperties();
                if (actionName != null) {
                    if (actionArguments != null) {
                        commit = adapter.runAction(actionName, actionArguments);
                    } else {
                        commit = adapter.runAction(actionName);
                    }
                }
            }
            writer.outObject(element);
        }
        if (commit) {
            graph.commit();
        } else {
            graph.rollback();
        }
    }
}
Also used : NoteCoordinate(org.openntf.domino.big.NoteCoordinate) DEdgeFrame(org.openntf.domino.graph2.builtin.DEdgeFrame) EdgeFrame(com.tinkerpop.frames.EdgeFrame) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) DVertexFrame(org.openntf.domino.graph2.builtin.DVertexFrame) VertexFrame(com.tinkerpop.frames.VertexFrame) JsonJavaObject(com.ibm.commons.util.io.json.JsonJavaObject) List(java.util.List) ArrayList(java.util.ArrayList)

Example 19 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class JsonFrameAdapter method getJsonProperties.

@Override
public Iterator<String> getJsonProperties() {
    // System.out
    // .println("TEMP DEBUG getting Json properties list for a frame of type
    // "
    // + frame_.getClass().getName());
    List<String> result = new ArrayList<String>();
    // if (getActionsParam() != null) {
    // for (CharSequence cis : getActionsParam()) {
    // result.add("%" + cis.toString());
    // }
    // }
    result.add("@id");
    result.add("@type");
    result.add("@editable");
    if (getIncludeDebug()) {
        result.add("@debug");
    }
    if (getFrame() instanceof VertexFrame) {
        result.add("@versions");
    }
    Collection<CharSequence> props = getProperties();
    if (props == null) {
        // NoteCoordinate nc = (NoteCoordinate)
        // ((VertexFrame)frame_).asVertex().getId();
        props = new ArrayList<CharSequence>();
        props.addAll(getGetters().keySet());
        Class<?> klazz = frame_.getClass();
        boolean incl = isInclusive(klazz);
        // }
        if (props == null || props.size() < 5 || incl) {
            if (frame_ instanceof DVertexFrame) {
                try {
                    Set<String> raw = ((DVertexFrame) frame_).asVertex().getPropertyKeys();
                    // Set<CharSequence> raw = ((DVertexFrame) frame_).asMap().keySet();
                    // System.out.println("TEMP DEBUG raw vertex has " + raw.size() + " properties");
                    props.addAll(CaseInsensitiveString.toCaseInsensitive(raw));
                } catch (Throwable t) {
                    Throwable cause = t.getCause();
                    if (cause != null) {
                        System.err.println("Exception trying to process a frame of type " + DGraphUtils.findInterface(frame_) + " resulting in a " + cause.getClass().getSimpleName());
                        cause.printStackTrace();
                        try {
                            throw cause;
                        } catch (Throwable e) {
                            e.printStackTrace();
                        }
                    }
                }
            } else if (frame_ instanceof DEdgeFrame) {
            // Set<CharSequence> raw = ((DEdgeFrame)
            // frame_).asMap().keySet();
            // props.addAll(CaseInsensitiveString.toCaseInsensitive(raw));
            }
        }
    }
    for (CharSequence cis : props) {
        result.add(cis.toString());
    // System.out.println("Adding " + cis.toString());
    }
    Object frame = getFrame();
    if (frame instanceof VertexFrame && getIncludeEdges()) {
        result.add("@edges");
    }
    if (getIncludeActions()) {
        result.add("@actions");
    }
    if (frame instanceof VertexFrame && getIncludeCounts()) {
        for (CaseInsensitiveString key : getCounters().keySet()) {
            result.add("@counts" + key.toString());
        }
    }
    if (frame instanceof VertexFrame) {
        Vertex v = ((VertexFrame) frame).asVertex();
        if (v instanceof DProxyVertex) {
            result.add("@proxyid");
        }
    }
    if (frame instanceof VertexFrame && getLabels() != null) {
        for (CharSequence cis : getLabels()) {
            result.add("#" + cis.toString());
        }
    }
    if (frame instanceof EdgeFrame) {
        result.add("@in");
        result.add("@out");
        result.add("@label");
    }
    if (frame instanceof ViewVertex) {
        result.add("@columninfo");
    }
    // }
    if (frame instanceof ViewVertex.Contains) {
        Edge edge = ((ViewVertex.Contains) frame).asEdge();
        if (edge instanceof DEdge) {
            result.addAll(((DEdge) edge).getDelegate().keySet());
        }
    }
    Collection<CharSequence> hideProps = getHideProperties();
    if (hideProps != null && !hideProps.isEmpty()) {
        for (CharSequence cis : hideProps) {
            result.remove(cis.toString());
        }
    }
    // System.out.println("TEMP DEBUG getting properties for a " + DGraphUtils.getInterfaceList(frame) + " -- " + Strings.getString(result, ","));
    return result.iterator();
}
Also used : ViewVertex(org.openntf.domino.graph2.builtin.ViewVertex) DVertex(org.openntf.domino.graph2.impl.DVertex) Vertex(com.tinkerpop.blueprints.Vertex) DbInfoVertex(org.openntf.domino.graph2.builtin.DbInfoVertex) DProxyVertex(org.openntf.domino.graph2.impl.DProxyVertex) DProxyVertex(org.openntf.domino.graph2.impl.DProxyVertex) EdgeFrame(com.tinkerpop.frames.EdgeFrame) DEdgeFrame(org.openntf.domino.graph2.builtin.DEdgeFrame) ArrayList(java.util.ArrayList) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) DVertexFrame(org.openntf.domino.graph2.builtin.DVertexFrame) DVertexFrame(org.openntf.domino.graph2.builtin.DVertexFrame) VertexFrame(com.tinkerpop.frames.VertexFrame) ViewVertex(org.openntf.domino.graph2.builtin.ViewVertex) DEdgeFrame(org.openntf.domino.graph2.builtin.DEdgeFrame) JsonJavaObject(com.ibm.commons.util.io.json.JsonJavaObject) JsonObject(com.ibm.commons.util.io.json.JsonObject) DEdge(org.openntf.domino.graph2.impl.DEdge) Edge(com.tinkerpop.blueprints.Edge) DEdge(org.openntf.domino.graph2.impl.DEdge)

Example 20 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class JsonFrameAdapter method putJsonProperty.

@Override
public void putJsonProperty(final String paramKey, Object value) {
    Object frame = getFrame();
    if (frame != null) {
        CaseInsensitiveString key = new CaseInsensitiveString(paramKey);
        Method crystal = getSetters().get(key);
        if (crystal != null) {
            try {
                Class<?>[] types = crystal.getParameterTypes();
                Class<?> type = types[0];
                if (value == null) {
                    String propName = null;
                    TypedProperty tprop = crystal.getAnnotation(TypedProperty.class);
                    if (tprop != null) {
                        propName = tprop.value();
                    } else {
                        Property prop = crystal.getAnnotation(Property.class);
                        if (prop != null) {
                            propName = prop.value();
                        }
                    }
                    if (propName != null) {
                        if (frame instanceof VertexFrame) {
                            ((VertexFrame) frame).asVertex().setProperty(propName, null);
                        } else if (frame instanceof EdgeFrame) {
                            ((EdgeFrame) frame).asEdge().setProperty(propName, null);
                        }
                    } else {
                        System.err.println("ALERT the next operation will probably throw an exception");
                        Object[] nullarg = { type.cast(null) };
                        crystal.invoke(frame, nullarg);
                    }
                } else if (!type.isAssignableFrom(value.getClass())) {
                    value = TypeUtils.convertToTarget(value, type, org.openntf.domino.utils.Factory.getSession(SessionType.CURRENT));
                    crystal.invoke(frame, value);
                } else if (JsonJavaObject.class.equals(type)) {
                    // FIXME NTF this is a complete hack :(
                    TypedProperty prop = crystal.getAnnotation(TypedProperty.class);
                    String itemname = prop.value();
                    if (frame instanceof DVertexFrame) {
                        Document doc = ((DVertexFrame) frame).asDocument();
                        TypeUtils.writeToItem(doc, itemname, value, false);
                    }
                } else {
                    crystal.invoke(frame, value);
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else {
            Method man = getGetters().get(key);
            if (man == null) {
                // undefined property
                if (frame instanceof EdgeFrame) {
                    ((EdgeFrame) frame).asEdge().setProperty(paramKey, value);
                } else if (frame instanceof VertexFrame) {
                    ((VertexFrame) frame).asVertex().setProperty(paramKey, value);
                }
            } else {
            // NTF if there is a getter but no setter, this is a
            // read-only property. Disregard the JSON
            }
        }
    }
}
Also used : EdgeFrame(com.tinkerpop.frames.EdgeFrame) DEdgeFrame(org.openntf.domino.graph2.builtin.DEdgeFrame) Method(java.lang.reflect.Method) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) Document(org.openntf.domino.Document) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) UserAccessException(org.openntf.domino.exceptions.UserAccessException) DVertexFrame(org.openntf.domino.graph2.builtin.DVertexFrame) DVertexFrame(org.openntf.domino.graph2.builtin.DVertexFrame) VertexFrame(com.tinkerpop.frames.VertexFrame) JsonJavaObject(com.ibm.commons.util.io.json.JsonJavaObject) JsonObject(com.ibm.commons.util.io.json.JsonObject) Property(com.tinkerpop.frames.Property) TypedProperty(org.openntf.domino.graph2.annotations.TypedProperty) TypedProperty(org.openntf.domino.graph2.annotations.TypedProperty)

Aggregations

CaseInsensitiveString (org.openntf.domino.types.CaseInsensitiveString)34 Map (java.util.Map)15 LinkedHashMap (java.util.LinkedHashMap)13 Document (org.openntf.domino.Document)13 Set (java.util.Set)12 JsonJavaObject (com.ibm.commons.util.io.json.JsonJavaObject)11 ArrayList (java.util.ArrayList)11 HashSet (java.util.HashSet)11 EdgeFrame (com.tinkerpop.frames.EdgeFrame)10 VertexFrame (com.tinkerpop.frames.VertexFrame)10 HashMap (java.util.HashMap)9 DVertexFrame (org.openntf.domino.graph2.builtin.DVertexFrame)9 Method (java.lang.reflect.Method)8 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)8 JsonObject (com.ibm.commons.util.io.json.JsonObject)7 UserAccessException (org.openntf.domino.exceptions.UserAccessException)7 List (java.util.List)6 DEdgeFrame (org.openntf.domino.graph2.builtin.DEdgeFrame)6 DbInfoVertex (org.openntf.domino.graph2.builtin.DbInfoVertex)5 ViewVertex (org.openntf.domino.graph2.builtin.ViewVertex)5