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

Added printing of model name to services

parent fbfffe44
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +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
......@@ -241,5 +241,16 @@ public class ModelResourceImpl implements ModelResource{
}
}
@Override
public Response printModelName(String modelId) {
return this.printModelName(modelId, Model.DEFAULT_LANGUAGE);
}
@Override
public Response printModelName(String modelId, String language) {
String name = ModelFactory.getInstance().getModelName(modelId, language);
return Response.ok().entity(name).build();
}
}
......@@ -166,6 +166,21 @@ public class ModelFactory {
return this.modelList;
}
/**
* Gets the name of the model, in the appropriate language
* @param modelId
* @param language
* @return
*/
public String getModelName(String modelId, String language)
{
if(this.isDuplicateModelId(modelId))
{
return this.getDuplicateModelIdWarning();
}
return language != null ? this.models.get(modelId).getModelName(language) : this.models.get(modelId).getModelName();
}
/**
*
* @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