diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/applications/openbis-screening-test/openbis-screening-test.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/applications/openbis-screening-test/openbis-screening-test.js index 8766f6b7601b28424100c86f14bc35fc7db65eb5..1f0ff0c43e83efb2e4572931cf68999a546ea3e6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/applications/openbis-screening-test/openbis-screening-test.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/applications/openbis-screening-test/openbis-screening-test.js @@ -8,9 +8,9 @@ var createExperimentIdentfier = function(identifierString){ return { "@type" : "ExperimentIdentifier", - spaceCode : parts[1], - projectCode : parts[2], - experimentCode : parts[3] + "spaceCode" : parts[1], + "projectCode" : parts[2], + "experimentCode" : parts[3] }; } @@ -29,25 +29,25 @@ var createMaterialIdentifier = function(identifierString){ return { "@type" : "MaterialIdentifierScreening", - materialTypeIdentifier : { + "materialTypeIdentifier" : { "@type" : "MaterialTypeIdentifierScreening", - materialTypeCode : parts[1] + "materialTypeCode" : parts[1] }, - materialCode : parts[2] + "materialCode" : parts[2] }; } var createMaterialTypeIdentifier = function(typeCode){ return { "@type" : "MaterialTypeIdentifierScreening", - materialTypeCode : typeCode + "materialTypeCode" : typeCode }; } var createWellIdentifier = function(permId){ return { "@type" : "WellIdentifier", - permId : permId + "permId" : permId }; } @@ -59,6 +59,14 @@ var createWellPosition = function(wellRow, wellColumn){ }; } +var createImageSize = function(width, height){ + return { + "@type" : "ImageSize", + "width" : width, + "height" : height + }; +} + test("listPlates()", function(){ createFacadeAndLogin(function(facade){ @@ -380,6 +388,29 @@ test("loadThumbnailImagesBase64ForImageReferences()", function(){ var imageReferences = response.result; facade.loadThumbnailImagesBase64ForImageReferences(imageReferences, function(response){ + // TODO generate some thumbnails at screening sprint server + assertObjectsCount(response.result, 0); + facade.close(); + }); + }); + }); + }); +}); + +test("loadImagesBase64ForImageReferencesAndImageSize()", function(){ + createFacadeAndLogin(function(facade){ + var plateIdentifiers = [ createPlateIdentifier("/PLATONIC/PLATE-1") ]; + + facade.listImageDatasets(plateIdentifiers, function(response){ + var dataSetIdentifier = response.result[0]; + var wellPositions = [ createWellPosition(1, 1) ]; + var channel = "DAPI"; + + facade.listPlateImageReferencesForDataSetIdentifierAndWellPositionsAndChannel(dataSetIdentifier, wellPositions, channel, function(response){ + var imageReferences = response.result; + var imageSize = createImageSize(100, 100); + + facade.loadImagesBase64ForImageReferencesAndImageSize(imageReferences, imageSize, function(response){ assertObjectsCount(response.result, 9); facade.close(); }); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js-new/openbis-screening.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js-new/openbis-screening.js index 32b597140225122835393a3f387bb3650b34a212..1a145a1ecd22a521c99e5c3d40fe424dc5f9af7c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js-new/openbis-screening.js +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/js-new/openbis-screening.js @@ -5,24 +5,24 @@ */ if(typeof openbis == 'undefined' || typeof _openbisInternal == 'undefined'){ - alert('Loading of openbis-screening.js failed - openbis.js is missing'); + alert('Loading of openbis-screening.js failed - openbis.js is missing'); } var _openbisInternalGeneric = _openbisInternal; var _openbisInternal = function(openbisUrl){ - this.init(openbisUrl); + this.init(openbisUrl); } $.extend(_openbisInternal.prototype, _openbisInternalGeneric.prototype); _openbisInternal.prototype.init = function(openbisUrl){ - _openbisInternalGeneric.prototype.init.call(this, openbisUrl); - this.screeningUrl = openbisUrl + "/rmi-screening-api-v1.json" + _openbisInternalGeneric.prototype.init.call(this, openbisUrl); + this.screeningUrl = openbisUrl + "/rmi-screening-api-v1.json" } _openbisInternal.prototype.getScreeningDataStoreApiUrlForDataStoreUrl = function(dataStoreUrl){ - return dataStoreUrl + "/rmi-datastore-server-screening-api-v1.json" + return dataStoreUrl + "/rmi-datastore-server-screening-api-v1.json" } var _openbisGeneric = openbis; @@ -333,7 +333,12 @@ openbis.prototype.loadImagesBase64ForImageReferencesAndImageConversion = functio this._internal.ajaxRequest({ url: this._internal.screeningUrl, data: { "method" : "loadImagesBase64", - "params" : [ this.getSession(), imageReferences, convertToPng ] }, + "params" : { + "sessionToken" : this.getSession(), + "imageReferences" : imageReferences, + "convertToPng" : convertToPng + } + }, success: action }); } @@ -346,7 +351,11 @@ openbis.prototype.loadThumbnailImagesBase64ForImageReferences = function(imageRe this._internal.ajaxRequest({ url: this._internal.screeningUrl, data: { "method" : "loadThumbnailImagesBase64", - "params" : [ this.getSession(), imageReferences ] }, + "params" : { + "sessionToken" : this.getSession(), + "imageReferences" : imageReferences + } + }, success: action }); } @@ -359,7 +368,12 @@ openbis.prototype.loadImagesBase64ForImageReferencesAndImageSize = function(imag this._internal.ajaxRequest({ url: this._internal.screeningUrl, data: { "method" : "loadImagesBase64", - "params" : [ this.getSession(), imageReferences, size ] }, + "params" : { + "sessionToken" : this.getSession(), + "imageReferences" : imageReferences, + "size" : size + } + }, success: action }); } @@ -372,7 +386,11 @@ openbis.prototype.loadImagesBase64ForImageReferences = function(imageReferences, this._internal.ajaxRequest({ url: this._internal.screeningUrl, data: { "method" : "loadImagesBase64", - "params" : [ this.getSession(), imageReferences ] }, + "params" : { + "sessionToken" : this.getSession(), + "imageReferences" : imageReferences + } + }, success: action }); } @@ -385,7 +403,12 @@ openbis.prototype.loadImagesBase64ForImageReferencesAndImageConfiguration = func this._internal.ajaxRequest({ url: this._internal.screeningUrl, data: { "method" : "loadImagesBase64", - "params" : [ this.getSession(), imageReferences, configuration ] }, + "params" : { + "sessionToken" : this.getSession(), + "imageReferences" : imageReferences, + "configuration" : configuration + } + }, success: action }); } @@ -398,7 +421,12 @@ openbis.prototype.loadImagesBase64ForImageReferencesAndImageRepresentationFormat this._internal.ajaxRequest({ url: this._internal.screeningUrl, data: { "method" : "loadImagesBase64", - "params" : [ this.getSession(), imageReferences, format ] }, + "params" : { + "sessionToken" : this.getSession(), + "imageReferences" : imageReferences, + "format" : format + } + }, success: action }); } @@ -411,7 +439,12 @@ openbis.prototype.loadImagesBase64ForImageReferencesAndImageRepresentationFormat this._internal.ajaxRequest({ url: this._internal.screeningUrl, data: { "method" : "loadImagesBase64", - "params" : [ this.getSession(), imageReferences, criteria ] }, + "params" : { + "sessionToken" : this.getSession(), + "imageReferences" : imageReferences, + "criteria" : criteria + } + }, success: action }); } @@ -469,7 +502,14 @@ openbis.prototype.loadImagesBase64ForDataSetIdentifierAndWellPositionsAndChannel this._internal.ajaxRequest({ url: this._internal.getScreeningDataStoreApiUrlForDataStoreUrl(dataSetIdentifier.datastoreServerUrl), data: { "method" : "loadImagesBase64", - "params" : [ this.getSession(), dataSetIdentifier, wellPositions, channel, thumbnailSizeOrNull ] }, + "params" : { + "sessionToken" : this.getSession(), + "dataSetIdentifier" : dataSetIdentifier, + "wellPositions" : wellPositions, + "channel" : channel, + "thumbnailSizeOrNull" : thumbnailSizeOrNull + } + }, success: action }); } @@ -482,7 +522,13 @@ openbis.prototype.loadImagesBase64ForDataSetIdentifierAndChannelAndImageSize = f this._internal.ajaxRequest({ url: this._internal.getScreeningDataStoreApiUrlForDataStoreUrl(dataSetIdentifier.datastoreServerUrl), data: { "method" : "loadImagesBase64", - "params" : [ this.getSession(), dataSetIdentifier, channel, thumbnailSizeOrNull ] }, + "params" : { + "sessionToken" : this.getSession(), + "dataSetIdentifier" : dataSetIdentifier, + "channel" : channel, + "thumbnailSizeOrNull" : thumbnailSizeOrNull + } + }, success: action }); } @@ -495,7 +541,12 @@ openbis.prototype.loadThumbnailImagesBase64ForDataSetIdentifierAndChannels = fun this._internal.ajaxRequest({ url: this._internal.getScreeningDataStoreApiUrlForDataStoreUrl(dataSetIdentifier.datastoreServerUrl), data: { "method" : "loadThumbnailImagesBase64", - "params" : [ this.getSession(), dataSetIdentifier, channels ] }, + "params" : { + "sessionToken" : this.getSession(), + "dataSetIdentifier" : dataSetIdentifier, + "channels" : channels + } + }, success: action }); } @@ -508,7 +559,13 @@ openbis.prototype.listPlateImageReferencesForDataSetIdentifierAndWellPositionsAn this._internal.ajaxRequest({ url: this._internal.getScreeningDataStoreApiUrlForDataStoreUrl(dataSetIdentifier.datastoreServerUrl), data: { "method" : "listPlateImageReferences", - "params" : [ this.getSession(), dataSetIdentifier, wellPositions, channel ] }, + "params" : { + "sessionToken" : this.getSession(), + "dataSetIdentifier" : dataSetIdentifier, + "wellPositions" : wellPositions, + "channel" : channel + } + }, success: action }); } @@ -521,7 +578,13 @@ openbis.prototype.listPlateImageReferencesForDataSetIdentifierAndWellPositionsAn this._internal.ajaxRequest({ url: this._internal.getScreeningDataStoreApiUrlForDataStoreUrl(dataSetIdentifier.datastoreServerUrl), data: { "method" : "listPlateImageReferences", - "params" : [ this.getSession(), dataSetIdentifier, wellPositions, channels ] }, + "params" : { + "sessionToken" : this.getSession(), + "dataSetIdentifier" : dataSetIdentifier, + "wellPositions" : wellPositions, + "channels" : channels + } + }, success: action }); } @@ -534,7 +597,12 @@ openbis.prototype.listImageReferencesForDataSetIdentifierAndChannel = function(d this._internal.ajaxRequest({ url: this._internal.getScreeningDataStoreApiUrlForDataStoreUrl(dataSetIdentifier.datastoreServerUrl), data: { "method" : "listImageReferences", - "params" : [ this.getSession(), dataSetIdentifier, channel ] }, + "params" : { + "sessionToken" : this.getSession(), + "dataSetIdentifier" : dataSetIdentifier, + "channel" : channel + } + }, success: action }); } @@ -547,7 +615,12 @@ openbis.prototype.listImageReferencesForDataSetIdentifierAndChannels = function( this._internal.ajaxRequest({ url: this._internal.getScreeningDataStoreApiUrlForDataStoreUrl(dataSetIdentifier.datastoreServerUrl), data: { "method" : "listImageReferences", - "params" : [ this.getSession(), dataSetIdentifier, channels ] }, + "params" : { + "sessionToken" : this.getSession(), + "dataSetIdentifier" : dataSetIdentifier, + "channels" : channels + } + }, success: action }); } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningLogger.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningLogger.java index 82ab3227b69ff8475ad8bb707995a033508fa942..af99494de2226a6040fd9a6c82234249a4d93df4 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningLogger.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/screening/server/DssServiceRpcScreeningLogger.java @@ -125,7 +125,7 @@ public class DssServiceRpcScreeningLogger extends AbstractServerLogger implement boolean convertToPng) { logAccess(sessionToken, "load_images_base64", "IMAGE_REFERENCES(%s) CONVERT(%s)", - references); + references, convertToPng); return null; } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/IScreeningApiServer.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/IScreeningApiServer.java index 906c724fbbb9dafd28fc334d6e4cf49508131fff..8d55b242bae52a28cfec26f17b3bf37e4aab963a 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/IScreeningApiServer.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/IScreeningApiServer.java @@ -20,6 +20,8 @@ import java.util.List; import org.springframework.transaction.annotation.Transactional; +import com.googlecode.jsonrpc4j.JsonRpcParam; + import ch.systemsx.cisd.common.api.IRpcService; import ch.systemsx.cisd.common.api.MinimalMinorVersion; import ch.systemsx.cisd.openbis.dss.screening.shared.api.v1.IDssServiceRpcScreening; @@ -325,8 +327,10 @@ public interface IScreeningApiServer extends IRpcService */ @Transactional(readOnly = true) @MinimalMinorVersion(10) - public List<String> loadImagesBase64(String sessionToken, - List<PlateImageReference> imageReferences, boolean convertToPng); + public List<String> loadImagesBase64(@JsonRpcParam("sessionToken") + String sessionToken, @JsonRpcParam("imageReferences") + List<PlateImageReference> imageReferences, @JsonRpcParam("convertToPng") + boolean convertToPng); /** * Groups the specified objects by a data store code and calls @@ -338,8 +342,9 @@ public interface IScreeningApiServer extends IRpcService */ @Transactional(readOnly = true) @MinimalMinorVersion(10) - public List<String> loadThumbnailImagesBase64(String sessionToken, - List<PlateImageReference> imageReferences); + public List<String> loadThumbnailImagesBase64(@JsonRpcParam("sessionToken") + String sessionToken, @JsonRpcParam("imageReferences") + List<PlateImageReference> imageReferences); /** * Groups the specified objects by a data store code and calls @@ -351,8 +356,10 @@ public interface IScreeningApiServer extends IRpcService */ @Transactional(readOnly = true) @MinimalMinorVersion(10) - public List<String> loadImagesBase64(String sessionToken, - List<PlateImageReference> imageReferences, ImageSize size); + public List<String> loadImagesBase64(@JsonRpcParam("sessionToken") + String sessionToken, @JsonRpcParam("imageReferences") + List<PlateImageReference> imageReferences, @JsonRpcParam("size") + ImageSize size); /** * Groups the specified objects by a data store code and calls @@ -364,8 +371,9 @@ public interface IScreeningApiServer extends IRpcService */ @Transactional(readOnly = true) @MinimalMinorVersion(10) - public List<String> loadImagesBase64(String sessionToken, - List<PlateImageReference> imageReferences); + public List<String> loadImagesBase64(@JsonRpcParam("sessionToken") + String sessionToken, @JsonRpcParam("imageReferences") + List<PlateImageReference> imageReferences); /** * Groups the specified objects by a data store code and calls @@ -377,8 +385,10 @@ public interface IScreeningApiServer extends IRpcService */ @Transactional(readOnly = true) @MinimalMinorVersion(10) - public List<String> loadImagesBase64(String sessionToken, - List<PlateImageReference> imageReferences, LoadImageConfiguration configuration); + public List<String> loadImagesBase64(@JsonRpcParam("sessionToken") + String sessionToken, @JsonRpcParam("imageReferences") + List<PlateImageReference> imageReferences, @JsonRpcParam("configuration") + LoadImageConfiguration configuration); /** * Groups the specified objects by a data store code and calls @@ -390,8 +400,10 @@ public interface IScreeningApiServer extends IRpcService */ @Transactional(readOnly = true) @MinimalMinorVersion(10) - public List<String> loadImagesBase64(String sessionToken, - List<PlateImageReference> imageReferences, ImageRepresentationFormat format); + public List<String> loadImagesBase64(@JsonRpcParam("sessionToken") + String sessionToken, @JsonRpcParam("imageReferences") + List<PlateImageReference> imageReferences, @JsonRpcParam("format") + ImageRepresentationFormat format); /** * Groups the specified objects by a data store code and calls @@ -403,9 +415,10 @@ public interface IScreeningApiServer extends IRpcService */ @Transactional(readOnly = true) @MinimalMinorVersion(10) - public List<String> loadImagesBase64(String sessionToken, - List<PlateImageReference> imageReferences, - IImageRepresentationFormatSelectionCriterion... criteria); + public List<String> loadImagesBase64(@JsonRpcParam("sessionToken") + String sessionToken, @JsonRpcParam("imageReferences") + List<PlateImageReference> imageReferences, @JsonRpcParam("criteria") + IImageRepresentationFormatSelectionCriterion... criteria); /** * Groups the specified objects by a data store code and calls