Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/JumpMind/metl.git
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Aug 2, 2016
2 parents 96e5a8a + 965543b commit e9208d6
Show file tree
Hide file tree
Showing 7 changed files with 5,071 additions and 853 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ This is the development site for Metl. To run the latest and greatest use the f

<a href="https://sourceforge.net/projects/metl/files/latest/download" rel="nofollow"><img alt="Download Metl" src="https://a.fsdn.com/con/app/sf-download-button"></a>

Please use the forum for general discussion and questions. It is location here: https://sourceforge.net/p/metl/discussion/general/

Metl is a simple, web-based integration platform that allows for several different styles of data integration including messaging, file based Extract/Transform/Load (ETL), and remote procedure invocation via Web Services.

Metl was built to solve fairly simple day to day integration tasks without the need for custom coding, heavy infrastructure or high costs. It can be deployed in the cloud or in an internal data center, and was built to allow developers to extend it to fit their needs by writing their own components that can be included and leveraged by the existing Metl infrastructure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@

public class FixedLengthFormatter extends AbstractComponentRuntime {

public static final String TYPE = "Format Fixed";
public final static String TYPE = "Format Fixed";

public final static String FIXED_LENGTH_FORMATTER_WRITE_HEADER = "fixed.length.formatter.header";

public final static String FIXED_LENGTH_FORMATTER_ATTRIBUTE_ORDINAL = "fixed.length.formatter.attribute.ordinal";
public final static String FIXED_LENGTH_FORMATTER_ATTRIBUTE_LENGTH = "fixed.length.formatter.attribute.length";
public final static String FIXED_LENGTH_FORMATTER_ATTRIBUTE_FORMAT_FUNCTION = "fixed.length.formatter.attribute.format.function";

public final static String PAD_CHAR = " ";

/* settings */
boolean useHeader;

Expand Down Expand Up @@ -85,7 +87,12 @@ public void handle(Message inputMessage, ISendMessageCallback callback, boolean
for (AttributeFormat attr : attributesList) {
if (attr.getAttribute() != null) {
String name = attr.getAttribute().getName();
String paddedValue = StringUtils.pad(name != null ? name.toString() : "", attr.getLength(), " ", true);
if (name != null) {
name = StringUtils.trim(name, true, true, PAD_CHAR);
} else {
name = "";
}
String paddedValue = StringUtils.pad(name, attr.getLength(), PAD_CHAR, true);
stringBuilder.append(paddedValue);
}
}
Expand All @@ -111,7 +118,12 @@ private String processInputRow(Message inputMessage, EntityData inputRow) {
value = ModelAttributeScriptHelper.eval(inputMessage, context, attribute.getAttribute(), value, attribute.getEntity(),
inputRow, attribute.getFormatFunction());
}
String paddedValue = StringUtils.pad(value != null ? value.toString() : "", attribute.getLength(), " ", true);
if (value != null) {
value = StringUtils.trim(value.toString(), true, true, PAD_CHAR);
} else {
value = "";
}
String paddedValue = StringUtils.pad(value.toString(), attribute.getLength(), PAD_CHAR, true);
stringBuilder.append(paddedValue);
}
return stringBuilder.toString();
Expand Down
Loading

0 comments on commit e9208d6

Please sign in to comment.