Package org.openbel.framework.ws.core

Examples of org.openbel.framework.ws.core.RequestException


        }

        // Make sure a KAM was specified in the request
        KamHandle hndl = request.getHandle();
        if (hndl == null || hndl.getHandle() == null) {
            throw new RequestException(KAM_REQUEST_NO_HANDLE);
        }

        EdgeFilter filter = request.getFilter();
        if (filter == null) {
            throw new RequestException("Filter is missing.");
        }

        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());
View Full Code Here


        }

        // Make sure a KamNode was specified
        KamNode kamNode = request.getKamNode();
        if (null == kamNode) {
            throw new RequestException("KamNode payload is missing");
        }

        // See if we got a DirectionType to use
        org.openbel.framework.api.EdgeDirectionType direction =
                null;
        EdgeDirectionType edgeDirectionType = request.getDirection();
        if (null != edgeDirectionType) {
            direction = convert(edgeDirectionType);
        }

        // Get the real Kam from the KamCache
        KamStoreObjectRef kamElementRef;
        try {
            kamElementRef = Converter.decodeNode(kamNode);
        } catch (InvalidIdException e) {
            throw new RequestException("Error processing KAM node", e);
        }

        org.openbel.framework.api.Kam objKam;
        final KamInfo kamInfo = getKamInfo(kamElementRef,
                "Error processing KAM node");
        objKam = kamCacheService.getKam(kamInfo.getName());

        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());
        if (dialect != null) {
            objKam = new KamDialect(objKam, dialect);
        }

        if (objKam == null) {
            throw new RequestException("Error processing KAM node",
                    new InvalidIdException(kamElementRef.getEncodedString()));
        }

        final org.openbel.framework.api.NodeFilter nodes =
                convertNodeFilterInRequest(
View Full Code Here

        }

        // Make sure a KamNode was specified
        KamNode kamNode = request.getKamNode();
        if (kamNode == null) {
            throw new RequestException("KamNode payload is missing");
        }

        if (kamNode.getFunction() == null) {
            final String msg = "KAM node is missing function";
            throw new RequestException(msg);
        }
        if (noLength(kamNode.getId())) {
            final String msg = "KAM node is missing id";
            throw new RequestException(msg);
        }
        if (noLength(kamNode.getLabel())) {
            final String msg = "KAM node is missing label";
            throw new RequestException(msg);
        }

        // See if we got a DirectionType to use
        org.openbel.framework.api.EdgeDirectionType direction =
                null;
        EdgeDirectionType edgeDirectionType = request.getDirection();
        if (edgeDirectionType != null) {
            direction = convert(edgeDirectionType);
        }

        // Get the real Kam from the KamCache
        KamStoreObjectRef kamElementRef;
        try {
            kamElementRef = Converter.decodeNode(kamNode);
        } catch (InvalidIdException e) {
            throw new RequestException("Error processing KAM node", e);
        }

        final KamInfo kamInfo = getKamInfo(kamElementRef,
                "Error processing KAM node");
        org.openbel.framework.api.Kam objKam;
        objKam = kamCacheService.getKam(kamInfo.getName());
        if (objKam == null) {
            throw new RequestException("Error processing KAM node",
                    new InvalidIdException(kamElementRef.getEncodedString()));
        }
        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());
        if (dialect != null) {
View Full Code Here

            throw new MissingRequest(FIND_KAM_NODES_BY_NAMESPACE_VALUES_REQUEST);
        }

        final KamHandle kamHandle = request.getHandle();
        if (null == kamHandle) {
            throw new RequestException("Handle is missing");
        }

        if (request.getNamespaceValues() == null
                || request.getNamespaceValues().isEmpty()) {
            throw new RequestException("At least 1 NamespaceValue is required");
        }

        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());
        final org.openbel.framework.api.Kam objKam = getKam(
View Full Code Here

                .getHandle());

        if (dialect == null) {
            final String fmt = DIALECT_REQUEST_NO_DIALECT_FOR_HANDLE;
            final String msg = format(fmt, dialectHandle.getHandle());
            throw new RequestException(msg);
        }

        return dialect;
    }
