Search in sources :

Example 6 with MapLayerMetadata

use of edu.harvard.iq.dataverse.MapLayerMetadata in project dataverse by IQSS.

the class Geoconnect method checkStatus.

private JsonObjectBuilder checkStatus(MapLayerMetadata unmodified) {
    JsonObjectBuilder jsonObjectBuilder = Json.createObjectBuilder();
    jsonObjectBuilder.add("fileId", unmodified.getDataFile().getId());
    jsonObjectBuilder.add("mapLayerMetadataId", unmodified.getId());
    jsonObjectBuilder.add("layerLink", unmodified.getLayerLink());
    jsonObjectBuilder.add("fileLandingPage", systemConfig.getDataverseSiteUrl() + "/file.xhtml?fileId=" + unmodified.getDataFile().getId());
    MapLayerMetadata modified = updateLastVerifiedTimeAndStatusCode(unmodified);
    if (modified != null) {
        jsonObjectBuilder.add("lastVerifiedStatus", modified.getLastVerifiedStatus());
    } else {
        jsonObjectBuilder.add("error", "Could not check status of map associate with file id " + unmodified.getDataFile().getId());
    }
    return jsonObjectBuilder;
}
Also used : MapLayerMetadata(edu.harvard.iq.dataverse.MapLayerMetadata) JsonObjectBuilder(javax.json.JsonObjectBuilder)

Example 7 with MapLayerMetadata

use of edu.harvard.iq.dataverse.MapLayerMetadata in project dataverse by IQSS.

the class WorldMapPermissionHelper method loadMapLayerMetadataLookup.

/**
 * Create a hashmap consisting of { DataFile.id : MapLayerMetadata object}
 *
 * Very few DataFiles will have associated MapLayerMetadata objects so only
 * use 1 query to get them
 */
private void loadMapLayerMetadataLookup(Dataset dataset) {
    mapLayerMetadataLookup = new HashMap<>();
    if (dataset == null) {
    }
    if (dataset.getId() == null) {
        return;
    }
    List<MapLayerMetadata> mapLayerMetadataList = mapLayerMetadataService.getMapLayerMetadataForDataset(dataset);
    if (mapLayerMetadataList == null) {
        return;
    }
    for (MapLayerMetadata layer_metadata : mapLayerMetadataList) {
        mapLayerMetadataLookup.put(layer_metadata.getDataFile().getId(), layer_metadata);
    }
}
Also used : MapLayerMetadata(edu.harvard.iq.dataverse.MapLayerMetadata)

Aggregations

MapLayerMetadata (edu.harvard.iq.dataverse.MapLayerMetadata)7 JsonParsingException (javax.json.stream.JsonParsingException)3 Path (javax.ws.rs.Path)3 DataFile (edu.harvard.iq.dataverse.DataFile)2 WorldMapToken (edu.harvard.iq.dataverse.worldmapauth.WorldMapToken)2 IOException (java.io.IOException)2 StringReader (java.io.StringReader)2 JsonObject (javax.json.JsonObject)2 POST (javax.ws.rs.POST)2 AuthenticatedUser (edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser)1 GuestUser (edu.harvard.iq.dataverse.authorization.users.GuestUser)1 URISyntaxException (java.net.URISyntaxException)1 JsonObjectBuilder (javax.json.JsonObjectBuilder)1 GET (javax.ws.rs.GET)1