use of jp.ossc.nimbus.beans.dataset.Record in project nimbus by nimbus-org.
the class DataSetHtmlConverterTest method testConvertToObject.
public void testConvertToObject() {
DataSet inputDataSet = new DataSetHtmlConverterTestDataSet();
DataSetHtmlConverter converter = new DataSetHtmlConverter();
converter.setCharacterEncodingToObject("Windows-31J");
DataSetHtmlConverterTestDataSet dataSet = (DataSetHtmlConverterTestDataSet) converter.convertToObject(createTestData(), inputDataSet);
Header header = dataSet.getHeader();
RecordList recordList = dataSet.getRecordList();
Assert.assertEquals("タイトル", header.get(DataSetHtmlConverterTestDataSet.PROPERTY1));
Assert.assertEquals("テキスト", header.get(DataSetHtmlConverterTestDataSet.PROPERTY2));
for (int i = 0; i < recordList.size(); i++) {
Record record = (Record) recordList.get(i);
Assert.assertEquals("テキスト" + (i + 1) + "-1", record.get(DataSetHtmlConverterTestDataSet.PROPERTY3));
Assert.assertEquals("テキスト" + (i + 1) + "-2", record.get(DataSetHtmlConverterTestDataSet.PROPERTY4));
Assert.assertEquals("テキスト" + (i + 1) + "-3", record.get(DataSetHtmlConverterTestDataSet.PROPERTY5));
}
}
use of jp.ossc.nimbus.beans.dataset.Record in project nimbus by nimbus-org.
the class BeanTableView method sort.
protected static Comparator sort(Class elementClass, List list, String[] propNames, boolean[] isAsc) throws IndexPropertyAccessException {
if (list.size() <= 1) {
return Record.class.isAssignableFrom(elementClass) ? (Comparator) new RecordList.RecordComparator(propNames, isAsc) : (Comparator) new BeanComparator(elementClass, propNames, isAsc);
}
Comparator c = Record.class.isAssignableFrom(elementClass) ? (Comparator) new RecordList.RecordComparator(((Record) list.get(0)).getRecordSchema(), propNames, isAsc) : (Comparator) new BeanComparator(elementClass, propNames, isAsc);
Collections.sort(list, c);
return c;
}
use of jp.ossc.nimbus.beans.dataset.Record in project nimbus by nimbus-org.
the class CSVRecordReader method readRecord.
/**
* CSV行を1行、レコードとして読み込む。<p>
* CSV要素の値を格納するレコードを再利用するためのメソッドである。<br>
*
* @param record CSV要素の値を格納するレコード
* @return CSV要素を格納したレコード
* @exception IOException 入出力エラーが発生した場合
* @exception PropertySetException CSV形式の要素文字列のパースに失敗した場合
*/
public Record readRecord(Record record) throws IOException, PropertySetException {
if (workList == null) {
workList = new ArrayList();
}
List csv = readCSVLineList(workList);
if (csv == null) {
return null;
}
if (record == null) {
record = new Record(getRecordSchema());
} else {
record.clear();
}
for (int i = 0, imax = Math.min(csv.size(), record.size()); i < imax; i++) {
String element = (String) csv.get(i);
record.setParseProperty(i, element);
}
return record;
}
use of jp.ossc.nimbus.beans.dataset.Record in project nimbus by nimbus-org.
the class FLVRecordReader method readRecord.
/**
* FLV行を1行、レコードとして読み込む。<p>
* FLV要素の値を格納するレコードを再利用するためのメソッドである。<br>
*
* @param record FLV要素の値を格納するレコード
* @return FLV要素を格納したレコード
* @exception IOException 入出力エラーが発生した場合
* @exception PropertySetException FLV形式の要素文字列のパースに失敗した場合
*/
public Record readRecord(Record record) throws IOException, PropertySetException {
if (workList == null) {
workList = new ArrayList();
}
List flv = readFLVLineList(workList);
if (flv == null) {
return null;
}
if (record == null) {
record = new Record(getRecordSchema());
} else {
record.clear();
}
for (int i = 0, imax = Math.min(flv.size(), record.size()); i < imax; i++) {
String element = (String) flv.get(i);
record.setParseProperty(i, element);
}
return record;
}
use of jp.ossc.nimbus.beans.dataset.Record in project nimbus by nimbus-org.
the class DataSetServletRequestParameterConverter method setRecordListProperty.
protected void setRecordListProperty(RecordList recList, String name, String[] vals) throws PropertySetException {
for (int i = 0; i < vals.length; i++) {
Record rec = null;
if (recList.size() > i) {
rec = recList.getRecord(i);
} else {
rec = recList.createRecord();
recList.addRecord(rec);
}
rec.setParseProperty(name, vals[i]);
}
}
Aggregations