javax.jcr.query.Row.getValues()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中javax.jcr.query.Row.getValues方法的一些代码示例,展示了Row.getValues的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Row.getValues方法的具体详情如下:
包路径:javax.jcr.query.Row
类名称:Row
方法名:getValues

Row.getValues介绍

[英]Returns an array of all the values in the same order as the column names returned by QueryResult#getColumnNames().
[中]以与QueryResult#getColumnNames()返回的列名相同的顺序返回所有值的数组。

代码示例

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

@Override
public Value[] getValues() throws RepositoryException {
  return row.getValues();
}

代码示例来源:origin: net.adamcin.oakpal/oakpal-core

@Override
public Value[] getValues() throws RepositoryException {
  return delegate.getValues();
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

public Value[] getValues() throws RepositoryException {
  return row.getValues();
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

public Value[] getValues() throws RepositoryException {
  return row.getValues();
}

代码示例来源:origin: apache/jackrabbit

public Value[] getValues() throws RepositoryException {
  return row.getValues();
}

代码示例来源:origin: stackoverflow.com

public static Object[][] get2ArgArrayFromRows( List<Row> rows ) {
   Object[][] myArray = new Object[rows.size()][2];
   int i = 0;
   SelectItem[] cols = rows.get(0).getSelectItems();
   for ( Row r : rows ) {
     Object[] data = r.getValues();
     for ( int j = 0; j < cols.length; j++ ) {
       if ( data[j] == null ) data[j] = ""; // force empty string where there are NULL values
     }
     myArray[i][0] = cols;
     myArray[i][1] = data;
     i++;
   }
   logger.info( "Row count: " + rows.size() );
   logger.info( "Column names: " + Arrays.toString( cols ) );
   return myArray;
 }

代码示例来源:origin: stackoverflow.com

if (data != null) {
   List<Row> rows = data.getRows();
   Iterator<Row> it = rows.iterator();
   while (it.hasNext()) {
     Row row = it.next();
     List<String> values = row.getValues("jid");
     Iterator<String> iterator = values.iterator();
     if (iterator.hasNext()) {
       String value = iterator.next();
       //Do what you want
     }
   }
 }

代码示例来源:origin: stackoverflow.com

if(data.getRows() != null)
 {
   Iterator<Row> it = data.getRows();
   while(it.hasNext())
   {
     Row row = it.next();
     Iterator iterator = row.getValues("jid");
     if(iterator.hasNext())
     {
       String value = iterator.next().toString();
       Log.i("Iteartor values......"," "+value);
     }
     //Log.i("Iteartor values......"," "+value);
   }
    Toast.makeText(_service,"Username Exists",Toast.LENGTH_SHORT).show();
    );
 }

代码示例来源:origin: stackoverflow.com

public static Object[][] getCsvData(File csvFile) {
   CsvConfiguration conf = new CsvConfiguration(1);
   DataContext csvContext = DataContextFactory.createCsvDataContext(
       csvFile, conf);
   Schema schema = csvContext.getDefaultSchema();
   Table[] tables = schema.getTables();
   Table table = tables[0];
   DataSet dataSet = csvContext.query().from(table).selectAll().where("run").eq("Y").execute();
   List<Row> rows = dataSet.toRows();
   Object[][] myArray = new Object[rows.size()][2];
   int i = 0;
   SelectItem[] cols = rows.get(0).getSelectItems();
   for (Row r : rows) {
     Object[] data = r.getValues();
     for (int j = 0; j < cols.length; j++) {
       if (data[j] == null)
         data[j] = ""; // force empty string where there are NULL
                 // values
     }
     myArray[i][0] = cols;
     myArray[i][1] = data;
     i++;
   }
   logger.info("Row count: " + rows.size());
   logger.info("Column names: " + Arrays.toString(cols));
   return myArray;
 }

代码示例来源:origin: apache/jackrabbit

/** {@inheritDoc} */
public Value[] getValues() throws RepositoryException, RemoteException {
  try {
    return getSerialValues(row.getValues());
  } catch (RepositoryException ex) {
    throw getRepositoryException(ex);    		
  }
}

代码示例来源:origin: apache/jackrabbit

public void testGetValues() throws RepositoryException {
  Row r = getRow();
  Value[] values = r.getValues();
  assertEquals("wrong number of columns", 1, values.length);
  assertEquals("property value does not match", TEST_VALUE, values[0].getString());
}

代码示例来源:origin: stackoverflow.com

@Test
 public void testXML() {
   XmlSaxTableDef employeeTableDef = new XmlSaxTableDef(
       "/root/organization/employees/employee", new String[] {
           "/root/organization/employees/employee/name",
           "/root/organization/employees/employee/gender",
           "index(/root/organization)"});
   XmlSaxTableDef organizationTableDef = new XmlSaxTableDef(
       "/root/organization", new String[] { 
           "/root/organization/name",
           "/root/organization@type" });
   DataContext dc = new XmlSaxDataContext(xmlFile, employeeTableDef,
       organizationTableDef);
   Table employeeTable = dc.getTableByQualifiedLabel("/employee");
   Column fk = employeeTable.getColumnByName("index(/root/organization)");
   Column empName = employeeTable.getColumnByName("/name");
   Table organizationTable = dc.getTableByQualifiedLabel("/organization");
   Column orgId = organizationTable.getColumnByName("row_id");
   Column orgName = organizationTable.getColumnByName("/name");
   Query q = dc.query().from(employeeTable)
       .innerJoin(organizationTable).on( fk, orgId )
       .select(empName).as("employeename")
       .select(orgName).as("companyname").toQuery();
   DataSet ds = dc.executeQuery(q);
   List<Row> rows = ds.toRows();
   for (Row r : rows) {
     System.out.println(Arrays.deepToString(r.getValues()));
   }
 }

代码示例来源:origin: brix-cms/brix-cms

public JcrValue[] execute() throws Exception {
    return JcrValue.Wrapper.wrap(getDelegate().getValues(), getJcrSession());
  }
});

