Skip to content
Snippets Groups Projects
Commit ca253ade authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added methods getLicense and GetCopyright to model factory and REST service

parent 1a188f72
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,6 @@ public class VIPSCoreApplication extends Application
*/
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(no.bioforsk.vips.core.config.JacksonConfig.class);
resources.add(no.bioforsk.vips.core.service.ModelResource.class);
resources.add(no.bioforsk.vips.coremanager.service.ManagerResource.class);
}
}
\ No newline at end of file
......@@ -187,10 +187,6 @@ public class ModelResourceImpl implements ModelResource{
* @param config input data for the model
* @return list of result objects
*/
//@POST
//@Path("models/run")
//@Consumes("application/json")
//@Produces("application/json")
@Override
public Response runModel(ModelConfiguration config)
{
......@@ -213,10 +209,6 @@ public class ModelResourceImpl implements ModelResource{
* @param config input data for the model
* @return list of result objects
*/
//@POST
//@Path("models/{modelId}/run")
//@Consumes("application/json")
//@Produces("application/json")
@Override
public Response runModel(@PathParam("modelId") String modelId, ModelConfiguration config)
{
......@@ -252,5 +244,17 @@ public class ModelResourceImpl implements ModelResource{
return Response.ok().entity(name).build();
}
@Override
public Response printModelLicense(String modelId) {
String license = ModelFactory.getInstance().getModelLicense(modelId);
return Response.ok().entity(license).build();
}
@Override
public Response printModelCopyright(String modelId) {
String copyright = ModelFactory.getInstance().getModelCopyright(modelId);
return Response.ok().entity(copyright).build();
}
}
......@@ -181,6 +181,34 @@ public class ModelFactory {
return language != null ? this.models.get(modelId).getModelName(language) : this.models.get(modelId).getModelName();
}
/**
*
* @param modelId
* @return The license for the requested model
*/
public String getModelLicense(String modelId)
{
if(this.isDuplicateModelId(modelId))
{
return this.getDuplicateModelIdWarning();
}
return this.models.get(modelId).getLicense();
}
/**
*
* @param modelId
* @return the copyright information for the requested model
*/
public String getModelCopyright(String modelId)
{
if(this.isDuplicateModelId(modelId))
{
return this.getDuplicateModelIdWarning();
}
return this.models.get(modelId).getCopyright();
}
/**
*
* @param modelId ID of the requested model
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment