Example #1
0
 private void removeTags(Set<Tag> newTags, Set<Tag> orginalTags) {
   SetView<Tag> removedTags = Sets.difference(orginalTags, newTags);
   logger.debug("removedTags size : {}", removedTags.size());
   for (Tag tag : removedTags) {
     tag.deTagged();
   }
 }
Example #2
0
 private void addNewTags(Set<Tag> newTags, Set<Tag> orginalTags) {
   SetView<Tag> addedTags = Sets.difference(newTags, orginalTags);
   logger.debug("addedTags size : {}", addedTags.size());
   for (Tag tag : addedTags) {
     tag.tagged();
   }
 }
Example #3
0
 private void applyParsedTag(String parsedTag) {
   Tag tag = tagRepository.findByName(parsedTag);
   if (tag != null) {
     tags.add(tag.getRevisedTag());
   } else {
     newTags.add(new NewTag(parsedTag));
   }
 }
Example #4
0
 @RequestMapping("/search")
 public @ResponseBody List<TagForm> searchByTagName(String name) {
   logger.debug("search tag by name : {}", name);
   List<Tag> searchedTags = tagService.findsBySearch(name);
   List<TagForm> tags = new ArrayList<TagForm>();
   for (Tag tag : searchedTags) {
     tags.add(new TagForm(tag.getName()));
   }
   return tags;
 }
Example #5
0
  @Test
  public void processTags_최초_생성() throws Exception {
    // given
    Tag tag = new Tag("java");
    String plainTags = "java newTags";
    Set<Tag> originalTags = Sets.newHashSet();
    when(tagRepository.findByName(tag.getName())).thenReturn(tag);

    // when
    dut.processTags(originalTags, plainTags);

    // then
    Set<Tag> tags = dut.getTags();
    assertThat(tags.size(), is(1));
    assertThat(tag.getTaggedCount(), is(1));
    assertThat(dut.getDenormalizedTags(), is("java"));
    Set<NewTag> newTags = dut.getNewTags();
    assertThat(newTags.size(), is(1));
  }
Example #6
0
 private Tag createTaggedTag(String tagName) {
   Tag tag = new Tag(tagName);
   tag.tagged();
   return tag;
 }