Package com.buschmais.cdo.api

Examples of com.buschmais.cdo.api.CdoException


    @Override
    public void deleteEntity(ObjectNode entity) {
        File file = getFile(entity);
        if (!file.exists()) {
            throw new CdoException("Cannot deleteEntity entity '" + entity + "' as it does not exist.");
        }
        file.delete();
    }
View Full Code Here


    public void flushEntity(ObjectNode objectNode) {
        File file = getFile(objectNode);
        try {
            mapper.writeValue(new FileWriter(file), objectNode);
        } catch (IOException e) {
            throw new CdoException("Cannot write file " + file.getName());
        }
    }
View Full Code Here

    public void setEntityProperty(ObjectNode objectNode, PrimitivePropertyMethodMetadata<JsonPrimitivePropertyMetadata> metadata, Object value) {
        Class<?> type = metadata.getAnnotatedMethod().getType();
        if (String.class.equals(type)) {
            objectNode.put(metadata.getAnnotatedMethod().getName(), (String) value);
        } else {
            throw new CdoException("Unsupported type " + type + " for property " + metadata.getAnnotatedMethod().getName());
        }
    }
View Full Code Here

    private boolean active = false;

    @Override
    public void begin() {
        if (active) {
            throw new CdoException("There is already an active transaction.");
        }
        active = true;
    }
View Full Code Here

    @Override
    public Datastore<JsonFileStoreSession, JsonNodeMetadata, String, JsonRelationMetadata, String> createDatastore(CdoUnit cdoUnit) {
        URI uri = cdoUnit.getUri();
        if (!"file".equals(uri.getScheme())) {
            throw new CdoException("Only file URIs are supported by this store.");
        }
        try {
            return new JsonFileStore(uri.toURL().getPath());
        } catch (MalformedURLException e) {
            throw new CdoException("Cannot convert URI '" + uri.toString() + "' to URL.", e);
        }
    }
View Full Code Here

        super(graphDatabaseService);
    }

    @Override
    public DatastoreTransaction getDatastoreTransaction() {
        throw new CdoException("Transactions are not supported for this datastore.");
    }
View Full Code Here

            case OUTGOING:
                return source.createRelationshipTo(target, metadata.getDatastoreMetadata().getRelationshipType());
            case INCOMING:
                return target.createRelationshipTo(source, metadata.getDatastoreMetadata().getRelationshipType());
            default:
                throw new CdoException("Unsupported direction " + direction);
        }
    }
View Full Code Here

            case OUTGOING:
                return Direction.OUTGOING;
            case INCOMING:
                return Direction.INCOMING;
            default:
                throw new CdoException("Unsupported direction " + direction);
        }
    }
View Full Code Here

        private Transaction transaction;

        @Override
        public void begin() {
            if (transaction != null) {
                throw new CdoException("There is already an existing transaction.");
            }
            transaction = getGraphDatabaseService().beginTx();
        }
View Full Code Here

    public RelationMetadata.Direction getRelationDirection(PropertyMethod propertyMethod) {
        Relation.Incoming incoming = propertyMethod.getAnnotationOfProperty(Relation.Incoming.class);
        Relation.Outgoing outgoing = propertyMethod.getAnnotationOfProperty(Relation.Outgoing.class);
        if (incoming != null && outgoing != null) {
            throw new CdoException("A relation property must be either incoming or outgoing: '" + propertyMethod.getName() + "'");
        }
        if (incoming != null) {
            return RelationMetadata.Direction.INCOMING;
        }
        return RelationMetadata.Direction.OUTGOING;
View Full Code Here

TOP

Related Classes of com.buschmais.cdo.api.CdoException

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.