Ticket #752 (closed Enhancement: fixed)
Switch off automatic workspace assignment
Reported by: | jri | Owned by: | jri |
---|---|---|---|
Priority: | Major | Milestone: | Release 4.5 |
Component: | DeepaMehta Standard Distribution | Version: | 4.4 |
Keywords: | Cc: | dgf, Malte | |
Complexity: | 3 | Area: | |
Module: | deepamehta-workspaces |
Description
The automatic workspace assignment for each topic/association created should be switchable on/off on a per-request basis. (Analogous to the geocoder of the Geomaps module.)
We need this in conjunction with #751
Change History
comment:3 Changed 10 years ago by jri
- Status changed from accepted to closed
- Resolution set to fixed
comment:4 Changed 9 years ago by jri
- Status changed from closed to reopened
- Resolution fixed deleted
The current realization as a query parameter is not suitable for 3 reasons:
- A finer granularity is needed. Consider method A calls method B. The workspace assignment might need be suppressed inside method B but not inside method A.
- A reconceptualization is needed. Actually its not up to the caller to decide to suppress workspace assignment. Instead it depends on the semantic of the respective method. (In this regard suppressing workspace assignment is not like suppressing geocoding (as mentionened in the ticket description). The latter is indeed optional and to be decided by the caller.)
- The caller might forget to add the query parameter and then things doesn't work as expected.
comment:9 Changed 9 years ago by Malte
Assessment:
This means that workspace suppression over all core methods/endpoints is uniform and not possible per Request anymore. If one needs to prevent workspace assignment one must create a new REST endpoint which wraps the core.
Question:
How is it with Associations? Don't have Associations have workspace assigments too?
comment:10 Changed 9 years ago by Malte
Background here is uncritical, just an issue of optimization:
The dm4-wikidata search plugin must make sure that a topic with a wikidata uri never lies in a "Private Workspace" or a workspace a caller might not have READ access too. Instead of re-assigning all the topics to the Wikidata workspace, it would be more optimal (performance wise) if no assignment exists (in postCreateTopic) in first place.
The question "How is this with Associations?" is just interesting for me because i want to estimate how much work it will be and what needs to be done to switch to a wikidata search plugin which creates everything (topics and assocs) under the privileged runWithoutWorkspaceAssignment-call.
comment:11 follow-up: ↓ 12 Changed 9 years ago by Malte
Please forget about my question: "How is this with associations" as it is incomplete and makes no sense to me. In the provided method one can do assignments of topics and associations as described in the comments.
I was just wondering if there is a reason why the return Type of the (runWithoutWorkspaceAssignment) construct is a Topic and not a DeepMehtaObject?.
comment:12 in reply to: ↑ 11 Changed 9 years ago by jri
Replying to Malte:
I was just wondering if there is a reason why the return Type of the (runWithoutWorkspaceAssignment) construct is a Topic [...]
That's not quite correct. It's you who decides what Type the runWithoutWorkspaceAssignment() method returns. You do so by passing that type as a type parameter to the Callable you provide.
Look at the runWithoutWorkspaceAssignment() declaration:
public <V> V runWithoutWorkspaceAssignment(Callable<V> callable) throws Exception {
That is referred to in comment:5:
Your Callable can return a result object. That object will be finally returned by runWithoutWorkspaceAssignment(). The type parameter of the Callable is the type of the result object.
See also the specification of the Callable interface:
http://docs.oracle.com/javase/6/docs/api/index.html?java/util/concurrent/Callable.html
So, this would be perfectly fine:
DeepaMehtaObject result = dms.getAccessControl().runWithoutWorkspaceAssignment(new Callable<DeepaMehtaObject>() { @Override public DeepaMehtaObject call() { DeepaMehtaObject o; ... return o; } });
Type parameters are introduced in Java 5 in conjunction with Generics:
https://docs.oracle.com/javase/tutorial/java/generics/