Browse code

BM-12638 Fix: introduce ITags.allUids

David Phan authored on 09/02/2018 08:22:53
Showing 3 changed files
... ...
@@ -160,4 +160,15 @@ public interface ITags {
160 160
 	@Path("_changeset")
161 161
 	public ContainerChangeset<String> changeset(@QueryParam("since") Long since) throws ServerFault;
162 162
 
163
+	/**
164
+	 * List all {@link Tag} uids from container
165
+	 * 
166
+	 * @return
167
+	 * @throws ServerFault
168
+	 */
169
+
170
+	@GET
171
+	@Path("_alluids")
172
+	public List<String> allUids() throws ServerFault;
173
+
163 174
 }
... ...
@@ -35,7 +35,6 @@ import net.bluemind.core.context.SecurityContext;
35 35
 import net.bluemind.core.rest.BmContext;
36 36
 import net.bluemind.core.rest.ServerSideServiceProvider;
37 37
 import net.bluemind.tag.api.ITags;
38
-import net.bluemind.tag.api.Tag;
39 38
 import net.bluemind.tag.api.TagsContainerType;
40 39
 import net.bluemind.user.api.User;
41 40
 import net.bluemind.user.hook.DefaultUserHook;
... ...
@@ -83,9 +82,9 @@ public class UserTagHook extends DefaultUserHook {
83 83
 
84 84
 				ITags tagsService = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM).instance(ITags.class,
85 85
 						containerUid);
86
-				List<ItemValue<Tag>> tags = tagsService.all();
86
+				List<String> tags = tagsService.allUids();
87 87
 				tags.forEach(tag -> {
88
-					tagsService.delete(tag.uid);
88
+					tagsService.delete(tag);
89 89
 				});
90 90
 
91 91
 				IContainers cm = ServerSideServiceProvider.getProvider(SecurityContext.SYSTEM)
... ...
@@ -253,4 +253,10 @@ public class Tags implements ITags {
253 253
 		rbacManager.check(Verb.Write.name());
254 254
 	}
255 255
 
256
+	@Override
257
+	public List<String> allUids() throws ServerFault {
258
+		rbacManager.check(Verb.Read.name());
259
+		return storeService.allUids();
260
+	}
261
+
256 262
 }