You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/09/14 06:10:28 UTC
[incubator-hop] branch master updated: HOP-3268 Add MDI support to
Detect Last Row
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new 1d5a333 HOP-3268 Add MDI support to Detect Last Row
new 97545eb Merge pull request #1056 from nadment/HOP-3268
1d5a333 is described below
commit 1d5a3339e6c8fb7e533b99c152b2abbfe9c83d77
Author: Nicolas Adment <na...@gmail.com>
AuthorDate: Mon Sep 13 21:35:36 2021 +0200
HOP-3268 Add MDI support to Detect Last Row
---
.../transforms/detectlastrow/DetectLastRow.java | 12 ++---
.../detectlastrow/DetectLastRowData.java | 4 +-
.../detectlastrow/DetectLastRowMeta.java | 53 ++++++----------------
.../messages/messages_en_US.properties | 5 +-
.../messages/messages_fr_FR.properties | 7 +--
.../messages/messages_ja_JP.properties | 4 +-
.../messages/messages_zh_CN.properties | 3 +-
7 files changed, 30 insertions(+), 58 deletions(-)
diff --git a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRow.java b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRow.java
index 3e8765c..be6f623 100644
--- a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRow.java
+++ b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRow.java
@@ -29,9 +29,6 @@ import org.apache.hop.pipeline.transform.TransformMeta;
/**
* Detect last row in a stream
- *
- * @author Samatar
- * @since 03June2008
*/
public class DetectLastRow extends BaseTransform<DetectLastRowMeta, DetectLastRowData>
implements ITransform<DetectLastRowMeta, DetectLastRowData> {
@@ -53,7 +50,8 @@ public class DetectLastRow extends BaseTransform<DetectLastRowMeta, DetectLastRo
@Override
public boolean processRow() throws HopException {
- Object[] r = getRow(); // Get row from input rowset & set row busy!
+ // Get row from input rowset & set row busy!
+ Object[] r = getRow();
if (first) {
if (getInputRowMeta() == null) {
@@ -82,7 +80,8 @@ public class DetectLastRow extends BaseTransform<DetectLastRowMeta, DetectLastRo
outputRow = previousRow;
}
- putRow(data.outputRowMeta, outputRow); // copy row to output rowset(s);
+ // copy row to output rowset(s)
+ putRow(data.outputRowMeta, outputRow);
if (log.isRowLevel()) {
logRowlevel(
@@ -102,7 +101,8 @@ public class DetectLastRow extends BaseTransform<DetectLastRowMeta, DetectLastRo
if (!first) {
outputRow =
RowDataUtil.addRowData(previousRow, getInputRowMeta().size(), data.getFalseArray());
- putRow(data.outputRowMeta, outputRow); // copy row to output rowset(s);
+ // copy row to output rowset(s)
+ putRow(data.outputRowMeta, outputRow);
if (log.isRowLevel()) {
logRowlevel(
diff --git a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowData.java b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowData.java
index 0744f62..07bd36d 100644
--- a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowData.java
+++ b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowData.java
@@ -21,9 +21,9 @@ import org.apache.hop.core.row.IRowMeta;
import org.apache.hop.pipeline.transform.BaseTransformData;
import org.apache.hop.pipeline.transform.ITransformData;
+
/**
- * @author Samatar
- * @since 03June2008
+ * Detect last row data
*/
public class DetectLastRowData extends BaseTransformData implements ITransformData {
public IRowMeta outputRowMeta;
diff --git a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowMeta.java b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowMeta.java
index 318637b..34c838d 100644
--- a/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowMeta.java
+++ b/plugins/transforms/detectlastrow/src/main/java/org/apache/hop/pipeline/transforms/detectlastrow/DetectLastRowMeta.java
@@ -21,14 +21,13 @@ import org.apache.hop.core.CheckResult;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.annotations.Transform;
import org.apache.hop.core.exception.HopTransformException;
-import org.apache.hop.core.exception.HopXmlException;
import org.apache.hop.core.row.IRowMeta;
import org.apache.hop.core.row.IValueMeta;
import org.apache.hop.core.row.value.ValueMetaBoolean;
import org.apache.hop.core.util.Utils;
import org.apache.hop.core.variables.IVariables;
-import org.apache.hop.core.xml.XmlHandler;
import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.pipeline.Pipeline;
import org.apache.hop.pipeline.PipelineMeta;
@@ -36,15 +35,14 @@ import org.apache.hop.pipeline.PipelineMeta.PipelineType;
import org.apache.hop.pipeline.transform.BaseTransformMeta;
import org.apache.hop.pipeline.transform.ITransformMeta;
import org.apache.hop.pipeline.transform.TransformMeta;
-import org.w3c.dom.Node;
import java.util.List;
@Transform(
id = "DetectLastRow",
image = "detectlastrow.svg",
- name = "i18n::BaseTransform.TypeLongDesc.DetectLastRow",
- description = "i18n::BaseTransform.TypeTooltipDesc.DetectLastRow",
+ name = "i18n::DetectLastRow.Name",
+ description = "i18n::DetectLastRow.Description",
categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Flow",
documentationUrl =
"https://hop.apache.org/manual/latest/pipeline/transforms/identifylastrow.html")
@@ -53,22 +51,17 @@ public class DetectLastRowMeta extends BaseTransformMeta
private static final Class<?> PKG = DetectLastRowMeta.class; // For Translator
/** function result: new value name */
- private String resultfieldname;
+ @HopMetadataProperty(key = "resultfieldname")
+ private String resultFieldName;
/** @return Returns the resultName. */
public String getResultFieldName() {
- return resultfieldname;
+ return resultFieldName;
}
/** @param resultfieldname The resultfieldname to set. */
public void setResultFieldName(String resultfieldname) {
- this.resultfieldname = resultfieldname;
- }
-
- @Override
- public void loadXml(Node transformNode, IHopMetadataProvider metadataProvider)
- throws HopXmlException {
- readData(transformNode);
+ this.resultFieldName = resultfieldname;
}
@Override
@@ -80,7 +73,7 @@ public class DetectLastRowMeta extends BaseTransformMeta
@Override
public void setDefault() {
- resultfieldname = "result";
+ resultFieldName = "result";
}
@Override
@@ -93,30 +86,14 @@ public class DetectLastRowMeta extends BaseTransformMeta
IHopMetadataProvider metadataProvider)
throws HopTransformException {
- if (!Utils.isEmpty(resultfieldname)) {
- IValueMeta v = new ValueMetaBoolean(variables.resolve(resultfieldname));
+ if (!Utils.isEmpty(resultFieldName)) {
+ IValueMeta v = new ValueMetaBoolean(variables.resolve(resultFieldName));
v.setOrigin(name);
row.addValueMeta(v);
}
}
@Override
- public String getXml() {
- StringBuilder retval = new StringBuilder();
- retval.append(" " + XmlHandler.addTagValue("resultfieldname", resultfieldname));
- return retval.toString();
- }
-
- private void readData(Node transformNode) throws HopXmlException {
- try {
- resultfieldname = XmlHandler.getTagValue(transformNode, "resultfieldname");
- } catch (Exception e) {
- throw new HopXmlException(
- BaseMessages.getString(PKG, "DetectLastRowMeta.Exception.UnableToReadTransformMeta"), e);
- }
- }
-
- @Override
public void check(
List<ICheckResult> remarks,
PipelineMeta pipelineMeta,
@@ -130,14 +107,14 @@ public class DetectLastRowMeta extends BaseTransformMeta
CheckResult cr;
String errorMessage = "";
- if (Utils.isEmpty(resultfieldname)) {
+ if (Utils.isEmpty(resultFieldName)) {
errorMessage =
BaseMessages.getString(PKG, "DetectLastRowMeta.CheckResult.ResultFieldMissing");
- cr = new CheckResult(CheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta);
+ cr = new CheckResult(ICheckResult.TYPE_RESULT_ERROR, errorMessage, transformMeta);
remarks.add(cr);
} else {
errorMessage = BaseMessages.getString(PKG, "DetectLastRowMeta.CheckResult.ResultFieldOK");
- cr = new CheckResult(CheckResult.TYPE_RESULT_OK, errorMessage, transformMeta);
+ cr = new CheckResult(ICheckResult.TYPE_RESULT_OK, errorMessage, transformMeta);
remarks.add(cr);
}
@@ -145,7 +122,7 @@ public class DetectLastRowMeta extends BaseTransformMeta
if (input.length > 0) {
cr =
new CheckResult(
- CheckResult.TYPE_RESULT_OK,
+ ICheckResult.TYPE_RESULT_OK,
BaseMessages.getString(
PKG, "DetectLastRowMeta.CheckResult.ReceivingInfoFromOtherTransforms"),
transformMeta);
@@ -153,7 +130,7 @@ public class DetectLastRowMeta extends BaseTransformMeta
} else {
cr =
new CheckResult(
- CheckResult.TYPE_RESULT_ERROR,
+ ICheckResult.TYPE_RESULT_ERROR,
BaseMessages.getString(PKG, "DetectLastRowMeta.CheckResult.NoInpuReceived"),
transformMeta);
remarks.add(cr);
diff --git a/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_en_US.properties b/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_en_US.properties
index aa8778f..39865de 100644
--- a/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_en_US.properties
+++ b/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_en_US.properties
@@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-BaseTransform.TypeLongDesc.DetectLastRow=Identify last row in a stream
-BaseTransform.TypeTooltipDesc.DetectLastRow=Last row will be marked
+DetectLastRow.Name=Identify last row in a stream
+DetectLastRow.Description=Last row will be marked
DetectLastRow.Error.ResultFieldMissing=Result fieldname is missing\!
DetectLastRowMeta.CheckResult.ResultFieldOK=Result fieldname is provided
DetectLastRowDialog.ResultField.Tooltip=Specify here the name of the result fieldname (Boolean)\nadded in the input stream
@@ -30,7 +30,6 @@ DetectLastRowMeta.CheckResult.ReceivingInfoFromOtherTransforms=Transform is rece
DetectLastRowDialog.ResultField.Label=Result fieldname
DetectLastRowMeta.CheckResult.ResultFieldMissing=Result fieldname is missing\!
DetectLastRowMeta.CheckResult.ErrorOccurred=An error occurred\:
-DetectLastRowMeta.Exception.UnableToReadTransformMeta=Unable to read transform information from XML
DetectLastRow.Log.StartingToRun=Starting to run...
DetectLastRow.Log.UnexpectedError=Unexpected error
DetectLastRow.Log.WroteRowToNextTransform=Wrote row to next transform:
\ No newline at end of file
diff --git a/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_fr_FR.properties b/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_fr_FR.properties
index 3e2e0a8..970b0eb 100644
--- a/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_fr_FR.properties
+++ b/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_fr_FR.properties
@@ -17,16 +17,14 @@
#
#
#
-BaseTransform.TypeLongDesc.DetectLastRow=Identification derni\u00E8re ligne
-BaseTransform.TypeTooltipDesc.DetectLastRow=Cette transformation permet d''identifier la derni\u00E8re ligne\ndans un flux.Un champ (bool\u00E9en) sera ajout\u00E9 au flux entrant.\nSeule la derni\u00E8re ligne aura la valeur 'Vrai''.
+DetectLastRow.Name=Identification derni\u00E8re ligne
+DetectLastRow.Description=Cette transformation permet d''identifier la derni\u00E8re ligne dans un flux.\nUn champ (bool\u00E9en) sera ajout\u00E9 au flux entrant.\nSeule la derni\u00E8re ligne aura la valeur 'Vrai''.
DetectLastRow.Error.ResultFieldMissing=Le champ contenant le r\u00E9sultat n''a pas \u00E9t\u00E9 sp\u00E9cifi\u00E9\!
DetectLastRow.Log.UnexpectedError=Erreur inattendue
DetectLastRow.Log.LineNumber=N\u00B0ligne
DetectLastRowMeta.CheckResult.ResultFieldMissing=Le champ contenant le r\u00E9sultat n''a pas \u00E9t\u00E9 renseign\u00E9\!
DetectLastRowDialog.Log.GettingKeyInfo=r\u00E9cup\u00E9ration infos cl\u00E9s...
DetectLastRowMeta.CheckResult.ErrorOccurred=Apache Hop a rencontr\u00E9 une erreur\:
-DetectLastRowMeta.Exception.UnableToSaveTransformMeta=Impossible de sauvegarder dans le r\u00E9f\u00E9rentiel, les informations de la transformation identifi\u00E9epar l''id\={0}
-DetectLastRowMeta.Exception.UnexpectedErrorReadingTransformMeta=Apache Hop a rencontr\u00E9 une erreur lors de la lecture des informations depuis le r\u00E9f\u00E9rentiel
DetectLastRow.ErrorInTransformRunning=Apache Hop va arr\u00EAter l''ex\u00E9cution de cette transformation suite \u00E0 une erreur\:
DetectLastRowMeta.CheckResult.ReceivingInfoFromOtherTransforms=La transformation re\u00E7oit des informations des autres transformations.
DetectLastRow.Log.WroteRowToNextTransform=\u00C9crire ligne vers la transformation suivante\:
@@ -35,6 +33,5 @@ DetectLastRow.LineNumber=N\u00B0ligne
DetectLastRowMeta.CheckResult.ResultFieldOK=Le champ contenant le r\u00E9sultat a \u00E9t\u00E9 sp\u00E9cifi\u00E9
DetectLastRowDialog.Shell.Title=Identification derni\u00E8re ligne
DetectLastRowDialog.ResultField.Label=Nom champ r\u00E9sultat
-DetectLastRowMeta.Exception.UnableToReadTransformMeta=Impossible de lire les informations de la transformation depuis le fichier XML
DetectLastRowMeta.CheckResult.NoInpuReceived=Aucun flux d''entr\u00E9e en provenance des autres transformations\!
DetectLastRowDialog.TransformName.Label=Nom de la transformation
diff --git a/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_ja_JP.properties b/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_ja_JP.properties
index 86b8378..e14dcf4 100644
--- a/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_ja_JP.properties
+++ b/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_ja_JP.properties
@@ -17,8 +17,8 @@
#
#
#
-BaseTransform.TypeLongDesc.DetectLastRow=\u6700\u7D42\u884C\u30DE\u30FC\u30AF
-BaseTransform.TypeTooltipDesc.DetectLastRow=Identify last row in a stream\n\u6700\u5F8C\u306E\u884C\u304C\u30DE\u30FC\u30AF\u3055\u308C\u307E\u3059\u3002
+DetectLastRow.Name=\u6700\u7D42\u884C\u30DE\u30FC\u30AF
+DetectLastRow.Description=Identify last row in a stream\n\u6700\u5F8C\u306E\u884C\u304C\u30DE\u30FC\u30AF\u3055\u308C\u307E\u3059\u3002
DetectLastRow.Error.ResultFieldMissing=Result fieldname is missing\!
DetectLastRowMeta.CheckResult.ResultFieldOK=Result fieldname is provided
DetectLastRowDialog.ResultField.Tooltip=\u5165\u529B\u30B9\u30C8\u30EA\u30FC\u30E0\u3067\u8FFD\u52A0\u3055\u308C\u305F\u30D5\u30A3\u30FC\u30EB\u30C9\u540D(Boolean)\u306E\u540D\u524D\u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u306F\u30C1\u30A7\u30C3\u30AF\u30DC\u30C3\u30AF\u30B9\u3092\u6709\u52B9\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
diff --git a/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_zh_CN.properties b/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_zh_CN.properties
index 7fe4b4f..e3f3505 100644
--- a/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_zh_CN.properties
+++ b/plugins/transforms/detectlastrow/src/main/resources/org/apache/hop/pipeline/transforms/detectlastrow/messages/messages_zh_CN.properties
@@ -17,7 +17,7 @@
#
#
#
-BaseTransform.TypeLongDesc.DetectLastRow=\u8BC6\u522B\u6D41\u7684\u6700\u540E\u4E00\u884C
+DetectLastRow.Name=\u8BC6\u522B\u6D41\u7684\u6700\u540E\u4E00\u884C
DetectLastRow.Error.ResultFieldMissing=Result fieldname is missing\!
DetectLastRowMeta.CheckResult.ResultFieldOK=Result fieldname is provided
DetectLastRowDialog.ResultField.Tooltip=Specify here the name of the result fieldname (Boolean)\nadded in the input stream
@@ -32,7 +32,6 @@ DetectLastRowMeta.CheckResult.ReceivingInfoFromOtherTransforms=Transform is rece
DetectLastRowDialog.ResultField.Label=\u7ED3\u679C\u5B57\u6BB5\u540D
DetectLastRowMeta.CheckResult.ResultFieldMissing=Result fieldname is missing\!
DetectLastRowMeta.CheckResult.ErrorOccurred=An error occurred\:
-DetectLastRowMeta.Exception.UnableToReadTransformMeta=Unable to read transform information from XML
DetectLastRow.Log.StartingToRun=Starting to run...
DetectLastRow.Log.UnexpectedError=Unexpected error
DetectLastRow.Log.WroteRowToNextTransform=Wrote row to next transform:
\ No newline at end of file