From 9574b9c2feef28b00718c66edf5469383cf54a55 Mon Sep 17 00:00:00 2001 From: Emanuela Epure <67077116+emanuelaepure10@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:04:31 +0200 Subject: [PATCH 1/2] feat: type selection broken on custom export config CSV: Add a warning label to CSV dialog telling that feature types without data are not selectable. XSL: remove the button "Ignore feature types without data" and add intro the checkbox table disabled from selection elements that don't have any data for export. ING-3987 --- .../ui/InstanceExportConfigurationPage.java | 11 +- .../hale/io/csv/InstanceTableIOConstants.java | 5 - .../hale/io/xls/test/XLSInstanceIOTest.java | 2 - .../test/writer/XLSInstanceWriterTest.java | 8 -- .../XLSInstanceExportConfigurationPage.java | 118 ++++++++++++++---- .../hale/io/xls/writer/XLSInstanceWriter.java | 17 +-- 6 files changed, 103 insertions(+), 58 deletions(-) diff --git a/io/plugins/eu.esdihumboldt.hale.io.csv.ui/src/eu/esdihumboldt/hale/io/csv/ui/InstanceExportConfigurationPage.java b/io/plugins/eu.esdihumboldt.hale.io.csv.ui/src/eu/esdihumboldt/hale/io/csv/ui/InstanceExportConfigurationPage.java index a30d08fb84..813b3d5d99 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.csv.ui/src/eu/esdihumboldt/hale/io/csv/ui/InstanceExportConfigurationPage.java +++ b/io/plugins/eu.esdihumboldt.hale.io.csv.ui/src/eu/esdihumboldt/hale/io/csv/ui/InstanceExportConfigurationPage.java @@ -21,6 +21,7 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.PlatformUI; @@ -110,6 +111,13 @@ protected void createContent(Composite page) { final Label label = new Label(page, SWT.NONE); label.setText("Choose your Type you want to export:"); + Label separatorLabel = new Label(page, SWT.NONE); + separatorLabel.setText("Warning! Feature types with no data are not selectable"); + + // Set the text colour of the label to yellow + Color greyLabel = PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY); + separatorLabel.setForeground(greyLabel); + page.pack(); // wait for selected type @@ -132,9 +140,6 @@ protected void onShowPage(boolean firstShow) { public void selectionChanged(SelectionChangedEvent event) { setPageComplete(!(event.getSelection().isEmpty())); if (typeSelector.getSelectedObject() != null) { - // TypeDefinition type = - // typeSelector.getSelectedObject(); - // label.getParent().layout(); page.layout(); page.pack(); } diff --git a/io/plugins/eu.esdihumboldt.hale.io.csv/src/eu/esdihumboldt/hale/io/csv/InstanceTableIOConstants.java b/io/plugins/eu.esdihumboldt.hale.io.csv/src/eu/esdihumboldt/hale/io/csv/InstanceTableIOConstants.java index 1ebaaa38b0..0b547d15b7 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.csv/src/eu/esdihumboldt/hale/io/csv/InstanceTableIOConstants.java +++ b/io/plugins/eu.esdihumboldt.hale.io.csv/src/eu/esdihumboldt/hale/io/csv/InstanceTableIOConstants.java @@ -45,9 +45,4 @@ public class InstanceTableIOConstants { */ public static final String EXPORT_TYPE = "selectedExportType"; - /** - * Parameter for exporting empty feature types to XLS Export - */ - public static final String EXPORT_IGNORE_EMPTY_FEATURETYPES = "ignoreEmptyFeaturetypes"; - } diff --git a/io/plugins/eu.esdihumboldt.hale.io.xls.test/src/eu/esdihumboldt/hale/io/xls/test/XLSInstanceIOTest.java b/io/plugins/eu.esdihumboldt.hale.io.xls.test/src/eu/esdihumboldt/hale/io/xls/test/XLSInstanceIOTest.java index a09d9c9581..bb71444539 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.xls.test/src/eu/esdihumboldt/hale/io/xls/test/XLSInstanceIOTest.java +++ b/io/plugins/eu.esdihumboldt.hale.io.xls.test/src/eu/esdihumboldt/hale/io/xls/test/XLSInstanceIOTest.java @@ -60,8 +60,6 @@ public void test() { .getContentType("eu.esdihumboldt.hale.io.xls.xls"); writer.setParameter(InstanceTableIOConstants.SOLVE_NESTED_PROPERTIES, Value.of(false)); writer.setParameter(InstanceTableIOConstants.USE_SCHEMA, Value.of(true)); - writer.setParameter(InstanceTableIOConstants.EXPORT_IGNORE_EMPTY_FEATURETYPES, - Value.of(false)); writer.setParameter(InstanceTableIOConstants.EXPORT_TYPE, Value.of("ItemType")); File tempDir = Files.createTempDir(); diff --git a/io/plugins/eu.esdihumboldt.hale.io.xls.test/src/eu/esdihumboldt/hale/io/xls/test/writer/XLSInstanceWriterTest.java b/io/plugins/eu.esdihumboldt.hale.io.xls.test/src/eu/esdihumboldt/hale/io/xls/test/writer/XLSInstanceWriterTest.java index 2a90b88ce2..ec3db25740 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.xls.test/src/eu/esdihumboldt/hale/io/xls/test/writer/XLSInstanceWriterTest.java +++ b/io/plugins/eu.esdihumboldt.hale.io.xls.test/src/eu/esdihumboldt/hale/io/xls/test/writer/XLSInstanceWriterTest.java @@ -96,8 +96,6 @@ public void testWriteSimpleSchemaColOrder() throws Exception { .getContentType("eu.esdihumboldt.hale.io.xls.xls"); writer.setParameter(InstanceTableIOConstants.SOLVE_NESTED_PROPERTIES, Value.of(true)); writer.setParameter(InstanceTableIOConstants.USE_SCHEMA, Value.of(true)); - writer.setParameter(InstanceTableIOConstants.EXPORT_IGNORE_EMPTY_FEATURETYPES, - Value.of(false)); writer.setParameter(InstanceTableIOConstants.EXPORT_TYPE, Value.of("city")); File tmpFile = tmpFolder.newFile("excelTestWriteSimpleSchema.xls"); @@ -148,8 +146,6 @@ public void testWriteComplexSchema() throws Exception { .getContentType("eu.esdihumboldt.hale.io.xls.xls"); writer.setParameter(InstanceTableIOConstants.SOLVE_NESTED_PROPERTIES, Value.of(true)); writer.setParameter(InstanceTableIOConstants.USE_SCHEMA, Value.of(false)); - writer.setParameter(InstanceTableIOConstants.EXPORT_IGNORE_EMPTY_FEATURETYPES, - Value.of(true)); writer.setParameter(InstanceTableIOConstants.EXPORT_TYPE, Value.of("person")); File tmpFile = tmpFolder.newFile("excelTestWriteComplexSchema.xls"); @@ -200,8 +196,6 @@ public void testWriteNotNestedProperties() throws Exception { .getContentType("eu.esdihumboldt.hale.io.xls.xls"); writer.setParameter(InstanceTableIOConstants.SOLVE_NESTED_PROPERTIES, Value.of(false)); writer.setParameter(InstanceTableIOConstants.USE_SCHEMA, Value.of(false)); - writer.setParameter(InstanceTableIOConstants.EXPORT_IGNORE_EMPTY_FEATURETYPES, - Value.of(true)); writer.setParameter(InstanceTableIOConstants.EXPORT_TYPE, Value.of("person")); File tmpFile = tmpFolder.newFile("excelNotNestedProperties.xls"); @@ -252,8 +246,6 @@ public void testExportMultiFeatureToExcel() throws Exception { .getContentType("eu.esdihumboldt.hale.io.xls.xls"); writer.setParameter(InstanceTableIOConstants.SOLVE_NESTED_PROPERTIES, Value.of(false)); writer.setParameter(InstanceTableIOConstants.USE_SCHEMA, Value.of(false)); - writer.setParameter(InstanceTableIOConstants.EXPORT_IGNORE_EMPTY_FEATURETYPES, - Value.of(false)); writer.setParameter(InstanceTableIOConstants.EXPORT_TYPE, Value.of("person" + "," + "t1")); File tmpFile = tmpFolder.newFile("excelWith2Sheets.xls"); diff --git a/io/plugins/eu.esdihumboldt.hale.io.xls.ui/src/eu/esdihumboldt/hale/io/xls/ui/XLSInstanceExportConfigurationPage.java b/io/plugins/eu.esdihumboldt.hale.io.xls.ui/src/eu/esdihumboldt/hale/io/xls/ui/XLSInstanceExportConfigurationPage.java index c236a7c263..0113f22c32 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.xls.ui/src/eu/esdihumboldt/hale/io/xls/ui/XLSInstanceExportConfigurationPage.java +++ b/io/plugins/eu.esdihumboldt.hale.io.xls.ui/src/eu/esdihumboldt/hale/io/xls/ui/XLSInstanceExportConfigurationPage.java @@ -15,8 +15,8 @@ package eu.esdihumboldt.hale.io.xls.ui; -import java.util.ArrayList; -import java.util.Collection; +import java.util.NoSuchElementException; +import java.util.Set; import javax.xml.namespace.QName; @@ -25,23 +25,31 @@ import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.ICheckStateProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Table; import org.eclipse.ui.PlatformUI; import eu.esdihumboldt.hale.common.core.io.Value; import eu.esdihumboldt.hale.common.instance.io.InstanceWriter; +import eu.esdihumboldt.hale.common.instance.model.DataSet; +import eu.esdihumboldt.hale.common.instance.model.Instance; +import eu.esdihumboldt.hale.common.instance.model.InstanceCollection; +import eu.esdihumboldt.hale.common.instance.model.ResourceIterator; import eu.esdihumboldt.hale.common.schema.model.TypeDefinition; import eu.esdihumboldt.hale.io.csv.InstanceTableIOConstants; import eu.esdihumboldt.hale.io.csv.ui.CommonInstanceExportConfigurationPage; +import eu.esdihumboldt.hale.ui.service.instance.InstanceService; /** * Configuration page for exporting Excel @@ -52,7 +60,6 @@ public class XLSInstanceExportConfigurationPage extends CommonInstanceExportConf private CheckboxTableViewer featureTypeTable; private Button selectAll = null; - private Button ignoreEmptyFeaturetypes = null; private Group chooseFeatureTypes; private Table table; @@ -91,19 +98,6 @@ protected void createContent(Composite page) { protected void onShowPage(boolean firstShow) { if (firstShow) { - ignoreEmptyFeaturetypes = new Button(chooseFeatureTypes, SWT.CHECK); - ignoreEmptyFeaturetypes.setText("Ignore feature types without data"); - ignoreEmptyFeaturetypes - .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); - - ignoreEmptyFeaturetypes.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - } - }); - ignoreEmptyFeaturetypes.setSelection(false); - selectAll = new Button(chooseFeatureTypes, SWT.CHECK); selectAll.setText("Select all"); selectAll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); @@ -119,6 +113,14 @@ public void widgetSelected(SelectionEvent e) { } }); + Label separatorLabel = new Label(page, SWT.NONE); + separatorLabel.setText("Warning! Feature types with no data are not selectable"); + + // Set the text colour of the label to yellow + Color greyLabel = PlatformUI.getWorkbench().getDisplay() + .getSystemColor(SWT.COLOR_DARK_GRAY); + separatorLabel.setForeground(greyLabel); + table = new Table(chooseFeatureTypes, SWT.CHECK | SWT.MULTI | SWT.SCROLL_PAGE); table.setHeaderVisible(false); table.setLinesVisible(false); @@ -138,25 +140,63 @@ public String getText(Object element) { }); featureTypeTable.setContentProvider(ArrayContentProvider.getInstance()); - Collection relevantTypes = getWizard().getProvider() - .getTargetSchema().getMappingRelevantTypes(); - - ArrayList tableContent = new ArrayList<>(); - for (TypeDefinition typeDefinition : relevantTypes) { - tableContent.add(typeDefinition.getName()); - } + featureTypeTable.setInput( + getWizard().getProvider().getTargetSchema().getMappingRelevantTypes()); - featureTypeTable.setInput(relevantTypes); featureTypeTable.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { + // Programmatic action to toggle the state + selectAll.setSelection( + featureTypeTable.getCheckedElements().length == featureTypeTable + .getTable().getItemCount()); + page.layout(); page.pack(); setPageComplete(validate()); } }); + featureTypeTable.setCheckStateProvider(new ICheckStateProvider() { + + @Override + public boolean isChecked(Object element) { + if (!(element instanceof TypeDefinition)) + return false; + return checkboxState(element); + } + + @Override + public boolean isGrayed(Object element) { + if (!(element instanceof TypeDefinition)) + return false; + return checkboxState(element); + } + + /** + * @param element + * @return true if the button cannot be selected + */ + private boolean checkboxState(Object element) { + InstanceService instanceService = PlatformUI.getWorkbench() + .getService(InstanceService.class); + + Set instanceSourceTypes = instanceService + .getInstanceTypes(DataSet.SOURCE); + if (instanceSourceTypes.contains(element)) { + return false; + } + + Set instanceTransformedTypes = instanceService + .getInstanceTypes(DataSet.TRANSFORMED); + if (instanceTransformedTypes.contains(element)) { + return false; + } + return true; + } + }); + page.layout(); page.pack(); } @@ -173,9 +213,6 @@ private boolean validate() { public boolean updateConfiguration(InstanceWriter provider) { super.updateConfiguration(provider); - provider.setParameter(InstanceTableIOConstants.EXPORT_IGNORE_EMPTY_FEATURETYPES, - Value.of(ignoreEmptyFeaturetypes.getSelection())); - Object[] elements = featureTypeTable.getCheckedElements(); String param = ""; for (Object el : elements) { @@ -204,4 +241,31 @@ public void disable() { } + /** + * @param instances InstanceCollection + * @return boolean true if the instance has at least one properties + */ + protected boolean extractedSelectableTypeDefinition(InstanceCollection instances) { + try (ResourceIterator instanceIterator = instances.iterator();) { + Instance instance = null; + try { + instance = instanceIterator.next(); + Iterable allProperties = instance.getPropertyNames(); + + for (QName qname : allProperties) { + + // get properties of the current instance + Object[] properties = instance.getProperty(qname); + if (properties != null && properties.length != 0) { + return true; + } + } + } catch (NoSuchElementException e) { + return false; + } + + } + return false; + } + } diff --git a/io/plugins/eu.esdihumboldt.hale.io.xls/src/eu/esdihumboldt/hale/io/xls/writer/XLSInstanceWriter.java b/io/plugins/eu.esdihumboldt.hale.io.xls/src/eu/esdihumboldt/hale/io/xls/writer/XLSInstanceWriter.java index 9a5e0b16f7..7189a40eb0 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.xls/src/eu/esdihumboldt/hale/io/xls/writer/XLSInstanceWriter.java +++ b/io/plugins/eu.esdihumboldt.hale.io.xls/src/eu/esdihumboldt/hale/io/xls/writer/XLSInstanceWriter.java @@ -74,9 +74,6 @@ protected IOReport execute(ProgressIndicator progress, IOReporter reporter) boolean solveNestedProperties = getParameter( InstanceTableIOConstants.SOLVE_NESTED_PROPERTIES).as(Boolean.class, false); - boolean ignoreEmptyFeaturetypes = getParameter( - InstanceTableIOConstants.EXPORT_IGNORE_EMPTY_FEATURETYPES).as(Boolean.class, false); - // write xls file if (getContentType().getId().equals("eu.esdihumboldt.hale.io.xls.xls")) { workbook = new HSSFWorkbook(); @@ -114,8 +111,7 @@ else if (getContentType().getId().equals("eu.esdihumboldt.hale.io.xls.xlsx")) { for (QName selectedTypeName : selectedFeatureTypes) { // get all instances of the selected Type InstanceCollection instances = getInstanceCollection(selectedTypeName); - addSheetByQName(solveNestedProperties, ignoreEmptyFeaturetypes, selectedTypeName, - instances); + addSheetByQName(solveNestedProperties, selectedTypeName, instances); } } @@ -124,17 +120,17 @@ else if (getContentType().getId().equals("eu.esdihumboldt.hale.io.xls.xlsx")) { } reporter.setSuccess(true); + return reporter; } // close try-iterator /** * @param solveNestedProperties : Solve nested properties - * @param ignoreEmptyFeaturetypes don't add empty feature types to excel * @param selectedTypeName selected feature type * @param instances InstanceCollection available */ - private void addSheetByQName(boolean solveNestedProperties, boolean ignoreEmptyFeaturetypes, - QName selectedTypeName, InstanceCollection instances) { + private void addSheetByQName(boolean solveNestedProperties, QName selectedTypeName, + InstanceCollection instances) { // use ResourceIterator in a try block because is closable // - @@ -145,11 +141,6 @@ private void addSheetByQName(boolean solveNestedProperties, boolean ignoreEmptyF try { instance = instanceIterator.next(); } catch (NoSuchElementException e) { - if (!ignoreEmptyFeaturetypes) { - Sheet sheet = workbook.createSheet(selectedTypeName.getLocalPart()); - sheet.createRow(0); - resizeSheet(sheet); - } return; } From 1724495ac2536f40e291ac77e2df1dcc569492a8 Mon Sep 17 00:00:00 2001 From: Emanuela Epure <67077116+emanuelaepure10@users.noreply.github.com> Date: Mon, 21 Aug 2023 23:13:30 +0200 Subject: [PATCH 2/2] feat: update CSV ViewerFilter and remove unused method in the XLS Update CSV InstanceExportConfigurationPage with the same approach used by XLS for finding which feature types has data or not. Remove unused method from XLSInstanceExportConfigurationPage ING-3987 --- .../ui/InstanceExportConfigurationPage.java | 25 +++++++++----- .../XLSInstanceExportConfigurationPage.java | 33 ------------------- 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/io/plugins/eu.esdihumboldt.hale.io.csv.ui/src/eu/esdihumboldt/hale/io/csv/ui/InstanceExportConfigurationPage.java b/io/plugins/eu.esdihumboldt.hale.io.csv.ui/src/eu/esdihumboldt/hale/io/csv/ui/InstanceExportConfigurationPage.java index 813b3d5d99..00cd28575e 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.csv.ui/src/eu/esdihumboldt/hale/io/csv/ui/InstanceExportConfigurationPage.java +++ b/io/plugins/eu.esdihumboldt.hale.io.csv.ui/src/eu/esdihumboldt/hale/io/csv/ui/InstanceExportConfigurationPage.java @@ -15,6 +15,8 @@ package eu.esdihumboldt.hale.io.csv.ui; +import java.util.Set; + import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -29,7 +31,6 @@ import eu.esdihumboldt.hale.common.core.io.Value; import eu.esdihumboldt.hale.common.instance.io.InstanceWriter; import eu.esdihumboldt.hale.common.instance.model.DataSet; -import eu.esdihumboldt.hale.common.instance.model.TypeFilter; import eu.esdihumboldt.hale.common.schema.model.TypeDefinition; import eu.esdihumboldt.hale.io.csv.InstanceTableIOConstants; import eu.esdihumboldt.hale.ui.common.definition.selector.TypeDefinitionSelector; @@ -50,17 +51,22 @@ public class InstanceExportConfigurationPage extends CommonInstanceExportConfigu public boolean select(Viewer viewer, Object parentElement, Object element) { if (!(element instanceof TypeDefinition)) return false; - InstanceService ins = PlatformUI.getWorkbench().getService(InstanceService.class); - // select all source type which has at least one instance - if (!ins.getInstances(DataSet.SOURCE).select(new TypeFilter((TypeDefinition) element)) - .isEmpty()) { + + InstanceService instanceService = PlatformUI.getWorkbench() + .getService(InstanceService.class); + + Set instanceSourceTypes = instanceService + .getInstanceTypes(DataSet.SOURCE); + if (instanceSourceTypes.contains(element)) { return true; } - // select all type which has at least one transformed instance - if (!ins.getInstances(DataSet.TRANSFORMED) - .select(new TypeFilter((TypeDefinition) element)).isEmpty()) { + + Set instanceTransformedTypes = instanceService + .getInstanceTypes(DataSet.TRANSFORMED); + if (instanceTransformedTypes.contains(element)) { return true; } + return false; } }; @@ -115,7 +121,8 @@ protected void createContent(Composite page) { separatorLabel.setText("Warning! Feature types with no data are not selectable"); // Set the text colour of the label to yellow - Color greyLabel = PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY); + Color greyLabel = PlatformUI.getWorkbench().getDisplay() + .getSystemColor(SWT.COLOR_DARK_GRAY); separatorLabel.setForeground(greyLabel); page.pack(); diff --git a/io/plugins/eu.esdihumboldt.hale.io.xls.ui/src/eu/esdihumboldt/hale/io/xls/ui/XLSInstanceExportConfigurationPage.java b/io/plugins/eu.esdihumboldt.hale.io.xls.ui/src/eu/esdihumboldt/hale/io/xls/ui/XLSInstanceExportConfigurationPage.java index 0113f22c32..442e09bbb8 100644 --- a/io/plugins/eu.esdihumboldt.hale.io.xls.ui/src/eu/esdihumboldt/hale/io/xls/ui/XLSInstanceExportConfigurationPage.java +++ b/io/plugins/eu.esdihumboldt.hale.io.xls.ui/src/eu/esdihumboldt/hale/io/xls/ui/XLSInstanceExportConfigurationPage.java @@ -15,11 +15,8 @@ package eu.esdihumboldt.hale.io.xls.ui; -import java.util.NoSuchElementException; import java.util.Set; -import javax.xml.namespace.QName; - import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.CheckStateChangedEvent; @@ -43,9 +40,6 @@ import eu.esdihumboldt.hale.common.core.io.Value; import eu.esdihumboldt.hale.common.instance.io.InstanceWriter; import eu.esdihumboldt.hale.common.instance.model.DataSet; -import eu.esdihumboldt.hale.common.instance.model.Instance; -import eu.esdihumboldt.hale.common.instance.model.InstanceCollection; -import eu.esdihumboldt.hale.common.instance.model.ResourceIterator; import eu.esdihumboldt.hale.common.schema.model.TypeDefinition; import eu.esdihumboldt.hale.io.csv.InstanceTableIOConstants; import eu.esdihumboldt.hale.io.csv.ui.CommonInstanceExportConfigurationPage; @@ -241,31 +235,4 @@ public void disable() { } - /** - * @param instances InstanceCollection - * @return boolean true if the instance has at least one properties - */ - protected boolean extractedSelectableTypeDefinition(InstanceCollection instances) { - try (ResourceIterator instanceIterator = instances.iterator();) { - Instance instance = null; - try { - instance = instanceIterator.next(); - Iterable allProperties = instance.getPropertyNames(); - - for (QName qname : allProperties) { - - // get properties of the current instance - Object[] properties = instance.getProperty(qname); - if (properties != null && properties.length != 0) { - return true; - } - } - } catch (NoSuchElementException e) { - return false; - } - - } - return false; - } - }