|
| 1 | +/* |
| 2 | + * Copyright (c) 2021 MarkLogic Corporation |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.marklogic.client.expression; |
| 17 | + |
| 18 | +import com.marklogic.client.type.PlanColumn; |
| 19 | +import com.marklogic.client.type.PlanExprCol; |
| 20 | +import com.marklogic.client.type.ServerExpression; |
| 21 | + |
| 22 | +import java.util.Map; |
| 23 | + |
| 24 | +/** |
| 25 | + * The RdtExpr instance provides functions that build expressions |
| 26 | + * for redacting the values of a column. |
| 27 | + * <p>In addition to using the provided functions, |
| 28 | + * you can redact any column by using {@link PlanBuilder#as(PlanColumn, ServerExpression)} |
| 29 | + * to rebind the column to an expression that replaces the existing value |
| 30 | + * with an altered or randomly generated value. |
| 31 | + * You can also hide a column by binding the column to the null value |
| 32 | + * or by projecting other columns. |
| 33 | + * </p> |
| 34 | + */ |
| 35 | +public interface RdtExpr { |
| 36 | + /** |
| 37 | + * Redacts a column with string values by replacing each value with deterministic masking text. |
| 38 | + * That is, a specific value generates the same masked value every time the value is redacted. |
| 39 | + * <p>Provides a client interface to the |
| 40 | + * <a href="http://docs.marklogic.com/ordt:mask-deterministic" target="mlserverdoc">ordt:mask-deterministic</a> |
| 41 | + * server function.</p> |
| 42 | + * @param column the column to be redacted |
| 43 | + * @return a PlanExprCol object |
| 44 | + */ |
| 45 | + PlanExprCol maskDeterministic(PlanColumn column); |
| 46 | + /** |
| 47 | + * Redacts a column with string values by replacing each value with deterministic masking text. |
| 48 | + * That is, a specific value generates the same masked value every time the value is redacted. |
| 49 | + * <p>Provides a client interface to the |
| 50 | + * <a href="http://docs.marklogic.com/ordt:mask-deterministic" target="mlserverdoc">ordt:mask-deterministic</a> |
| 51 | + * server function.</p> |
| 52 | + * @param column the column to be redacted |
| 53 | + * @param options the options for redacting the column |
| 54 | + * @return a PlanExprCol object |
| 55 | + */ |
| 56 | + PlanExprCol maskDeterministic(PlanColumn column, Map<String,?> options); |
| 57 | + /** |
| 58 | + * Redacts a column with string values by replacing each value with random masking text. |
| 59 | + * The same value may produce a different masked value every time the value is redacted. |
| 60 | + * <p>Provides a client interface to the |
| 61 | + * <a href="http://docs.marklogic.com/ordt:mask-random" target="mlserverdoc">ordt:mask-random</a> |
| 62 | + * server function.</p> |
| 63 | + * @param column the column to be redacted |
| 64 | + * @return a PlanExprCol object for the redacted column |
| 65 | + */ |
| 66 | + PlanExprCol maskRandom(PlanColumn column); |
| 67 | + /** |
| 68 | + * Redacts a column with string values by replacing each value with random masking text. |
| 69 | + * The same value may produce a different masked value every time the value is redacted. |
| 70 | + * <p>Provides a client interface to the |
| 71 | + * <a href="http://docs.marklogic.com/ordt:mask-random" target="mlserverdoc">ordt:mask-random</a> |
| 72 | + * server function.</p> |
| 73 | + * @param column the column to be redacted |
| 74 | + * @param options the options for redacting the column |
| 75 | + * @return a PlanExprCol object for the redacted column |
| 76 | + */ |
| 77 | + PlanExprCol maskRandom(PlanColumn column, Map<String,?> options); |
| 78 | + /** |
| 79 | + * Redacts a column with date or datetime values either by masking part |
| 80 | + * of the existing value or by generating a random value. |
| 81 | + * <p>Provides a client interface to the |
| 82 | + * <a href="http://docs.marklogic.com/ordt:redact-datetime" target="mlserverdoc">ordt:redact-datetime</a> |
| 83 | + * server function.</p> |
| 84 | + * @param column the column to be redacted |
| 85 | + * @param options the options for redacting the column |
| 86 | + * @return a PlanExprCol object for the redacted column |
| 87 | + */ |
| 88 | + PlanExprCol redactDatetime(PlanColumn column, Map<String,?> options); |
| 89 | + /** |
| 90 | + * Redacts a column with email address string |
| 91 | + * that conforms to the pattern <code>name@domain</code>. |
| 92 | + * <p>Provides a client interface to the |
| 93 | + * <a href="http://docs.marklogic.com/ordt:redact-email" target="mlserverdoc">ordt:redact-email</a> |
| 94 | + * server function.</p> |
| 95 | + * @param column the column to be redacted |
| 96 | + * @return a PlanExprCol object for the redacted column |
| 97 | + */ |
| 98 | + PlanExprCol redactEmail(PlanColumn column); |
| 99 | + /** |
| 100 | + * Redacts a column with email address string |
| 101 | + * that conforms to the pattern <code>name@domain</code>. |
| 102 | + * <p>Provides a client interface to the |
| 103 | + * <a href="http://docs.marklogic.com/ordt:redact-email" target="mlserverdoc">ordt:redact-email</a> |
| 104 | + * server function.</p> |
| 105 | + * @param column the column to be redacted |
| 106 | + * @param options the options for redacting the column |
| 107 | + * @return a PlanExprCol object for the redacted column |
| 108 | + */ |
| 109 | + PlanExprCol redactEmail(PlanColumn column, Map<String,?> options); |
| 110 | + /** |
| 111 | + * Redacts a column with IPv4 address string that conforms to a pattern with |
| 112 | + * four blocks of 1-3 decimal digits separated by period (.) where the value of each block |
| 113 | + * of digits is less than or equal to 255 as in <code>123.201.098.112</code> and |
| 114 | + * <code>123.45.678.0</code>. |
| 115 | + * <p>Provides a client interface to the |
| 116 | + * <a href="http://docs.marklogic.com/ordt:redact-ipv4" target="mlserverdoc">ordt:redact-ipv4</a> |
| 117 | + * server function.</p> |
| 118 | + * @param column the column to be redacted |
| 119 | + * @return a PlanExprCol object for the redacted column |
| 120 | + */ |
| 121 | + PlanExprCol redactIpv4(PlanColumn column); |
| 122 | + /** |
| 123 | + * Redacts a column with IPv4 address string that conforms to a pattern with |
| 124 | + * four blocks of 1-3 decimal digits separated by period (.) where the value of each block |
| 125 | + * of digits is less than or equal to 255 as in <code>123.201.098.112</code> and |
| 126 | + * <code>123.45.678.0</code>. |
| 127 | + * <p>Provides a client interface to the |
| 128 | + * <a href="http://docs.marklogic.com/ordt:redact-ipv4" target="mlserverdoc">ordt:redact-ipv4</a> |
| 129 | + * server function.</p> |
| 130 | + * @param column the column to be redacted |
| 131 | + * @param options the options for redacting the column |
| 132 | + * @return a PlanExprCol object for the redacted column |
| 133 | + */ |
| 134 | + PlanExprCol redactIpv4(PlanColumn column, Map<String,?> options); |
| 135 | + /** |
| 136 | + * Redacts a column by generating a random number within a configurable range |
| 137 | + * either as a numeric data type or as a formatted string. |
| 138 | + * <p>Provides a client interface to the |
| 139 | + * <a href="http://docs.marklogic.com/ordt:redact-number" target="mlserverdoc">ordt:redact-number</a> |
| 140 | + * server function.</p> |
| 141 | + * @param column the column to be redacted |
| 142 | + * @return a PlanExprCol object for the redacted column |
| 143 | + */ |
| 144 | + PlanExprCol redactNumber(PlanColumn column); |
| 145 | + /** |
| 146 | + * Redacts a column by generating a random number within a configurable range |
| 147 | + * either as a numeric data type or as a formatted string. |
| 148 | + * <p>Provides a client interface to the |
| 149 | + * <a href="http://docs.marklogic.com/ordt:redact-number" target="mlserverdoc">ordt:redact-number</a> |
| 150 | + * server function.</p> |
| 151 | + * @param column the column to be redacted |
| 152 | + * @param options the options for redacting the column |
| 153 | + * @return a PlanExprCol object for the redacted column |
| 154 | + */ |
| 155 | + PlanExprCol redactNumber(PlanColumn column, Map<String,?> options); |
| 156 | + /** |
| 157 | + * Redacts a string column by applying a regular expression. |
| 158 | + * <p>Provides a client interface to the |
| 159 | + * <a href="http://docs.marklogic.com/ordt:redact-regex" target="mlserverdoc">ordt:redact-regex</a> |
| 160 | + * server function.</p> |
| 161 | + * @param column the column to be redacted |
| 162 | + * @param options the options for redacting the column |
| 163 | + * @return a PlanExprCol object for the redacted column |
| 164 | + */ |
| 165 | + PlanExprCol redactRegex(PlanColumn column, Map<String,?> options); |
| 166 | + /** |
| 167 | + * Redacts a column with a 10-digit US phone number string |
| 168 | + * by generating random numbers or replacing numbers with a masking character. |
| 169 | + * <p>Provides a client interface to the |
| 170 | + * <a href="http://docs.marklogic.com/ordt:redact-us-phone" target="mlserverdoc">ordt:redact-us-phone</a> |
| 171 | + * server function.</p> |
| 172 | + * @param column the column to be redacted |
| 173 | + * @return a PlanExprCol object for the redacted column |
| 174 | + */ |
| 175 | + PlanExprCol redactUsPhone(PlanColumn column); |
| 176 | + /** |
| 177 | + * Redacts a column with a 10-digit US phone number string |
| 178 | + * by generating random numbers or replacing numbers with a masking character. |
| 179 | + * <p>Provides a client interface to the |
| 180 | + * <a href="http://docs.marklogic.com/ordt:redact-us-phone" target="mlserverdoc">ordt:redact-us-phone</a> |
| 181 | + * server function.</p> |
| 182 | + * @param column the column to be redacted |
| 183 | + * @param options the options for redacting the column |
| 184 | + * @return a PlanExprCol object for the redacted column |
| 185 | + */ |
| 186 | + PlanExprCol redactUsPhone(PlanColumn column, Map<String,?> options); |
| 187 | + /** |
| 188 | + * Redacts a column with a 9-digit US SSN (Social Security Number) string |
| 189 | + * by generating random numbers or replacing numbers with a masking character. |
| 190 | + * <p>Provides a client interface to the |
| 191 | + * <a href="http://docs.marklogic.com/ordt:redact-us-ssn" target="mlserverdoc">ordt:redact-us-ssn</a> |
| 192 | + * server function.</p> |
| 193 | + * @param column the column to be redacted |
| 194 | + * @return a PlanExprCol object for the redacted column |
| 195 | + */ |
| 196 | + PlanExprCol redactUsSsn(PlanColumn column); |
| 197 | + /** |
| 198 | + * Redacts a column with a 9-digit US SSN (Social Security Number) string |
| 199 | + * by generating random numbers or replacing numbers with a masking character. |
| 200 | + * <p>Provides a client interface to the |
| 201 | + * <a href="http://docs.marklogic.com/ordt:redact-us-ssn" target="mlserverdoc">ordt:redact-us-ssn</a> |
| 202 | + * server function.</p> |
| 203 | + * @param column the column to be redacted |
| 204 | + * @param options the options for redacting the column |
| 205 | + * @return a PlanExprCol object for the redacted column |
| 206 | + */ |
| 207 | + PlanExprCol redactUsSsn(PlanColumn column, Map<String,?> options); |
| 208 | +} |
0 commit comments