Skip to content

Commit

Permalink
Refactor EncryptProjectionTokenGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Jul 28, 2024
1 parent 075f4f8 commit e17fe7d
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,6 @@ private ColumnSegmentBoundInfo getColumnSegmentBoundInfo(final Projection projec
: new ColumnSegmentBoundInfo(new IdentifierValue(projection.getColumnLabel()));
}

private ColumnProjection buildColumnProjection(final ColumnProjectionSegment segment) {
IdentifierValue owner = segment.getColumn().getOwner().map(OwnerSegment::getIdentifier).orElse(null);
ColumnProjection result = new ColumnProjection(owner, segment.getColumn().getIdentifier(), segment.getAliasName().isPresent() ? segment.getAlias().orElse(null) : null, databaseType);
result.setOriginalColumn(segment.getColumn().getColumnBoundInfo().getOriginalColumn());
result.setOriginalTable(segment.getColumn().getColumnBoundInfo().getOriginalTable());
return result;
}

private Optional<SubstitutableColumnNameToken> generateSQLToken(final SelectStatementContext selectStatementContext, final ColumnProjectionSegment columnSegment) {
ColumnProjection columnProjection = buildColumnProjection(columnSegment);
String columnName = columnProjection.getOriginalColumn().getValue();
Expand Down Expand Up @@ -166,6 +158,14 @@ private SubstitutableColumnNameToken generateSQLToken(final ShorthandProjectionS
return new SubstitutableColumnNameToken(startIndex, segment.getStopIndex(), projections, selectStatementContext.getDatabaseType());
}

private ColumnProjection buildColumnProjection(final ColumnProjectionSegment segment) {
IdentifierValue owner = segment.getColumn().getOwner().map(OwnerSegment::getIdentifier).orElse(null);
ColumnProjection result = new ColumnProjection(owner, segment.getColumn().getIdentifier(), segment.getAliasName().isPresent() ? segment.getAlias().orElse(null) : null, databaseType);
result.setOriginalColumn(segment.getColumn().getColumnBoundInfo().getOriginalColumn());
result.setOriginalTable(segment.getColumn().getColumnBoundInfo().getOriginalTable());
return result;
}

private Collection<Projection> generateProjections(final EncryptColumn encryptColumn, final ColumnProjection columnProjection,
final SubqueryType subqueryType, final boolean shorthandProjection) {
if (null == subqueryType || SubqueryType.PROJECTION == subqueryType) {
Expand Down

0 comments on commit e17fe7d

Please sign in to comment.