Examples of SeoUrlEntity


Examples of org.vosao.entity.SeoUrlEntity

            return;
        }
        if (!isLoggedIn(httpRequest) && servedFromCache(url, httpResponse)) {
          return;
        }
        SeoUrlEntity seoUrl = getDao().getSeoUrlDao().getByFrom(url);
        if (seoUrl != null) {
          httpResponse.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
          httpResponse.setHeader("Location", seoUrl.getToLink());
          httpResponse.setHeader("Connection", "close");
            return;
        }
      try {
        if (getDao().getGroupDao().getGuestsGroup() == null) {
View Full Code Here

Examples of org.vosao.entity.SeoUrlEntity


public class SeoUrlDaoTest extends AbstractDaoTest {

  private SeoUrlEntity addSeoUrl(String from, String to) {
    return getDao().getSeoUrlDao().save(new SeoUrlEntity(from, to));
  }
View Full Code Here

Examples of org.vosao.entity.SeoUrlEntity

 
  public void testGetByFrom() {
    addSeoUrl("/man", "/woman");
    addSeoUrl("/black", "/white");
    addSeoUrl("/super/man", "/ordinal/woman");
    SeoUrlEntity s = getDao().getSeoUrlDao().getByFrom("/man");
    assertNotNull(s);
    assertEquals("/woman", s.getToLink());
    s = getDao().getSeoUrlDao().getByFrom(null);
    assertNull(s);
    s = getDao().getSeoUrlDao().getByFrom("/megahit");
    assertNull(s);
 
View Full Code Here

Examples of org.vosao.entity.SeoUrlEntity

        i.hasNext(); ) {
            Element element = i.next();
            if (element.getName().equals("seo-url")) {
              String from = element.elementText("from");
              String to = element.elementText("to");
              SeoUrlEntity seourl = getDao().getSeoUrlDao().getByFrom(from);
              if (seourl == null) {
                seourl = new SeoUrlEntity(from, to);
              }
              getDaoTaskAdapter().seoUrlSave(seourl);
            }
    }   
  }
View Full Code Here

Examples of org.vosao.entity.SeoUrlEntity

  @Override
  public void seoUrlSave(SeoUrlEntity entity) throws DaoTaskException {
    if (isSkip()) {
      if (entity.getId() == null) {
        SeoUrlEntity found = getDao().getSeoUrlDao().getByFrom(
            entity.getFromLink());
        if (found == null) {
          throw new DaoTaskException("SeoUrl not found while "
            + "skipping save operation. " + entity.getFromLink());
        }
        entity.setId(found.getId());
      }
    }
    else {
      getDao().getSeoUrlDao().saveNoAudit(entity);
    }
View Full Code Here

Examples of org.vosao.entity.SeoUrlEntity

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

  private List<String> validate(SeoUrlEntity entity) {
    List<String> errors = new ArrayList<String>();
    SeoUrlEntity found = getDao().getSeoUrlDao().getByFrom(
        entity.getFromLink());
    if (found != null && !found.getId().equals(entity.getId())) {
        errors.add(Messages.get("seo_urls.already_exists"));
    }
    return errors;
  }
View Full Code Here

Examples of org.vosao.entity.SeoUrlEntity

    return errors;
  }
 
  @Override
  public ServiceResponse save(Map<String, String> vo) {
    SeoUrlEntity seoUrl = null;
    if (!StringUtils.isEmpty(vo.get("id"))) {
      seoUrl = getDao().getSeoUrlDao().getById(Long.valueOf(vo.get("id")));
    }
    if (seoUrl == null) {
      seoUrl = new SeoUrlEntity();
    }
    seoUrl.setFromLink(vo.get("fromLink"));
    seoUrl.setToLink(vo.get("toLink"));
    List<String> errors = validate(seoUrl);
    if (errors.isEmpty()) {
      getDao().getSeoUrlDao().save(seoUrl);
      return ServiceResponse.createSuccessResponse(
          Messages.get("seo_urls.success_save"));
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.