-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1def889
commit 35be171
Showing
9 changed files
with
329 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/ch/admin/bar/siard2/cmd/mapping/ColumnIdMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package ch.admin.bar.siard2.cmd.mapping; | ||
|
||
import ch.admin.bar.siard2.cmd.model.QualifiedColumnId; | ||
|
||
public interface ColumnIdMapper { | ||
QualifiedColumnId map(QualifiedColumnId origQualifiedColumnId); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/ch/admin/bar/siard2/cmd/mapping/TableIdMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package ch.admin.bar.siard2.cmd.mapping; | ||
|
||
import ch.admin.bar.siard2.cmd.model.QualifiedTableId; | ||
|
||
public interface TableIdMapper { | ||
QualifiedTableId map(QualifiedTableId origQualifiedTableId); | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/ch/admin/bar/siard2/cmd/model/QualifiedColumnId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package ch.admin.bar.siard2.cmd.model; | ||
|
||
import lombok.Builder; | ||
import lombok.NonNull; | ||
import lombok.Value; | ||
|
||
@Value | ||
@Builder(toBuilder = true) | ||
public class QualifiedColumnId { | ||
@NonNull String schema; | ||
@NonNull String table; | ||
@NonNull String column; | ||
|
||
public QualifiedTableId getQualifiedTableId() { | ||
return QualifiedTableId.builder() | ||
.schema(schema) | ||
.table(table) | ||
.build(); | ||
} | ||
|
||
public static class QualifiedColumnIdBuilder { | ||
public QualifiedColumnIdBuilder qualifiedTable(final QualifiedTableId qualifiedTableId) { | ||
schema(qualifiedTableId.getSchema()); | ||
table(qualifiedTableId.getTable()); | ||
return this; | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/ch/admin/bar/siard2/cmd/model/QualifiedTableId.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ch.admin.bar.siard2.cmd.model; | ||
|
||
import lombok.Builder; | ||
import lombok.NonNull; | ||
import lombok.Value; | ||
|
||
@Value | ||
@Builder(toBuilder = true) | ||
public class QualifiedTableId { | ||
@NonNull String schema; | ||
@NonNull String table; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ch.admin.bar.siard2.cmd.sql; | ||
|
||
import ch.admin.bar.siard2.cmd.model.QualifiedTableId; | ||
|
||
public class IdEncoder { | ||
|
||
public String encodeKeySensitive(final QualifiedTableId tableId) { | ||
return encodeKeySensitive(tableId.getSchema()) + | ||
"." + | ||
encodeKeySensitive(tableId.getTable()); | ||
} | ||
|
||
public String encodeKeySensitive(final String value) { | ||
return "\"" + | ||
value + | ||
"\""; | ||
} | ||
} |
Oops, something went wrong.