コード例 #1
1
  @SuppressWarnings("unchecked")
  public ResidentConverter(List<ObjectConverter.ColumnInfo> allColumns) throws java.io.IOException {
    Optional<ObjectConverter.ColumnInfo> column;

    final java.util.List<ObjectConverter.ColumnInfo> columns =
        allColumns
            .stream()
            .filter(
                it ->
                    "mixinReference".equals(it.typeSchema) && "Resident_entity".equals(it.typeName))
            .collect(Collectors.toList());
    columnCount = columns.size();

    readers = new ObjectConverter.Reader[columnCount];
    for (int i = 0; i < readers.length; i++) {
      readers[i] = (instance, rdr, ctx) -> StringConverter.skip(rdr, ctx);
    }

    final java.util.List<ObjectConverter.ColumnInfo> columnsExtended =
        allColumns
            .stream()
            .filter(
                it ->
                    "mixinReference".equals(it.typeSchema)
                        && "-ngs_Resident_type-".equals(it.typeName))
            .collect(Collectors.toList());
    columnCountExtended = columnsExtended.size();

    readersExtended = new ObjectConverter.Reader[columnCountExtended];
    for (int i = 0; i < readersExtended.length; i++) {
      readersExtended[i] = (instance, rdr, ctx) -> StringConverter.skip(rdr, ctx);
    }

    column = columns.stream().filter(it -> "id".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'id' column in mixinReference Resident_entity. Check if DB is in sync");
    __index___id = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "id".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'id' column in mixinReference Resident. Check if DB is in sync");
    __index__extended_id = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "birth".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'birth' column in mixinReference Resident_entity. Check if DB is in sync");
    __index___birth = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "birth".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'birth' column in mixinReference Resident. Check if DB is in sync");
    __index__extended_birth = (int) column.get().order - 1;
  }
コード例 #2
0
ファイル: QuestaoTexto.java プロジェクト: NAWEB-USP/aulas
  public boolean comparaDuasRespostas(String resp1, String resp2) throws java.lang.Exception {

    // --- prepara respostas para comparacao ---

    // From DataBase Notation
    String temp1 = StringConverter.fromDataBaseNotation(resp1);
    String temp2 = StringConverter.fromDataBaseNotation(resp2);

    // lowercase
    temp1 = temp1.toLowerCase();
    temp2 = temp2.toLowerCase();

    // sem acentos
    temp1 = StringConverter.removeAcentos(temp1);
    temp2 = StringConverter.removeAcentos(temp2);

    // corrige parenteses
    temp1 = StringConverter.replace(temp1, ") (", ")(");
    temp1 = StringConverter.replace(temp1, "( ", "(");
    temp1 = StringConverter.replace(temp1, " )", ")");
    temp2 = StringConverter.replace(temp2, ") (", ")(");
    temp2 = StringConverter.replace(temp2, "( ", "(");
    temp2 = StringConverter.replace(temp2, " )", ")");

    return temp1.equals(temp2);
  }
  public static void serialize(final Writer writer, final Customer value) throws IOException {
    writer.write("{\"URI\":");
    StringConverter.serialize(value.getURI(), writer);

    final String _name = value.getName();
    if (_name.length() > 0) {
      writer.write(",\"name\":");
      StringConverter.serialize(_name, writer);
    }
    writer.write(",\"profile\":");
    ProfileManualOptJsonSerialization.serialize(writer, value.getProfile());
    final List<Account> _accounts = value.getAccounts();
    if (_accounts != null && !_accounts.isEmpty()) {
      writer.write(",\"accounts\":[");
      int _cnt = 0;
      final int _total = _accounts.size() - 1;
      for (; _cnt < _total; _cnt++) {
        AccountManualOptJsonSerialization.serialize(writer, _accounts.get(_cnt));
        writer.write(',');
      }
      AccountManualOptJsonSerialization.serialize(writer, _accounts.get(_cnt));
      writer.write(']');
    } else if (_accounts != null) writer.write(",\"accounts\":[]");
    writer.write('}');
  }
コード例 #4
0
ファイル: IOFacade.java プロジェクト: elazarg/tvla
  /**
   * Prints a strucutre with an associated message. If the message stream is not null, output is
   * directed to the messagfe stream. Otherwise, it is printed into the outputstream.
   */
  public void printStrucutreWithMessages(String header, Object tvs, Collection messages) {
    for (Iterator i = implementations.values().iterator(); i.hasNext(); ) {
      ImplementationsBundle bundle = (ImplementationsBundle) i.next();

      ///////////
      PrintStream printTo = null;
      StringConverter c = bundle.structureConverter;
      if (c != null) {
        if (bundle.messagesEnabled) printTo = bundle.messagesStream;
        else if (bundle.outputEnabled) printTo = bundle.outputStream;
      }

      if (printTo == null) continue;

      StringBuffer msgs = new StringBuffer(header + ": ");
      Iterator messagesItr = messages.iterator();

      int msgNum = 1;
      while (messagesItr.hasNext()) {
        String msg = (String) messagesItr.next();
        msgs.append(StringUtils.newLine + msgNum + ". " + msg);
        msgNum++;
      }

      // print the structure with the accompnied messages to the messages stream
      //    String quotedMsgs = c.quote(msgs.toString());
      String tvsWithMessages = c.convert(tvs, msgs.toString());
      printTo.println(tvsWithMessages);
      messages = null; // Opportunity for compile-time GC.
    }
  }
コード例 #5
0
ファイル: Disciplina_ger.java プロジェクト: NAWEB-USP/aulas
  public synchronized Disciplina inclui(String nome, String descricao) throws Exception {

    // ------- Testa consist�ncia dos dados -------
    String testeCons = testaConsistencia(null, nome, descricao);
    if (testeCons != null)
      throw new Exception("não foi possível inserir devido ao campo " + testeCons + "");

    // ------- Insere na base de dados -------
    // Inicia a conexão com a base de dados
    Connection dbCon = BancoDados.abreConexao();
    Statement dbStmt = dbCon.createStatement();
    ResultSet dbRs;
    String str;

    // Pega Id maximo
    long maxId = 1;
    str = "SELECT Max(cod) AS maxId From Disciplina";
    BancoDadosLog.log(str);
    dbRs = dbStmt.executeQuery(str);
    if (dbRs.next()) {
      maxId = dbRs.getLong("maxId");
      maxId++;
    }
    String id = Long.toString(maxId);

    nome = StringConverter.toDataBaseNotation(nome);

    // Insere o elemento na base de dados
    str = "INSERT INTO Disciplina (cod, nome, descricao, desativada)";
    str +=
        " VALUES ("
            + id
            + ",'"
            + nome
            + "'"
            + ",'"
            + StringConverter.toDataBaseNotation(descricao)
            + "',0)";

    BancoDadosLog.log(str);
    dbStmt.executeUpdate(str);

    // Finaliza conexao
    dbStmt.close();
    dbCon.close();

    // ------- Insere na mem�ria -------
    // Cria um novo objeto
    Disciplina obj = new Disciplina(id, nome, descricao, false);

    // Insere o objeto na lista do gerente
    this.listaObj.addElement(obj);

    // ---- Cria uma nova turma ----
    Turma_ger turmager = new Turma_ger();
    turmager.inclui("Turma 1", "", obj);

    return obj;
  }
コード例 #6
0
ファイル: IOFacade.java プロジェクト: elazarg/tvla
 /**
  * Prints a structure to all desired outputs.
  *
  * @param structure A TVS.
  * @param header An optional header.
  */
 protected void printStructure(Object structure, String header, String breachedHeader) {
   for (Iterator i = implementations.values().iterator(); i.hasNext(); ) {
     ImplementationsBundle bundle = (ImplementationsBundle) i.next();
     StringConverter c = bundle.structureConverter;
     if (bundle.outputEnabled && c != null) {
       String converted = c.convert(structure, header);
       bundle.outputStream.println(converted);
     }
   }
 }
コード例 #7
0
ファイル: IOFacade.java プロジェクト: elazarg/tvla
 public void printVocabulary() {
   for (Iterator i = implementations.values().iterator(); i.hasNext(); ) {
     ImplementationsBundle bundle = (ImplementationsBundle) i.next();
     StringConverter c = bundle.vocabularyConverter;
     if (bundle.outputEnabled && c != null) {
       String converted = c.convert(null);
       bundle.outputStream.println(converted);
     }
   }
 }
コード例 #8
0
ファイル: IOFacade.java プロジェクト: elazarg/tvla
 public void printTransitionRelation(TransitionRelation transitionRelation) {
   for (Iterator i = implementations.values().iterator(); i.hasNext(); ) {
     ImplementationsBundle bundle = (ImplementationsBundle) i.next();
     StringConverter c = bundle.transitionRelationConverter;
     if (bundle.outputEnabled && bundle.transitionEnabled && c != null) {
       assert (bundle.outputStream != null && bundle.transitionStream != null);
       c.print(bundle.transitionStream, transitionRelation, null);
     }
   }
 }
コード例 #9
0
  /**
   * Converts the argument(s) to the target type (specified by {@code MappedFieldPath}) and then to
   * a Mongo object.
   *
   * @param arguments Single or multiple arguments in a list.
   * @param mfp The mapped field path.
   * @param singleValue Whether a single argument is expected.
   * @return An argument(s) converted to Mongo value.
   * @throws cz.jirutka.rsql.mongodb.morphia.RSQLArgumentFormatException
   */
  protected Object convertToMappedValue(
      List<String> arguments, MappedFieldPath mfp, boolean singleValue) {

    Object value =
        singleValue
            ? converter.convert(arguments.get(0), mfp.getTargetValueType())
            : converter.convert(arguments, mfp.getTargetValueType());

    return mapper.toMongoObject(mfp.getMappedField(), null, value);
  }
コード例 #10
0
ファイル: IOFacade.java プロジェクト: elazarg/tvla
  /** Prints general information, such as the TVLA version, to all output files. */
  private void printHeader() {
    String version =
        new PropertiesEx("/tvla/version.properties").getProperty("version", "Unknown TVLA version");
    String header = version;

    for (Iterator i = implementations.values().iterator(); i.hasNext(); ) {
      ImplementationsBundle bundle = (ImplementationsBundle) i.next();
      StringConverter c = bundle.commentConverter;
      if (bundle.outputEnabled && c != null) {
        String convertedHeader = c.convert(header);
        bundle.outputStream.println(convertedHeader);
      }
    }
  }
コード例 #11
0
  /** Test of getAsString method, of class StringConverter. */
  @Test
  public void testGetAsStringWhenValueIsBiggerThenLimit() {
    String value = "valor maior que tamanho 25";

    String expectedValue =
        "valor maior que tamanho 2<br/>5 valor maior que "
            + "tamanho<br/> 25 valor maior que taman<br/>ho 25 valor maior "
            + "que tam<br/>anho 25 valor maior que t<br/>amanho 25 valor "
            + "maior que<br/> tamanho 25 valor maior q<br/>ue tamanho 25 "
            + "valor maior<br/> que tamanho 25 valor mai<br/>or que tamanho "
            + "25 valor m<br/>aior que tamanho 25 valor<br/> maior que "
            + "tamanho 25 val<br/>or maior que tamanho 25 v<br/>alor maior "
            + "que tamanho 25<br/> valor maior que tamanho <br/>25 valor "
            + "maior que tamanh<br/>o 25 valor maior que tama<br/>nho 25 "
            + "valor maior que ta<br/>manho 25 valor maior que <br/>tamanho "
            + "25 valor maior qu<br/>e tamanho 25 valor maior <br/>que "
            + "tamanho 25 valor maio<br/>r que tamanho 25 valor ma<br/>ior "
            + "que tamanho 25 valor <br/>maior que tamanho 25 valo<br/>r "
            + "maior que tamanho 25 va<br/>lor maior que tamanho 25 <br/>valor "
            + "maior que tamanho 2<br/>5 valor maior que tamanho<br/> 25 valor "
            + "maior que taman<br/>ho 25 valor maior que tam<br/>anho 25 valor "
            + "maior que t<br/>amanho 25 valor maior que<br/> tamanho 25 valor "
            + "maior q<br/>ue tamanho 25";

    for (int i = 0; i < 5; i++) {
      value += " " + value;
    }

    String result = stringConverter.getAsString(facesContext, component, value);
    assertEquals(expectedValue, result);
  }
コード例 #12
0
 public void print() {
   MyPrintStream mps = new MyPrintStream(f);
   for (int i = 0; i < data.length; i++) {
     mps.println(StringConverter.arrayToTabString(data[i]));
   }
   mps.close();
 }
コード例 #13
0
  private static int writeLine(Writer w, String s) throws IOException {

    String logLine = StringConverter.unicodeToAscii(s).append(lineSep).toString();

    w.write(logLine);

    return logLine.length();
  }
コード例 #14
0
  private void printMatrix(String matrix, Matrix m) {
    MyPrintStream mps = new MyPrintStream(new File(matrix));
    double[][] vals = m.getArray();

    mps.println(header);
    for (int i = 0; i < vals.length; i++) {
      mps.println(StringConverter.arrayToTabString(vals[i]));
    }
  }
コード例 #15
0
ファイル: QuestaoTexto.java プロジェクト: NAWEB-USP/aulas
  public String trataResposta(String resposta) throws Exception {

    if (resposta == null) return "";

    // remove tabs da resposta
    resposta = StringConverter.replace(resposta, "\t", " ");

    // remove espacos duplos
    while (resposta.indexOf("  ") != -1) {
      resposta = StringConverter.replace(resposta, "  ", " ");
    }

    // remove espacos do inicio e do final
    resposta.trim();

    // Corrige posicionamento da virgula
    resposta = StringConverter.replace(resposta, " ,", ",");
    resposta = StringConverter.replace(resposta, ",", ", ");

    // Corrige posicionamento dos pontos
    // resposta = StringConverter.replace(resposta," .",".");
    // resposta = StringConverter.replace(resposta,".",". ");

    // remove espacos duplos
    resposta = StringConverter.replace(resposta, "  ", " ");

    // remove enter no inicio e no final da string
    while (resposta.startsWith("\n") || resposta.startsWith("\r") || resposta.startsWith(" ")) {
      resposta = resposta.substring(1);
    }
    while (resposta.endsWith("\n") || resposta.endsWith("\r") || resposta.endsWith(" ")) {
      resposta = resposta.substring(0, resposta.length() - 1);
    }

    // resposta = StringConverter.replace(resposta,"  "," ");

    // while

    return resposta;
  }
コード例 #16
0
ファイル: Disciplina_ger.java プロジェクト: NAWEB-USP/aulas
  public void altera(Disciplina obj, String nome, String descricao) throws Exception {

    // ------- Testa consist�ncia dos dados -------
    String testeCons = testaConsistencia(obj, nome, descricao);
    if (testeCons != null)
      throw new Exception("não foi possível alterar devido ao campo " + testeCons + "");

    // ------- Altera na base de dados -------
    // Inicia a conexão com a base de dados
    Connection dbCon = BancoDados.abreConexao();
    Statement dbStmt = dbCon.createStatement();
    ResultSet dbRs;
    String str;

    nome = StringConverter.toDataBaseNotation(nome);

    str =
        "UPDATE Disciplina SET nome='"
            + nome
            + "', descricao='"
            + StringConverter.toDataBaseNotation(descricao)
            + "' WHERE cod="
            + obj.getCod();
    BancoDadosLog.log(str);
    dbStmt.executeUpdate(str);

    // Finaliza conexao
    dbStmt.close();
    dbCon.close();

    // Altera dados do objeto
    if (!obj.getNome().equals(nome)) {
      obj.setNome(nome);
    }

    if (!obj.getDescricao().equals(descricao)) {
      obj.setDescricao(descricao);
    }
  }
コード例 #17
0
ファイル: Disciplina_ger.java プロジェクト: NAWEB-USP/aulas
  protected static synchronized void inicializa() throws Exception {

    if (listaObj == null) { // primeira utilização do gerente de objetos

      listaObj = new Vector();

      // Inicia a conexão com a base de dados
      Connection dbCon = BancoDados.abreConexao();
      Statement dbStmt = dbCon.createStatement();
      ResultSet dbRs;

      // seleciona todos objetos
      String str = "SELECT * FROM Disciplina ORDER BY Nome";
      BancoDadosLog.log(str);
      dbRs = dbStmt.executeQuery(str);

      while (dbRs.next()) {
        // Le dados da base
        String cod = dbRs.getString("cod");
        String nome = dbRs.getString("nome");
        String descricao = StringConverter.fromDataBaseNotation(dbRs.getString("descricao"));
        boolean desativada = dbRs.getBoolean("desativada");

        // Instancia o objeto
        Disciplina obj = new Disciplina(cod, nome, descricao, desativada);

        // Coloca-o na lista de objetos
        listaObj.addElement(obj);
      }

      listaObj.trimToSize();

      // Finaliza conexao
      dbStmt.close();
      dbCon.close();
    }
  }
コード例 #18
0
 /** Test of getAsObject method, of class StringConverter. */
 @Test
 public void testGetAsObjectWhenValueIsNull() {
   String value = "";
   Object result = stringConverter.getAsObject(facesContext, component, value);
   assertNull(result);
 }
 public static Customer deserialize(
     final Reader reader,
     final char[] buffer,
     final int[] tokens,
     int nextToken,
     final ServiceLocator locator)
     throws IOException {
   String _uri = "";
   long _id = 0L;
   String _name = "";
   Profile _profile = new Profile();
   ArrayList<Account> _accounts = null;
   if (nextToken == '}') return new Customer(_uri, _id, _name, _profile, _accounts, locator);
   int nameHash = ManualJson.fillName(reader, buffer, nextToken);
   nextToken = ManualJson.getNextToken(reader);
   if (nextToken == 'n') {
     if (reader.read() != 'u' || reader.read() != 'l' || reader.read() != 'l')
       throw new IOException("null value expected");
   } else {
     switch (nameHash) {
       case 1:
         _uri = StringConverter.deserialize(reader, buffer, nextToken);
         nextToken = ManualJson.getNextToken(reader);
         break;
       case 25458:
         _id = NumberConverter.deserializeInt(reader, buffer, tokens, nextToken);
         nextToken = ManualJson.moveToNextToken(reader, tokens[0]);
         break;
       case 24614690:
         _name = StringConverter.deserialize(reader, buffer, nextToken);
         nextToken = ManualJson.getNextToken(reader);
         break;
       case 1120506290:
         if (nextToken != '{') throw new IOException("Expecting '{'");
         nextToken = ManualJson.getNextToken(reader);
         _profile =
             ProfileManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken);
         nextToken = ManualJson.getNextToken(reader);
         break;
       case -758926083:
         if (nextToken != '[') throw new IOException("Expecting '['");
         nextToken = ManualJson.getNextToken(reader);
         if (nextToken != '{') throw new IOException("Expecting '{'");
         nextToken = ManualJson.getNextToken(reader);
         _accounts = new ArrayList<Account>();
         _accounts.add(
             AccountManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken));
         while ((nextToken = ManualJson.getNextToken(reader)) == ',') {
           nextToken = ManualJson.getNextToken(reader);
           if (nextToken != '{') throw new IOException("Expecting '{'");
           nextToken = ManualJson.getNextToken(reader);
           _accounts.add(
               AccountManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken));
         }
         nextToken = ManualJson.getNextToken(reader);
         break;
       default:
         nextToken = ManualJson.skip(reader, buffer, tokens, nextToken);
         break;
     }
   }
   while (nextToken == ',') {
     nextToken = ManualJson.getNextToken(reader);
     nameHash = ManualJson.fillName(reader, buffer, nextToken);
     nextToken = ManualJson.getNextToken(reader);
     if (nextToken == 'n') {
       if (reader.read() == 'u' && reader.read() == 'l' && reader.read() == 'l') {
         nextToken = ManualJson.getNextToken(reader);
         continue;
       }
       throw new IOException("null value expected");
     } else {
       switch (nameHash) {
         case 1:
           _uri = StringConverter.deserialize(reader, buffer, nextToken);
           nextToken = ManualJson.getNextToken(reader);
           break;
         case 25458:
           _id = NumberConverter.deserializeInt(reader, buffer, tokens, nextToken);
           nextToken = ManualJson.moveToNextToken(reader, tokens[0]);
           break;
         case 24614690:
           _name = StringConverter.deserialize(reader, buffer, nextToken);
           nextToken = ManualJson.getNextToken(reader);
           break;
         case 1120506290:
           _profile =
               ProfileManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken);
           nextToken = ManualJson.getNextToken(reader);
           break;
         case -758926083:
           if (nextToken != '[') throw new IOException("Expecting '['");
           nextToken = ManualJson.getNextToken(reader);
           if (nextToken != '{') throw new IOException("Expecting '{'");
           nextToken = ManualJson.getNextToken(reader);
           _accounts = new ArrayList<Account>();
           _accounts.add(
               AccountManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken));
           while ((nextToken = ManualJson.getNextToken(reader)) == ',') {
             nextToken = ManualJson.getNextToken(reader);
             if (nextToken != '{') throw new IOException("Expecting '{'");
             nextToken = ManualJson.getNextToken(reader);
             _accounts.add(
                 AccountManualOptJsonSerialization.deserialize(reader, buffer, tokens, nextToken));
           }
           nextToken = ManualJson.getNextToken(reader);
           break;
         default:
           nextToken = ManualJson.skip(reader, buffer, tokens, nextToken);
           break;
       }
     }
   }
   if (nextToken != '}') {
     if (nextToken == -1) throw new IOException("Unexpected end of json in object Transaction");
     else
       throw new IOException(
           "Expecting '}' at position "
               + ManualJson.positionInStream(reader)
               + ". Found "
               + (char) nextToken);
   }
   return new Customer(_uri, _id, _name, _profile, _accounts, locator);
 }
