Skip to content

Commit

Permalink
additional metadata action, transform and property types. apache#3981
Browse files Browse the repository at this point in the history
  • Loading branch information
bamaer authored and hansva committed Nov 11, 2024
1 parent 7ab63da commit 0566910
Show file tree
Hide file tree
Showing 30 changed files with 210 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum HopMetadataPropertyType {
NONE,

// MISC
HOP_FILE,
EXEC_INFO_LOCATION,
EXEC_INFO_DATA_PROFILE,
PARTITION_SCHEMA,
Expand All @@ -30,6 +31,7 @@ public enum HopMetadataPropertyType {
SPLUNK_CONNECTION,

// PIPELINE
PIPELINE_FILE,
PIPELINE_RUN_CONFIG,
PIPELINE_LOG,
PIPELINE_PROBE,
Expand All @@ -40,6 +42,7 @@ public enum HopMetadataPropertyType {
BEAM_FILE_DEFINITION,

// WORKFLOW
WORKFLOW_FILE,
WORKFLOW_RUN_CONFIG,
WORKFLOW_LOG,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ public enum ActionTransformType {
FILE,
RDBMS,
GRAPH,
NOSQL
NOSQL,

HOP_FILE,
HOP_PIPELINE,
HOP_WORKFLOW
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.hop.core.RowMetaAndData;
import org.apache.hop.core.SqlStatement;
import org.apache.hop.core.annotations.Action;
import org.apache.hop.core.annotations.ActionTransformType;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.file.IHasFilename;
import org.apache.hop.core.logging.LogChannelFileWriter;
Expand Down Expand Up @@ -70,7 +71,8 @@
description = "i18n::ActionPipeline.Description",
categoryDescription = "i18n:org.apache.hop.workflow:ActionCategory.Category.General",
keywords = "i18n::ActionPipeline.keyword",
documentationUrl = "/workflow/actions/pipeline.html")
documentationUrl = "/workflow/actions/pipeline.html",
actionTransformTypes = {ActionTransformType.HOP_FILE, ActionTransformType.HOP_PIPELINE})
public class ActionPipeline extends ActionBase implements Cloneable, IAction {
private static final Class<?> PKG = ActionPipeline.class;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.hop.core.Const;
import org.apache.hop.core.Result;
import org.apache.hop.core.annotations.Action;
import org.apache.hop.core.annotations.ActionTransformType;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.file.IHasFilename;
import org.apache.hop.core.logging.ILoggingObject;
Expand All @@ -42,6 +43,7 @@
import org.apache.hop.core.vfs.HopVfs;
import org.apache.hop.core.xml.XmlHandler;
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.HopMetadataPropertyType;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.engine.IPipelineEngine;
Expand All @@ -63,14 +65,19 @@
categoryDescription = "i18n:org.apache.hop.workflow:ActionCategory.Category.General",
keywords = "i18n::Repeat.keywords",
image = "repeat.svg",
documentationUrl = "/workflow/actions/repeat.html")
documentationUrl = "/workflow/actions/repeat.html",
actionTransformTypes = {
ActionTransformType.HOP_FILE,
ActionTransformType.HOP_PIPELINE,
ActionTransformType.HOP_WORKFLOW
})
@Getter
@Setter
public class Repeat extends ActionBase implements IAction, Cloneable {

public static final String REPEAT_END_LOOP = "_REPEAT_END_LOOP_";

@HopMetadataProperty(key = "filename")
@HopMetadataProperty(key = "filename", hopMetadataPropertyType = HopMetadataPropertyType.HOP_FILE)
private String filename;

@HopMetadataProperty(key = "parameter", groupKey = "parameters")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.hop.core.RowMetaAndData;
import org.apache.hop.core.SqlStatement;
import org.apache.hop.core.annotations.Action;
import org.apache.hop.core.annotations.ActionTransformType;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.file.IHasFilename;
import org.apache.hop.core.logging.LogChannelFileWriter;
Expand All @@ -44,6 +45,7 @@
import org.apache.hop.core.vfs.HopVfs;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.HopMetadataPropertyType;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.resource.IResourceNaming;
import org.apache.hop.resource.ResourceDefinition;
Expand All @@ -70,7 +72,8 @@
description = "i18n::ActionWorkflow.Description",
categoryDescription = "i18n:org.apache.hop.workflow:ActionCategory.Category.General",
keywords = "i18n::ActionWorkflow.keyword",
documentationUrl = "/workflow/actions/workflow.html")
documentationUrl = "/workflow/actions/workflow.html",
actionTransformTypes = {ActionTransformType.HOP_FILE, ActionTransformType.HOP_WORKFLOW})
public class ActionWorkflow extends ActionBase implements Cloneable, IAction {
private static final Class<?> PKG = ActionWorkflow.class;

Expand Down Expand Up @@ -134,7 +137,9 @@ public void setField(String field) {
}
}

