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));
}
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));
}
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();
}
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));
}
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));
}
Aggregations