Package es.emergya.bbdd.bean

Examples of es.emergya.bbdd.bean.Rol


    return res;
  }

  public static Rol findByName(String string) {
    Rol rol = null;
    try {
      rol = rolHome.find(string);
    } catch (Throwable t) {
      log.error(t, t);
    }
View Full Code Here


            i18n.getString("admin.roles.tabla.titulo.nombre"), //$NON-NLS-1$
            i18n.getString("admin.roles.tabla.titulo.ficha"), //$NON-NLS-1$
            i18n.getString("admin.roles.tabla.titulo.eliminar") //$NON-NLS-1$
        }, new String[][] { {} }, getNoFiltrarAction(),
        getFiltrarAction());
    roles.setTableData(getAll(new Rol()));
    roles.setErrorCause(i18n.getString("Roles.errorCause"));
    this.add(roles);
  }
View Full Code Here

      private static final long serialVersionUID = -2344175197357308765L;

      @Override
      protected void applyFilter(JTable filters) {
        final Rol example = new Rol();
        final Object valueAt = filters.getValueAt(0, 1);
        if (valueAt != null && valueAt.toString().length() > 0) {
          example.setNombre(valueAt.toString());
        }
        roles.setTableData(getAll(example));
      }
    };
  }
View Full Code Here

      private static final long serialVersionUID = 7405524818005801713L;

      @Override
      protected void applyFilter() {
        roles.setTableData(getAll(new Rol()));
      }
    };
  }
View Full Code Here

                      JOptionPane.YES_NO_CANCEL_OPTION);

              if (i == JOptionPane.YES_OPTION) {

                if (original == null) {
                  original = new Rol();
                }

                original.setInfoAdicional(textfieldPie
                    .getText());
                original.setNombre(textfieldCabecera.getText());

                HashSet<Flota> flotas = new HashSet<Flota>();
                for (Object r : ((DefaultListModel) right
                    .getModel()).toArray()) {
                  if (r instanceof Flota) {
                    flotas.add((Flota) r);
                  } else {
                    log.error(i18n
                        .getString("admin.roles18")); //$NON-NLS-1$
                  }
                }
                original.setFlotas(flotas);

                RolAdmin.saveOrUpdate(original);
                PluginEventHandler.fireChange(AdminRoles.this);

                cambios = false;
                original = null;

                roles.setTableData(getAll(new Rol()));

                closeFrame();
              } else if (i == JOptionPane.NO_OPTION) {
                closeFrame();
              }
View Full Code Here

        LOG.info("Usuario nulo. No devolvemos recursos");
        return new String[] {};
      }
      // Obtenemos todas las subflotas que puede supervisar el usuario a
      // partir de su rol
      Rol r = user.getRoles();
      if (r == null) {
        // Sin rol, no se pueden ver recursos
        LOG.info("Usuario sin rol. No devolvemos recursos.");
        return new String[] {};
      }
      // Utilizamos las flotas del rol para hacer una consulta sobre el
      // histórico.
      List<String> recursos = HistoricoGPSConsultas
          .findRecursosInIntervalForFoltas(r.getFlotas(),
              fechaInicio, fechaFinal, user);
      LOG.info("Se encontraron los siguientes recursos: " + recursos);
      return recursos.toArray(new String[0]);
    } catch (Throwable t) {
      LOG.error("Se produjo un error buscando los recursos del periodo",
View Full Code Here

          }
        }

      if (roles != null)
        for (Rol r : roles) {
          Rol rentity = (Rol) currentSession
              .get(Rol.class, r.getId());
          if (rentity != null) {
            rentity.getFlotas().add(entity);
            currentSession.saveOrUpdate(rentity);
          }
        }

      currentSession.saveOrUpdate(entity);
View Full Code Here

  @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false, rollbackFor = Throwable.class)
  public boolean saveOrUpdate(final Rol rol) {

    Session currentSession = getSession();
    currentSession.clear();
    Rol entity = null;

    final Set<Flota> flotas = rol.getFlotas();
    if (rol.getId() != null && this.get(rol.getId()) != null)
      entity = this.get(rol.getId());

    if (entity == null)
      entity = rol;

    if (entity == null)
      return false;

    entity.setInfoAdicional(rol.getInfoAdicional());
    currentSession.saveOrUpdate(entity);

    if (entity != null && flotas != null) {
      for (Flota f : flotas) {
        try {
          Flota flota = (Flota) currentSession.get(Flota.class, f
              .getId());
          flota.getRoles().add(entity);
          entity.getFlotas().add(flota);
          currentSession.saveOrUpdate(flota);
        } catch (Throwable t) {
          log.error(t);
        }
      }
View Full Code Here

    if (rol == null || rol.getId() == null)
      return;

    Session currentSession = getSession();
    currentSession.clear();
    Rol entity = this.get(rol.getId());

    if (entity == null)
      return;

    if (entity.getFlotas() != null)
      for (Flota f : entity.getFlotas()) {
        if (!rol.getFlotas().contains(f)) {
          log.debug("Borrando la flota " + f + " del rol " + entity);
          f.getRoles().remove(entity);
          currentSession.saveOrUpdate(f);
        } else
          log.debug("La flota " + f + " permanece en el rol "
              + entity);
      }
    entity.setFlotas(new HashSet<Flota>());
    currentSession.saveOrUpdate(entity);
  }
View Full Code Here

TOP

Related Classes of es.emergya.bbdd.bean.Rol

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.