Search in sources :

Example 1 with Tuple

use of nl.knaw.huygens.timbuctoo.util.Tuple in project timbuctoo by HuygensING.

the class RootQuery method rebuildSchema.

public synchronized GraphQLSchema rebuildSchema() {
    final TypeDefinitionRegistry staticQuery = schemaParser.parse(this.staticQuery);
    if (archetypes != null && !archetypes.isEmpty()) {
        staticQuery.merge(schemaParser.parse(archetypes + "extend type DataSetMetadata {\n" + "  archetypes: Archetypes! @passThrough\n" + "}\n" + "\n"));
    }
    TypeDefinitionRegistry registry = new TypeDefinitionRegistry();
    registry.merge(staticQuery);
    final RuntimeWiring.Builder wiring = RuntimeWiring.newRuntimeWiring();
    wiring.type("Query", builder -> builder.dataFetcher("promotedDataSets", env -> dataSetRepository.getPromotedDataSets().stream().map(DataSetWithDatabase::new).collect(Collectors.toList())).dataFetcher("allDataSets", env -> dataSetRepository.getDataSets().stream().map(DataSetWithDatabase::new).filter(x -> {
        if (x.isPublished()) {
            return true;
        } else {
            ContextData contextData = env.getContext();
            UserPermissionCheck userPermissionCheck = contextData.getUserPermissionCheck();
            return userPermissionCheck.getPermissions(x.getDataSet().getMetadata()).contains(Permission.READ);
        }
    }).collect(Collectors.toList())).dataFetcher("dataSetMetadata", env -> {
        final String dataSetId = env.getArgument("dataSetId");
        ContextData context = env.getContext();
        final User user = context.getUser().orElse(null);
        Tuple<String, String> splitCombinedId = DataSetMetaData.splitCombinedId(dataSetId);
        return dataSetRepository.getDataSet(user, splitCombinedId.getLeft(), splitCombinedId.getRight()).map(DataSetWithDatabase::new);
    }).dataFetcher("dataSetMetadataList", env -> {
        Stream<DataSetWithDatabase> dataSets = dataSetRepository.getDataSets().stream().map(DataSetWithDatabase::new);
        if (env.getArgument("promotedOnly")) {
            dataSets = dataSets.filter(DataSetWithDatabase::isPromoted);
        }
        if (env.getArgument("publishedOnly")) {
            dataSets = dataSets.filter(DataSetWithDatabase::isPublished);
        }
        return dataSets.filter(x -> {
            ContextData contextData = env.getContext();
            UserPermissionCheck userPermissionCheck = contextData.getUserPermissionCheck();
            return userPermissionCheck.getPermissions(x.getDataSet().getMetadata()).contains(Permission.READ);
        }).collect(Collectors.toList());
    }).dataFetcher("aboutMe", env -> ((RootData) env.getRoot()).getCurrentUser().orElse(null)).dataFetcher("availableExportMimetypes", env -> supportedFormats.getSupportedMimeTypes().stream().map(MimeTypeDescription::create).collect(Collectors.toList())));
    wiring.type("DataSetMetadata", builder -> builder.dataFetcher("currentImportStatus", env -> {
        DataSetMetaData input = env.getSource();
        Optional<User> currentUser = ((RootData) env.getRoot()).getCurrentUser();
        if (!currentUser.isPresent()) {
            throw new RuntimeException("User is not provided");
        }
        return dataSetRepository.getDataSet(currentUser.get(), input.getOwnerId(), input.getDataSetId()).map(dataSet -> dataSet.getImportManager().getImportStatus());
    }).dataFetcher("dataSetImportStatus", env -> {
        Optional<User> currentUser = ((RootData) env.getRoot()).getCurrentUser();
        if (!currentUser.isPresent()) {
            throw new RuntimeException("User is not provided");
        }
        DataSetMetaData input = env.getSource();
        return dataSetRepository.getDataSet(currentUser.get(), input.getOwnerId(), input.getDataSetId()).map(dataSet -> dataSet.getImportManager().getDataSetImportStatus());
    }).dataFetcher("collectionList", env -> getCollections(env.getSource(), ((ContextData) env.getContext()).getUser())).dataFetcher("collection", env -> {
        String collectionId = (String) env.getArguments().get("collectionId");
        if (collectionId != null && collectionId.endsWith("List")) {
            collectionId = collectionId.substring(0, collectionId.length() - "List".length());
        }
        DataSetMetaData input = env.getSource();
        ContextData context = env.getContext();
        final User user = context.getUser().orElse(null);
        final DataSet dataSet = dataSetRepository.getDataSet(user, input.getOwnerId(), input.getDataSetId()).get();
        final TypeNameStore typeNameStore = dataSet.getTypeNameStore();
        String collectionUri = typeNameStore.makeUri(collectionId);
        if (dataSet.getSchemaStore().getStableTypes() == null || dataSet.getSchemaStore().getStableTypes().get(collectionUri) == null) {
            return null;
        } else {
            return getCollection(dataSet, typeNameStore, dataSet.getSchemaStore().getStableTypes().get(collectionUri));
        }
    }).dataFetcher("dataSetId", env -> ((DataSetMetaData) env.getSource()).getCombinedId()).dataFetcher("dataSetName", env -> ((DataSetMetaData) env.getSource()).getDataSetId()).dataFetcher("ownerId", env -> ((DataSetMetaData) env.getSource()).getOwnerId()));
    wiring.type("CurrentImportStatus", builder -> builder.dataFetcher("elapsedTime", env -> {
        final String timeUnit = env.getArgument("unit");
        return ((ImportStatus) env.getSource()).getElapsedTime(timeUnit);
    }));
    wiring.type("DataSetImportStatus", builder -> builder.dataFetcher("lastImportDuration", env -> {
        final String timeUnit = env.getArgument("unit");
        return ((DataSetImportStatus) env.getSource()).getLastImportDuration(timeUnit);
    }));
    wiring.type("EntryImportStatus", builder -> builder.dataFetcher("elapsedTime", env -> {
        final String timeUnit = env.getArgument("unit");
        return ((EntryImportStatus) env.getSource()).getElapsedTime(timeUnit);
    }));
    wiring.type("CollectionMetadata", builder -> builder.dataFetcher("indexConfig", env -> {
        SubjectReference source = env.getSource();
        final QuadStore qs = source.getDataSet().getQuadStore();
        try (Stream<CursorQuad> quads = qs.getQuads(source.getSubjectUri(), TIM_HASINDEXERCONFIG, Direction.OUT, "")) {
            final Map result = quads.findFirst().map(q -> {
                try {
                    return objectMapper.readValue(q.getObject(), Map.class);
                } catch (IOException e) {
                    LOG.error("Value not a Map", e);
                    return new HashMap<>();
                }
            }).orElse(new HashMap());
            if (!result.containsKey("facet") || !(result.get("facet") instanceof List)) {
                result.put("facet", new ArrayList<>());
            }
            if (!result.containsKey("fullText") || !(result.get("fullText") instanceof List)) {
                result.put("fullText", new ArrayList<>());
            }
            return result;
        }
    }).dataFetcher("viewConfig", new ViewConfigFetcher(objectMapper)));
    wiring.type("AboutMe", builder -> builder.dataFetcher("dataSets", env -> (Iterable) () -> dataSetRepository.getDataSetsWithWriteAccess(env.getSource()).stream().map(DataSetWithDatabase::new).iterator()).dataFetcher("dataSetMetadataList", env -> (Iterable) () -> {
        Stream<DataSetWithDatabase> dataSets = dataSetRepository.getDataSets().stream().map(DataSetWithDatabase::new);
        if (env.getArgument("ownOnly")) {
            String userId = ((ContextData) env.getContext()).getUser().map(u -> "u" + u.getPersistentId()).orElse(null);
            dataSets = dataSets.filter(d -> d.getOwnerId().equals(userId));
        }
        Permission permission = Permission.valueOf(env.getArgument("permission"));
        if (permission != Permission.READ) {
            // Read is implied
            UserPermissionCheck check = ((ContextData) env.getContext()).getUserPermissionCheck();
            dataSets = dataSets.filter(d -> check.getPermissions(d).contains(permission));
        }
        return dataSets.iterator();
    }).dataFetcher("id", env -> ((User) env.getSource()).getPersistentId()).dataFetcher("name", env -> ((User) env.getSource()).getDisplayName()).dataFetcher("personalInfo", env -> "http://example.com").dataFetcher("canCreateDataSet", env -> true));
    wiring.type("Mutation", builder -> builder.dataFetcher("setViewConfig", new ViewConfigMutation(dataSetRepository)).dataFetcher("setSummaryProperties", new SummaryPropsMutation(dataSetRepository)).dataFetcher("setIndexConfig", new IndexConfigMutation(dataSetRepository)).dataFetcher("createDataSet", new CreateDataSetMutation(dataSetRepository)).dataFetcher("deleteDataSet", new DeleteDataSetMutation(dataSetRepository)).dataFetcher("publish", new MakePublicMutation(dataSetRepository)).dataFetcher("extendSchema", new ExtendSchemaMutation(dataSetRepository)).dataFetcher("setDataSetMetadata", new DataSetMetadataMutation(dataSetRepository)).dataFetcher("setCollectionMetadata", new CollectionMetadataMutation(dataSetRepository)));
    wiring.wiringFactory(wiringFactory);
    StringBuilder root = new StringBuilder("type DataSets {\n sillyWorkaroundWhenNoDataSetsAreVisible: Boolean\n");
    boolean[] dataSetAvailable = new boolean[] { false };
    dataSetRepository.getDataSets().forEach(dataSet -> {
        final DataSetMetaData dataSetMetaData = dataSet.getMetadata();
        final String name = dataSetMetaData.getCombinedId();
        Map<String, Type> types = dataSet.getSchemaStore().getStableTypes();
        Map<String, List<ExplicitField>> customSchema = dataSet.getCustomSchema();
        final Map<String, Type> customTypes = new HashMap<>();
        for (Map.Entry<String, List<ExplicitField>> entry : customSchema.entrySet()) {
            ExplicitType explicitType = new ExplicitType(entry.getKey(), entry.getValue());
            customTypes.put(entry.getKey(), explicitType.convertToType());
        }
        Map<String, Type> mergedTypes;
        MergeSchemas mergeSchemas = new MergeSchemas();
        mergedTypes = mergeSchemas.mergeSchema(types, customTypes);
        types = mergedTypes;
        if (types != null) {
            dataSetAvailable[0] = true;
            root.append("  ").append(name).append(":").append(name).append(" @dataSet(userId:\"").append(dataSetMetaData.getOwnerId()).append("\", dataSetId:\"").append(dataSetMetaData.getDataSetId()).append("\")\n");
            wiring.type(name, c -> c.dataFetcher("metadata", env -> new DataSetWithDatabase(dataSet)));
            final String schema = typeGenerator.makeGraphQlTypes(name, types, dataSet.getTypeNameStore());
            staticQuery.merge(schemaParser.parse(schema));
        }
    });
    root.append("}\n\nextend type Query {\n  #The actual dataSets\n  dataSets: DataSets @passThrough\n}\n\n");
    if (dataSetAvailable[0]) {
        staticQuery.merge(schemaParser.parse(root.toString()));
    }
    SchemaGenerator schemaGenerator = new SchemaGenerator();
    return schemaGenerator.makeExecutableSchema(staticQuery, wiring.build());
}
Also used : CursorQuad(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.CursorQuad) DataSetRepository(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetRepository) ImmutableProperty(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableProperty) ExplicitType(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitType) Type(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type) MakePublicMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.MakePublicMutation) LoggerFactory(org.slf4j.LoggerFactory) ExtendSchemaMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.ExtendSchemaMutation) DerivedSchemaTypeGenerator(nl.knaw.huygens.timbuctoo.v5.graphql.derivedschema.DerivedSchemaTypeGenerator) DeleteDataSetMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.DeleteDataSetMutation) SubjectReference(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.SubjectReference) Map(java.util.Map) SummaryPropsMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.SummaryPropsMutation) ImmutableCollectionMetadataList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableCollectionMetadataList) TypeNameStore(nl.knaw.huygens.timbuctoo.v5.datastores.prefixstore.TypeNameStore) ImmutablePropertyList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutablePropertyList) ViewConfigFetcher(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ViewConfigFetcher) CreateDataSetMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.CreateDataSetMutation) RootData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.RootData) TypeDefinitionRegistry(graphql.schema.idl.TypeDefinitionRegistry) Collectors(java.util.stream.Collectors) Resources.getResource(com.google.common.io.Resources.getResource) List(java.util.List) Stream(java.util.stream.Stream) DataSetMetaData(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData) ExplicitField(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitField) Optional(java.util.Optional) Direction(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.Direction) RdfWiringFactory(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.RdfWiringFactory) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) CollectionMetadata(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.CollectionMetadata) SupportedExportFormats(nl.knaw.huygens.timbuctoo.v5.dropwizard.SupportedExportFormats) CollectionMetadataList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.CollectionMetadataList) DataSetImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetImportStatus) Tuple(nl.knaw.huygens.timbuctoo.util.Tuple) HashMap(java.util.HashMap) QuadStore(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.QuadStore) Supplier(java.util.function.Supplier) ContextData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.ContextData) ArrayList(java.util.ArrayList) User(nl.knaw.huygens.timbuctoo.v5.security.dto.User) SchemaParser(graphql.schema.idl.SchemaParser) ImmutableStringList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableStringList) GraphQLSchema(graphql.schema.GraphQLSchema) ImmutableCollectionMetadata(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableCollectionMetadata) Charsets(com.google.common.base.Charsets) ViewConfigMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.ViewConfigMutation) Logger(org.slf4j.Logger) UserPermissionCheck(nl.knaw.huygens.timbuctoo.v5.graphql.security.UserPermissionCheck) Resources(com.google.common.io.Resources) MimeTypeDescription(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.MimeTypeDescription) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) MergeSchemas(nl.knaw.huygens.timbuctoo.v5.graphql.customschema.MergeSchemas) Property(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.Property) IOException(java.io.IOException) DataSetWithDatabase(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.DataSetWithDatabase) EntryImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.dto.EntryImportStatus) TIM_HASINDEXERCONFIG(nl.knaw.huygens.timbuctoo.v5.util.RdfConstants.TIM_HASINDEXERCONFIG) Permission(nl.knaw.huygens.timbuctoo.v5.security.dto.Permission) IndexConfigMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.IndexConfigMutation) RuntimeWiring(graphql.schema.idl.RuntimeWiring) DataSetMetadataMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.DataSetMetadataMutation) CollectionMetadataMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.CollectionMetadataMutation) SchemaGenerator(graphql.schema.idl.SchemaGenerator) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) Collections(java.util.Collections) MergeSchemas(nl.knaw.huygens.timbuctoo.v5.graphql.customschema.MergeSchemas) QuadStore(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.QuadStore) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) HashMap(java.util.HashMap) TypeNameStore(nl.knaw.huygens.timbuctoo.v5.datastores.prefixstore.TypeNameStore) ViewConfigMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.ViewConfigMutation) Permission(nl.knaw.huygens.timbuctoo.v5.security.dto.Permission) ContextData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.ContextData) Stream(java.util.stream.Stream) ImmutableCollectionMetadataList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableCollectionMetadataList) ImmutablePropertyList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutablePropertyList) List(java.util.List) CollectionMetadataList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.CollectionMetadataList) ArrayList(java.util.ArrayList) ImmutableStringList(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ImmutableStringList) MakePublicMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.MakePublicMutation) ExplicitType(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitType) Optional(java.util.Optional) RootData(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.RootData) IndexConfigMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.IndexConfigMutation) RuntimeWiring(graphql.schema.idl.RuntimeWiring) DataSetWithDatabase(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.DataSetWithDatabase) DataSetMetaData(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData) Map(java.util.Map) HashMap(java.util.HashMap) User(nl.knaw.huygens.timbuctoo.v5.security.dto.User) CollectionMetadataMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.CollectionMetadataMutation) TypeDefinitionRegistry(graphql.schema.idl.TypeDefinitionRegistry) SubjectReference(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.dto.SubjectReference) DeleteDataSetMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.DeleteDataSetMutation) CursorQuad(nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.CursorQuad) CreateDataSetMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.CreateDataSetMutation) DataSetMetadataMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.DataSetMetadataMutation) ExtendSchemaMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.ExtendSchemaMutation) SchemaGenerator(graphql.schema.idl.SchemaGenerator) IOException(java.io.IOException) ViewConfigFetcher(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.dataproviders.ViewConfigFetcher) ExplicitType(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.ExplicitType) Type(nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Type) SummaryPropsMutation(nl.knaw.huygens.timbuctoo.v5.graphql.mutations.SummaryPropsMutation) UserPermissionCheck(nl.knaw.huygens.timbuctoo.v5.graphql.security.UserPermissionCheck)

