diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 93ac12b..1434645 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -1,68 +1,61 @@ import data.source.PersonSource; -import data.target.PersonTarget; -import etl.Extractor; -import etl.Loader; -import etl.Transformer; +import data.target.CharacterTarget; +import etl.*; import utils.*; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.time.Period; -import java.util.ArrayList; -import java.util.List; +import java.util.*; public class Main { - public static void main(final String[] args) throws SQLException + public static void main(final String[] args) { -// mysqlDb(); -// postgresqlDb(); -// mariaDb(); - var p = testExtract(); var pt = testTransform(p); testLoad(pt); } - private static List testExtract() throws SQLException + private static List testExtract() { - final var dbInfo = new DatabaseInformation("localhost", "sourcedb1", "test", "test", 5435); + final var dbInfo = new DatabaseInformation("localhost", "sourcedb1", "test", "test", 25003); final var connection = new ConnectionHelper(DatabaseType.MARIADB, dbInfo).createConnection(); DataStorer personSourceDataStorer = (rs) -> { var persons = new ArrayList(); while (rs.next()) { - persons.add(new PersonSource(rs.getInt("personId"), + persons.add(new PersonSource( + rs.getInt("personId"), rs.getString("name"), - rs.getBoolean("mortal"))); + rs.getBoolean("mortal")) + ); } return persons; }; + StatementPreparerExtractor statementPreparer = (preparedStatement) -> { + }; + var sql = "select * from person;"; - return new Extractor<>(connection, personSourceDataStorer, sql).doExtract(); + return new Extractor<>(connection, personSourceDataStorer, statementPreparer, sql).doExtract(); } - private static List testTransform(List persons) + private static List testTransform(List persons) { - DataTransformer personTransformer = (personSource) -> { - return new PersonTarget(personSource.getPersonId(), - personSource.getName(), - personSource.isMortal()); - }; + DataTransformer personTransformer = + (personSource) -> new CharacterTarget(personSource.getPersonId(), + personSource.getName(), + personSource.isMortal()); return new Transformer<>(personTransformer, persons).doTransform(); } - private static void testLoad(List transformedData) + private static void testLoad(List transformedData) { - final var dbInfo = new DatabaseInformation("localhost", "targetdb", "test", "test", 5432); + final var dbInfo = new DatabaseInformation("localhost", "targetdb", "test", "test", 25001); final var connection = new ConnectionHelper(DatabaseType.POSTGRESQL, dbInfo).createConnection(); - StatementPreparer statementPreparer = (preparedStatement, data) -> { + StatementPreparerLoader statementPreparerLoader = (preparedStatement, data) -> { preparedStatement.setInt(1, data.getPersonId()); preparedStatement.setString(2, data.getName()); preparedStatement.setBoolean(3, data.isMortal()); @@ -70,6 +63,6 @@ public class Main var sql = "insert into person values (?, ?, ?)"; - new Loader<>(connection, statementPreparer, transformedData, sql).doLoad(); + new Loader<>(connection, statementPreparerLoader, transformedData, sql).doLoad(); } } diff --git a/src/main/java/data/Dataset.java b/src/main/java/data/Dataset.java deleted file mode 100644 index 1cf08a1..0000000 --- a/src/main/java/data/Dataset.java +++ /dev/null @@ -1,5 +0,0 @@ -package data; - -public interface Dataset -{ -} diff --git a/src/main/java/data/SourceDataset.java b/src/main/java/data/SourceDataset.java new file mode 100644 index 0000000..0aae7b8 --- /dev/null +++ b/src/main/java/data/SourceDataset.java @@ -0,0 +1,5 @@ +package data; + +public interface SourceDataset +{ +} diff --git a/src/main/java/data/TargetDataset.java b/src/main/java/data/TargetDataset.java new file mode 100644 index 0000000..2690387 --- /dev/null +++ b/src/main/java/data/TargetDataset.java @@ -0,0 +1,5 @@ +package data; + +public interface TargetDataset +{ +} diff --git a/src/main/java/data/source/AbilitiesSource.java b/src/main/java/data/source/AbilitiesSource.java new file mode 100644 index 0000000..65f07be --- /dev/null +++ b/src/main/java/data/source/AbilitiesSource.java @@ -0,0 +1,38 @@ +package data.source; + +import data.SourceDataset; + +public class AbilitiesSource implements SourceDataset +{ + private String name; + private String description; + private int level; + + public AbilitiesSource(String name, String description, int level) + { + this.name = name; + this.description = description; + this.level = level; + } + + public String getName() + { + return name; + } + + public String getDescription() + { + return description; + } + + public int getLevel() + { + return level; + } + + @Override + public String toString() + { + return String.format("Ability { %s, %s, %d }", this.name, this.description, this.level); + } +} diff --git a/src/main/java/data/source/ActiveQuestsSource.java b/src/main/java/data/source/ActiveQuestsSource.java new file mode 100644 index 0000000..da4224c --- /dev/null +++ b/src/main/java/data/source/ActiveQuestsSource.java @@ -0,0 +1,31 @@ +package data.source; + +import data.SourceDataset; + +public class ActiveQuestsSource implements SourceDataset +{ + private int questId; + private int progress; + + public ActiveQuestsSource(int questId, int progress) + { + this.questId = questId; + this.progress = progress; + } + + public int getQuestId() + { + return questId; + } + + public int getProgress() + { + return progress; + } + + @Override + public String toString() + { + return String.format("ActiveQuest { %d, %d }", this.questId, this.progress); + } +} diff --git a/src/main/java/data/source/GameobjectSource.java b/src/main/java/data/source/GameobjectSource.java new file mode 100644 index 0000000..a8668da --- /dev/null +++ b/src/main/java/data/source/GameobjectSource.java @@ -0,0 +1,38 @@ +package data.source; + +import data.SourceDataset; + +public class GameobjectSource implements SourceDataset +{ + private int objectId; + private String name; + private String description; + + public GameobjectSource(int objectId, String name, String description) + { + this.objectId = objectId; + this.name = name; + this.description = description; + } + + public int getObjectId() + { + return objectId; + } + + public String getName() + { + return name; + } + + public String getDescription() + { + return description; + } + + @Override + public String toString() + { + return String.format("Gameobject { %d, %s, %s }", this.objectId, this.name, this.description); + } +} diff --git a/src/main/java/data/source/InventorySource.java b/src/main/java/data/source/InventorySource.java new file mode 100644 index 0000000..9376da0 --- /dev/null +++ b/src/main/java/data/source/InventorySource.java @@ -0,0 +1,24 @@ +package data.source; + +import data.SourceDataset; + +public class InventorySource implements SourceDataset +{ + private int objectId; + + public InventorySource(int objectId) + { + this.objectId = objectId; + } + + public int getObjectId() + { + return objectId; + } + + @Override + public String toString() + { + return String.format("Inventory { %d }", this.objectId); + } +} diff --git a/src/main/java/data/source/ModSource.java b/src/main/java/data/source/ModSource.java new file mode 100644 index 0000000..c65cef5 --- /dev/null +++ b/src/main/java/data/source/ModSource.java @@ -0,0 +1,48 @@ +package data.source; + +import data.SourceDataset; + +import java.sql.Blob; +import java.time.LocalDate; + +public class ModSource implements SourceDataset +{ + private int modId; + private String name; + private LocalDate installationDate; + private Blob binary; + + public ModSource(int modId, String name, LocalDate installationDate, Blob binary) + { + this.modId = modId; + this.name = name; + this.installationDate = installationDate; + this.binary = binary; + } + + public int getModId() + { + return modId; + } + + public String getName() + { + return name; + } + + public LocalDate getInstallationDate() + { + return installationDate; + } + + public Blob getBinary() + { + return binary; + } + + @Override + public String toString() + { + return String.format("Mod { %d, %s, Binary: %s }", this.modId, this.name, this.binary); + } +} diff --git a/src/main/java/data/source/PersonInventorySource.java b/src/main/java/data/source/PersonInventorySource.java new file mode 100644 index 0000000..7c87468 --- /dev/null +++ b/src/main/java/data/source/PersonInventorySource.java @@ -0,0 +1,31 @@ +package data.source; + +import data.SourceDataset; + +public class PersonInventorySource implements SourceDataset +{ + private int personId; + private int objectId; + + public PersonInventorySource(int personId, int objectId) + { + this.personId = personId; + this.objectId = objectId; + } + + public int getPersonId() + { + return personId; + } + + public int getObjectId() + { + return objectId; + } + + @Override + public String toString() + { + return String.format("PersonInventory { %d, %d }", this.personId, this.objectId); + } +} diff --git a/src/main/java/data/source/PersonSource.java b/src/main/java/data/source/PersonSource.java index 4dafade..3df6ead 100644 --- a/src/main/java/data/source/PersonSource.java +++ b/src/main/java/data/source/PersonSource.java @@ -1,8 +1,8 @@ package data.source; -import data.Dataset; +import data.SourceDataset; -public class PersonSource implements Dataset +public class PersonSource implements SourceDataset { private int personId; private String name; diff --git a/src/main/java/data/source/QuestParticipationSource.java b/src/main/java/data/source/QuestParticipationSource.java new file mode 100644 index 0000000..f00827d --- /dev/null +++ b/src/main/java/data/source/QuestParticipationSource.java @@ -0,0 +1,31 @@ +package data.source; + +import data.SourceDataset; + +public class QuestParticipationSource implements SourceDataset +{ + private int questId; + private int personId; + + public QuestParticipationSource(int questId, int personId) + { + this.questId = questId; + this.personId = personId; + } + + public int getPersonId() + { + return personId; + } + + public int getQuestId() + { + return questId; + } + + @Override + public String toString() + { + return String.format("QuestParticipation { %d, %d }", this.questId, this.personId); + } +} diff --git a/src/main/java/data/source/QuestSource.java b/src/main/java/data/source/QuestSource.java new file mode 100644 index 0000000..2f4daad --- /dev/null +++ b/src/main/java/data/source/QuestSource.java @@ -0,0 +1,38 @@ +package data.source; + +import data.SourceDataset; + +public class QuestSource implements SourceDataset +{ + private int questId; + private String name; + private String dialogue; + + public QuestSource(int questId, String name, String dialogue) + { + this.questId = questId; + this.name = name; + this.dialogue = dialogue; + } + + public int getQuestId() + { + return questId; + } + + public String getName() + { + return name; + } + + public String getDialogue() + { + return dialogue; + } + + @Override + public String toString() + { + return String.format("Quest { %d, %s, %s... }", this.questId, this.name, this.dialogue.substring(0, 10)); + } +} diff --git a/src/main/java/data/source/RelationshipsSource.java b/src/main/java/data/source/RelationshipsSource.java new file mode 100644 index 0000000..f2a6e9d --- /dev/null +++ b/src/main/java/data/source/RelationshipsSource.java @@ -0,0 +1,31 @@ +package data.source; + +import data.SourceDataset; + +public class RelationshipsSource implements SourceDataset +{ + private int personId; + private int relationshipLevel; + + public RelationshipsSource(int personId, int relationshipLevel) + { + this.personId = personId; + this.relationshipLevel = relationshipLevel; + } + + public int getPersonId() + { + return personId; + } + + public int getRelationshipLevel() + { + return relationshipLevel; + } + + @Override + public String toString() + { + return String.format("Relationship { %d, %d }", this.personId, this.relationshipLevel); + } +} diff --git a/src/main/java/data/target/AbilityTarget.java b/src/main/java/data/target/AbilityTarget.java new file mode 100644 index 0000000..d20f312 --- /dev/null +++ b/src/main/java/data/target/AbilityTarget.java @@ -0,0 +1,46 @@ +package data.target; + +import data.TargetDataset; + +public class AbilityTarget implements TargetDataset +{ + private int abilityId; + private String abilityName; + private String abilityDescription; + private int abilityLevel; + + public AbilityTarget(int abilityId, String abilityName, String abilityDescription, int abilityLevel) + { + this.abilityId = abilityId; + this.abilityName = abilityName; + this.abilityDescription = abilityDescription; + this.abilityLevel = abilityLevel; + } + + public int getAbilityId() + { + return abilityId; + } + + public String getAbilityName() + { + return abilityName; + } + + public String getAbilityDescription() + { + return abilityDescription; + } + + public int getAbilityLevel() + { + return abilityLevel; + } + + @Override + public String toString() + { + return String.format("Ability [ %d, %s, %s, %d ]", this.abilityId, this.abilityName, this.abilityDescription, this.abilityLevel); + } + +} diff --git a/src/main/java/data/target/ActiveQuestsTarget.java b/src/main/java/data/target/ActiveQuestsTarget.java new file mode 100644 index 0000000..37048a3 --- /dev/null +++ b/src/main/java/data/target/ActiveQuestsTarget.java @@ -0,0 +1,33 @@ +package data.target; + +import data.TargetDataset; + +public class ActiveQuestsTarget implements TargetDataset +{ + private int playerId; + private int questId; + private int questProgress; + + public ActiveQuestsTarget(int playerId, int questId, int questProgress) + { + this.playerId = playerId; + this.questId = questId; + this.questProgress = questProgress; + } + + public int getQuestId() + { + return questId; + } + + public int getQuestProgress() + { + return questProgress; + } + + @Override + public String toString() + { + return String.format("ActiveQuest [ %d, %d, %d ]", this.playerId, this.questId, this.questProgress); + } +} diff --git a/src/main/java/data/target/CharacterInventoryTarget.java b/src/main/java/data/target/CharacterInventoryTarget.java new file mode 100644 index 0000000..57dcc34 --- /dev/null +++ b/src/main/java/data/target/CharacterInventoryTarget.java @@ -0,0 +1,31 @@ +package data.target; + +import data.TargetDataset; + +public class CharacterInventoryTarget implements TargetDataset +{ + private int personId; + private int objectId; + + public CharacterInventoryTarget(int personId, int objectId) + { + this.personId = personId; + this.objectId = objectId; + } + + public int getPersonId() + { + return personId; + } + + public int getObjectId() + { + return objectId; + } + + @Override + public String toString() + { + return String.format("CharacterInventory [ %d, %d ]", this.personId, this.objectId); + } +} diff --git a/src/main/java/data/target/PersonTarget.java b/src/main/java/data/target/CharacterTarget.java similarity index 75% rename from src/main/java/data/target/PersonTarget.java rename to src/main/java/data/target/CharacterTarget.java index 2f5754d..bc7c8fa 100644 --- a/src/main/java/data/target/PersonTarget.java +++ b/src/main/java/data/target/CharacterTarget.java @@ -1,14 +1,15 @@ package data.target; -import data.Dataset; +import data.SourceDataset; +import data.TargetDataset; -public class PersonTarget implements Dataset +public class CharacterTarget implements TargetDataset { private int personId; private String name; private boolean mortal; - public PersonTarget(int personId, String name, boolean mortal) + public CharacterTarget(int personId, String name, boolean mortal) { this.personId = personId; this.name = name; diff --git a/src/main/java/data/target/GameobjectTarget.java b/src/main/java/data/target/GameobjectTarget.java new file mode 100644 index 0000000..13813d3 --- /dev/null +++ b/src/main/java/data/target/GameobjectTarget.java @@ -0,0 +1,38 @@ +package data.target; + +import data.TargetDataset; + +public class GameobjectTarget implements TargetDataset +{ + private int objectId; + private String name; + private String description; + + public GameobjectTarget(int objectId, String name, String description) + { + this.objectId = objectId; + this.name = name; + this.description = description; + } + + public int getObjectId() + { + return objectId; + } + + public String getName() + { + return name; + } + + public String getDescription() + { + return description; + } + + @Override + public String toString() + { + return String.format("Gameobject [ %d, %s, %s ]", this.objectId, this.name, this.description); + } +} diff --git a/src/main/java/data/target/InventoryTarget.java b/src/main/java/data/target/InventoryTarget.java new file mode 100644 index 0000000..3a4fe0b --- /dev/null +++ b/src/main/java/data/target/InventoryTarget.java @@ -0,0 +1,38 @@ +package data.target; + +import data.TargetDataset; + +public class InventoryTarget implements TargetDataset +{ + private int playerId; + private int objectId; + private boolean stolen; + + public InventoryTarget(int playerId, int objectId, boolean stolen) + { + this.playerId = playerId; + this.objectId = objectId; + this.stolen = stolen; + } + + public int getPlayerId() + { + return playerId; + } + + public int getObjectId() + { + return objectId; + } + + public boolean isStolen() + { + return stolen; + } + + @Override + public String toString() + { + return String.format("Inventory [ %d, %d, %s ]", this.playerId, this.objectId, this.stolen); + } +} diff --git a/src/main/java/data/target/ModTarget.java b/src/main/java/data/target/ModTarget.java new file mode 100644 index 0000000..5446599 --- /dev/null +++ b/src/main/java/data/target/ModTarget.java @@ -0,0 +1,49 @@ +package data.target; + +import data.TargetDataset; + +import java.sql.Blob; +import java.time.LocalDate; + +public class ModTarget implements TargetDataset +{ + private int modId; + private String modName; + private LocalDate modInstallationDate; + private Blob modBinary; + + public ModTarget(int modId, String modName, LocalDate modInstallationDate, Blob modBinary) + { + this.modId = modId; + this.modName = modName; + this.modInstallationDate = modInstallationDate; + this.modBinary = modBinary; + } + + public int getModId() + { + return modId; + } + + public String getName() + { + return modName; + } + + public LocalDate getModInstallationDate() + { + return modInstallationDate; + } + + public Blob getModBinary() + { + return modBinary; + } + + @Override + public String toString() + { + return String.format("Mod { %d, %s, Binary: %s }", this.modId, this.modName, this.modBinary); + } + +} diff --git a/src/main/java/data/target/PlayerAbilitiesTarget.java b/src/main/java/data/target/PlayerAbilitiesTarget.java new file mode 100644 index 0000000..367fa15 --- /dev/null +++ b/src/main/java/data/target/PlayerAbilitiesTarget.java @@ -0,0 +1,31 @@ +package data.target; + +import data.TargetDataset; + +public class PlayerAbilitiesTarget implements TargetDataset +{ + private int playerId; + private int abilityId; + + public PlayerAbilitiesTarget(int playerId, int abilityId) + { + this.playerId = playerId; + this.abilityId = abilityId; + } + + public int getPlayerId() + { + return playerId; + } + + public int getAbilityId() + { + return abilityId; + } + + @Override + public String toString() + { + return String.format("PlayerAbility [ %d, %d ]", this.playerId, this.abilityId); + } +} diff --git a/src/main/java/data/target/PlayerTarget.java b/src/main/java/data/target/PlayerTarget.java new file mode 100644 index 0000000..ef1e4cd --- /dev/null +++ b/src/main/java/data/target/PlayerTarget.java @@ -0,0 +1,31 @@ +package data.target; + +import data.TargetDataset; + +public class PlayerTarget implements TargetDataset +{ + private int playerId; + private String playerName; + + public PlayerTarget(int playerId, String playerName) + { + this.playerId = playerId; + this.playerName = playerName; + } + + public int getPlayerId() + { + return playerId; + } + + public String getPlayerName() + { + return playerName; + } + + @Override + public String toString() + { + return String.format("Player [ %d, %s ]", this.playerId, this.playerName); + } +} diff --git a/src/main/java/data/target/QuestTarget.java b/src/main/java/data/target/QuestTarget.java new file mode 100644 index 0000000..0a1bbbd --- /dev/null +++ b/src/main/java/data/target/QuestTarget.java @@ -0,0 +1,45 @@ +package data.target; + +import data.TargetDataset; + +public class QuestTarget implements TargetDataset +{ + private int questId; + private String name; + private String involvedCharacters; + private String dialogue; + + public QuestTarget(int questId, String name, String involvedCharacters, String dialogue) + { + this.questId = questId; + this.name = name; + this.involvedCharacters = involvedCharacters; + this.dialogue = dialogue; + } + + public int getQuestId() + { + return questId; + } + + public String getName() + { + return name; + } + + public String getInvolvedCharacters() + { + return involvedCharacters; + } + + public String getDialogue() + { + return dialogue; + } + + @Override + public String toString() + { + return String.format("Quest [ %d, %s, %s, %s... ]", this.questId, this.name, this.involvedCharacters, this.dialogue.substring(0, 10)); + } +} diff --git a/src/main/java/data/target/RelationshipTarget.java b/src/main/java/data/target/RelationshipTarget.java new file mode 100644 index 0000000..e0450cb --- /dev/null +++ b/src/main/java/data/target/RelationshipTarget.java @@ -0,0 +1,39 @@ +package data.target; + +import data.TargetDataset; + +public class RelationshipTarget implements TargetDataset +{ + private int playerId; + private int personId; + private int relationshipLevel; + + public RelationshipTarget(int playerId, int personId, int relationshipLevel) + { + this.playerId = playerId; + this.personId = personId; + this.relationshipLevel = relationshipLevel; + } + + public int getPlayerId() + { + return playerId; + } + + public int getPersonId() + { + return personId; + } + + public int getRelationshipLevel() + { + return relationshipLevel; + } + + @Override + public String toString() + { + return String.format("Relationship [ %d, %d, %d ]", this.playerId, this.personId, this.relationshipLevel); + } + +} diff --git a/src/main/java/etl/Extractor.java b/src/main/java/etl/Extractor.java index 061a6e8..ec4e181 100644 --- a/src/main/java/etl/Extractor.java +++ b/src/main/java/etl/Extractor.java @@ -1,26 +1,26 @@ package etl; -import data.Dataset; +import data.SourceDataset; import utils.DataStorer; -import utils.StatementPreparer; +import utils.StatementPreparerExtractor; import java.sql.Connection; -import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; -public class Extractor +public class Extractor { private Connection sourceDatabase; private DataStorer dataStorer; - private ResultSet resultSet; + private StatementPreparerExtractor statementPreparer; private String sql; public Extractor(Connection sourceDatabase, DataStorer dataStorer, - String sql) + StatementPreparerExtractor statementPreparer, String sql) { this.sourceDatabase = sourceDatabase; this.dataStorer = dataStorer; + this.statementPreparer = statementPreparer; this.sql = sql; } @@ -29,9 +29,10 @@ public class Extractor try { var preparedStatement = this.sourceDatabase.prepareStatement(sql); - this.resultSet = preparedStatement.executeQuery(); + this.statementPreparer.doPrepare(preparedStatement); + var resultSet = preparedStatement.executeQuery(); this.sourceDatabase.close(); - return this.dataStorer.doStore(this.resultSet); + return this.dataStorer.doStore(resultSet); } catch (SQLException e) { diff --git a/src/main/java/etl/Loader.java b/src/main/java/etl/Loader.java index 3809492..fd8b791 100644 --- a/src/main/java/etl/Loader.java +++ b/src/main/java/etl/Loader.java @@ -1,24 +1,25 @@ package etl; -import data.Dataset; -import utils.StatementPreparer; +import data.SourceDataset; +import data.TargetDataset; +import utils.StatementPreparerLoader; import java.sql.Connection; import java.sql.SQLException; import java.util.List; -public class Loader +public class Loader { private Connection targetDatabase; - private StatementPreparer statementPreparer; + private StatementPreparerLoader statementPreparerLoader; private List transformedData; private String sql; - public Loader(Connection targetDatabase, StatementPreparer statementPreparer, List transformedData, + public Loader(Connection targetDatabase, StatementPreparerLoader statementPreparerLoader, List transformedData, String sql) { this.targetDatabase = targetDatabase; - this.statementPreparer = statementPreparer; + this.statementPreparerLoader = statementPreparerLoader; this.transformedData = transformedData; this.sql = sql; } @@ -30,7 +31,7 @@ public class Loader for (T transformedDatum : this.transformedData) { var preparedStatement = this.targetDatabase.prepareStatement(this.sql); - this.statementPreparer.doPrepare(preparedStatement, transformedDatum); + this.statementPreparerLoader.doPrepare(preparedStatement, transformedDatum); preparedStatement.executeUpdate(); } diff --git a/src/main/java/etl/Transformer.java b/src/main/java/etl/Transformer.java index 78085b0..bffde1d 100644 --- a/src/main/java/etl/Transformer.java +++ b/src/main/java/etl/Transformer.java @@ -1,27 +1,28 @@ package etl; -import data.Dataset; +import data.SourceDataset; +import data.TargetDataset; import utils.DataTransformer; import java.util.ArrayList; import java.util.List; -public class Transformer +public class Transformer { private DataTransformer transformer; - private List datasets; + private List extractedData; - public Transformer(DataTransformer transformer, List datasets) + public Transformer(DataTransformer transformer, List extractedData) { this.transformer = transformer; - this.datasets = datasets; + this.extractedData = extractedData; } public List doTransform() { var transformed = new ArrayList(); - for (T dataset : this.datasets) + for (T dataset : this.extractedData) { transformed.add(this.transformer.transform(dataset)); } diff --git a/src/main/java/utils/DataStorer.java b/src/main/java/utils/DataStorer.java index 84f02d3..9e7bec4 100644 --- a/src/main/java/utils/DataStorer.java +++ b/src/main/java/utils/DataStorer.java @@ -1,12 +1,12 @@ package utils; -import data.Dataset; +import data.SourceDataset; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; -public interface DataStorer +public interface DataStorer { List doStore(ResultSet resultSet) throws SQLException; } diff --git a/src/main/java/utils/DataTransformer.java b/src/main/java/utils/DataTransformer.java index f934cfc..ede3299 100644 --- a/src/main/java/utils/DataTransformer.java +++ b/src/main/java/utils/DataTransformer.java @@ -1,10 +1,9 @@ package utils; -import data.Dataset; +import data.SourceDataset; +import data.TargetDataset; -import java.util.List; - -public interface DataTransformer +public interface DataTransformer { E transform(T dataset); } diff --git a/src/main/java/utils/StatementPreparerExtractor.java b/src/main/java/utils/StatementPreparerExtractor.java new file mode 100644 index 0000000..1b46df5 --- /dev/null +++ b/src/main/java/utils/StatementPreparerExtractor.java @@ -0,0 +1,9 @@ +package utils; + +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public interface StatementPreparerExtractor +{ + void doPrepare(PreparedStatement preparedStatement) throws SQLException; +} diff --git a/src/main/java/utils/StatementPreparer.java b/src/main/java/utils/StatementPreparerLoader.java similarity index 58% rename from src/main/java/utils/StatementPreparer.java rename to src/main/java/utils/StatementPreparerLoader.java index 9c2f373..b00e992 100644 --- a/src/main/java/utils/StatementPreparer.java +++ b/src/main/java/utils/StatementPreparerLoader.java @@ -1,11 +1,12 @@ package utils; -import data.Dataset; +import data.SourceDataset; +import data.TargetDataset; import java.sql.PreparedStatement; import java.sql.SQLException; -public interface StatementPreparer +public interface StatementPreparerLoader { void doPrepare(PreparedStatement preparedStatement, T data) throws SQLException; }