Package ch.entwine.weblounge.security.sql.entities

Examples of ch.entwine.weblounge.security.sql.entities.JpaSite


    try {
      jpaAccount = query.getSingleResult();
      logger.debug("User account already exists for user '{}'", login);
    } catch (NoResultException e) {
      JpaSite jpaSite = registerSite(site);
      jpaAccount = new JpaAccount(jpaSite, login, password);
      entityManager.persist(jpaAccount);
      logger.info("User account '{}@{}' created", login, site);
    }
View Full Code Here


  public boolean isSiteEnabled(String site) throws Exception {
    TypedQuery<JpaSite> query = null;
    query = entityManager.createNamedQuery("getSiteByName", JpaSite.class);
    query.setParameter("site", site);

    JpaSite jpaSite = null;
    try {
      jpaSite = query.getSingleResult();
      return jpaSite.isEnabled();
    } catch (NoResultException e) {
      logger.debug("Site '{}' is not part of the user database (yet)", site);
      return true;
    }
  }
View Full Code Here

   */
  private void toggleSite(String site, boolean enable) throws Exception {
    TypedQuery<JpaSite> query = null;
    query = entityManager.createNamedQuery("getSiteByName", JpaSite.class);
    query.setParameter("site", site);
    JpaSite jpaSite = null;
    try {
      jpaSite = query.getSingleResult();
    } catch (NoResultException e) {
      jpaSite = registerSite(site);
    }
    jpaSite.setEnabled(enable);
    entityManager.merge(jpaSite);
  }
View Full Code Here

   */
  protected JpaSite registerSite(String site) {
    TypedQuery<JpaSite> query = null;
    query = entityManager.createNamedQuery("getSiteByName", JpaSite.class);
    query.setParameter("site", site);
    JpaSite jpaSite = null;
    try {
      jpaSite = query.getSingleResult();
    } catch (NoResultException e) {
      jpaSite = new JpaSite(site);
      entityManager.persist(jpaSite);
      logger.info("Site '{}' created in user database", site);
    }
    return jpaSite;
  }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.security.sql.entities.JpaSite

Copyright © 2018 www.massapicom. 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.