Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspersorensen committed Dec 8, 2014
2 parents 1dfca2a + 88c977c commit 4a5d6cf
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

import junit.framework.TestCase;

import org.apache.metamodel.schema.ColumnType;
import org.apache.metamodel.schema.MutableColumn;
import org.apache.metamodel.schema.MutableTable;
import org.eobjects.analyzer.beans.StringAnalyzer;
import org.eobjects.analyzer.beans.coalesce.CoalesceMultipleFieldsTransformer;
import org.eobjects.analyzer.beans.coalesce.CoalesceUnit;
Expand All @@ -43,9 +46,6 @@
import org.eobjects.analyzer.job.builder.AnalysisJobBuilder;
import org.eobjects.analyzer.job.builder.FilterJobBuilder;
import org.eobjects.analyzer.job.builder.TransformerJobBuilder;
import org.apache.metamodel.schema.ColumnType;
import org.apache.metamodel.schema.MutableColumn;
import org.apache.metamodel.schema.MutableTable;

public class RowProcessingConsumerSorterTest extends TestCase {

Expand Down Expand Up @@ -110,7 +110,7 @@ public void testCreateProcessOrderedConsumerListWithMergedOutcomes() throws Exce
assertEquals("ImmutableTransformerJob[name=tjb1,transformer=Transformer mock]", consumers.get(1)
.getComponentJob().toString());
assertEquals(
"ImmutableTransformerJob[name=null,transformer=Coalesce multiple fields]",
"ImmutableTransformerJob[name=null,transformer=Fuse / Coalesce fields]",
consumers.get(2).getComponentJob().toString());
assertEquals("ImmutableFilterJob[name=fjb2,filter=Mock filter]", consumers.get(3).getComponentJob().toString());
assertEquals("ImmutableAnalyzerJob[name=null,analyzer=String analyzer]", consumers.get(4).getComponentJob()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
+ "Use it to identify relative dates such as 'latest activity' date "
+ "if multiple stages in a process may have been recorded in different columns.")
@Categorized({ DateAndTimeCategory.class })
@Deprecated
public class CoalesceDatesTransformer implements Transformer<Date> {

@Configured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,27 @@
import java.util.Arrays;
import java.util.List;

import org.eobjects.analyzer.beans.api.Alias;
import org.eobjects.analyzer.beans.api.Categorized;
import org.eobjects.analyzer.beans.api.Configured;
import org.eobjects.analyzer.beans.api.Description;
import org.eobjects.analyzer.beans.api.OutputColumns;
import org.eobjects.analyzer.beans.api.Transformer;
import org.eobjects.analyzer.beans.api.TransformerBean;
import org.eobjects.analyzer.beans.categories.FilterCategory;
import org.eobjects.analyzer.beans.categories.CompositionCategory;
import org.eobjects.analyzer.data.InputColumn;
import org.eobjects.analyzer.data.InputRow;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@TransformerBean("Coalesce multiple fields")
@Description("Returns the first non-null values of multiple fields and groups of fields. Use it to identify the most "
+ "accurate or most recent observation, if multiple entries have been recorded in separate columns.")
@Categorized({ FilterCategory.class })
@TransformerBean("Fuse / Coalesce fields")
@Alias("Coalesce multiple fields")
@Description("Lets you combine multiple fields into one, selecting the first value that is non-null.\n\n"
+ "Use it to fuse data streams coming from different filter requirements. You can define new fields whose values represent whatever is available from one of the input streams.\n\n"
+ "Or use it to identify the most accurate or most recent observation, if multiple entries have been recorded in separate columns.")
@Categorized(CompositionCategory.class)
public class CoalesceMultipleFieldsTransformer implements Transformer<Object> {

private static final Logger logger = LoggerFactory.getLogger(CoalesceMultipleFieldsTransformer.class);

@Configured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@Description("Returns the first non-null number. Use it to identify the most "
+ "accurate or most recent number if multiple observations have been recorded in columns.")
@Categorized({ NumbersCategory.class })
@Deprecated
public class CoalesceNumbersTransformer implements Transformer<Number> {

@Configured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
+ "accurate or most recent observation, if multiple entries "
+ "have been recorded in separate columns.")
@Categorized({ StringManipulationCategory.class })
@Deprecated
public class CoalesceStringsTransformer implements Transformer<String> {

@Configured
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* AnalyzerBeans
* Copyright (C) 2014 Neopost - Customer Information Management
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.eobjects.analyzer.beans.categories;

public class CompositionCategory extends AbstractComponentCategory {

private static final long serialVersionUID = 1L;

}
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ private void findAllSourceJobs(Object job, Set<Object> result) {
for (final InputColumn<?> inputColumn : inputColumns) {
final InputColumnSourceJob source = findInputColumnSource(inputColumn);
if (source != null) {
result.add(source);
findAllSourceJobs(source, result);
final boolean added = result.add(source);
if (added) {
findAllSourceJobs(source, result);
}
}
}
}
Expand All @@ -157,8 +159,10 @@ private void findAllSourceJobs(Object job, Set<Object> result) {
for (final FilterOutcome outcome : requirements) {
HasFilterOutcomes source = findOutcomeSource(outcome);
if (source != null) {
result.add(source);
findAllSourceJobs(source, result);
final boolean added = result.add(source);
if (added) {
findAllSourceJobs(source, result);
}
}
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
import java.util.LinkedHashMap;
import java.util.Map;

import org.eobjects.analyzer.beans.api.Categorized;
import org.eobjects.analyzer.beans.api.Configured;
import org.eobjects.analyzer.beans.api.Description;
import org.eobjects.analyzer.beans.api.FileProperty;
import org.eobjects.analyzer.beans.api.FileProperty.FileAccessMode;
import org.eobjects.analyzer.beans.api.TransformerBean;
import org.eobjects.analyzer.beans.categories.CompositionCategory;
import org.eobjects.analyzer.beans.transform.AbstractWrappedAnalysisJobTransformer;
import org.eobjects.analyzer.data.InputColumn;
import org.eobjects.analyzer.job.AnalysisJob;
Expand All @@ -40,6 +42,7 @@

@TransformerBean("Invoke child Analysis job")
@Description("Wraps another (external) Analysis job's transformations and invokes them as an integrated part of the current job. Using this transformation you can compose parent and child jobs for more coarse or more fine granularity of transformations.")
@Categorized(CompositionCategory.class)
public class InvokeChildAnalysisJobTransformer extends AbstractWrappedAnalysisJobTransformer {

@Configured
Expand Down

0 comments on commit 4a5d6cf

Please sign in to comment.