コード例 #1
0
ファイル: AcessoHelper.java プロジェクト: tiagoobastos/DEIP
  public AcessoTO montaTOBasico(AcessoFormBean formulario, HttpServletRequest request)
      throws Exception {
    AcessoTO acessoTO = new AcessoTO();

    BeanUtils.copyProperties(acessoTO, formulario);

    if (Util.isNumeric(formulario.getCdAcesso()))
      acessoTO.setId(Long.valueOf(formulario.getCdAcesso()));

    acessoTO.setCdSite(formulario.getCodigoSite());
    acessoTO.setDataSEV(Util.converteStringForDate(formulario.getDtSEV()));
    acessoTO.setAlteracaoBanda(
        formulario.getAlteracaoBanda() == null ? "N" : formulario.getAlteracaoBanda());
    acessoTO.setMudancaAcesso(
        formulario.getMudancaAcesso() == null ? "N" : formulario.getMudancaAcesso());
    acessoTO.setNumeroVelocidadeAcesso(formulario.getCodigoVelocidadeAcesso());
    acessoTO.setTpAcao(formulario.getTpAcao());

    // preencho no acessoTO, os campos relacionados ao SSA primeiro.
    SsaDeipHelper interfaceSsaDeip = SsaDeipHelper.create();
    AcessoHelper acessoHelper = AcessoHelper.create();
    SsaDeipTO interfaceSsaDeipTO = new SsaDeipTO();
    interfaceSsaDeipTO =
        interfaceSsaDeip.recuperaDadosInterface(Long.parseLong(formulario.getNumeroSEV()));

    acessoTO.setCodigoTipoAcessoSSA(
        acessoHelper.retornaTipoAcesso(interfaceSsaDeipTO.getNoTecnologia()).getDescTipoAcesso());
    acessoTO.setSevMestra(interfaceSsaDeipTO.getSevMestra());
    acessoTO.setCnlEstacaoSSA(interfaceSsaDeipTO.getCnl());
    acessoTO.setComplEstacaoSSA(interfaceSsaDeipTO.getNoComplemento());
    acessoTO.setNumeroVelocidadeAcesso(interfaceSsaDeipTO.getVelDes());

    return acessoTO;
  }
コード例 #2
0
ファイル: AcessoHelper.java プロジェクト: tiagoobastos/DEIP
  public void montaTelaForm(AcessoTO acessoTO, AcessoFormBean formulario) throws Exception {
    if (Util.isNumeric(acessoTO.getCodigoAcesso()))
      formulario.setCodigoAcesso(Long.parseLong(acessoTO.getCodigoAcesso()));

    formulario.setCdSite(acessoTO.getCdSite());
    formulario.setCodigoTipoAcesso(acessoTO.getCodigoTipoAcessoSSA());
    formulario.setCodigoInterface(acessoTO.getCodigoInterfaceSSA());
    formulario.setCodigoCaracteristicaInterface(
        "1"); // forçar "1" para não dar erro de PARENT KEY NOT FOUND
    formulario.setCodigoFornecedor(acessoTO.getCodigoFornecedor());
    formulario.setNumeroSEV(acessoTO.getNumeroSEV());
    formulario.setDtSEV(Util.convertDateToString(acessoTO.getDataSEV(), "dd/MM/yyyy"));
    formulario.setNumeroVelocidadeAcesso(acessoTO.getNumeroVelocidadeAcesso());
    formulario.setMudancaAcesso(acessoTO.getMudancaAcesso());
    formulario.setAtivacao(
        TipoAcaoEnum.INCLUSAO.getTipo().equals(acessoTO.getTpAcao())
            || acessoTO.getTpAcao() == null);
    formulario.setTpAcao(acessoTO.getTpAcao());

    if (acessoTO.getNumeroVelocidadeServico() == null
        || "null".equals(acessoTO.getNumeroVelocidadeServico().toLowerCase()))
      formulario.setNumeroVelocidadeServico("");
    else formulario.setNumeroVelocidadeServico(acessoTO.getNumeroVelocidadeServico());

    if (acessoTO.getMudancaAcesso() != null && acessoTO.getMudancaAcesso().equals("S"))
      formulario.setMudancaAcessoBoolean(true);
    else formulario.setMudancaAcessoBoolean(false);

    formulario.setAlteracaoBanda(acessoTO.getAlteracaoBanda());

    if (acessoTO.getAlteracaoBanda() != null && acessoTO.getAlteracaoBanda().equals("S"))
      formulario.setAlteracaoBandaBoolean(true);
    else formulario.setAlteracaoBandaBoolean(false);
  }
