当前位置: 首页>>代码示例>>Java>>正文


Java DataSetLookup类代码示例

本文整理汇总了Java中org.dashbuilder.dataset.DataSetLookup的典型用法代码示例。如果您正苦于以下问题:Java DataSetLookup类的具体用法?Java DataSetLookup怎么用?Java DataSetLookup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataSetLookup类属于org.dashbuilder.dataset包,在下文中一共展示了DataSetLookup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
public void init(DataSetLookupConstraints lookupConstraints,
                 final DataSetLookup dataSetLookup) {
    this.dataSetLookup = dataSetLookup;
    this.lookupConstraints = lookupConstraints;
    this.view.clearAll();
    this.clientServices.getPublicDataSetDefs(new RemoteCallback<List<DataSetDef>>() {
        public void callback(List<DataSetDef> dataSetDefs) {
            showDataSetDefs(dataSetDefs);
            if (dataSetLookup != null && dataSetLookup.getDataSetUUID() != null) {
                fetchMetadata(dataSetLookup.getDataSetUUID(),
                              new RemoteCallback<DataSetMetadata>() {
                                  public void callback(DataSetMetadata metadata) {
                                      updateDataSetLookup();
                                  }
                              });
            }
        }
    });
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:20,代码来源:DataSetLookupEditor.java

示例2: getExistingDataColumnIds

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
List<String> getExistingDataColumnIds() {
    DataSet dataSet = displayerSettings.getDataSet();
    DataSetLookup dataSetLookup = displayerSettings.getDataSetLookup();

    List<String> columnIds = new ArrayList<String>();
    if (dataSet != null) {
        for (DataColumn dataColumn : dataSet.getColumns()) {
            columnIds.add(dataColumn.getId());
        }
    }
    else if (dataSetLookup != null) {
        int idx = dataSetLookup.getLastGroupOpIndex(0);
        if (idx != -1) {
            DataSetGroup groupOp = dataSetLookup.getOperation(idx);
            for (GroupFunction groupFunction : groupOp.getGroupFunctions()) {
                columnIds.add(groupFunction.getColumnId());
            }
        }
    }
    return columnIds;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:DisplayerEditor.java

示例3: testDeleteColumns

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
@Test
public void testDeleteColumns() {
    DataSetLookup lookup = DataSetLookupFactory.newDataSetLookupBuilder()
            .dataset(POPULATION_UUID)
            .column("year")
            .column("population")
            .buildLookup();

    GroupFunction year = lookup.getLastGroupOp().getGroupFunction("year");
    presenter.init(DATA_MULTIPLE, lookup);

    reset(view);
    presenter.onColumnFunctionDeleted(new GroupFunctionDeletedEvent(year));

    verify(view).clearColumnList();
    verify(view, times(1)).addColumnEditor(any(ColumnFunctionEditor.class));
    verify(event).fire(any(DataSetLookupChangedEvent.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:DataSetLookupEditorTest.java

示例4: testDataSetSelected

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
@Test
public void testDataSetSelected() {
    presenter.init(DATA_2D_FIXED, DataSetLookupFactory.newDataSetLookupBuilder()
            .dataset(POPULATION_UUID)
            .group("country")
            .column("country")
            .column("population", AggregateFunctionType.SUM)
            .buildLookup());

    when(view.getSelectedDataSetId()).thenReturn(REVENUE_UUID);
    presenter.onDataSetSelected();
    verify(event).fire(any(DataSetLookupChangedEvent.class));

    DataSetLookup newLookup = presenter.getDataSetLookup();
    assertEquals(newLookup.getDataSetUUID(), REVENUE_UUID);
    assertEquals(presenter.getFirstGroupColumnId(), "company");
    assertEquals(presenter.getFirstGroupFunctions().size(), 2);
    assertEquals(presenter.getFirstGroupFunctions().get(0).getSourceId(), "company");
    assertEquals(presenter.getFirstGroupFunctions().get(1).getSourceId(), "revenue");
    assertEquals(presenter.getFirstGroupFunctions().get(0).getFunction(), null);
    assertEquals(presenter.getFirstGroupFunctions().get(1).getFunction(), AggregateFunctionType.SUM);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:23,代码来源:DataSetLookupEditorTest.java

示例5: _lookupDataSet

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
private void _lookupDataSet(DataSetLookup request,
                            final DataSetReadyCallback listener) {
    try {
        dataSetLookupServices.call(
                new RemoteCallback<DataSet>() {
                    public void callback(DataSet result) {
                        if (result == null) {
                            listener.notFound();
                        } else {
                            listener.callback(result);
                        }
                    }
                },
                new ErrorCallback<Message>() {
                    @Override
                    public boolean error(Message message,
                                         Throwable throwable) {
                        return listener.onError(new ClientRuntimeError(throwable));
                    }
                })
                .lookupDataSet(request);
    } catch (Exception e) {
        listener.onError(new ClientRuntimeError(e));
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:DataSetClientServices.java

示例6: setup

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    super.setup();

    presenter = new DataSetEditorWorkflow(clientServices, validatorProvider, beanManager, saveRequestEvent,
            testDataSetEvent, cancelRequestEvent, view) {

    };
    presenter.dataSetDef = this.dataSetDef;

    when(dataSetDef.getUUID()).thenReturn(UUID);
    when(dataSetDef.getName()).thenReturn(NAME);
    when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);
    when(dataSet.getUUID()).thenReturn(UUID);
    when(dataSet.getRowCount()).thenReturn(0);
    when(dataSetDef.clone()).thenReturn(dataSetDef);
    doAnswer(new Answer<Void>() {
        @Override
        public Void answer(final InvocationOnMock invocationOnMock) throws Throwable {
            DataSetReadyCallback callback = (DataSetReadyCallback) invocationOnMock.getArguments()[2];
            callback.callback(dataSet);
            return null;
        }
    }).when(clientServices).lookupDataSet(any(dataSetDef.getClass()), any(DataSetLookup.class), any(DataSetReadyCallback.class));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:DataSetEditorWorkflowTest.java

示例7: testGetDisplayerSettings

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
@Test
public void testGetDisplayerSettings() {
    expectedDataSetUUID = DATASOURCE_UUID + SEPARATOR + SCHEMA + SEPARATOR + TABLE;

    DataSetLookup expectedLookup = new DataSetLookup();
    expectedLookup.setDataSetUUID(expectedDataSetUUID);

    DataSet expectedSet = mock(DataSet.class);
    List<DataColumn> dataColumns = new ArrayList<>();
    for (int i = 0; i < COLUMNS_COUNT; i++) {
        DataColumn dataColumn = mock(DataColumn.class);
        when(dataColumn.getId()).thenReturn(DATA_COLUMN + String.valueOf(i));
        dataColumns.add(dataColumn);
    }
    when(expectedSet.getColumns()).thenReturn(dataColumns);
    when(dataSetManager.lookupDataSet(expectedLookup)).thenReturn(expectedSet);

    DisplayerSettings settings = dataManagementService.getDisplayerSettings(DATASOURCE_UUID,
                                                                            SCHEMA,
                                                                            TABLE);

    verify(dataSetDefRegistry,
           times(1)).registerDataSetDef(dataSetDefCaptor.capture());
    verifyDataSetDef(dataSetDefCaptor.getValue());
    verifySettings(settings);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:27,代码来源:DataManagementServiceImplTest.java

示例8: toJsonObject

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
public JsonObject toJsonObject( DisplayerSettings displayerSettings ) {
    JsonObject json = Json.createObject();

    // UUID
    json.put(SETTINGS_UUID, displayerSettings.getUUID());

    for (Map.Entry<String, String> entry : displayerSettings.getSettingsFlatMap().entrySet()) {
        setNodeValue(json, entry.getKey(), entry.getValue());
    }

    // Data set
    DataSetLookup dataSetLookup = displayerSettings.getDataSetLookup();
    DataSet dataSet = displayerSettings.getDataSet();
    if (dataSet != null) {
        json.put(DATASET_PREFIX, dataSetJsonMarshaller.toJson(dataSet));
    }
    else if (dataSetLookup != null) {
        json.put(DATASET_LOOKUP_PREFIX, dataSetLookupJsonMarshaller.toJson(dataSetLookup));
    }
    else {
        throw new RuntimeException("Displayer settings dataset lookup not specified");
    }

    // Column settings
    List<ColumnSettings> columnSettingsList = displayerSettings.getColumnSettingsList();
    if (!columnSettingsList.isEmpty()) {
        json.put(COLUMNS_PREFIX, formatColumnSettings(columnSettingsList));
    }

    return json;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:32,代码来源:DisplayerSettingsJSONMarshaller.java

示例9: onDataSetLookupChanged

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
void onDataSetLookupChanged(@Observes DataSetLookupChangedEvent event) {
    DataSetLookup dataSetLookup = event.getDataSetLookup();
    displayerSettings.setDataSet(null);
    displayerSettings.setDataSetLookup(dataSetLookup);
    removeStaleSettings();
    initDisplayer();
    initSettingsEditor();
    showDisplayer();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:10,代码来源:DisplayerEditor.java

示例10: displayerTypeChanged

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
void displayerTypeChanged(DisplayerType type, DisplayerSubType displayerSubType) {

        // Create new settings for the selected type
        selectedTypeSettings = displayerPrototypes.getProto(type, displayerSubType);
        DataSet oldDataSet = displayerSettings.getDataSet();
        DataSetLookup oldDataLookup = displayerSettings.getDataSetLookup();

        // Check if the current data lookup is compatible with the new displayer type
        if (oldDataSet == null && oldDataLookup != null) {
            Displayer displayer = displayerLocator.lookupDisplayer(selectedTypeSettings);
            DisplayerConstraints displayerConstraints = displayer.getDisplayerConstraints();
            DataSetLookupConstraints dataConstraints = displayerConstraints.getDataSetLookupConstraints();
            DataSetMetadata metadata = clientServices.getMetadata(oldDataLookup.getDataSetUUID());

            // Keep the current data settings provided it satisfies the data constraints
            ValidationError validationError = dataConstraints.check(oldDataLookup, metadata);
            if (validationError == null) {
                selectedTypeSettings.setDataSet(null);
                selectedTypeSettings.setDataSetLookup(oldDataLookup);
                applySelectedType();
            }
            // If the data lookup is not compatible then ask the user what to do
            else {
                view.showTypeChangedWarning(this::applySelectedType, this::abortSelectedType);
            }
        }
        // If the displayer is static (no data lookup) then just display the selected displayer prototype
        else {
            applySelectedType();
        }
    }
 
开发者ID:kiegroup,项目名称:appformer,代码行数:32,代码来源:DisplayerEditor.java

示例11: testAddColumns

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
@Test
public void testAddColumns() {

    DataSetLookup lookup = DATA_2D_MULTIPLE.newDataSetLookup(POPULATION_META);
    presenter.init(DATA_2D_MULTIPLE, lookup);

    verify(view).setAddColumnOptionEnabled(true);
    presenter.onAddColumn();
    verify(event).fire(any(DataSetLookupChangedEvent.class));

    assertEquals(presenter.getFirstGroupFunctions().size(), 3);
    assertEquals(presenter.getFirstGroupFunctions().get(2).getSourceId(), "population");
    assertEquals(presenter.getFirstGroupFunctions().get(2).getColumnId(), "population_2");
    assertEquals(presenter.getFirstGroupFunctions().get(2).getFunction(), AggregateFunctionType.SUM);

    presenter.onAddColumn();
    assertEquals(presenter.getFirstGroupFunctions().size(), 4);
    assertEquals(presenter.getFirstGroupFunctions().get(3).getSourceId(), "population");
    assertEquals(presenter.getFirstGroupFunctions().get(3).getColumnId(), "population_3");
    assertEquals(presenter.getFirstGroupFunctions().get(3).getFunction(), AggregateFunctionType.SUM);

    reset(event);
    GroupFunction gf = new GroupFunction("population", "population_2", AggregateFunctionType.SUM);
    presenter.onColumnFunctionDeleted(new GroupFunctionDeletedEvent(gf));
    verify(event).fire(any(DataSetLookupChangedEvent.class));
    assertEquals(presenter.getFirstGroupFunctions().size(), 3);
    assertEquals(presenter.getFirstGroupFunctions().get(2).getSourceId(), "population");
    assertEquals(presenter.getFirstGroupFunctions().get(2).getColumnId(), "population_3");
    assertEquals(presenter.getFirstGroupFunctions().get(2).getFunction(), AggregateFunctionType.SUM);

    presenter.onAddColumn();
    assertEquals(presenter.getFirstGroupFunctions().size(), 4);
    assertEquals(presenter.getFirstGroupFunctions().get(3).getSourceId(), "population");
    assertEquals(presenter.getFirstGroupFunctions().get(3).getColumnId(), "population_2");
    assertEquals(presenter.getFirstGroupFunctions().get(3).getFunction(), AggregateFunctionType.SUM);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:37,代码来源:DataSetLookupEditorTest.java

示例12: testColumnChanged

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
@Test
public void testColumnChanged() {
    DataSetLookup lookup = DATA_2D_MULTIPLE.newDataSetLookup(POPULATION_META);
    presenter.init(DATA_2D_MULTIPLE, lookup);

    GroupFunction gf = new GroupFunction("population", "population", AggregateFunctionType.SUM);
    presenter.onColumnFunctionChanged(new GroupFunctionChangedEvent(gf));
    assertEquals(gf.getColumnId(), "population_2");
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:10,代码来源:DataSetLookupEditorTest.java

示例13: onDataSetModifiedEvent

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
/**
 * Listen to modifications on any of the data set being used in this perspective.
 */
private void onDataSetModifiedEvent(@Observes DataSetModifiedEvent event) {
    if (!editOn) {

        String targetUUID = event.getDataSetDef().getUUID();
        for (Displayer displayer : displayerCoordinator.getDisplayerList()) {
            DisplayerSettings settings = displayer.getDisplayerSettings();

            // Do nothing if the displayer:
            // - Is not drawn
            // - Is handling the refresh by itself
            // - Is not configured to be updated on stale data
            if (!displayer.isDrawn() || displayer.isRefreshOn() || !settings.isRefreshStaleData()) {
                continue;
            }

            String uuid = null;
            DataSet dataSet = settings.getDataSet();
            if (dataSet != null) {
                uuid = dataSet.getUUID();
            }
            DataSetLookup dataSetLookup = settings.getDataSetLookup();
            if (uuid == null && dataSetLookup != null) {
                uuid = dataSetLookup.getDataSetUUID();
            }
            if (uuid != null && targetUUID.equals(uuid)) {
                displayer.redraw();
            }
        }
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:34,代码来源:PerspectiveCoordinator.java

示例14: lookupDataSet

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
/**
 * Process the specified data set lookup request for a given definition.
 *
 * @param def     The data set definition
 * @param request The data set lookup request
 * @throws Exception It there is an unexpected error trying to execute the lookup request.
 */
public void lookupDataSet(final DataSetDef def,
                          final DataSetLookup request,
                          final DataSetReadyCallback listener) throws Exception {

    if (dataSetLookupServices != null) {
        try {
            dataSetLookupServices.call(
                    new RemoteCallback<DataSet>() {
                        public void callback(DataSet result) {
                            if (result == null) {
                                listener.notFound();
                            } else {
                                listener.callback(result);
                            }
                        }
                    },
                    new ErrorCallback<Message>() {
                        @Override
                        public boolean error(Message message,
                                             Throwable throwable) {
                            return listener.onError(new ClientRuntimeError(throwable));
                        }
                    })
                    .lookupDataSet(def,
                                   request);
        } catch (Exception e) {
            listener.onError(new ClientRuntimeError(e));
        }
    }
    // Data set not found on client.
    else {
        listener.notFound();
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:42,代码来源:DataSetClientServices.java

示例15: lookupDataSet

import org.dashbuilder.dataset.DataSetLookup; //导入依赖的package包/类
@Override
public DataSet lookupDataSet(DataSetLookup lookup) {
    String uuid = lookup.getDataSetUUID();
    if (StringUtils.isEmpty(uuid)) {
        return null;
    }

    // Get the target data set
    DataSetIndex dataSetIndex = dataSetOpEngine.getIndexRegistry().get(uuid);
    if (dataSetIndex == null) {
        return null;
    }
    List<DataSetPreprocessor> dataSetDefPreProcessors = getDataSetPreprocessors(uuid);
    if (dataSetDefPreProcessors != null) {
        for(DataSetPreprocessor p : dataSetDefPreProcessors){
            p.preprocess(lookup);
        }
    }
    DataSet dataSet = dataSetIndex.getDataSet();

    // Apply the list of operations specified (if any).
    if (!lookup.getOperationList().isEmpty()) {
        dataSet = dataSetOpEngine.execute(uuid, lookup.getOperationList());
    }

    // Trim the data set as requested.
    dataSet = dataSet.trim(lookup.getRowOffset(), lookup.getNumberOfRows());
    return dataSet;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:30,代码来源:ClientDataSetManager.java


注:本文中的org.dashbuilder.dataset.DataSetLookup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。