Ejemplo n.º 1
1
 private boolean dataCheckRequiredGroup() {
   boolean required = true;
   if (dualListModelUser.getTarget() == null || dualListModelUser.getTarget().size() == 0) {
     MessageManager.createErrorMessage(
         "editFormGroup:message", JSFUtils.getStringFromBundle("ErrorNoSelectUser"));
     required = false;
   }
   return required;
 }
Ejemplo n.º 2
0
 public void setStoresModel(DualListModel<StoreData> storesModel) {
   this.storesModel = storesModel;
   log.debug("target size : " + storesModel.getTarget().size());
   List<String> ids = new ArrayList<String>();
   for (StoreData data : storesModel.getTarget()) ids.add(data.getUuid());
   if (ids.size() > 0) getUserForm().getUser().setStoreIds(ids);
 }
 @Override
 public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
   Object ret = null;
   if (uic instanceof PickList) {
     Object dualList = ((PickList) uic).getValue();
     DualListModel dl = (DualListModel) dualList;
     for (Object o : dl.getSource()) {
       String id = ((BaseLegal) o).getNbaselegalid().toString();
       if (string.equals(id)) {
         ret = o;
         break;
       }
     }
     if (ret == null) {
       for (Object o : dl.getTarget()) {
         String id = ((BaseLegal) o).getNbaselegalid().toString();
         if (string.equals(id)) {
           ret = o;
           break;
         }
       }
     }
   }
   return ret;
 }
Ejemplo n.º 4
0
  public void sendOffer() {
    Trade trade = new Trade();
    if (handtohand == true) {
      trade.setStatus("handtohand");
    } else {
      trade.setStatus("opened");
    }
    trade.setOfferingUser(userService.getUserById(SessionBean.getUserId()));
    trade.setReceivingUser(userService.getUserById(SessionBean.getUserForTradeId()));
    trade.setOfferingUserPay(false);
    trade.setReceivingUserPay(false);
    trade.setReceivedByOfferingUser(false);
    trade.setReceivedByReceivingUser(false);
    trade.setDeposit(deposit);
    tradeService.create(trade);
    Trade currentTrade = tradeService.getLastTradeByOfferingUserId(SessionBean.getUserId());
    for (Game g : myGames.getTarget()) {
      OfferingUserTrade out = new OfferingUserTrade();
      out.setOfferingGame(g);
      out.setOfferingTrade(currentTrade);
      offeringUserTradeService.create(out);
    }

    for (Game g : tradeUserGames.getTarget()) {
      ReceivingUserTrade rut = new ReceivingUserTrade();
      rut.setReceivingGame(g);
      rut.setReceivingTrade(currentTrade);
      receivingUserTradeService.create(rut);
    }

    SessionBean.getSession().removeAttribute("tradeuser");
    RequestContext.getCurrentInstance().closeDialog("tradeOffer");
    FacesContext.getCurrentInstance()
        .addMessage(null, new FacesMessage("Trade offer has been sent"));
  }
 @Override
 public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
   Object ret = null;
   if (arg1 instanceof PickList) {
     Object dualList = ((PickList) arg1).getValue();
     DualListModel dl = (DualListModel) dualList;
     for (Iterator iterator = dl.getSource().iterator(); iterator.hasNext(); ) {
       Object o = iterator.next();
       String id = (new StringBuilder()).append(((Projeto) o).getId()).toString();
       if (arg2.equals(id)) {
         ret = o;
         break;
       }
     }
     if (ret == null) {
       for (Iterator iterator1 = dl.getTarget().iterator(); iterator1.hasNext(); ) {
         Object o = iterator1.next();
         String id = (new StringBuilder()).append(((Projeto) o).getId()).toString();
         if (arg2.equals(id)) {
           ret = o;
           break;
         }
       }
     }
   }
   return ret;
 }
Ejemplo n.º 6
0
 private Set<Role> redefineRoles() {
   Set<Role> userRoles = new HashSet<Role>(userToUpdate.getRoles());
   for (String newRole : roleDefinitions.getSource()) {
     Role role = registrationDao.findRoleByRoleName(newRole);
     userRoles.remove(role);
   }
   for (String newRole : roleDefinitions.getTarget()) {
     Role role = registrationDao.findRoleByRoleName(newRole);
     userRoles.add(role);
   }
   return userRoles;
 }
Ejemplo n.º 7
0
 private Set<UserGroup> redefineGroups() {
   Set<UserGroup> userGroups = new HashSet<UserGroup>(userToUpdate.getGroups());
   for (String newGroup : groupDefinitions.getSource()) {
     UserGroup userGroup = registrationDao.findGroupByGroupName(newGroup);
     userGroups.remove(userGroup);
   }
   for (String newGroup : groupDefinitions.getTarget()) {
     UserGroup userGroup = registrationDao.findGroupByGroupName(newGroup);
     userGroups.add(userGroup);
   }
   return userGroups;
 }
 @Override
 public String guardar() {
   for (Usuario u : usuarios.getSource()) {
     u.setProyecto(null);
     usuarioServicio.guardar(u);
   }
   for (Usuario u : usuarios.getTarget()) {
     u.setProyecto(getSesionControlador().getProyecto());
     usuarioServicio.guardar(u);
   }
   return buscar();
 }