Example 2 with Tuple

use of nl.knaw.huygens.timbuctoo.util.Tuple in project timbuctoo by HuygensING.

the class RrTriplesMap method getItems.

Stream<Quad> getItems(ErrorHandler defaultErrorHandler) {
    final int[] numberOfItemsProcessed = new int[1];
    Stream<Quad> quadStream = dataSource.getRows(defaultErrorHandler).peek(e -> {
        numberOfItemsProcessed[0]++;
        if (numberOfItemsProcessed[0] == 1) {
            LoggerFactory.getLogger(RrTriplesMap.class).info("collection '{}' has at least one item", uri);
        }
    }).flatMap(row -> {
        Optional<RdfUri> subjectOpt = subjectMap.generateValue(row);
        if (subjectOpt.isPresent()) {
            RdfUri subject = subjectOpt.get();
            for (Tuple<RrRefObjectMap, String> subscription : subscriptions) {
                subscription.getLeft().onNewSubject(row.getRawValue(subscription.getRight()), subject);
            }
            return predicateObjectMaps.stream().flatMap(predicateObjectMap -> predicateObjectMap.generateValue(subject, row));
        } else {
            defaultErrorHandler.subjectGenerationFailed(uri, row);
            return Stream.empty();
        }
    });
    return quadStream;
}
Also used : LoggerFactory(org.slf4j.LoggerFactory) Tuple(nl.knaw.huygens.timbuctoo.util.Tuple) ErrorHandler(nl.knaw.huygens.timbuctoo.rml.ErrorHandler) Collectors(java.util.stream.Collectors) Row(nl.knaw.huygens.timbuctoo.rml.Row) ArrayList(java.util.ArrayList) List(java.util.List) Stream(java.util.stream.Stream) RdfUri(nl.knaw.huygens.timbuctoo.rml.dto.RdfUri) Quad(nl.knaw.huygens.timbuctoo.rml.dto.Quad) Optional(java.util.Optional) RrRefObjectMap(nl.knaw.huygens.timbuctoo.rml.rmldata.termmaps.RrRefObjectMap) DataSource(nl.knaw.huygens.timbuctoo.rml.DataSource) Quad(nl.knaw.huygens.timbuctoo.rml.dto.Quad) RdfUri(nl.knaw.huygens.timbuctoo.rml.dto.RdfUri) RrRefObjectMap(nl.knaw.huygens.timbuctoo.rml.rmldata.termmaps.RrRefObjectMap)

