Examples of TagEntity


Examples of org.vosao.entity.TagEntity

    return getBusiness().getTagBusiness().getTree(name);
  }

  @Override
  public List<PageEntity> getPagesById(Long tagId) {
    TagEntity tag = getDao().getTagDao().getById(tagId);
    List<PageEntity> result = new ArrayList<PageEntity>();
    if (tag != null) {
      for (String url : tag.getPages()) {
        PageEntity page = getBusiness().getPageBusiness().getByUrl(url);
        if (page != null) {
          result.add(page);
        }
      }
View Full Code Here

Examples of org.vosao.entity.TagEntity

    if (paths.length == 0) {
      return Collections.EMPTY_LIST;
    }
    Set<PageEntity> pages = null;
    for (String tagPath : paths) {
      TagEntity tag = getBusiness().getTagBusiness().getByPath(tagPath);
      if (tag != null) {
        if (pages == null) {
          pages = getPagesByTag(tag.getId());
        }
        else {
          pages.retainAll(getPagesByTag(tag.getId()));
        }
      }
    }
    List<PageEntity> result = new ArrayList<PageEntity>(pages);
    Collections.sort(result, PageHelper.PUBLISH_DATE);
View Full Code Here

Examples of org.vosao.entity.TagEntity

    }
    if (StringUtils.isEmpty(tag.getName())) {
      return Messages.get("name_is_empty");
    }
    else {
      TagEntity found = getDao().getTagDao().getByName(tag.getParent(),
          tag.getName());
      if (tag.isNew()) {
        if (found != null) {
          return Messages.get("tag_already_exists");
        }
      }
      else {
        if (found != null && !found.getId().equals(tag.getId())) {
          return Messages.get("tag_already_exists");
       
      }
    }
    if (TAG_NAME_DISALLOWED.matcher(tag.getName()).find()) {
View Full Code Here

Examples of org.vosao.entity.TagEntity

  @Override
  public TagEntity getByPath(String tagPath) {
    int start = tagPath.startsWith("/") ? 1 : 0;
    String[] names = tagPath.substring(start).split("/");
    Long parent = null;
    TagEntity tag = null;
    for (String name : names) {
      tag = getDao().getTagDao().getByName(parent, name);
      if (tag == null) {
        return null;
      }
      parent = tag.getId();
    }
    return tag;
  }
View Full Code Here

Examples of org.vosao.entity.TagEntity

  @Override
  public String getPath(TagEntity tag) {
    String result = tag.getName();
    Long parent = tag.getParent();
    while (parent != null) {
      TagEntity parentTag = getDao().getTagDao().getById(parent);
      if (parentTag != null) {
        result = parentTag.getName() + "/" + result;
        parent = parentTag.getParent();
      }
      else {
        logger.error("Tag not found " + parent);
        parent = null;
      }
View Full Code Here

Examples of org.vosao.entity.TagEntity

    return getDao().getTagDao().getById(id);
  }

  @Override
  public ServiceResponse save(Map<String, String> vo) {
    TagEntity tag = null;
    if (!StringUtils.isEmpty(vo.get("id"))) {
      tag = getDao().getTagDao().getById(Long.valueOf(vo.get("id")));
    }
    if (tag == null) {
      tag = new TagEntity();
    }
    if (StringUtils.isEmpty(vo.get("parent"))) {
      tag.setParent(null);
    }
    else {
      tag.setParent(Long.valueOf(vo.get("parent")));
    }
    tag.setName(vo.get("name"));
    tag.setTitle(vo.get("title"));
    String error = getBusiness().getTagBusiness().validateBeforeSave(tag);
    if (error == null) {
      getDao().getTagDao().save(tag);
      return ServiceResponse.createSuccessResponse(
          Messages.get("tag.success_save"));
View Full Code Here

Examples of org.vosao.entity.TagEntity

        Messages.get("tag.success_remove"));
  }

  @Override
  public ServiceResponse addTag(String pageURL, Long tagId) {
    TagEntity tag = getDao().getTagDao().getById(tagId);
    if (tag == null) {
      logger.error("Tag not found " + tagId);
    }
    else {
      getBusiness().getTagBusiness().addTag(pageURL, tag);
View Full Code Here

Examples of org.vosao.entity.TagEntity

        Messages.get("tag.success_add"));
  }

  @Override
  public ServiceResponse removeTag(String pageURL, Long tagId) {
    TagEntity tag = getDao().getTagDao().getById(tagId);
    if (tag != null) {
      getBusiness().getTagBusiness().removeTag(pageURL, tag);
    }
    return ServiceResponse.createSuccessResponse(
        Messages.get("tag.success_remove"));
View Full Code Here

Examples of org.vosao.entity.TagEntity

  }

  @Override
  public List<PageVO> getPages(Long tagId) {
    List<PageVO> result = new ArrayList<PageVO>();
    TagEntity tag = getById(tagId);
    if (tag != null) {
      for (String url : tag.getPages()) {
        PageEntity page = getBusiness().getPageBusiness().getByUrl(url);
        if (page != null) {
          result.add(new PageVO(page));
        }
      }
View Full Code Here

Examples of org.vosao.entity.TagEntity

import org.vosao.entity.TagEntity;

public class TagDaoTest extends AbstractDaoTest {

  private TagEntity addTag(Long parent, String name) {
    return getDao().getTagDao().save(new TagEntity(parent, name, name));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.