Ejemplo n.º 9
0
 // ###################################################################
 // business methods
 // ###################################################################
 public String saveUserRegistration() {
   if (!roleDefinitions.getTarget().isEmpty() && !groupDefinitions.getTarget().isEmpty()) {
     User newUser = defineBasicUserAttributes();
     Set<Role> userRoles = defineRoles();
     newUser.setRoles(userRoles);
     Set<UserGroup> userGroups = defineGroups();
     newUser.setGroups(userGroups);
     registrationDao.persist(newUser);
     resetFields();
     MessageService.displayFacesMessageInfo(
         "registration_properties", "REGISTRATION_SUCCESS_SUMMARY", "REGISTRATION_SUCCESS_DETAIL");
   }
   allUsersByCreationDate = registrationDao.findAllUsersByRegistrationDate();
   return "/pages/administration/registration/new.jsf";
 }
Ejemplo n.º 10
0
 @SuppressWarnings("unchecked")
 private SegPermiso getObjectFromUIPickListComponent(UIComponent component, String value) {
   final DualListModel<SegPermiso> dualList;
   try {
     dualList = (DualListModel<SegPermiso>) ((PickList) component).getValue();
     SegPermiso acc = getObjectFromList(dualList.getSource(), Integer.valueOf(value));
     if (acc == null) {
       acc = getObjectFromList(dualList.getTarget(), Integer.valueOf(value));
     }
     return acc;
   } catch (ClassCastException cce) {
     throw new ConverterException();
   } catch (NumberFormatException nfe) {
     throw new ConverterException();
   }
 }
Ejemplo n.º 11
0
 public void seleccionarCargaTurnos() {
   if (turnosASeleccionarModel != null) {
     turnosFacturados =
         turnoFacturadoF.crearLineas(turnosASeleccionarModel.getTarget(), getSelected());
     turnosFacturadosModel = new ListDataModel(turnosFacturados);
     getSelected().setTurnosFacturadosCollection(turnosFacturados);
   }
 }
Ejemplo n.º 12
0
  @Override
  public void validate(FacesContext context, UIComponent component, Object value)
      throws ValidatorException {

    if (value == null || value.toString().isEmpty()) {
      return;
    }

    DualListModel<FechaRemesaVO> fechasRemesas = (DualListModel<FechaRemesaVO>) value;
    if (fechasRemesas.getTarget().size() == 0) {
      throw new ValidatorException(
          new FacesMessage(
              FacesMessage.SEVERITY_ERROR,
              "Error de Validación",
              value + "No se ha seleccionado ningún día para la remesa"));
    }
  }
Ejemplo n.º 13
0
 private Set<UserGroup> defineGroups() {
   Set<UserGroup> userGroups = new HashSet<UserGroup>();
   for (String newGroup : groupDefinitions.getTarget()) {
     UserGroup userGroup = registrationDao.findGroupByGroupName(newGroup);
     userGroups.add(userGroup);
   }
   return userGroups;
 }
Ejemplo n.º 14
0
 private Set<Role> defineRoles() {
   Set<Role> userRoles = new HashSet<Role>();
   for (String newRole : roleDefinitions.getTarget()) {
     Role role = registrationDao.findRoleByRoleName(newRole);
     userRoles.add(role);
   }
   return userRoles;
 }
Ejemplo n.º 15
0
 public DualListModel<Privilege> getPrivileges() {
   if (this.getItem().getPrimaryKey() != null) {
     privileges =
         new DualListModel<Privilege>(new ArrayList<Privilege>(), new ArrayList<Privilege>());
     List<Privilege> targetPrivileges = roleService.findPrivilegesById(this.getItem().getRoleId());
     List<Privilege> availablePrivileges = privilegeService.loadAll();
     for (Privilege role : availablePrivileges) {
       if (targetPrivileges.contains(role)) {
         privileges.getSource().add(role);
       }
     }
     privileges.setTarget(targetPrivileges);
   } else {
     privileges =
         new DualListModel<Privilege>(privilegeService.loadAll(), new ArrayList<Privilege>());
   }
   return privileges;
 }
Ejemplo n.º 16
0
 public void addCursoNovo(CursoVO cursoNovo) {
   System.out.println("Teste");
   cursoNovo.setDisciplinas(model.getTarget());
   save(cursoNovo);
   if (cursoNovo.getCoordenador() != null) {
     cursoNovo.getCoordenador().setCargo(Cargos.COORDENADOR);
     DocenteDAO.getInstance().save(cursoNovo.getCoordenador());
   }
   cursoNovo.clear();
 }
