Search in sources :

Example 1 with DataTablesSearch

use of org.eclipse.sw360.portal.common.datatables.data.DataTablesSearch in project sw360portal by sw360.

the class DataTablesParserTest method testName.

@Test
public void testName() throws Exception {
    Map<String, String[]> parameterMap = getTestParameterMap();
    DataTablesParameters parameters = DataTablesParser.parametersFrom(parameterMap);
    assertThat(parameters, is(not(nullValue())));
    assertThat(parameters.getDraw(), is(1));
    assertThat(parameters.getLength(), is(10));
    assertThat(parameters.getStart(), is(5));
    DataTablesSearch search = parameters.getSearch();
    assertThat(search, is(equalTo(new DataTablesSearch("lookingFor", false))));
    List<DataTablesColumn> columns = parameters.getColumns();
    assertThat(columns, hasSize(1));
    DataTablesColumn column1 = columns.get(0);
    assertThat(column1.isSearchable(), is(true));
    assertThat(column1.getSearch(), is(equalTo(new DataTablesSearch("col0Sear", true))));
    List<DataTablesOrder> orders = parameters.getOrders();
    assertThat(columns, hasSize(1));
    DataTablesOrder order = orders.get(0);
    assertThat(order.getColumn(), is(0));
    assertThat(order.isAscending(), is(true));
}
Also used : DataTablesSearch(org.eclipse.sw360.portal.common.datatables.data.DataTablesSearch) DataTablesParameters(org.eclipse.sw360.portal.common.datatables.data.DataTablesParameters) DataTablesColumn(org.eclipse.sw360.portal.common.datatables.data.DataTablesColumn) DataTablesOrder(org.eclipse.sw360.portal.common.datatables.data.DataTablesOrder) Test(org.junit.Test)

Example 2 with DataTablesSearch

use of org.eclipse.sw360.portal.common.datatables.data.DataTablesSearch in project sw360portal by sw360.

the class DataTablesParser method parametersFrom.

protected static DataTablesParameters parametersFrom(Map<String, String[]> parameterMap) {
    int draw = getSimpleInt(parameterMap, "draw");
    int length = getSimpleInt(parameterMap, "length");
    int start = getSimpleInt(parameterMap, "start");
    List<DataTablesOrder> orders = getOrders(parameterMap);
    List<DataTablesColumn> columns = getColumns(parameterMap);
    DataTablesSearch search = getSearch(parameterMap, "search");
    return new DataTablesParameters(draw, length, start, orders, columns, search);
}
Also used : DataTablesSearch(org.eclipse.sw360.portal.common.datatables.data.DataTablesSearch) DataTablesParameters(org.eclipse.sw360.portal.common.datatables.data.DataTablesParameters) DataTablesColumn(org.eclipse.sw360.portal.common.datatables.data.DataTablesColumn) DataTablesOrder(org.eclipse.sw360.portal.common.datatables.data.DataTablesOrder)

Aggregations

DataTablesColumn (org.eclipse.sw360.portal.common.datatables.data.DataTablesColumn)2 DataTablesOrder (org.eclipse.sw360.portal.common.datatables.data.DataTablesOrder)2 DataTablesParameters (org.eclipse.sw360.portal.common.datatables.data.DataTablesParameters)2 DataTablesSearch (org.eclipse.sw360.portal.common.datatables.data.DataTablesSearch)2 Test (org.junit.Test)1