コード例 #3
0
ファイル: AcessoHelper.java プロジェクト: tiagoobastos/DEIP
  public String getDataSev(AcessoFormBean formulario) throws Exception {
    SevTO sev = new SevTO();

    if (Util.isNumeric(formulario.getNumeroSEV())) sev.setId(new Long(formulario.getNumeroSEV()));

    if (!Util.isBlankOrNull(formulario.getNumeroSEV())) {
      sev = RecuperaSEVDelegate.getInstance().recuperaCepSEV(sev);
      if (sev.getDataSev() != null) {
        return sev.getDataSev().toString();
      } else {
        return "";
      }
    } else return "";
  }
コード例 #4
0
ファイル: EquipamentoTO.java プロジェクト: tiagoobastos/DEIP
  public String getDesTelefone() {
    if (!Util.isBlankOrNull(this.inTelefone)) {
      if (SimOuNaoEnum.SIM.getLabel().substring(0, 1).equals(this.inTelefone)) {
        return SimOuNaoEnum.SIM.getLabel();
      } else {
        return SimOuNaoEnum.NAO.getLabel();
      }

    } else {
      return "";
    }
  }
コード例 #5
0
ファイル: AcessoHelper.java プロジェクト: tiagoobastos/DEIP
  public boolean isSevValid(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    AcessoFormBean formulario = (AcessoFormBean) form;

    /* Comentado bloco abaixo, pois ele ignorava a validação de SEV, caso a SEV anterior fosse igual a SEV atual.
    if(AcessoAction.ACESSO_FORM_ALT.equals(formulario.getTelaFormJsp()) && !Util.isBlankOrNull(formulario.getCdAcesso()))
    {
    	AcessoTO acessoAntesDeAtualizar = (AcessoTO) AcessoDelegate.getInstance().read(Long.parseLong(formulario.getCdAcesso()));

    	if(!Util.isBlankOrNull(acessoAntesDeAtualizar.getNumeroSEVAnt()) && acessoAntesDeAtualizar.getNumeroSEVAnt().equals(formulario.getNumeroSEV()))
    		return true;
    }*/

    SevTO sev = new SevTO();
    if (Util.isNumeric(formulario.getNumeroSEV())) sev.setId(new Long(formulario.getNumeroSEV()));

    // SEV_MESTRA
    if (RecuperaSEVDelegate.getInstance().isSevMestra(formulario.getNumeroSEV()).equals("S")) {
      sev = RecuperaSEVDelegate.getInstance().recuperaCepSEV(sev);
      formulario.setInterfaceSEVCepRetorno(formulario.getCep());
      formulario.setValidadeDtVigencia(sev.getStatus());
      formulario.setDtSEV(sev.getDataSev());
      return "TRUE".equals(sev.getStatus());
    } else {
      if (!Util.isBlankOrNull(formulario.getNumeroSEV())) {
        sev = RecuperaSEVDelegate.getInstance().recuperaCepSEV(sev);
        formulario.setInterfaceSEVCepRetorno(sev.getCep());
        formulario.setValidadeDtVigencia(sev.getStatus());
        formulario.setDtSEV(sev.getDataSev());
      }
      formulario.setInterfaceSEVCepRetorno(sev.getCep());
    }
    if (formulario.getCep().equals(sev.getCep()) && "TRUE".equals(sev.getStatus())) return true;
    else return false;
  }