コード例 #20
0
 /** Test of getAsString method, of class StringConverter. */
 @Test
 public void testGetAsStringWhenValueIsEmpty() {
   String expResult = "";
   String result = stringConverter.getAsString(facesContext, component, "");
   assertEquals(expResult, result);
 }
コード例 #21
0
  /**
   * Method declaration
   *
   * @param r
   * @return
   * @throws IOException
   */
  private static String readLine(LineNumberReader r) throws IOException {

    String s = r.readLine();

    return StringConverter.asciiToUnicode(s);
  }
コード例 #22
0
 /** Test of getAsString method, of class StringConverter. */
 @Test
 public void testGetAsStringWhenValueLessThenLimit() {
   String expResult = "value less then 25";
   String result = stringConverter.getAsString(facesContext, component, expResult);
   assertEquals(expResult, result);
 }
コード例 #23
0
ファイル: QuestaoTexto.java プロジェクト: NAWEB-USP/aulas
 public String htmlParaImpressao() throws Exception {
   return "<B>" + StringConverter.replace(this.getEnunciado(), "\n", "<BR>") + "</B>";
 }
コード例 #24
0
ファイル: Detail2Converter.java プロジェクト: Koulio/revenj
  @SuppressWarnings("unchecked")
  public Detail2Converter(List<ObjectConverter.ColumnInfo> allColumns) throws java.io.IOException {
    Optional<ObjectConverter.ColumnInfo> column;

    final java.util.List<ObjectConverter.ColumnInfo> columns =
        allColumns
            .stream()
            .filter(it -> "test".equals(it.typeSchema) && "Detail2_entity".equals(it.typeName))
            .collect(Collectors.toList());
    columnCount = columns.size();

    readers = new ObjectConverter.Reader[columnCount];
    for (int i = 0; i < readers.length; i++) {
      readers[i] =
          (instance, rdr, ctx) -> {
            StringConverter.skip(rdr, ctx);
            return instance;
          };
    }

    final java.util.List<ObjectConverter.ColumnInfo> columnsExtended =
        allColumns
            .stream()
            .filter(it -> "test".equals(it.typeSchema) && "-ngs_Detail2_type-".equals(it.typeName))
            .collect(Collectors.toList());
    columnCountExtended = columnsExtended.size();

    readersExtended = new ObjectConverter.Reader[columnCountExtended];
    for (int i = 0; i < readersExtended.length; i++) {
      readersExtended[i] =
          (instance, rdr, ctx) -> {
            StringConverter.skip(rdr, ctx);
            return instance;
          };
    }

    column = columns.stream().filter(it -> "u".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'u' column in test Detail2_entity. Check if DB is in sync");
    __index___u = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "u".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'u' column in test Detail2. Check if DB is in sync");
    __index__extended_u = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "dd".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'dd' column in test Detail2_entity. Check if DB is in sync");
    __index___dd = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "dd".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'dd' column in test Detail2. Check if DB is in sync");
    __index__extended_dd = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "EntityCompositeid".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'EntityCompositeid' column in test Detail2_entity. Check if DB is in sync");
    __index___EntityCompositeid = (int) column.get().order - 1;

    column =
        columnsExtended.stream().filter(it -> "EntityCompositeid".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'EntityCompositeid' column in test Detail2. Check if DB is in sync");
    __index__extended_EntityCompositeid = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "EntityIndex".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'EntityIndex' column in test Detail2_entity. Check if DB is in sync");
    __index___EntityIndex = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "EntityIndex".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'EntityIndex' column in test Detail2. Check if DB is in sync");
    __index__extended_EntityIndex = (int) column.get().order - 1;

    column = columns.stream().filter(it -> "Index".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'Index' column in test Detail2_entity. Check if DB is in sync");
    __index___Index = (int) column.get().order - 1;

    column = columnsExtended.stream().filter(it -> "Index".equals(it.columnName)).findAny();
    if (!column.isPresent())
      throw new java.io.IOException(
          "Unable to find 'Index' column in test Detail2. Check if DB is in sync");
    __index__extended_Index = (int) column.get().order - 1;
  }
コード例 #25
0
 /** Test of getAsObject method, of class StringConverter. */
 @Test
 public void testGetAsObjectWhenValueIsAValidString() {
   String value = "valid string";
   Object result = stringConverter.getAsObject(facesContext, component, value);
   assertEquals(value, result);
 }