org.kie.soup.project.datamodel.imports.Import类的使用及代码示例

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

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

Import介绍

暂无

代码示例

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-common-ui

private static boolean isImported(final String qualifiedType,
                   final Imports imports) {
    final Import item = new Import(qualifiedType.replaceAll("\\$",
                                "."));
    return imports.contains(item);
  }
}

代码示例来源:origin: org.kie.soup/kie-soup-project-datamodel-api

public Set<String> getImportStrings() {
  Set<String> strings = new HashSet<>();
  for (Import item : imports) {
    strings.add(item.getType());
  }
  return strings;
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

public void onTypeNameChange(final String typeName){
  import_.setType(typeName);
  parentPresenter.fireChangeEvent();
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-config-resource-widget

@Test
public void testOnImportRemoved() {
  final Imports imports = new Imports();
  imports.addImport(new Import("Internal1"));
  presenter.setContent(dmo,
             imports,
             false);
  presenter.onRemoveImport(new Import("Internal1"));
  assertEquals(0,
         imports.getImports().size());
  verify(dmo).filter();
  verify(importRemovedEvent,
      times(1)).fire(importRemovedEventCaptor.capture());
  assertEquals("Internal1",
         importRemovedEventCaptor.getValue().getImport().getType());
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-config-resource-widget

@Test
public void checkAddImportSortsAlphabetically() {
  final Import newImport = new Import("new1");
  when(addImportPopup.getImportType()).thenReturn(newImport.getType());
  view.makeAddImportCommand().execute();
  verify(lockRequired).fire(any(LockRequiredEvent.class));
  final List<Import> imports = view.getDataProvider().getList();
  assertEquals(4,
         imports.size());
  assertEquals(newImport,
         imports.get(0));
  assertEquals(import3,
         imports.get(1));
  assertEquals(import2,
         imports.get(2));
  assertEquals(import1,
         imports.get(3));
}

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend

private ProjectImports createProjectImports() {
  ProjectImports projectImports = new ProjectImports();
  final Imports imports = projectImports.getImports();
  imports.addImport(new Import(java.lang.Number.class.getName()));
  imports.addImport(new Import(java.lang.Boolean.class.getName()));
  imports.addImport(new Import(java.lang.String.class.getName()));
  imports.addImport(new Import(java.lang.Integer.class.getName()));
  imports.addImport(new Import(java.lang.Double.class.getName()));
  imports.addImport(new Import(java.util.List.class.getName()));
  imports.addImport(new Import(java.util.Collection.class.getName()));
  imports.addImport(new Import(java.util.ArrayList.class.getName()));
  return projectImports;
}

代码示例来源:origin: org.kie.soup/kie-soup-project-datamodel-api

public String toString() {
  final StringBuilder sb = new StringBuilder();
  for (final Import i : imports) {
    sb.append("import ").append(i.getType()).append(";\n");
  }
  return sb.toString();
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-config-resource-widget

@Test
public void checkAddImportSortsAlphabetically() {
  final Import newImport = new Import("new1");
  when(addImportPopup.getImportType()).thenReturn(newImport.getType());
  when(presenter.isInternalImport(eq(newImport))).thenReturn(false);
  view.makeAddImportCommand().execute();
  verify(lockRequired).fire(any(LockRequiredEvent.class));
  final List<Import> imports = view.getDataProvider().getList();
  assertEquals(5,
         imports.size());
  assertEquals(internal2,
         imports.get(0));
  assertEquals(internal1,
         imports.get(1));
  assertEquals(newImport,
         imports.get(2));
  assertEquals(model2,
         imports.get(3));
  assertEquals(model1,
         imports.get(4));
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

public void addNewExternalDataObjects() {
  itemPresenters.add(new Import(""));
  fireChangeEvent();
}

代码示例来源:origin: kiegroup/drools-wb

private String convertToFullyQualifiedClassName(final String factType) {
  if (factType.contains(".")) {
    return factType;
  }
  String fullyQualifiedClassName = null;
  for (Import imp : imports.getImports()) {
    if (imp.getType().endsWith(factType)) {
      fullyQualifiedClassName = imp.getType();
      break;
    }
  }
  if (fullyQualifiedClassName == null) {
    fullyQualifiedClassName = packageName + "." + factType;
  }
  return fullyQualifiedClassName;
}

代码示例来源:origin: kiegroup/drools-wb

existingImports.add(item.getType());
  result.addMessage("Created Import for '" + item.getClassName() + "'.",
           ConversionMessageType.INFO);
  projectImports.getImports().addImport(new org.kie.soup.project.datamodel.imports.Import(item.getClassName()));

代码示例来源:origin: org.drools/drools-wb-test-scenario-editor-backend

void addDependentImportsToScenario(final Scenario scenario,
                  final Path path) {
  final PackageDataModelOracle dataModel = getDataModel(path);
  final Set<String> usedFullyQualifiedClassNames = getUsedFullyQualifiedClassNames(scenario,
                                           dataModel);
  for (String className : usedFullyQualifiedClassNames) {
    final Import imp = new Import(className);
    final List<Import> scenarioImports = scenario.getImports().getImports();
    if (!scenarioImports.contains(imp)) {
      scenarioImports.add(imp);
    }
  }
}

代码示例来源:origin: org.drools/drools-wb-guided-rule-editor-backend

private String convertToFullyQualifiedClassName(final String factType) {
  if (factType.contains(".")) {
    return factType;
  }
  String fullyQualifiedClassName = null;
  for (Import imp : imports.getImports()) {
    if (imp.getType().endsWith(factType)) {
      fullyQualifiedClassName = imp.getType();
      break;
    }
  }
  if (fullyQualifiedClassName == null) {
    fullyQualifiedClassName = packageName + "." + factType;
  }
  return fullyQualifiedClassName;
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-config-resource-widget

@Test
public void testOnImportAdded() {
  final Imports imports = new Imports();
  imports.addImport(new Import("Internal1"));
  presenter.setContent(dmo,
             imports,
             false);
  presenter.onAddImport(new Import("NewImport1"));
  assertEquals(2,
         imports.getImports().size());
  assertContains("Internal1",
          imports.getImports());
  assertContains("NewImport1",
          imports.getImports());
  verify(importAddedEvent,
      times(1)).fire(importAddedEventCaptor.capture());
  assertEquals("NewImport1",
         importAddedEventCaptor.getValue().getImport().getType());
}

代码示例来源:origin: kiegroup/drools-wb

void addDependentImportsToScenario(final Scenario scenario,
                  final Path path) {
  final PackageDataModelOracle dataModel = getDataModel(path);
  final Set<String> usedFullyQualifiedClassNames = getUsedFullyQualifiedClassNames(scenario,
                                           dataModel);
  for (String className : usedFullyQualifiedClassNames) {
    final Import imp = new Import(className);
    final List<Import> scenarioImports = scenario.getImports().getImports();
    if (!scenarioImports.contains(imp)) {
      scenarioImports.add(imp);
    }
  }
}

代码示例来源:origin: org.drools/drools-wb-guided-dtree-editor-backend

private String convertToFullyQualifiedClassName(final String factType) {
    if (factType.contains(".")) {
      return factType;
    }
    String fullyQualifiedClassName = null;
    for (Import imp : imports.getImports()) {
      if (imp.getType().endsWith(factType)) {
        fullyQualifiedClassName = imp.getType();
        break;
      }
    }
    if (fullyQualifiedClassName == null) {
      fullyQualifiedClassName = packageName + "." + factType;
    }
    return fullyQualifiedClassName;
  }
}

代码示例来源:origin: org.kie.workbench.widgets/kie-wb-config-resource-widget

@Test
public void testSetContentRemovesOldImportsOnImportAdded() {
  when(dmo.getInternalFactTypes()).thenReturn(new String[]{"a"});
  when(dmo.getExternalFactTypes()).thenReturn(new String[]{"b"});
  final Imports imports = new Imports();
  imports.addImport(new Import("c"));
  presenter.setContent(dmo,
             imports,
             false);
  when(dmo.getInternalFactTypes()).thenReturn(new String[]{"A"});
  when(dmo.getExternalFactTypes()).thenReturn(new String[]{"B"});
  final Imports importsNew = new Imports();
  importsNew.addImport(new Import("C"));
  presenter.setContent(dmo,
             importsNew,
             false);
  assertEquals(1, presenter.getInternalFactTypes().size());
  assertEquals("A", presenter.getInternalFactTypes().get(0).getType());
  assertEquals(1, presenter.getExternalFactTypes().size());
  assertEquals("B", presenter.getExternalFactTypes().get(0).getType());
  assertEquals(1, presenter.getModelFactTypes().size());
  assertEquals("C", presenter.getModelFactTypes().get(0).getType());
}

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

@Override
public void addImport(final String fqcn) {
  //Filter DMO
  final Import addedImport = new Import(fqcn);
  model.getImports().addImport(addedImport);
  oracle.filter(model.getImports());
  //Signal change to any other interested consumers (e.g. some editors support rendering of unknown fact-types)
  importAddedEvent.fire(new ImportAddedEvent(oracle,
                        addedImport));
}

代码示例来源:origin: kiegroup/drools-wb

private String convertToFullyQualifiedClassName(final String factType) {
  if (factType.contains(".")) {
    return factType;
  }
  String fullyQualifiedClassName = null;
  for (Import imp : imports.getImports()) {
    if (imp.getType().endsWith(factType)) {
      fullyQualifiedClassName = imp.getType();
      break;
    }
  }
  if (fullyQualifiedClassName == null) {
    fullyQualifiedClassName = packageName + "." + factType;
  }
  return fullyQualifiedClassName;
}

代码示例来源:origin: kiegroup/drools-wb

@Override
public void addImport(final String fqcn) {
  //Filter DMO
  final Import addedImport = new Import(fqcn);
  model.getImports().addImport(addedImport);
  oracle.filter(model.getImports());
  //Signal change to any other interested consumers (e.g. some editors support rendering of unknown fact-types)
  importAddedEvent.fire(new ImportAddedEvent(oracle,
                        addedImport));
}

相关文章