@HopMetadataProperty(key = "filename")
@HopMetadataProperty(
key = "filename",
hopMetadataPropertyType = HopMetadataPropertyType.WORKFLOW_FILE)
private String filename;

@HopMetadataProperty(key = "params_from_previous")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.List;
import org.apache.hop.core.CheckResult;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.annotations.ActionTransformType;
import org.apache.hop.core.annotations.Transform;
import org.apache.hop.core.exception.HopTransformException;
import org.apache.hop.core.row.IRowMeta;
Expand All @@ -29,6 +30,7 @@
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.HopMetadataPropertyType;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.transform.BaseTransformMeta;
Expand All @@ -41,37 +43,43 @@
description = "i18n::ColumnExists.Description",
categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Lookup",
keywords = "i18n::ColumnExistsMeta.keyword",
documentationUrl = "/pipeline/transforms/columnexists.html")
documentationUrl = "/pipeline/transforms/columnexists.html",
actionTransformTypes = {ActionTransformType.RDBMS})
public class ColumnExistsMeta extends BaseTransformMeta<ColumnExists, ColumnExistsData> {

private static final Class<?> PKG = ColumnExistsMeta.class;

/** database connection */
@HopMetadataProperty(
key = "connection",
injectionKeyDescription = "ColumnExists.Injection.ConnectionName")
injectionKeyDescription = "ColumnExists.Injection.ConnectionName",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_CONNECTION)
private String databaseName;

@HopMetadataProperty(
key = "schemaname",
injectionKeyDescription = "ColumnExists.Injection.SchemaName")
injectionKeyDescription = "ColumnExists.Injection.SchemaName",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_SCHEMA)
private String schemaname;

@HopMetadataProperty(
key = "tablename",
injectionKeyDescription = "ColumnExists.Injection.TableName")
injectionKeyDescription = "ColumnExists.Injection.TableName",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_TABLE)
private String tableName;

/** dynamic tablename */
@HopMetadataProperty(
key = "tablenamefield",
injectionKeyDescription = "ColumnExists.Injection.TableNameField")
injectionKeyDescription = "ColumnExists.Injection.TableNameField",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_TABLE)
private String tablenamefield;

/** dynamic columnname */
@HopMetadataProperty(
key = "columnnamefield",
injectionKeyDescription = "ColumnExists.Injection.ColumnNameField")
injectionKeyDescription = "ColumnExists.Injection.ColumnNameField",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_COLUMN)
private String columnnamefield;

/** function result: new value name */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.hop.core.Const;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.SqlStatement;
import org.apache.hop.core.annotations.ActionTransformType;
import org.apache.hop.core.annotations.Transform;
import org.apache.hop.core.database.Database;
import org.apache.hop.core.database.DatabaseMeta;
Expand All @@ -39,6 +40,7 @@
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.HopMetadataPropertyType;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.pipeline.DatabaseImpact;
import org.apache.hop.pipeline.PipelineMeta;
Expand All @@ -53,7 +55,8 @@
categoryDescription =
"i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.DataWarehouse",
keywords = "i18n::CombinationLookupMeta.keyword",
documentationUrl = "/pipeline/transforms/combinationlookup.html")
documentationUrl = "/pipeline/transforms/combinationlookup.html",
actionTransformTypes = {ActionTransformType.RDBMS, ActionTransformType.LOOKUP})
@Getter
@Setter
public class CombinationLookupMeta
Expand All @@ -68,22 +71,25 @@ public class CombinationLookupMeta
@HopMetadataProperty(
key = "schema",
injectionKey = "SCHEMA_NAME",
injectionKeyDescription = "CombinationLookup.Injection.SCHEMA_NAME")
injectionKeyDescription = "CombinationLookup.Injection.SCHEMA_NAME",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_SCHEMA)
private String schemaName;

/** what's the lookup table? */
@HopMetadataProperty(
key = "table",
injectionKey = "TABLE_NAME",
injectionKeyDescription = "CombinationLookup.Injection.TABLE_NAME")
injectionKeyDescription = "CombinationLookup.Injection.TABLE_NAME",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_TABLE)
private String tableName;

/** database connection */
@HopMetadataProperty(
key = "connection",
storeWithName = true,
injectionKey = "CONNECTIONNAME",
injectionKeyDescription = "CombinationLookup.Injection.CONNECTION_NAME")
injectionKeyDescription = "CombinationLookup.Injection.CONNECTION_NAME",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_CONNECTION)
private DatabaseMeta databaseMeta;

/** replace fields with technical key? */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
package org.apache.hop.pipeline.transforms.combinationlookup;

import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.HopMetadataPropertyType;

public class KeyField {
@HopMetadataProperty(
injectionKey = "KEY_FIELD",
injectionKeyDescription = "CombinationLookup.Injection.KEY_FIELD")
injectionKeyDescription = "CombinationLookup.Injection.KEY_FIELD",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_COLUMN)
String name;

@HopMetadataProperty(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.hop.core.CheckResult;
import org.apache.hop.core.Const;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.annotations.ActionTransformType;
import org.apache.hop.core.annotations.Transform;
import org.apache.hop.core.database.Database;
import org.apache.hop.core.database.DatabaseMeta;
Expand All @@ -36,6 +37,7 @@
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.HopMetadataPropertyType;
import org.apache.hop.metadata.api.IHopMetadataProvider;
import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.transform.BaseTransformMeta;
Expand All @@ -48,12 +50,15 @@
description = "i18n::CallDBProcedure.Description",
categoryDescription = "i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.Lookup",
keywords = "i18n::DBProcMeta.keyword",
documentationUrl = "/pipeline/transforms/calldbproc.html")
documentationUrl = "/pipeline/transforms/calldbproc.html",
actionTransformTypes = ActionTransformType.RDBMS)
public class DBProcMeta extends BaseTransformMeta<DBProc, DBProcData> {
private static final Class<?> PKG = DBProcMeta.class;

/** database connection */
@HopMetadataProperty(key = "connection")
@HopMetadataProperty(
key = "connection",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_CONNECTION)
private String connection;

/** procedure name to be called */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.hop.core.Const;
import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.SqlStatement;
import org.apache.hop.core.annotations.ActionTransformType;
import org.apache.hop.core.annotations.Transform;
import org.apache.hop.core.database.Database;
import org.apache.hop.core.database.DatabaseMeta;
Expand All @@ -42,6 +43,7 @@
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.metadata.api.HopMetadataProperty;
import org.apache.hop.metadata.api.HopMetadataPropertyType;
import org.apache.hop.metadata.api.IEnumHasCode;
import org.apache.hop.metadata.api.IEnumHasCodeAndDescription;
import org.apache.hop.metadata.api.IHopMetadataProvider;
Expand All @@ -58,7 +60,8 @@
categoryDescription =
"i18n:org.apache.hop.pipeline.transform:BaseTransform.Category.DataWarehouse",
keywords = "i18n::DimensionLookupMeta.keyword",
documentationUrl = "/pipeline/transforms/dimensionlookup.html")
documentationUrl = "/pipeline/transforms/dimensionlookup.html",
actionTransformTypes = {ActionTransformType.RDBMS, ActionTransformType.LOOKUP})
public class DimensionLookupMeta extends BaseTransformMeta<DimensionLookup, DimensionLookupData> {
private static final Class<?> PKG = DimensionLookupMeta.class;
public static final String CONST_DIMENSION_LOOKUP_META_CHECK_RESULT_KEY_HAS_PROBLEM =
Expand All @@ -69,21 +72,24 @@ public class DimensionLookupMeta extends BaseTransformMeta<DimensionLookup, Dime
@HopMetadataProperty(
key = "schema",
injectionKey = "TARGET_SCHEMA",
injectionKeyDescription = "DimensionLookup.Injection.TARGET_SCHEMA")
injectionKeyDescription = "DimensionLookup.Injection.TARGET_SCHEMA",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_SCHEMA)
private String schemaName;

/** The lookup table */
@HopMetadataProperty(
key = "table",
injectionKey = "TARGET_TABLE",
injectionKeyDescription = "DimensionLookup.Injection.TARGET_TABLE")
injectionKeyDescription = "DimensionLookup.Injection.TARGET_TABLE",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_TABLE)
private String tableName;

/** The database connection */
@HopMetadataProperty(
key = "connection",
injectionKey = "CONNECTION_NAME",
injectionKeyDescription = "DimensionLookup.Injection.CONNECTION_NAME")
injectionKeyDescription = "DimensionLookup.Injection.CONNECTION_NAME",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_CONNECTION)
private String connection;

/** Update the dimension or just lookup? */
Expand Down Expand Up @@ -1405,7 +1411,8 @@ public static class DLReturn {
@HopMetadataProperty(
key = "name",
injectionKey = "TECHNICAL_KEY_FIELD",
injectionKeyDescription = "DimensionLookup.Injection.TECHNICAL_KEY_FIELD")
injectionKeyDescription = "DimensionLookup.Injection.TECHNICAL_KEY_FIELD",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_COLUMN)
private String keyField;

@HopMetadataProperty(
Expand Down Expand Up @@ -1521,7 +1528,8 @@ public static class DLField {
@HopMetadataProperty(
key = "lookup",
injectionKey = "DATABASE_FIELDNAME",
injectionKeyDescription = "DimensionLookup.Injection.DATABASE_FIELDNAME")
injectionKeyDescription = "DimensionLookup.Injection.DATABASE_FIELDNAME",
hopMetadataPropertyType = HopMetadataPropertyType.RDBMS_COLUMN)
private String lookup;

/** The type of update to perform on the fields: insert, update, punch-through */
Expand Down
Loading

0 comments on commit 0566910

Please sign in to comment.