diff --git a/src/main/java/lv/ctco/javaschool/goal/boundary/GoalApi.java b/src/main/java/lv/ctco/javaschool/goal/boundary/GoalApi.java index 8b42bc7..4404060 100644 --- a/src/main/java/lv/ctco/javaschool/goal/boundary/GoalApi.java +++ b/src/main/java/lv/ctco/javaschool/goal/boundary/GoalApi.java @@ -3,7 +3,7 @@ import lv.ctco.javaschool.auth.control.UserStore; import lv.ctco.javaschool.auth.entity.domain.User; import lv.ctco.javaschool.goal.control.GoalStore; - +import lv.ctco.javaschool.goal.entity.TagDto; import javax.annotation.security.RolesAllowed; import javax.inject.Inject; @@ -13,6 +13,9 @@ import javax.ws.rs.Path; import javax.ws.rs.GET; import javax.ws.rs.POST; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; @Path("/goal") @Stateless @@ -31,4 +34,32 @@ public class GoalApi { public void startPage() { // User currentUser = userStore.getCurrentUser(); } + + @GET + @RolesAllowed({"ADMIN", "USER"}) + @Path("/taglist") + public List drawRecordTable() { + List dto = new ArrayList<>(); + int tagCount=new Random().nextInt(5)+3; + for(int i=0; i dto = goalStore.getTagList(); +// return new Gson().toJson(dto); + } + + private static String generateRandomWord() { + String randomStrings = new String(""); + Random random = new Random(); + char[] word = new char[random.nextInt(8) + 3]; // words of length 3 through 10. (1 and 2 letter words are boring.) + for (int j = 0; j < word.length; j++) { + word[j] = (char) ('a' + random.nextInt(26)); + } + randomStrings = new String(word); + return randomStrings; + } + + }