Commit 5e645641 authored by Jörg Richter's avatar Jörg Richter

REST API: change get-topic-by-value request, add 1 request (#341)

BREAKING CHANGE

change 1 request (get-topic-by-value):

    GET /core/topic/by_value/{key}/{value}
    ->
    GET /core/topic/type/{uri}/{value}

add 1 request (get-topics-by-value):

    GET /core/topics/type/{uri}/{value}     # plural
parent 215db789
Pipeline #9926 passed with stages
in 7 minutes and 49 seconds
......@@ -95,19 +95,19 @@ public class CoreServiceImpl implements CoreService {
}
@Override
public Topic getTopicByValue(String key, SimpleValue value) {
TopicModelImpl topic = al.getTopicByValue(key, value);
public Topic getTopicByValue(String typeUri, SimpleValue value) {
TopicModelImpl topic = al.getTopicByValue(typeUri, value);
return topic != null ? topic.instantiate() : null;
}
@Override
public List<Topic> getTopicsByValue(String key, SimpleValue value) {
return al.instantiate(al.getTopicsByValue(key, value));
public List<Topic> getTopicsByValue(String typeUri, SimpleValue value) {
return al.instantiate(al.getTopicsByValue(typeUri, value));
}
@Override
public List<Topic> queryTopics(String key, SimpleValue value) {
return al.instantiate(al.queryTopics(key, value));
public List<Topic> queryTopics(String typeUri, SimpleValue value) {
return al.instantiate(al.queryTopics(typeUri, value));
}
@Override
......@@ -150,14 +150,14 @@ public class CoreServiceImpl implements CoreService {
}
@Override
public Assoc getAssocByValue(String key, SimpleValue value) {
AssocModelImpl assoc = al.getAssocByValue(key, value);
public Assoc getAssocByValue(String typeUri, SimpleValue value) {
AssocModelImpl assoc = al.getAssocByValue(typeUri, value);
return assoc != null ? assoc.instantiate() : null;
}
@Override
public List<Assoc> queryAssocs(String key, SimpleValue value) {
return al.instantiate(al.queryAssocs(key, value));
public List<Assoc> queryAssocs(String typeUri, SimpleValue value) {
return al.instantiate(al.queryAssocs(typeUri, value));
}
@Override
......
......@@ -69,7 +69,7 @@ public interface CoreService {
*
* @throws RuntimeException If more than one topic is found.
*/
Topic getTopicByValue(String key, SimpleValue value);
Topic getTopicByValue(String typeUri, SimpleValue value);
/**
* Looks up topics by exact value.
......@@ -79,16 +79,16 @@ public interface CoreService {
*
* TODO: Convenience: take Object as "value" and let Core wrap it?
*/
List<Topic> getTopicsByValue(String key, SimpleValue value);
List<Topic> getTopicsByValue(String typeUri, SimpleValue value);
/**
* Looks up topics by key and value.
* Looks up topics by typeUri and value.
* <p>
* Wildcards like "*" in String values are interpreted.
*
* TODO: Convenience: take Object as "value" and let Core wrap it?
*/
List<Topic> queryTopics(String key, SimpleValue value);
List<Topic> queryTopics(String typeUri, SimpleValue value);
/**
* Performs a fulltext search.
......@@ -126,14 +126,14 @@ public interface CoreService {
*
* @throws RuntimeException If more than one association is found.
*/
Assoc getAssocByValue(String key, SimpleValue value);
Assoc getAssocByValue(String typeUri, SimpleValue value);
/**
* Looks up associations by key and value.
* Looks up associations by typeUri and value.
* <p>
* Wildcards like "*" in String values <i>are</i> interpreted.
*/
List<Assoc> queryAssocs(String key, SimpleValue value);
List<Assoc> queryAssocs(String typeUri, SimpleValue value);
/**
* Returns the association between two topics, qualified by association type and both role types.
......
......@@ -90,21 +90,25 @@ public class WebservicePlugin extends PluginActivator {
}
// Note: the "children" query parameter is handled by the core's JerseyResponseFilter
// ### TODO: change URI template
@GET
@Path("/topic/by_value/{key}/{value}")
public Topic getTopicByValue(@PathParam("key") String key, @PathParam("value") SimpleValue value) {
return dmx.getTopicByValue(key, value);
@Path("/topic/type/{uri}/{value}")
public Topic getTopicByValue(@PathParam("uri") String typeUri, @PathParam("value") SimpleValue value) {
return dmx.getTopicByValue(typeUri, value);
}
// TODO: getTopicsByValue()
// Note: the "children" query parameter is handled by the core's JerseyResponseFilter
@GET
@Path("/topics/type/{uri}/{value}")
public List<Topic> getTopicsByValue(@PathParam("uri") String typeUri, @PathParam("value") SimpleValue value) {
return dmx.getTopicsByValue(typeUri, value);
}
// Note: the "children" query parameter is handled by the core's JerseyResponseFilter
// ### TODO: change URI template, use query params (like queryTopicsFulltext())
@GET
@Path("/topic/multi/by_value/{key}/{value}")
public List<Topic> queryTopics(@PathParam("key") String key, @PathParam("value") SimpleValue value) {
return dmx.queryTopics(key, value);
@Path("/topic/multi/by_value/{uri}/{value}")
public List<Topic> queryTopics(@PathParam("uri") String typeUri, @PathParam("value") SimpleValue value) {
return dmx.queryTopics(typeUri, value);
}
// Note: the "children" query parameter is handled by the core's JerseyResponseFilter
......@@ -158,17 +162,17 @@ public class WebservicePlugin extends PluginActivator {
// Note: the "children" query parameter is handled by the core's JerseyResponseFilter
// ### TODO: change URI template
@GET
@Path("/assoc/by_value/{key}/{value}")
public Assoc getAssocByValue(@PathParam("key") String key, @PathParam("value") SimpleValue value) {
return dmx.getAssocByValue(key, value);
@Path("/assoc/by_value/{uri}/{value}")
public Assoc getAssocByValue(@PathParam("uri") String typeUri, @PathParam("value") SimpleValue value) {
return dmx.getAssocByValue(typeUri, value);
}
// Note: the "children" query parameter is handled by the core's JerseyResponseFilter
// ### TODO: change URI template
@GET
@Path("/assoc/multi/by_value/{key}/{value}")
public List<Assoc> queryAssocs(@PathParam("key") String key, @PathParam("value") SimpleValue value) {
return dmx.queryAssocs(key, value);
@Path("/assoc/multi/by_value/{uri}/{value}")
public List<Assoc> queryAssocs(@PathParam("uri") String typeUri, @PathParam("value") SimpleValue value) {
return dmx.queryAssocs(typeUri, value);
}
// Note: the "children" query parameter is handled by the core's JerseyResponseFilter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment