congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
DatastoreDictionary
Code IndexAdd Tabnine to your IDE (free)

How to use
DatastoreDictionary
in
org.datacleaner.reference

Best Java code snippets using org.datacleaner.reference.DatastoreDictionary (Showing top 12 results out of 315)

origin: datacleaner/DataCleaner

private Element toElement(final DatastoreDictionary dictionary) {
  final Element elem = getDocument().createElement("datastore-dictionary");
  elem.setAttribute("name", dictionary.getName());
  if (!Strings.isNullOrEmpty(dictionary.getDescription())) {
    elem.setAttribute("description", dictionary.getDescription());
  }
  appendElement(elem, "datastore-name", dictionary.getDatastoreName());
  appendElement(elem, "column-path", dictionary.getQualifiedColumnName());
  appendElement(elem, "load-into-memory", dictionary.isLoadIntoMemory());
  return elem;
}
origin: datacleaner/DataCleaner

@Override
public Iterator<String> getAllValues() {
  return _dictionary.loadIntoMemory(_datastoreConnection).openConnection(null).getAllValues();
}
origin: datacleaner/DataCleaner

private static String getDescription(final Dictionary dictionary) {
  if (dictionary.getDescription() != null) {
    return dictionary.getDescription();
  }
  if (dictionary instanceof TextFileDictionary) {
    return ((TextFileDictionary) dictionary).getFilename();
  } else if (dictionary instanceof DatastoreDictionary) {
    final DatastoreDictionary datastoreDictionary = (DatastoreDictionary) dictionary;
    return datastoreDictionary.getDatastoreName() + ": " + datastoreDictionary.getQualifiedColumnName();
  } else if (dictionary instanceof SimpleDictionary) {
    final SimpleDictionary simpleDictionary = (SimpleDictionary) dictionary;
    final Collection<String> values = simpleDictionary.getValueSet();
    final StringBuilder sb = new StringBuilder();
    for (final String value : values) {
      if (sb.length() > 0) {
        sb.append(",");
      }
      sb.append(value);
      if (sb.length() > 20) {
        break;
      }
    }
    return sb.toString();
  }
  return "";
}
origin: datacleaner/DataCleaner

_nameTextField.setText(dictionary.getName());
_columnTextField.setText(dictionary.getQualifiedColumnName());
_datastoreComboBox.setSelectedItem(dictionary.getDatastoreName());
origin: datacleaner/DataCleaner

public SimpleDictionary loadIntoMemory(final DatastoreConnection datastoreConnection) {
  final DataContext dataContext = datastoreConnection.getDataContext();
  final Column column = getColumn(datastoreConnection);
  final Query query = dataContext.query().from(column.getTable()).select(column).toQuery();
  if (datastoreConnection.getDatastore().getPerformanceCharacteristics().isQueryOptimizationPreferred()) {
    query.getSelectClause().setDistinct(true);
  }
  final Set<String> values = new HashSet<>();
  try (DataSet dataSet = dataContext.executeQuery(query)) {
    while (dataSet.next()) {
      final Object value = dataSet.getRow().getValue(0);
      if (value != null) {
        values.add(value.toString());
      }
    }
  }
  return new SimpleDictionary(getName(), values);
}
origin: datacleaner/DataCleaner

if (dictionary instanceof DatastoreDictionary) {
  datastores.add(configuration.getDatastoreCatalog()
      .getDatastore(((DatastoreDictionary) dictionary).getDatastoreName()));
origin: datacleaner/DataCleaner

    new DatastoreDictionary(name, dsName, columnPath, loadIntoMemory);
dict.setDescription(ddt.getDescription());
origin: datacleaner/DataCleaner

final String datastoreName = _analysisJobBuilder.getDatastoreConnection().getDatastore().getName();
final DatastoreDictionary dictionary =
    new DatastoreDictionary(column.getName(), datastoreName, column.getQualifiedLabel());
origin: datacleaner/DataCleaner

@Override
public boolean containsValue(final String value) {
  final DataContext dataContext = _datastoreConnection.getDataContext();
  final Column column = _dictionary.getColumn(_datastoreConnection);
  try (DataSet dataSet = dataContext.query().from(column.getTable()).select(column).where(column).eq(value)
      .maxRows(1).execute()) {
    if (dataSet.next()) {
      return true;
    }
    return false;
  }
}
origin: datacleaner/DataCleaner

final DatastoreDictionary dictionary = new DatastoreDictionary(name1, datastoreName, columnPath);
if (_originalDictionary != null) {
  _referenceDataCatalog.changeDictionary(_originalDictionary, dictionary);
origin: datacleaner/DataCleaner

@Override
public Iterator<String> getLengthSortedValues() {
  return _dictionary.loadIntoMemory(_datastoreConnection).openConnection(null).getLengthSortedValues();
}
origin: datacleaner/DataCleaner

@Override
public DictionaryConnection openConnection(final DataCleanerConfiguration configuration) {
  final Datastore datastore = configuration.getDatastoreCatalog().getDatastore(_datastoreName);
  if (datastore == null) {
    throw new NoSuchDatastoreException(_datastoreName);
  }
  final DatastoreConnection datastoreConnection = datastore.openConnection();
  if (_loadIntoMemory) {
    final SimpleDictionary simpleDictionary = loadIntoMemory(datastoreConnection);
    // no need for the connection anymore
    datastoreConnection.close();
    return simpleDictionary.openConnection(configuration);
  }
  return new DatastoreDictionaryConnection(this, datastoreConnection);
}
org.datacleaner.referenceDatastoreDictionary

Javadoc

A dictionary backed by a column in a datastore. Note that even though this datastore is serializable it is not entirely able to gracefully deserialize. The user of the dictionary will have to inject the DatastoreCatalog using the setter method for this.

Most used methods

  • getDatastoreName
  • getName
  • <init>
  • getQualifiedColumnName
  • getColumn
  • getDescription
  • isLoadIntoMemory
  • loadIntoMemory
  • setDescription

Popular in Java

  • Finding current android device location
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now