示例#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;
 }
  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"));
  }
示例#3
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);
 }
 // ###################################################################
 // 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";
 }
 @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;
 }
 @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;
 }
 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;
 }
 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;
 }
 public void seleccionarCargaTurnos() {
   if (turnosASeleccionarModel != null) {
     turnosFacturados =
         turnoFacturadoF.crearLineas(turnosASeleccionarModel.getTarget(), getSelected());
     turnosFacturadosModel = new ListDataModel(turnosFacturados);
     getSelected().setTurnosFacturadosCollection(turnosFacturados);
   }
 }
示例#10
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();
 }
 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;
 }
 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();
 }
 @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();
   }
 }
  @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"));
    }
  }
  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);
    }
  }
  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();
  }
示例#18
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;
 }
示例#19
0
 public List<Kraj> getSelected() {
   return tempList.getTarget();
 }
示例#20
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);
 }