代码示例来源:origin: stackoverflow.com

UserSearchManager search = new UserSearchManager(mXMPPConnection);  
   Form searchForm = search.getSearchForm("search."+mXMPPConnection.getServiceName());
   Form answerForm = searchForm.createAnswerForm();  
   answerForm.setAnswer("Username", true);  
   answerForm.setAnswer("search", user);  
   org.jivesoftware.smackx.ReportedData data = search.getSearchResults(answerForm,"search."+mXMPPConnection.getServiceName());  
 if(data.getRows() != null)
   {
     Iterator<Row> it = data.getRows();
     while(it.hasNext())
     {
       Row row = it.next();
       Iterator iterator = row.getValues("jid");
       if(iterator.hasNext())
       {
         String value = iterator.next().toString();
         Log.i("Iteartor values......"," "+value);
       }
       //Log.i("Iteartor values......"," "+value);
     }
      Toast.makeText(_service,"Username Exists",Toast.LENGTH_SHORT).show();
      );
   }

代码示例来源:origin: stackoverflow.com

UserSearchManager search = new UserSearchManager(mXMPPConnection);  
     Form searchForm = search.getSearchForm("search."+mXMPPConnection.getServiceName());
     Form answerForm = searchForm.createAnswerForm();  
     answerForm.setAnswer("Username", true);  
     answerForm.setAnswer("search", user);  
     org.jivesoftware.smackx.ReportedData data = search.getSearchResults(answerForm,"search."+mXMPPConnection.getServiceName());  
   if(data.getRows() != null)
     {
       Iterator<Row> it = data.getRows();
       while(it.hasNext())
       {
         Row row = it.next();
         Iterator iterator = row.getValues("jid");
         if(iterator.hasNext())
         {
           String value = iterator.next().toString();
           Log.i("Iteartor values......"," "+value);
         }
         //Log.i("Iteartor values......"," "+value);
       }
        Toast.makeText(_service,"Username Exists",Toast.LENGTH_SHORT).show();
        );
     }

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons

Value[] values = row.getValues();

代码示例来源:origin: stackoverflow.com

public Boolean checkIfUserExists(String user) throws XMPPException{
  UserSearchManager search = new UserSearchManager(xmppConnection);  
  Form searchForm = search.getSearchForm("search."+xmppConnection.getServiceName());
  Form answerForm = searchForm.createAnswerForm();  
  answerForm.setAnswer("Username", true);  
  answerForm.setAnswer("search", user);  
  ReportedData data = search.getSearchResults(answerForm,"search."+xmppConnection.getServiceName());  
  if (data.getRows() != null) {
    Iterator<Row> it = data.getRows();
    while (it.hasNext()) {
      Row row = it.next();
      Iterator iterator = row.getValues("jid");
      if (iterator.hasNext()) {
        String value = iterator.next().toString();
        System.out.println("Iteartor values...... " + value);
      }
    }
    return true;
  }
  return false;
}

代码示例来源:origin: apache/jackrabbit

private void executeAndCheckColumns(String sql2, int expected,
      String... cols) throws RepositoryException {
    QueryResult r = executeSQL2Query(sql2);
    assertEquals(
        "Got more columns than expected: "
            + Arrays.toString(r.getColumnNames()), expected,
        r.getColumnNames().length);
    if (expected > 0) {
      assertEquals(expected, cols.length);
      List<String> expectedCols = new ArrayList<String>(
          Arrays.asList(cols));
      expectedCols.removeAll(new ArrayList<String>(Arrays.asList(r
          .getColumnNames())));
      assertTrue("Got unexpected columns: " + expectedCols,
          expectedCols.isEmpty());
      for (Row row : JcrUtils.getRows(r)) {
        assertNotNull(row.getValues());
        assertEquals(expected, row.getValues().length);
      }
    }
  }
}

代码示例来源:origin: apache/jackrabbit-oak

/**
 * OAK-1093
 */
@Test
public void getValuesOnMvp() throws RepositoryException {
  Session session = getAdminSession();
  Node hello = session.getRootNode().addNode("hello");
  hello.setProperty("id", "1");
  hello.setProperty("properties", new String[] { "p1", "p2" });
  session.save();
  QueryManager qm = session.getWorkspace().getQueryManager();
  Query q = qm.createQuery("select properties from [nt:base] where id = 1",
      Query.JCR_SQL2);
  QueryResult r = q.execute();
  RowIterator it = r.getRows();
  assertTrue(it.hasNext());
  Row row = it.nextRow();
  assertEquals("p1 p2", row.getValues()[0].getString());
}

代码示例来源:origin: apache/jackrabbit

for (RowIterator it = result.getRows(); it.hasNext(); count++) {
  StringBuffer msg = new StringBuffer();
  Value[] values = it.nextRow().getValues();
  for (int i = 0; i < propNames.length; i++) {
    msg.append("  ").append(propNames[i]).append(": ");

相关文章