Example 3 with Tuple

use of nl.knaw.huygens.timbuctoo.util.Tuple in project timbuctoo by HuygensING.

the class TinkerPopOperations method replaceEntity.

@Override
public int replaceEntity(Collection collection, UpdateEntity updateEntity) throws NotFoundException, AlreadyUpdatedException, IOException {
    requireCommit = true;
    GraphTraversal<Vertex, Vertex> entityTraversal = entityFetcher.getEntity(this.traversal, updateEntity.getId(), null, collection.getCollectionName());
    if (!entityTraversal.hasNext()) {
        throw new NotFoundException();
    }
    Vertex entityVertex = entityTraversal.next();
    int curRev = getProp(entityVertex, "rev", Integer.class).orElse(1);
    if (curRev != updateEntity.getRev()) {
        throw new AlreadyUpdatedException();
    }
    int newRev = updateEntity.getRev() + 1;
    entityVertex.property("rev", newRev);
    // update properties
    TinkerPopPropertyConverter tinkerPopPropertyConverter = new TinkerPopPropertyConverter(collection);
    for (TimProperty<?> property : updateEntity.getProperties()) {
        try {
            Tuple<String, Object> nameValue = property.convert(tinkerPopPropertyConverter);
            collection.getWriteableProperties().get(nameValue.getLeft()).setValue(entityVertex, nameValue.getRight());
        } catch (IOException e) {
            throw new IOException(property.getName() + " could not be saved. " + e.getMessage(), e);
        }
    }
    // Set removed values to null.
    Set<String> propertyNames = updateEntity.getProperties().stream().map(prop -> prop.getName()).collect(Collectors.toSet());
    for (String name : Sets.difference(collection.getWriteableProperties().keySet(), propertyNames)) {
        collection.getWriteableProperties().get(name).setJson(entityVertex, null);
    }
    String entityTypesStr = getProp(entityVertex, "types", String.class).orElse("[]");
    boolean wasAddedToCollection = false;
    if (!entityTypesStr.contains("\"" + collection.getEntityTypeName() + "\"")) {
        try {
            ArrayNode entityTypes = arrayToEncodedArray.tinkerpopToJson(entityTypesStr);
            entityTypes.add(collection.getEntityTypeName());
            entityVertex.property("types", entityTypes.toString());
            wasAddedToCollection = true;
        } catch (IOException e) {
            // FIXME potential bug?
            LOG.error(Logmarkers.databaseInvariant, "property 'types' was not parseable: " + entityTypesStr);
        }
    }
    setModified(entityVertex, updateEntity.getModified());
    entityVertex.property("pid").remove();
    Vertex duplicate = duplicateVertex(traversal, entityVertex, indexHandler);
    listener.onPropertyUpdate(collection, Optional.of(entityVertex), duplicate);
    if (wasAddedToCollection) {
        listener.onAddToCollection(collection, Optional.of(entityVertex), duplicate);
    }
    return newRev;
}
Also used : AlreadyUpdatedException(nl.knaw.huygens.timbuctoo.core.AlreadyUpdatedException) CreateCollection(nl.knaw.huygens.timbuctoo.core.dto.CreateCollection) RdfImportedDefaultDisplayname(nl.knaw.huygens.timbuctoo.model.properties.RdfImportedDefaultDisplayname) VRE_NAME_PROPERTY_NAME(nl.knaw.huygens.timbuctoo.model.vre.Vre.VRE_NAME_PROPERTY_NAME) EdgeManipulator.duplicateEdge(nl.knaw.huygens.timbuctoo.database.tinkerpop.EdgeManipulator.duplicateEdge) MediaType(javax.ws.rs.core.MediaType) QuickSearch(nl.knaw.huygens.timbuctoo.core.dto.QuickSearch) ReadableProperty(nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty) RdfProperty(nl.knaw.huygens.timbuctoo.core.dto.rdf.RdfProperty) COLLECTION_IS_UNKNOWN_PROPERTY_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.COLLECTION_IS_UNKNOWN_PROPERTY_NAME) Map(java.util.Map) Converters.arrayToEncodedArray(nl.knaw.huygens.timbuctoo.model.properties.converters.Converters.arrayToEncodedArray) JsonNode(com.fasterxml.jackson.databind.JsonNode) DataStoreOperations(nl.knaw.huygens.timbuctoo.core.DataStoreOperations) Transaction(org.apache.tinkerpop.gremlin.structure.Transaction) HAS_ENTITY_NODE_RELATION_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.HAS_ENTITY_NODE_RELATION_NAME) QuickSearchResult(nl.knaw.huygens.timbuctoo.core.dto.QuickSearchResult) RdfIndexChangeListener(nl.knaw.huygens.timbuctoo.database.tinkerpop.changelistener.RdfIndexChangeListener) TinkerPopGraphManager(nl.knaw.huygens.timbuctoo.server.TinkerPopGraphManager) COLLECTION_NAME_PROPERTY_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.COLLECTION_NAME_PROPERTY_NAME) Logmarkers.configurationFailure(nl.knaw.huygens.timbuctoo.logging.Logmarkers.configurationFailure) Set(java.util.Set) ChangeListener(nl.knaw.huygens.timbuctoo.database.tinkerpop.changelistener.ChangeListener) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) ImmutableValueTypeInUse(nl.knaw.huygens.timbuctoo.core.dto.rdf.ImmutableValueTypeInUse) ReadEntity(nl.knaw.huygens.timbuctoo.core.dto.ReadEntity) DATABASE_LABEL(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.DATABASE_LABEL) Element(org.apache.tinkerpop.gremlin.structure.Element) Stream(java.util.stream.Stream) Vre(nl.knaw.huygens.timbuctoo.model.vre.Vre) CreateEntity(nl.knaw.huygens.timbuctoo.core.dto.CreateEntity) GraphTraversalSource(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource) Index(org.neo4j.graphdb.index.Index) ERROR_PREFIX(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver.ERROR_PREFIX) LocalProperty(nl.knaw.huygens.timbuctoo.model.properties.LocalProperty) LabelP(org.apache.tinkerpop.gremlin.neo4j.process.traversal.LabelP) RAW_PROPERTY_EDGE_NAME(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver.RAW_PROPERTY_EDGE_NAME) CreateProperty(nl.knaw.huygens.timbuctoo.core.dto.rdf.CreateProperty) Supplier(java.util.function.Supplier) Node(org.neo4j.graphdb.Node) CreateRelation(nl.knaw.huygens.timbuctoo.core.dto.CreateRelation) Lists(com.google.common.collect.Lists) ImmutableVresDto(nl.knaw.huygens.timbuctoo.core.dto.dataset.ImmutableVresDto) PersonNames(nl.knaw.huygens.timbuctoo.model.PersonNames) HAS_ENTITY_RELATION_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.HAS_ENTITY_RELATION_NAME) StreamSupport(java.util.stream.StreamSupport) PropertyDescriptorFactory(nl.knaw.huygens.timbuctoo.search.description.property.PropertyDescriptorFactory) RelationType(nl.knaw.huygens.timbuctoo.core.dto.RelationType) Logmarkers.databaseInvariant(nl.knaw.huygens.timbuctoo.logging.Logmarkers.databaseInvariant) RelationTypeService(nl.knaw.huygens.timbuctoo.relationtypes.RelationTypeService) AddLabelChangeListener(nl.knaw.huygens.timbuctoo.database.tinkerpop.changelistener.AddLabelChangeListener) VreBuilder(nl.knaw.huygens.timbuctoo.model.vre.VreBuilder) DataStream(nl.knaw.huygens.timbuctoo.core.dto.DataStream) ImmutablePredicateInUse(nl.knaw.huygens.timbuctoo.core.dto.rdf.ImmutablePredicateInUse) IOException(java.io.IOException) T(org.apache.tinkerpop.gremlin.structure.T) HAS_NEXT_PROPERTY_RELATION_NAME(nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty.HAS_NEXT_PROPERTY_RELATION_NAME) DatabaseMigrator(nl.knaw.huygens.timbuctoo.server.databasemigration.DatabaseMigrator) Direction(org.apache.tinkerpop.gremlin.structure.Direction) VertexDuplicator.duplicateVertex(nl.knaw.huygens.timbuctoo.database.tinkerpop.VertexDuplicator.duplicateVertex) CompositeChangeListener(nl.knaw.huygens.timbuctoo.database.tinkerpop.changelistener.CompositeChangeListener) HAS_DISPLAY_NAME_RELATION_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.HAS_DISPLAY_NAME_RELATION_NAME) Traversal(org.apache.tinkerpop.gremlin.process.traversal.Traversal) TinkerPopPropertyConverter(nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopPropertyConverter) GraphReadUtils.getProp(nl.knaw.huygens.timbuctoo.model.GraphReadUtils.getProp) Change(nl.knaw.huygens.timbuctoo.model.Change) WwDocumentDisplayNameDescriptor(nl.knaw.huygens.timbuctoo.search.description.property.WwDocumentDisplayNameDescriptor) RDFINDEX_NAME(nl.knaw.huygens.timbuctoo.rdf.Database.RDFINDEX_NAME) ImmutableEntityRelation(nl.knaw.huygens.timbuctoo.core.dto.ImmutableEntityRelation) StreamIterator.stream(nl.knaw.huygens.timbuctoo.util.StreamIterator.stream) HAS_ARCHETYPE_RELATION_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.HAS_ARCHETYPE_RELATION_NAME) Graph(org.apache.tinkerpop.gremlin.structure.Graph) LoggerFactory(org.slf4j.LoggerFactory) RDF_SYNONYM_PROP(nl.knaw.huygens.timbuctoo.rdf.Database.RDF_SYNONYM_PROP) PropertyParserFactory(nl.knaw.huygens.timbuctoo.search.description.propertyparser.PropertyParserFactory) EntityRelation(nl.knaw.huygens.timbuctoo.core.dto.EntityRelation) TinkerPopToEntityMapper(nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopToEntityMapper) RelationNotPossibleException(nl.knaw.huygens.timbuctoo.core.RelationNotPossibleException) URI(java.net.URI) P(org.apache.tinkerpop.gremlin.process.traversal.P) Property(org.apache.tinkerpop.gremlin.structure.Property) IS_RELATION_COLLECTION_PROPERTY_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.IS_RELATION_COLLECTION_PROPERTY_NAME) CollectionHasEntityRelationChangeListener(nl.knaw.huygens.timbuctoo.database.tinkerpop.changelistener.CollectionHasEntityRelationChangeListener) org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.has(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.has) ImmutableMap(com.google.common.collect.ImmutableMap) CollectionBuilder(nl.knaw.huygens.timbuctoo.core.dto.dataset.CollectionBuilder) EntityFinisherHelper(nl.knaw.huygens.timbuctoo.core.EntityFinisherHelper) LocationNames(nl.knaw.huygens.timbuctoo.model.LocationNames) NotFoundException(nl.knaw.huygens.timbuctoo.core.NotFoundException) UUID(java.util.UUID) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) UpdateEntity(nl.knaw.huygens.timbuctoo.core.dto.UpdateEntity) List(java.util.List) DirectionalRelationType(nl.knaw.huygens.timbuctoo.core.dto.DirectionalRelationType) Optional(java.util.Optional) FulltextIndexChangeListener(nl.knaw.huygens.timbuctoo.database.tinkerpop.changelistener.FulltextIndexChangeListener) JsonBuilder.jsnO(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsnO) HAS_PREDICATE_RELATION_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.HAS_PREDICATE_RELATION_NAME) Tuple(nl.knaw.huygens.timbuctoo.util.Tuple) HashMap(java.util.HashMap) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) Function(java.util.function.Function) VERSION_OF(nl.knaw.huygens.timbuctoo.database.tinkerpop.VertexDuplicator.VERSION_OF) VreMetadata(nl.knaw.huygens.timbuctoo.model.vre.VreMetadata) Logmarkers(nl.knaw.huygens.timbuctoo.logging.Logmarkers) CollectionNameHelper.defaultEntityTypeName(nl.knaw.huygens.timbuctoo.core.CollectionNameHelper.defaultEntityTypeName) VertexProperty(org.apache.tinkerpop.gremlin.structure.VertexProperty) GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) SAVED_MAPPING_STATE(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver.SAVED_MAPPING_STATE) HAS_INITIAL_PROPERTY_RELATION_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.HAS_INITIAL_PROPERTY_RELATION_NAME) JsonBuilder.jsnA(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsnA) COLLECTION_ENTITIES_LABEL(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.COLLECTION_ENTITIES_LABEL) NoSuchElementException(java.util.NoSuchElementException) JsonBuilder.jsn(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsn) Edge(org.apache.tinkerpop.gremlin.structure.Edge) RdfReadProperty(nl.knaw.huygens.timbuctoo.core.dto.rdf.RdfReadProperty) PredicateInUse(nl.knaw.huygens.timbuctoo.core.dto.rdf.PredicateInUse) Logger(org.slf4j.Logger) TimProperty(nl.knaw.huygens.timbuctoo.core.dto.property.TimProperty) Iterator(java.util.Iterator) RAW_ITEM_EDGE_NAME(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver.RAW_ITEM_EDGE_NAME) ENTITY_TYPE_NAME_PROPERTY_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.ENTITY_TYPE_NAME_PROPERTY_NAME) PropertyDescriptor(nl.knaw.huygens.timbuctoo.search.description.PropertyDescriptor) org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__) TempName(nl.knaw.huygens.timbuctoo.model.TempName) Maps(com.google.common.collect.Maps) IdIndexChangeListener(nl.knaw.huygens.timbuctoo.database.tinkerpop.changelistener.IdIndexChangeListener) GraphTraversal(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal) PropertyNameHelper.createPropName(nl.knaw.huygens.timbuctoo.database.tinkerpop.PropertyNameHelper.createPropName) TIMBUCTOO_NAMESPACE(nl.knaw.huygens.timbuctoo.server.databasemigration.RelationTypeRdfUriMigration.TIMBUCTOO_NAMESPACE) Vres(nl.knaw.huygens.timbuctoo.model.vre.Vres) SystemPropertyModifier(nl.knaw.huygens.timbuctoo.rdf.SystemPropertyModifier) Collectors.toList(java.util.stream.Collectors.toList) HAS_COLLECTION_RELATION_NAME(nl.knaw.huygens.timbuctoo.model.vre.Vre.HAS_COLLECTION_RELATION_NAME) Clock(java.time.Clock) HAS_PROPERTY_RELATION_NAME(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection.HAS_PROPERTY_RELATION_NAME) RAW_COLLECTION_EDGE_NAME(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver.RAW_COLLECTION_EDGE_NAME) UpdateRelation(nl.knaw.huygens.timbuctoo.core.dto.UpdateRelation) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) VertexDuplicator.duplicateVertex(nl.knaw.huygens.timbuctoo.database.tinkerpop.VertexDuplicator.duplicateVertex) AlreadyUpdatedException(nl.knaw.huygens.timbuctoo.core.AlreadyUpdatedException) TinkerPopPropertyConverter(nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopPropertyConverter) NotFoundException(nl.knaw.huygens.timbuctoo.core.NotFoundException) IOException(java.io.IOException) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode)