View Full Code Here

        objKam = kamCacheService.getKam(kamHandle.getHandle());

        if (objKam == null) {
            final String fmt = KAM_REQUEST_NO_KAM_FOR_HANDLE;
            final String msg = format(fmt, kamHandle.getHandle());
            throw new RequestException(msg);
        }
        return dialect == null ? objKam : new KamDialect(objKam, dialect);
    }
View Full Code Here

        KamInfo kamInfo = null;
        try {
            kamInfo = kamCatalogDao
                    .getKamInfoById(kamElementRef.getKamInfoId());
        } catch (SQLException e) {
            throw new RequestException(errorMsg, e);
        }
        if (kamInfo == null) {
            throw new RequestException(errorMsg, new InvalidIdException(
                    kamElementRef.getEncodedString()));
        }
        return kamInfo;
    }
View Full Code Here

            throw new MissingRequest(RESOLVE_NODES_REQUEST);
        }

        final KamHandle handle = request.getHandle();
        if (handle == null) {
            throw new RequestException("KamHandle payload is missing");
        }

        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());

        final org.openbel.framework.api.Kam kam = verifyKam(handle, dialect);

        final List<Node> nodes = request.getNodes();
        if (nodes.isEmpty()) {
            throw new RequestException("No node to resolve");
        }

        final ResolveNodesResponse response = OBJECT_FACTORY
                .createResolveNodesResponse();

        try {
            List<KamNode> kamNodes = resolverService.resolveNodes(kam, nodes);
            for (final KamNode kamNode : kamNodes) {
                response.getKamNodes().add(kamNode);
            }

            return response;
        } catch (ResolverServiceException e) {
            final String msg = "error resolving nodes";
            throw new RequestException(msg, e);
        }
    }
View Full Code Here

            throw new MissingRequest(RESOLVE_EDGES_REQUEST);
        }

        final KamHandle handle = request.getHandle();
        if (handle == null) {
            throw new RequestException("KamHandle payload is missing");
        }

        // Get the Dialect (may be null)
        final Dialect dialect = getDialect(request.getDialect());

        final org.openbel.framework.api.Kam kam = verifyKam(handle, dialect);

        final List<Edge> edges = request.getEdges();
        if (edges.isEmpty()) {
            throw new RequestException("No edge to resolve");
        }

        // Sanity check the edges (see #83)
        for (final Edge e : edges) {
            Node src = e.getSource(), tgt = e.getTarget();
            if (src == null || tgt == null) {
                final String msg = "edge missing source and target nodes";
                throw new RequestException(msg);
            }
            RelationshipType rel = e.getRelationship();
            if (rel == null) {
                final String msg = "edge missing relationship";
                throw new RequestException(msg);
            }
            if (noLength(src.getLabel())) {
                final String msg = "edge source node label is missing";
                throw new RequestException(msg);
            }
            if (noLength(tgt.getLabel())) {
                final String msg = "edge target node label is missing";
                throw new RequestException(msg);
            }
        }

        final ResolveEdgesResponse response = OBJECT_FACTORY
                .createResolveEdgesResponse();

        try {
            List<KamEdge> kamEdges = resolverService.resolveEdges(kam, edges);
            for (final KamEdge kamEdge : kamEdges) {
                response.getKamEdges().add(kamEdge);
            }

            return response;
        } catch (ResolverServiceException e) {
            final String msg = "error resolving edges";
            throw new RequestException(msg, e);
        }
    }
View Full Code Here

                dialectCacheService.getDialect(dialectHandle.getHandle());

        if (dialect == null) {
            final String fmt = DIALECT_REQUEST_NO_DIALECT_FOR_HANDLE;
            final String msg = format(fmt, dialectHandle.getHandle());
            throw new RequestException(msg);
        }

        return dialect;
    }
View Full Code Here

TOP

Related Classes of org.openbel.framework.ws.core.RequestException

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.