public MutableAnalysisJobMetadata(final AnalysisJobMetadata metadata) { _jobName = metadata.getJobName(); _jobVersion = metadata.getJobVersion(); _jobDescription = metadata.getJobDescription(); _author = metadata.getAuthor(); _createdDate = metadata.getCreatedDate(); _updatedDate = metadata.getUpdatedDate(); final Map<String, String> variables = metadata.getVariables(); if (variables == null) { _variables = new HashMap<>(); } else { _variables = new HashMap<>(variables); } final Map<String, String> properties = metadata.getProperties(); if (properties == null) { _properties = new HashMap<>(); } else { _properties = new HashMap<>(properties); } }
public SourceColumnMapping(final AnalysisJobMetadata metadata) { this(metadata.getSourceColumnPaths()); }
private String getTablePath(final String columnPath) { final int columnDelim = columnPath.lastIndexOf('.'); final String tablePath; if (columnDelim == -1) { // some column paths contain only the column name tablePath = _metadata.getDatastoreName(); } else { // this tablePath will be used to group together columns from the same original table // The column's path contains also the table name in the path tablePath = columnPath.substring(0, columnDelim); } return tablePath; }
protected void buildMainSection(final JobMetadataType jobMetadata, final AnalysisJob analysisJob) throws Exception { final AnalysisJobMetadata metadata = getMetadata(analysisJob); final Date createdDate = metadata.getCreatedDate(); if (createdDate != null) { final GregorianCalendar c = new GregorianCalendar(); c.setTime(createdDate); jobMetadata.setCreatedDate(_datatypeFactory.newXMLGregorianCalendar(c)); } jobMetadata.setUpdatedDate(_datatypeFactory.newXMLGregorianCalendar(new GregorianCalendar())); jobMetadata.setAuthor(_author == null ? metadata.getAuthor() : _author); jobMetadata.setJobName(_jobName == null ? metadata.getJobName() : _jobName); jobMetadata.setJobDescription(_jobDescription == null ? metadata.getJobDescription() : _jobDescription); jobMetadata.setJobVersion(_jobVersion == null ? metadata.getJobVersion() : _jobVersion); }
final String jobName = _metadata.getJobName(); if (jobName != null) { _centerPanel.add(new JLabel("<html><b>Job name:</b></html>")); final String jobDescription = _metadata.getJobDescription(); if (jobDescription != null) { _centerPanel.add(new JLabel("<html><b>Job description:</b></html>")); final String jobVersion = _metadata.getJobVersion(); if (jobVersion != null) { _centerPanel.add(new JLabel("<html><b>Job version:</b></html>")); final String author = _metadata.getAuthor(); if (author != null) { _centerPanel.add(new JLabel("<html><b>Author:</b></html>")); final Date createdDate = _metadata.getCreatedDate(); if (createdDate != null) { _centerPanel.add(new JLabel("<html><b>Created:</b></html>")); final Date updatedDate = _metadata.getUpdatedDate(); if (updatedDate != null) { _centerPanel.add(new JLabel("<html><b>Updated:</b></html>")); final String datastoreName = _metadata.getDatastoreName(); _centerPanel.add(Box.createVerticalStrut(separatorHeight)); _centerPanel.add(new JLabel("<html><b>Source columns:</b></html>")); final List<String> paths = _metadata.getSourceColumnPaths();
/** * Checks if the current copy of the metadata object is recent. * * @param metadataObject * the object to look for. */ private void verifyJobMetadataCurrent(final Object metadataObject) { long lastModified = _file.getLastModified(); if (metadataObject == null || lastModified != _lastModifiedCache) { synchronized (this) { lastModified = _file.getLastModified(); if (_sourceDatastoreName == null || lastModified != _lastModifiedCache) { final DataCleanerConfiguration configuration = _tenantContext.getConfiguration(); final AnalysisJobMetadata metadata = _file.readFile(new Func<InputStream, AnalysisJobMetadata>() { @Override public AnalysisJobMetadata eval(InputStream in) { final JaxbJobReader jobReader = new JaxbJobReader(configuration); AnalysisJobMetadata metadata = jobReader.readMetadata(in); return metadata; } }); _sourceDatastoreName = metadata.getDatastoreName(); _sourceColumnPaths = metadata.getSourceColumnPaths(); _variables = metadata.getVariables(); } } } }
if (metadata != null) { _jobNameTextField.setText(Strings.nullToEmpty(metadata.getJobName())); _jobDescriptionTextField.setText(Strings.nullToEmpty(metadata.getJobDescription())); _authorTextField.setText(Strings.nullToEmpty(metadata.getAuthor()));
private Map<String, JXTextField> createVariableTextFields() { final Map<String, JXTextField> variableTextFields = new HashMap<>(); for (final Entry<String, String> variableEntry : _metadata.getVariables().entrySet()) { final String id = variableEntry.getKey(); final String value = variableEntry.getValue(); final JXTextField textField = WidgetFactory.createTextField("Original: " + value); textField.setText(value); variableTextFields.put(id, textField); } return variableTextFields; }
@Override public AnalysisJobBuilder eval(InputStream inputStream) { if (datastore == null) { final List<String> sourceColumnPaths = metadata.getSourceColumnPaths(); final List<ColumnType> sourceColumnTypes = metadata.getSourceColumnTypes(); final PlaceholderDatastore placeholderDatastore = new PlaceholderDatastore(datastoreName, sourceColumnPaths, sourceColumnTypes); final SourceColumnMapping sourceColumnMapping = new SourceColumnMapping(sourceColumnPaths); sourceColumnMapping.setDatastore(placeholderDatastore); sourceColumnMapping.autoMap(placeholderDatastore); if (!sourceColumnMapping.isSatisfied()) { throw new IllegalStateException("Not all column mapping satisfied. Missing: " + sourceColumnMapping.getUnmappedPaths()); } return jobReader.create(inputStream, sourceColumnMapping, variableOverrides); } else { return jobReader.create(inputStream, variableOverrides); } } };
@Override public Map<String, String> getMetadataProperties() { final RepositoryFile file = getJobFile(); final DataCleanerConfiguration configuration = _tenantContext.getConfiguration(); final AnalysisJobMetadata jobMetadata = file.readFile(new Func<InputStream, AnalysisJobMetadata>() { @Override public AnalysisJobMetadata eval(InputStream in) { final JaxbJobReader jobReader = new JaxbJobReader(configuration); AnalysisJobMetadata metadata = jobReader.readMetadata(in); return metadata; } }); if (jobMetadata == null) { return Collections.emptyMap(); } return jobMetadata.getProperties(); } }
final String jobName = existingMetadata.getJobName(); final String jobVersion = existingMetadata.getJobVersion(); if (Strings.isNullOrEmpty(existingMetadata.getAuthor())) { author = System.getProperty("user.name"); } else { author = existingMetadata.getAuthor(); if (Strings.isNullOrEmpty(existingMetadata.getJobDescription())) { jobDescription = "Created with DataCleaner " + Version.getEdition() + " " + Version.getVersion(); } else { jobDescription = existingMetadata.getJobDescription();
final Map<String, String> variables = analysisJob.getMetadata().getVariables(); if ((variables != null) && (variables.size() > 0)) { for (final Map.Entry<String, String> variableEntry : variables.entrySet()) {
protected void buildProperties(final JobMetadataType jobMetadata, final AnalysisJob analysisJob) throws Exception { final AnalysisJobMetadata metadata = getMetadata(analysisJob); if (metadata != null) { final Map<String, String> properties = metadata.getProperties(); if (properties != null && !properties.isEmpty()) { final MetadataProperties propertiesType = new MetadataProperties(); final List<Property> propertyList = propertiesType.getProperty(); for (final Entry<String, String> entry : properties.entrySet()) { final Property property = new Property(); property.setName(entry.getKey()); property.setValue(entry.getValue()); propertyList.add(property); } jobMetadata.setMetadataProperties(propertiesType); } } }
private Map<String, List<SourceColumnComboBox>> createSourceColumnComboBoxes() { final Map<String, List<SourceColumnComboBox>> sourceColumnComboBoxes = new HashMap<>(); final List<String> columnPaths = _metadata.getSourceColumnPaths(); for (final String columnPath : columnPaths) { final String tablePath = getTablePath(columnPath); final SourceColumnComboBox comboBox = createSourceColumnComboBoxForColumn(sourceColumnComboBoxes, tablePath, columnPath); sourceColumnComboBoxes.get(tablePath).add(comboBox); } return sourceColumnComboBoxes; }
private void addTopLabels() { WidgetUtils.addToGridBag(DCLabel.bright("<html><b>Original value:</b></html>"), _panel, 1, _row); WidgetUtils.addToGridBag(DCLabel.bright("<html><b>New/mapped value:</b></html>"), _panel, 2, _row); _row++; WidgetUtils .addToGridBag(new JLabel(imageManager.getImageIcon(IconUtils.GENERIC_DATASTORE_IMAGEPATH)), _panel, 0, _row); WidgetUtils.addToGridBag(DCLabel.bright(_metadata.getDatastoreName()), _panel, 1, _row, GridBagConstraints.WEST); }
final String datastoreName = metadata.getDatastoreName(); final Datastore datastore = _configuration.getDatastoreCatalog().getDatastore(datastoreName);