44
55import com .google .common .collect .ImmutableMap ;
66import com .google .common .collect .ImmutableSet ;
7+ import com .scalar .db .api .OperationBuilder .AbacReadTagAttribute ;
78import com .scalar .db .api .OperationBuilder .And ;
89import com .scalar .db .api .OperationBuilder .Attribute ;
910import com .scalar .db .api .OperationBuilder .Buildable ;
11+ import com .scalar .db .api .OperationBuilder .ClearAbacReadTagAttribute ;
1012import com .scalar .db .api .OperationBuilder .ClearAttribute ;
1113import com .scalar .db .api .OperationBuilder .ClearClusteringKey ;
1214import com .scalar .db .api .OperationBuilder .ClearConditions ;
@@ -93,7 +95,8 @@ public static class BuildableGet extends Buildable<Get>
9395 implements ClusteringKey <BuildableGet >,
9496 Consistency <BuildableGet >,
9597 Projection <BuildableGet >,
96- Attribute <BuildableGet > {
98+ Attribute <BuildableGet >,
99+ AbacReadTagAttribute <BuildableGet > {
97100 final List <String > projections = new ArrayList <>();
98101 @ Nullable Key clusteringKey ;
99102 @ Nullable com .scalar .db .api .Consistency consistency ;
@@ -158,6 +161,14 @@ public BuildableGet attributes(Map<String, String> attributes) {
158161 return this ;
159162 }
160163
164+ @ Override
165+ public BuildableGet readTag (String policyName , String readTag ) {
166+ checkNotNull (policyName );
167+ checkNotNull (readTag );
168+ AbacOperationAttributes .setReadTag (attributes , policyName , readTag );
169+ return this ;
170+ }
171+
161172 @ Override
162173 public Get build () {
163174 return build (ImmutableSet .of ());
@@ -227,6 +238,12 @@ public BuildableGetWithPartitionKey attributes(Map<String, String> attributes) {
227238 return this ;
228239 }
229240
241+ @ Override
242+ public BuildableGet readTag (String policyName , String readTag ) {
243+ super .readTag (policyName , readTag );
244+ return this ;
245+ }
246+
230247 @ Override
231248 public BuildableGetWithOngoingWhere where (ConditionalExpression condition ) {
232249 checkNotNull (condition );
@@ -390,6 +407,7 @@ public static class BuildableGetWithIndex
390407 implements Consistency <BuildableGetWithIndex >,
391408 Projection <BuildableGetWithIndex >,
392409 Attribute <BuildableGetWithIndex >,
410+ AbacReadTagAttribute <BuildableGetWithIndex >,
393411 OperationBuilder .Where <BuildableGetWithIndexOngoingWhere >,
394412 WhereAnd <BuildableGetWithIndexOngoingWhereAnd >,
395413 WhereOr <BuildableGetWithIndexOngoingWhereOr > {
@@ -447,6 +465,14 @@ public BuildableGetWithIndex attributes(Map<String, String> attributes) {
447465 return this ;
448466 }
449467
468+ @ Override
469+ public BuildableGetWithIndex readTag (String policyName , String readTag ) {
470+ checkNotNull (policyName );
471+ checkNotNull (readTag );
472+ AbacOperationAttributes .setReadTag (attributes , policyName , readTag );
473+ return this ;
474+ }
475+
450476 @ Override
451477 public BuildableGetWithIndexOngoingWhere where (ConditionalExpression condition ) {
452478 checkNotNull (condition );
@@ -602,7 +628,8 @@ public BuildableGetWithIndexOngoingWhereOr or(AndConditionSet andConditionSet) {
602628 public static class BuildableGetWithIndexWhere
603629 implements Consistency <BuildableGetWithIndexWhere >,
604630 Projection <BuildableGetWithIndexWhere >,
605- Attribute <BuildableGetWithIndexWhere > {
631+ Attribute <BuildableGetWithIndexWhere >,
632+ AbacReadTagAttribute <BuildableGetWithIndexWhere > {
606633
607634 BuildableGetWithIndex buildableGetWithIndex ;
608635 final SelectionBuilder .Where where ;
@@ -657,6 +684,12 @@ public BuildableGetWithIndexWhere attributes(Map<String, String> attributes) {
657684 return this ;
658685 }
659686
687+ @ Override
688+ public BuildableGetWithIndexWhere readTag (String policyName , String readTag ) {
689+ buildableGetWithIndex = buildableGetWithIndex .readTag (policyName , readTag );
690+ return this ;
691+ }
692+
660693 public Get build () {
661694 return buildableGetWithIndex .build (getConjunctions (where ));
662695 }
@@ -674,7 +707,8 @@ public static class BuildableGetOrGetWithIndexFromExisting extends BuildableGet
674707 ClearProjections <BuildableGetOrGetWithIndexFromExisting >,
675708 ClearClusteringKey <BuildableGetOrGetWithIndexFromExisting >,
676709 ClearNamespace <BuildableGetOrGetWithIndexFromExisting >,
677- ClearAttribute <BuildableGetOrGetWithIndexFromExisting > {
710+ ClearAttribute <BuildableGetOrGetWithIndexFromExisting >,
711+ ClearAbacReadTagAttribute <BuildableGetOrGetWithIndexFromExisting > {
678712
679713 private Key indexKey ;
680714 private final boolean isGetWithIndex ;
@@ -770,6 +804,12 @@ public BuildableGetOrGetWithIndexFromExisting attributes(Map<String, String> att
770804 return this ;
771805 }
772806
807+ @ Override
808+ public BuildableGet readTag (String policyName , String readTag ) {
809+ super .readTag (policyName , readTag );
810+ return this ;
811+ }
812+
773813 @ Override
774814 public BuildableGetFromExistingWithOngoingWhere where (ConditionalExpression condition ) {
775815 checkConditionsEmpty ();
@@ -845,6 +885,18 @@ public BuildableGetOrGetWithIndexFromExisting clearAttribute(String name) {
845885 return this ;
846886 }
847887
888+ @ Override
889+ public BuildableGetOrGetWithIndexFromExisting clearReadTag (String policyName ) {
890+ AbacOperationAttributes .clearReadTag (attributes , policyName );
891+ return this ;
892+ }
893+
894+ @ Override
895+ public BuildableGetOrGetWithIndexFromExisting clearReadTags () {
896+ AbacOperationAttributes .clearReadTags (attributes );
897+ return this ;
898+ }
899+
848900 private void checkNotGet () {
849901 if (!isGetWithIndex ) {
850902 throw new UnsupportedOperationException (
@@ -910,9 +962,11 @@ public static class BuildableGetFromExistingWithWhere
910962 Consistency <BuildableGetFromExistingWithWhere >,
911963 Projection <BuildableGetFromExistingWithWhere >,
912964 Attribute <BuildableGetFromExistingWithWhere >,
965+ AbacReadTagAttribute <BuildableGetFromExistingWithWhere >,
913966 ClearProjections <BuildableGetFromExistingWithWhere >,
914967 ClearNamespace <BuildableGetFromExistingWithWhere >,
915- ClearAttribute <BuildableGetFromExistingWithWhere > {
968+ ClearAttribute <BuildableGetFromExistingWithWhere >,
969+ ClearAbacReadTagAttribute <BuildableGetFromExistingWithWhere > {
916970
917971 private final BuildableGetOrGetWithIndexFromExisting BuildableGetFromExisting ;
918972 final SelectionBuilder .Where where ;
@@ -999,6 +1053,12 @@ public BuildableGetFromExistingWithWhere attributes(Map<String, String> attribut
9991053 return this ;
10001054 }
10011055
1056+ @ Override
1057+ public BuildableGetFromExistingWithWhere readTag (String policyName , String readTag ) {
1058+ BuildableGetFromExisting .readTag (policyName , readTag );
1059+ return this ;
1060+ }
1061+
10021062 @ Override
10031063 public BuildableGetFromExistingWithWhere clearProjections () {
10041064 BuildableGetFromExisting .clearProjections ();
@@ -1023,6 +1083,18 @@ public BuildableGetFromExistingWithWhere clearAttribute(String name) {
10231083 return this ;
10241084 }
10251085
1086+ @ Override
1087+ public BuildableGetFromExistingWithWhere clearReadTag (String policyName ) {
1088+ BuildableGetFromExisting .clearReadTag (policyName );
1089+ return this ;
1090+ }
1091+
1092+ @ Override
1093+ public BuildableGetFromExistingWithWhere clearReadTags () {
1094+ BuildableGetFromExisting .clearReadTags ();
1095+ return this ;
1096+ }
1097+
10261098 public Get build () {
10271099 return BuildableGetFromExisting .build (getConjunctions (where ));
10281100 }
0 commit comments