Commit 62f35401 by Kazuyuki Hida

reportLockUserNameとsendBackUserNameをローカルDB内に保存する際に、難読化するようにした。

parent 833d44f3
...@@ -164,10 +164,10 @@ public class ReportStatusDao extends AbstractDao { ...@@ -164,10 +164,10 @@ public class ReportStatusDao extends AbstractDao {
dto.taskReportId = longOrNull(cursor, "task_report_id"); dto.taskReportId = longOrNull(cursor, "task_report_id");
dto.reportStartDate = dateOrNull(cursor, "report_start_date"); dto.reportStartDate = dateOrNull(cursor, "report_start_date");
dto.reportLockUserId = stringOrNull(cursor, "report_lock_user_id"); dto.reportLockUserId = stringOrNull(cursor, "report_lock_user_id");
dto.reportLockUserName = stringOrNull(cursor, "report_lock_user_name"); dto.reportLockUserName = TaskReportDao.decode(stringOrNull(cursor, "report_lock_user_name"));
dto.reportLockTime = dateOrNull(cursor, "report_lock_time"); dto.reportLockTime = dateOrNull(cursor, "report_lock_time");
dto.sendBackUserId = stringOrNull(cursor, "send_back_user_id"); dto.sendBackUserId = stringOrNull(cursor, "send_back_user_id");
dto.sendBackUserName = stringOrNull(cursor, "send_back_user_name"); dto.sendBackUserName = TaskReportDao.decode(stringOrNull(cursor, "send_back_user_name"));
dto.sendBackComment = stringOrNull(cursor, "send_back_comment"); dto.sendBackComment = stringOrNull(cursor, "send_back_comment");
return dto; return dto;
......
package jp.agentec.abook.abv.bl.data.dao; package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Base64;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
...@@ -106,7 +107,7 @@ public class TaskReportDao extends AbstractDao { ...@@ -106,7 +107,7 @@ public class TaskReportDao extends AbstractDao {
column = cursor.getColumnIndex("report_lock_user_name"); column = cursor.getColumnIndex("report_lock_user_name");
if (column != -1) { if (column != -1) {
dto.reportLockUserName = cursor.getString(column); dto.reportLockUserName = decode(cursor.getString(column));
} }
column = cursor.getColumnIndex("report_lock_time"); column = cursor.getColumnIndex("report_lock_time");
...@@ -121,7 +122,7 @@ public class TaskReportDao extends AbstractDao { ...@@ -121,7 +122,7 @@ public class TaskReportDao extends AbstractDao {
column = cursor.getColumnIndex("send_back_user_name"); column = cursor.getColumnIndex("send_back_user_name");
if (column != -1) { if (column != -1) {
dto.sendBackUserName = cursor.getString(column); dto.sendBackUserName = decode(cursor.getString(column));
} }
column = cursor.getColumnIndex("send_back_comment"); column = cursor.getColumnIndex("send_back_comment");
...@@ -169,7 +170,29 @@ public class TaskReportDao extends AbstractDao { ...@@ -169,7 +170,29 @@ public class TaskReportDao extends AbstractDao {
+ "local_saved_flg ) " + "local_saved_flg ) "
+ "values " + "values "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", + "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues()); new Object[] {
dto.taskKey,
dto.jsonData,
dto.attachedFileName,
dto.localAttachedFileName,
dto.attachedFileSendFlg,
dto.dataSendFlg,
dto.taskReportId,
dto.taskReportInfoId,
dto.reportStartDate,
dto.reportEndDate,
dto.enableReport,
dto.taskReportLevel,
dto.reportLockUserId,
encode(dto.reportLockUserName),
dto.reportLockTime,
dto.sendBackUserId,
encode(dto.sendBackUserName),
dto.sendBackComment,
dto.taskStatus,
dto.reportStatus,
dto.localSavedFlg
});
} }
/** /**
...@@ -202,15 +225,52 @@ public class TaskReportDao extends AbstractDao { ...@@ -202,15 +225,52 @@ public class TaskReportDao extends AbstractDao {
sql.append("WHERE task_key=? AND task_report_level=?"); sql.append("WHERE task_key=? AND task_report_level=?");
if (dto.reportStartDate != null) { if (dto.reportStartDate != null) {
sql.append(" AND datetime(report_start_date)=datetime(?)"); sql.append(" AND datetime(report_start_date)=datetime(?)");
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg, objects = new Object[]{
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg, dto.jsonData,
dto.reportLockUserId, dto.reportLockUserName, dto.reportLockTime, dto.sendBackUserId, dto.sendBackUserName, dto.sendBackComment, dto.taskStatus, dto.reportStatus, dto.attachedFileName,
dto.taskReportInfoId, dto.taskKey, dto.taskReportLevel, dto.reportStartDate}; dto.localAttachedFileName,
dto.attachedFileSendFlg,
dto.dataSendFlg,
dto.reportEndDate,
dto.enableReport,
dto.taskReportLevel,
dto.localSavedFlg,
dto.reportLockUserId,
encode(dto.reportLockUserName),
dto.reportLockTime,
dto.sendBackUserId,
encode(dto.sendBackUserName),
dto.sendBackComment,
dto.taskStatus,
dto.reportStatus,
dto.taskReportInfoId,
dto.taskKey,
dto.taskReportLevel,
dto.reportStartDate
};
} else { } else {
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg, objects = new Object[]{
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg, dto.jsonData,
dto.reportLockUserId, dto.reportLockUserName, dto.reportLockTime, dto.sendBackUserId, dto.sendBackUserName, dto.sendBackComment, dto.taskStatus, dto.reportStatus, dto.attachedFileName,
dto.taskReportInfoId, dto.taskKey, dto.taskReportLevel}; dto.localAttachedFileName,
dto.attachedFileSendFlg,
dto.dataSendFlg,
dto.reportEndDate,
dto.enableReport,
dto.taskReportLevel,
dto.localSavedFlg,
dto.reportLockUserId,
encode(dto.reportLockUserName),
dto.reportLockTime,
dto.sendBackUserId,
encode(dto.sendBackUserName),
dto.sendBackComment,
dto.taskStatus,
dto.reportStatus,
dto.taskReportInfoId,
dto.taskKey,
dto.taskReportLevel
};
} }
return update(sql.toString(), objects) > 0; return update(sql.toString(), objects) > 0;
...@@ -252,7 +312,7 @@ public class TaskReportDao extends AbstractDao { ...@@ -252,7 +312,7 @@ public class TaskReportDao extends AbstractDao {
} }
args.add(reportStatus); args.add(reportStatus);
args.add(reportLockUserId); args.add(reportLockUserId);
args.add(reportLockUserName); args.add(encode(reportLockUserName));
args.add(reportLockTime); args.add(reportLockTime);
if (reportStartDate != null) { if (reportStartDate != null) {
args.add(taskReportId); args.add(taskReportId);
...@@ -551,4 +611,18 @@ public class TaskReportDao extends AbstractDao { ...@@ -551,4 +611,18 @@ public class TaskReportDao extends AbstractDao {
} }
return count > 0; return count > 0;
} }
public static String encode(String plain) {
if (plain == null) {
return null;
}
return Base64.getEncoder().encodeToString(plain.getBytes());
}
public static String decode(String encoded) {
if (encoded == null) {
return null;
}
return new String(Base64.getDecoder().decode(encoded));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment