use of org.sagacity.sqltoy.config.model.SecureMask in project sagacity-sqltoy by chenrenfei.
the class ResultUtils method secureMask.
/**
* @todo 对字段进行安全脱敏
* @param desensitizeProvider
* @param rows
* @param masks
* @param labelIndexMap
*/
private static void secureMask(DesensitizeProvider desensitizeProvider, List<List> rows, Iterator<SecureMask> masks, LabelIndexModel labelIndexMap) {
Integer index;
Object value;
SecureMask mask;
int columnIndex;
while (masks.hasNext()) {
mask = masks.next();
index = labelIndexMap.get(mask.getColumn());
if (index != null) {
columnIndex = index.intValue();
for (List row : rows) {
value = row.get(columnIndex);
if (value != null) {
row.set(columnIndex, desensitizeProvider.desensitize(value.toString(), mask));
}
}
}
}
}
use of org.sagacity.sqltoy.config.model.SecureMask in project sagacity-sqltoy by chenrenfei.
the class EntityQuery method secureMask.
/**
* @TODO 对结果字段进行安全脱敏
* @param maskType
* @param columns
* @return
*/
public EntityQuery secureMask(MaskType maskType, String... columns) {
if (maskType != null && columns != null && columns.length > 0) {
for (String column : columns) {
SecureMask mask = new SecureMask();
mask.setColumn(column);
mask.setType(maskType.getValue());
innerModel.secureMask.put(column, mask);
}
}
return this;
}
Aggregations