Example 4 with Tuple

use of nl.knaw.huygens.timbuctoo.util.Tuple in project timbuctoo by HuygensING.

the class EntityToJsonMapper method mapEntity.

public ObjectNode mapEntity(Collection collection, ReadEntity entity, boolean withRelations, ExtraEntityMappingOptions extraEntityMappingOptions, ExtraRelationMappingOptions relationMappingOptions) {
    final ObjectNode mappedEntity = JsonNodeFactory.instance.objectNode();
    String id = entity.getId().toString();
    mappedEntity.set("@type", jsn(collection.getEntityTypeName()));
    mappedEntity.set("_id", jsn(id));
    mappedEntity.set("^rev", jsn(entity.getRev()));
    mappedEntity.set("^deleted", jsn(entity.getDeleted()));
    mappedEntity.set("^pid", jsn(entity.getPid()));
    if (entity.getRdfUri() != null) {
        mappedEntity.set("^rdfUri", jsn(entity.getRdfUri().toString()));
    }
    mappedEntity.set("^rdfAlternatives", jsnA(entity.getRdfAlternatives().stream().map(JsonBuilder::jsn)));
    JsonNode variationRefs = jsnA(entity.getTypes().stream().map(type -> {
        ObjectNode variationRef = jsnO();
        variationRef.set("id", jsn(id));
        variationRef.set("type", jsn(type));
        return variationRef;
    }));
    mappedEntity.set("@variationRefs", variationRefs);
    Change modified = entity.getModified();
    mappedEntity.set("^modified", mapChange(modified));
    Change created = entity.getCreated();
    mappedEntity.set("^created", mapChange(created));
    // translate TimProperties to Json
    JsonPropertyConverter jsonPropertyConverter = new JsonPropertyConverter(collection);
    entity.getProperties().forEach(prop -> {
        try {
            Tuple<String, JsonNode> convertedProperty = prop.convert(jsonPropertyConverter);
            mappedEntity.set(convertedProperty.getLeft(), convertedProperty.getRight());
        } catch (IOException e) {
            LOG.error(databaseInvariant, propConversionErrorMessage(id, prop));
            LOG.error("Exception message: {}", e.getMessage());
            LOG.debug("Stack trace", e);
        }
    });
    if (!Strings.isNullOrEmpty(entity.getDisplayName())) {
        mappedEntity.set("@displayName", jsn(entity.getDisplayName()));
    }
    extraEntityMappingOptions.execute(entity, mappedEntity);
    if (withRelations) {
        mappedEntity.set("@relationCount", jsn(entity.getRelations().size()));
        mappedEntity.set("@relations", mapRelations(entity.getRelations(), relationMappingOptions));
    }
    return mappedEntity;
}
Also used : JsonBuilder(nl.knaw.huygens.timbuctoo.util.JsonBuilder) UserValidator(nl.knaw.huygens.timbuctoo.v5.security.UserValidator) JsonBuilder.jsnO(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsnO) JsonBuilder(nl.knaw.huygens.timbuctoo.util.JsonBuilder) LoggerFactory(org.slf4j.LoggerFactory) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Tuple(nl.knaw.huygens.timbuctoo.util.Tuple) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) UrlGenerator(nl.knaw.huygens.timbuctoo.crud.UrlGenerator) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Strings(com.google.common.base.Strings) JsonBuilder.jsnA(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsnA) JsonNode(com.fasterxml.jackson.databind.JsonNode) JsonBuilder.jsn(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsn) Logmarkers.databaseInvariant(nl.knaw.huygens.timbuctoo.logging.Logmarkers.databaseInvariant) RelationRef(nl.knaw.huygens.timbuctoo.core.dto.RelationRef) Logger(org.slf4j.Logger) TimProperty(nl.knaw.huygens.timbuctoo.core.dto.property.TimProperty) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IOException(java.io.IOException) UUID(java.util.UUID) ReadEntity(nl.knaw.huygens.timbuctoo.core.dto.ReadEntity) List(java.util.List) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) Change(nl.knaw.huygens.timbuctoo.model.Change) Tuple.tuple(nl.knaw.huygens.timbuctoo.util.Tuple.tuple) UserValidationException(nl.knaw.huygens.timbuctoo.v5.security.exceptions.UserValidationException) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) JsonNode(com.fasterxml.jackson.databind.JsonNode) Change(nl.knaw.huygens.timbuctoo.model.Change) IOException(java.io.IOException)