コード例 #6
0
ファイル: AcessoHelper.java プロジェクト: tiagoobastos/DEIP
  public ActionErrors validate(
      ActionMapping mapping, AcessoFormBean formulario, HttpServletRequest request)
      throws Exception {
    ActionErrors errors = new ActionErrors(); // formulario.validate(mapping, request);

    if (formulario.getCodigoTipoAcesso().isEmpty()) {
      errors.add("", new ActionMessage("AcessoFormBean.codigoTipoAcesso"));
    }

    if (formulario.getCodigoInterface().isEmpty()) {
      errors.add("", new ActionMessage("AcessoFormBean.codigoInterface"));
    }
    /* Codigo Velocidade Retirado - Projeto adocao.
    if(formulario.getCodigoVelocidadeAcesso().isEmpty()){
    	errors.add("", new ActionMessage("AcessoFormBean.velocidadeAcesso"));
    }
    */
    /*
    		if(formulario.getCodigoCaracteristicaInterface().isEmpty()){
    			errors.add("", new ActionMessage("AcessoFormBean.caraInter"));
    		}
    */
    if (formulario.getCodigoFornecedor().isEmpty()) {
      errors.add("", new ActionMessage("AcessoFormBean.codigoFornecedor"));
    }

    if (formulario.getNumeroSEV().isEmpty()) {
      errors.add("", new ActionMessage("AcessoFormBean.sev"));
    }
    /*
    if(formulario.getDtSEV().isEmpty()){
    	errors.add("", new ActionMessage("AcessoFormBean.dataSev"));
    }
     */
    if (Util.isBlankOrNull(formulario.getMudancaAcesso())
        && isTrocaEnderecoWorkflow(request)
        && AcessoDelegate.getInstance()
            .isMandatoryAccessChangeRequest(Long.valueOf(formulario.getCodigoSite()))) {
      errors.add("", new ActionMessage("AcessoFormBean.mudancaAcesso"));
    }

    if (!permiteTrocaAcesso(formulario, request) && !"8".equals(formulario.getCodigoTipoAcesso())) {
      errors.add("", new ActionMessage("AcessoFormBean.trocaAcessoNaoPermitida"));
    }

    return errors;
  }
コード例 #7
0
ファイル: AcessoHelper.java プロジェクト: tiagoobastos/DEIP
  public void preencheTOsdeCombo(AcessoTO acessoTO, AcessoFormBean formulario)
      throws NumberFormatException, DelegateException, BusinessException {
    if (Util.isNumeric(acessoTO.getCodigoCaracteristicaInterface()))
      formulario.setCaracteristicaInterfaceTO(
          (CaracteristicaInterfaceTO)
              CaracteristicaInterfaceDelegate.getInstance()
                  .read(Long.valueOf(acessoTO.getCodigoCaracteristicaInterface())));
    else formulario.setCaracteristicaInterfaceTO(new CaracteristicaInterfaceTO());

    if (Util.isNumeric(acessoTO.getCodigoInterface()))
      formulario.setInterfaceTO(
          (InterfaceTO)
              InterfaceDelegate.getInstance().read(Long.valueOf(acessoTO.getCodigoInterface())));
    else formulario.setInterfaceTO(new InterfaceTO());

    if (Util.isNumeric(acessoTO.getCodigoInterfaceSSA()))
      formulario.setInterfaceTO(
          (InterfaceTO)
              InterfaceDelegate.getInstance().read(Long.valueOf(acessoTO.getCodigoInterfaceSSA())));
    else formulario.setInterfaceTO(new InterfaceTO());

    if (Util.isNumeric(acessoTO.getCodigoTipoAcesso()))
      formulario.setTipoAcessoTO(
          (TipoAcessoTO)
              TipoAcessoDelegate.getInstance().read(Long.valueOf(acessoTO.getCodigoTipoAcesso())));
    else formulario.setTipoAcessoTO(new TipoAcessoTO());

    if (Util.isNumeric(acessoTO.getCodigoTipoAcessoSSA()))
      formulario.setTipoAcessoTO(
          (TipoAcessoTO)
              TipoAcessoDelegate.getInstance()
                  .read(Long.valueOf(acessoTO.getCodigoTipoAcessoSSA())));
    else formulario.setTipoAcessoTO(new TipoAcessoTO());

    if (Util.isNumeric(acessoTO.getCodigoFornecedor()))
      formulario.setProvedorAcessoTO(
          (ProvedorAcessoTO)
              ProvedorAcessoDelegate.getInstance()
                  .read(Long.valueOf(acessoTO.getCodigoFornecedor())));
    else formulario.setProvedorAcessoTO(new ProvedorAcessoTO());
  }