コード例 #1
0
ファイル: UserPage.java プロジェクト: yudhik/brain-invoicing
 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);
 }
コード例 #2
0
 @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;
 }
コード例 #3
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"));
  }
コード例 #4
0
 @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;
 }
コード例 #5
0
ファイル: GroupController.java プロジェクト: xabe/Spring
 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;
 }
コード例 #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;
 }
コード例 #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;
 }
コード例 #8
0
 @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();
 }
コード例 #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";
 }
コード例 #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();
   }
 }
コード例 #11
0
 public void seleccionarCargaTurnos() {
   if (turnosASeleccionarModel != null) {
     turnosFacturados =
         turnoFacturadoF.crearLineas(turnosASeleccionarModel.getTarget(), getSelected());
     turnosFacturadosModel = new ListDataModel(turnosFacturados);
     getSelected().setTurnosFacturadosCollection(turnosFacturados);
   }
 }
コード例 #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"));
    }
  }
コード例 #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;
 }
コード例 #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;
 }
コード例 #15
0
ファイル: RoleController.java プロジェクト: piomin/pm-core
 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;
 }
コード例 #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();
 }
コード例 #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;
    }
  }
コード例 #18
0
  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();
  }
コード例 #19
0
  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);
    }
  }
コード例 #20
0
ファイル: GroupController.java プロジェクト: xabe/Spring
 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;
 }
コード例 #21
0
ファイル: MebelFormBean.java プロジェクト: Zynio/Java-EE
 public List<Kraj> getSelected() {
   return tempList.getTarget();
 }
コード例 #22
0
ファイル: UserPage.java プロジェクト: yudhik/brain-invoicing
 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);
 }