Commit 66104d4f by Yujin Seo

Merge branch 'feature/contract/sato/1.0.300_encrypt' into 'contract/sato/1.0.300'

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

See merge request !304
parents a105f9c1 62f35401
......@@ -164,10 +164,10 @@ public class ReportStatusDao extends AbstractDao {
dto.taskReportId = longOrNull(cursor, "task_report_id");
dto.reportStartDate = dateOrNull(cursor, "report_start_date");
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.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");
return dto;
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
......@@ -106,7 +107,7 @@ public class TaskReportDao extends AbstractDao {
column = cursor.getColumnIndex("report_lock_user_name");
if (column != -1) {
dto.reportLockUserName = cursor.getString(column);
dto.reportLockUserName = decode(cursor.getString(column));
}
column = cursor.getColumnIndex("report_lock_time");
......@@ -121,7 +122,7 @@ public class TaskReportDao extends AbstractDao {
column = cursor.getColumnIndex("send_back_user_name");
if (column != -1) {
dto.sendBackUserName = cursor.getString(column);
dto.sendBackUserName = decode(cursor.getString(column));
}
column = cursor.getColumnIndex("send_back_comment");
......@@ -169,7 +170,29 @@ public class TaskReportDao extends AbstractDao {
+ "local_saved_flg ) "
+ "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 {
sql.append("WHERE task_key=? AND task_report_level=?");
if (dto.reportStartDate != null) {
sql.append(" AND datetime(report_start_date)=datetime(?)");
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg,
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg,
dto.reportLockUserId, dto.reportLockUserName, dto.reportLockTime, dto.sendBackUserId, dto.sendBackUserName, dto.sendBackComment, dto.taskStatus, dto.reportStatus,
dto.taskReportInfoId, dto.taskKey, dto.taskReportLevel, dto.reportStartDate};
objects = new Object[]{
dto.jsonData,
dto.attachedFileName,
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 {
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg,
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg,
dto.reportLockUserId, dto.reportLockUserName, dto.reportLockTime, dto.sendBackUserId, dto.sendBackUserName, dto.sendBackComment, dto.taskStatus, dto.reportStatus,
dto.taskReportInfoId, dto.taskKey, dto.taskReportLevel};
objects = new Object[]{
dto.jsonData,
dto.attachedFileName,
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;
......@@ -252,7 +312,7 @@ public class TaskReportDao extends AbstractDao {
}
args.add(reportStatus);
args.add(reportLockUserId);
args.add(reportLockUserName);
args.add(encode(reportLockUserName));
args.add(reportLockTime);
if (reportStartDate != null) {
args.add(taskReportId);
......@@ -551,4 +611,18 @@ public class TaskReportDao extends AbstractDao {
}
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