Search in sources :

Example 1 with MediaObjectMetadataQueryResult

use of org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult in project cineast by vitrivr.

the class FindObjectMetadataByDomainPostHandler method performPost.

@Override
public MediaObjectMetadataQueryResult performPost(IdList ids, Context ctx) {
    final Map<String, String> parameters = ctx.pathParamMap();
    if (ids == null || ids.getIds().length == 0) {
        return new MediaObjectMetadataQueryResult("", new ArrayList<>(0));
    }
    final String domain = parameters.get(DOMAIN_NAME);
    final MetadataRetrievalService service = new MetadataRetrievalService();
    return new MediaObjectMetadataQueryResult("", service.findByDomain(ids.getIdList(), domain));
}
Also used : MetadataRetrievalService(org.vitrivr.cineast.api.rest.services.MetadataRetrievalService) MediaObjectMetadataQueryResult(org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult)

Example 2 with MediaObjectMetadataQueryResult

use of org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult in project cineast by vitrivr.

the class FindObjectMetadataGetHandler method doGet.

@Override
public MediaObjectMetadataQueryResult doGet(Context ctx) {
    final Map<String, String> parameters = ctx.pathParamMap();
    final String objectId = parameters.get(OBJECT_ID_NAME);
    final MetadataRetrievalService service = new MetadataRetrievalService();
    return new MediaObjectMetadataQueryResult("", service.lookupMultimediaMetadata(objectId));
}
Also used : MetadataRetrievalService(org.vitrivr.cineast.api.rest.services.MetadataRetrievalService) MediaObjectMetadataQueryResult(org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult)

Example 3 with MediaObjectMetadataQueryResult

use of org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult in project cineast by vitrivr.

the class MetadataLookupMessageHandler method handle.

/**
 * Invoked when a Message of type MetadataLookup arrives and requires handling. Looks up the MultimediaMetadataDescriptors of the requested objects, wraps them in a MediaObjectMetadataQueryResult object and writes them to the stream.
 *
 * @param session WebSocketSession for which the message arrived.
 * @param message Message of type a that needs to be handled.
 */
@Override
public void handle(Session session, MetadataLookup message) {
    Thread.currentThread().setName("metadata-lookup-handler");
    MediaObjectMetadataReader reader = new MediaObjectMetadataReader(Config.sharedConfig().getDatabase().getSelectorSupplier().get());
    List<MediaObjectMetadataDescriptor> descriptors = reader.lookupMultimediaMetadata(message.getIds());
    this.write(session, new MediaObjectMetadataQueryResult("", descriptors));
    reader.close();
}
Also used : MediaObjectMetadataDescriptor(org.vitrivr.cineast.core.data.entities.MediaObjectMetadataDescriptor) MediaObjectMetadataReader(org.vitrivr.cineast.core.db.dao.reader.MediaObjectMetadataReader) MediaObjectMetadataQueryResult(org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult)

Example 4 with MediaObjectMetadataQueryResult

use of org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult in project cineast by vitrivr.

the class FindObjectMetadataByDomainGetHandler method doGet.

@Override
public MediaObjectMetadataQueryResult doGet(Context ctx) {
    final Map<String, String> parameters = ctx.pathParamMap();
    final String objectId = parameters.get(OBJECT_ID_NAME);
    final String domain = parameters.get(DOMAIN_NAME);
    final MetadataRetrievalService service = new MetadataRetrievalService();
    return new MediaObjectMetadataQueryResult("", service.findByDomain(objectId, domain));
}
Also used : MetadataRetrievalService(org.vitrivr.cineast.api.rest.services.MetadataRetrievalService) MediaObjectMetadataQueryResult(org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult)

Example 5 with MediaObjectMetadataQueryResult

use of org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult in project cineast by vitrivr.

the class FindObjectMetadataByKeyGetHandler method doGet.

@Override
public MediaObjectMetadataQueryResult doGet(Context ctx) {
    final Map<String, String> parameters = ctx.pathParamMap();
    final String objectId = parameters.get(OBJECT_ID_NAME);
    final String key = parameters.get(KEY_NAME);
    final MetadataRetrievalService service = new MetadataRetrievalService();
    return new MediaObjectMetadataQueryResult("", service.findByKey(objectId, key));
}
Also used : MetadataRetrievalService(org.vitrivr.cineast.api.rest.services.MetadataRetrievalService) MediaObjectMetadataQueryResult(org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult)

Aggregations

MediaObjectMetadataQueryResult (org.vitrivr.cineast.api.messages.result.MediaObjectMetadataQueryResult)9 MetadataRetrievalService (org.vitrivr.cineast.api.rest.services.MetadataRetrievalService)7 MediaObjectMetadataDescriptor (org.vitrivr.cineast.core.data.entities.MediaObjectMetadataDescriptor)3 ArrayList (java.util.ArrayList)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 AbstractMetadataFilterDescriptor (org.vitrivr.cineast.api.messages.components.AbstractMetadataFilterDescriptor)1 MediaObjectMetadataReader (org.vitrivr.cineast.core.db.dao.reader.MediaObjectMetadataReader)1