Example 5 with Tuple

use of nl.knaw.huygens.timbuctoo.util.Tuple in project timbuctoo by HuygensING.

the class RdfUpload method upload.

@Consumes(MediaType.MULTIPART_FORM_DATA)
@POST
public Response upload(@FormDataParam("file") final InputStream rdfInputStream, @FormDataParam("file") final FormDataBodyPart body, @FormDataParam("fileMimeTypeOverride") final MediaType mimeTypeOverride, @FormDataParam("encoding") final String encoding, @FormDataParam("baseUri") final URI baseUri, @FormDataParam("defaultGraph") final URI defaultGraph, @HeaderParam("authorization") final String authHeader, @PathParam("userId") final String userId, @PathParam("dataSet") final String dataSetId, @QueryParam("forceCreation") boolean forceCreation, @QueryParam("async") final boolean async) throws ExecutionException, InterruptedException, LogStorageFailedException, DataStoreCreationException {
    final Either<Response, Response> result = authCheck.getOrCreate(authHeader, userId, dataSetId, forceCreation).flatMap(userAndDs -> authCheck.hasAdminAccess(userAndDs.getLeft(), userAndDs.getRight())).map((Tuple<User, DataSet> userDataSetTuple) -> {
        final MediaType mediaType = mimeTypeOverride == null ? body.getMediaType() : mimeTypeOverride;
        final DataSet dataSet = userDataSetTuple.getRight();
        ImportManager importManager = dataSet.getImportManager();
        if (mediaType == null || !importManager.isRdfTypeSupported(mediaType)) {
            return Response.status(Response.Status.BAD_REQUEST).type(MediaType.APPLICATION_JSON_TYPE).entity("{\"error\": \"We do not support the mediatype '" + mediaType + "'. Make sure to add the correct " + "mediatype to the file parameter. In curl you'd use `-F \"file=@<filename>;type=<mediatype>\"`. In a " + "webbrowser you probably have no way of setting the correct mimetype. So you can use a special " + "parameter " + "to override it: `formData.append(\"fileMimeTypeOverride\", \"<mimetype>\");`\"}").build();
        }
        if (StringUtils.isBlank(encoding)) {
            return Response.status(Response.Status.BAD_REQUEST).entity("Please provide an 'encoding' parameter").build();
        }
        if (StringUtils.isBlank(body.getContentDisposition().getFileName())) {
            return Response.status(400).entity("filename cannot be empty.").build();
        }
        Future<ImportStatus> promise = null;
        try {
            promise = importManager.addLog(baseUri == null ? dataSet.getMetadata().getBaseUri() : baseUri.toString(), defaultGraph == null ? dataSet.getMetadata().getBaseUri() : defaultGraph.toString(), body.getContentDisposition().getFileName(), rdfInputStream, Optional.of(Charset.forName(encoding)), mediaType);
        } catch (LogStorageFailedException e) {
            return Response.serverError().build();
        }
        if (!async) {
            return handleImportManagerResult(promise);
        }
        return Response.accepted().build();
    });
    if (result.isLeft()) {
        return result.getLeft();
    } else {
        return result.get();
    }
}
Also used : Response(javax.ws.rs.core.Response) PathParam(javax.ws.rs.PathParam) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) Path(javax.ws.rs.Path) Tuple(nl.knaw.huygens.timbuctoo.util.Tuple) StringUtils(org.apache.commons.lang3.StringUtils) User(nl.knaw.huygens.timbuctoo.v5.security.dto.User) MediaType(javax.ws.rs.core.MediaType) Future(java.util.concurrent.Future) QueryParam(javax.ws.rs.QueryParam) Consumes(javax.ws.rs.Consumes) Charset(java.nio.charset.Charset) FormDataBodyPart(org.glassfish.jersey.media.multipart.FormDataBodyPart) HeaderParam(javax.ws.rs.HeaderParam) URI(java.net.URI) LogStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.LogStorageFailedException) AuthCheck(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.auth.AuthCheck) Either(javaslang.control.Either) POST(javax.ws.rs.POST) ImportManager(nl.knaw.huygens.timbuctoo.v5.dataset.ImportManager) DataStoreCreationException(nl.knaw.huygens.timbuctoo.v5.dataset.exceptions.DataStoreCreationException) ErrorResponseHelper.handleImportManagerResult(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.ErrorResponseHelper.handleImportManagerResult) ExecutionException(java.util.concurrent.ExecutionException) FormDataParam(org.glassfish.jersey.media.multipart.FormDataParam) Response(javax.ws.rs.core.Response) Optional(java.util.Optional) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) InputStream(java.io.InputStream) ImportManager(nl.knaw.huygens.timbuctoo.v5.dataset.ImportManager) DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) LogStorageFailedException(nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.LogStorageFailedException) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) MediaType(javax.ws.rs.core.MediaType) Tuple(nl.knaw.huygens.timbuctoo.util.Tuple) Consumes(javax.ws.rs.Consumes) POST(javax.ws.rs.POST)

Aggregations

Tuple (nl.knaw.huygens.timbuctoo.util.Tuple)5 List (java.util.List)4 Optional (java.util.Optional)4 IOException (java.io.IOException)3 Collectors (java.util.stream.Collectors)3 Stream (java.util.stream.Stream)3 LoggerFactory (org.slf4j.LoggerFactory)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 UUID (java.util.UUID)2 MediaType (javax.ws.rs.core.MediaType)2 ReadEntity (nl.knaw.huygens.timbuctoo.core.dto.ReadEntity)2 Collection (nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection)2 TimProperty (nl.knaw.huygens.timbuctoo.core.dto.property.TimProperty)2 Logmarkers.databaseInvariant (nl.knaw.huygens.timbuctoo.logging.Logmarkers.databaseInvariant)2 Change (nl.knaw.huygens.timbuctoo.model.Change)2