Ejemplo n.º 17
0
  public void seleccionarEmbarqueYProveedor() {
    if (getSelected().getExportador() == null) {
      JsfUtil.addErrorMessage("Seleccione un Exportador");
    }

    if (getSelected().getEmbarque() == null) {
      JsfUtil.addErrorMessage("Seleccione un Embarque");
    }

    if (getSelected().getExportador() != null && getSelected().getEmbarque() != null) {
      turnosASeleccionarModel = new DualListModel<CargaTurno>();
      List<CargaTurno> cargaTurnosDelExportador =
          cargaTurnoF.obtenerCargasSinFacturar(
              getSelected().getEmbarque(), getSelected().getExportador());
      Collections.sort(cargaTurnosDelExportador);
      turnosASeleccionarModel.setSource(new ArrayList<CargaTurno>(cargaTurnosDelExportador));
      turnosASeleccionarModel.setTarget(new ArrayList<CargaTurno>());

      lineasFacturaModel = null;
      lineasFactura = null;
    }
  }
  public String salvar() {
    respPK = new ResponsavelAtividadePK();
    List<Supervisor> docentessupervisores = atividade.getProjeto().getSupervisorList();
    for (Supervisor docenteEnsBasico : docentessupervisores) {
      respPK.setSupervisor(docenteEnsBasico.getDocenteEnsBasico().getId());
    }
    List<ProfessorColaborador> docentescolaboradores =
        atividade.getProjeto().getProfessorColaboradorList();
    for (ProfessorColaborador docenteEnsSuperior : docentescolaboradores) {
      respPK.setDocente(docenteEnsSuperior.getDocenteEnsSuperior().getId());
    }
    List<AlunoColaborador> alunocolaborador = atividade.getProjeto().getAlunoColaboradorList();
    for (AlunoColaborador aluno : alunocolaborador) {
      respPK.setDiscente(aluno.getDiscente1().getId());
    }
    estaonoprojeto = discentes.getTarget();
    naoestaonoprojeto = discentes.getSource();
    for (Discente discente : naoestaonoprojeto) {
      discente.setStatusAtividade(0);
      rn.salvar(discente);
    }
    for (Discente discente : estaonoprojeto) {

      discente.setStatusAtividade(1);

      respPK.setDiscente(discente.getId());
      respPK.setAtividade(atividade.getId());
      if (discente.getStatus() == 1) {
        respPK.setBolsista(discente.getId());
      }
      responsavelatividade.setResponsavelAtividadePK(respPK);
      rn.salvar(discente);
      resrn.salvar(responsavelatividade);
    }
    return atribuir();
  }
  public void saveRoleToAccessRightsMapping() {
    try {
      List<AccessRights> selectedAccessRightsList = dualAccessRightsList.getTarget();
      HashSet<AccessRights> selectedAccessRightsSet = new HashSet<AccessRights>();
      selectedAccessRightsSet.addAll(selectedAccessRightsList);
      selectedRole.setAccessRights(selectedAccessRightsSet);
      getRoleService().update(selectedRole);

      auditTrail.log(
          SystemAuditTrailActivity.UPDATED,
          SystemAuditTrailLevel.INFO,
          getActorUsers().getId(),
          getActorUsers().getUsername(),
          getActorUsers().getUsername()
              + " has Assigned Access Rights for "
              + selectedRole.getRole());
    } catch (BSLException e) {
      FacesMessage msg = new FacesMessage("Error", getExcptnMesProperty(e.getMessage()));
      msg.setSeverity(FacesMessage.SEVERITY_ERROR);
      FacesContext.getCurrentInstance().addMessage(null, msg);
    }
  }
Ejemplo n.º 20
0
 public String updateCurrentGroupPermissionView() {
   try {
     if (!dataCheckRequiredPermission()) {
       return "";
     }
     if (!auxCodeSecureAction.equals(codeSecureAction)) {
       generateRandom();
       throw new ValidatorException(
           new FacesMessage(
               FacesMessage.SEVERITY_ERROR,
               JSFUtils.getStringFromBundle(Constants.ERROR_VALIDATION),
               JSFUtils.getStringFromBundle(Constants.ERROR_VALIDATION)));
     }
     security.addManyGroupPermissionEdit(
         currentEntity.getId().toString(), dualListModelPermission.getTarget());
     MessageManager.createInfoMessage(
         "editFormPermission:message", JSFUtils.getStringFromBundle("UpdateOK"));
   } catch (Exception ex) {
     LOGGER.error("Error update Gruop with permissions: " + ex.getMessage(), ex);
     MessageManager.createErrorMessage("editFormPermission:message", ex.getLocalizedMessage());
   }
   reload();
   return null;
 }
Ejemplo n.º 21
0
 public List<Kraj> getSelected() {
   return tempList.getTarget();
 }
Ejemplo n.º 22
0
 public void setRolesModel(DualListModel<RoleData> rolesModel) {
   this.rolesModel = rolesModel;
   List<String> ids = new ArrayList<String>();
   for (RoleData data : rolesModel.getTarget()) ids.add(data.getRole());
   if (ids.size() > 0) getUserForm().getUser().setRoleIds(ids);
 }