fix: repair decompiled sources and add exhaustive documentation
- restore generic signatures, scoped variables and missing code from original bytecode - remove decompiler artifacts and document classes, methods, fields and packages - restore resources, add Batik/BouncyCastle dependencies and build/runtime docs
This commit is contained in:
1 parent
9d7e42eda8
commit
10aa1829f5
346 files changed
+42404
-622
No files matched your search
@@ -12,6 +12,31 @@ import org.springframework.data.mongodb.core.index.CompoundIndexes;
|
||||
import org.springframework.data.mongodb.core.mapping.DBRef;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
/**
|
||||
* 【MongoDB 文档实体】{@code MidmLog}
|
||||
*
|
||||
* 类职责:
|
||||
* <ul>
|
||||
* <li>作为 MongoDB 集合文档,承载该领域对象的持久化字段与索引。</li>
|
||||
* <li>通过字段/依赖注入持有运行期状态,字段含义见下方“核心字段”。</li>
|
||||
* </ul>
|
||||
*
|
||||
* 核心字段(按声明顺序):
|
||||
* <ul>
|
||||
* <li>{@code uuid}(UUID):对象唯一标识(MongoDB 主键)</li>
|
||||
* <li>{@code forWhat}(UUID):用于What</li>
|
||||
* <li>{@code category}(String):字段 category</li>
|
||||
* <li>{@code log}(String):日志</li>
|
||||
* <li>{@code reference}(DbObject):字段 reference</li>
|
||||
* <li>{@code loggedAt}(Date):时间字段</li>
|
||||
* </ul>
|
||||
*
|
||||
* 协作对象:{@code DbObject、User}。
|
||||
*
|
||||
* 持久化/框架标记:{@code @Document} 映射为 MongoDB 集合。
|
||||
*
|
||||
* 学习提示:先看字段与 @Field/@Indexed,再看对应 Service/Repository 如何构造查询条件。
|
||||
*/
|
||||
@Document
|
||||
@CompoundIndexes({@CompoundIndex(
|
||||
def = "{'category':1, 'loggedAt':1}"
|
||||
@@ -21,21 +46,62 @@ import org.springframework.data.mongodb.core.mapping.Document;
|
||||
def = "{'forWhat':1, 'log': 1}"
|
||||
)})
|
||||
public class MidmLog {
|
||||
/**
|
||||
* 对象唯一标识(MongoDB 主键);MongoDB 主键。
|
||||
*
|
||||
* 注解:{@code @Id}。
|
||||
*/
|
||||
@Id
|
||||
private UUID uuid;
|
||||
/**
|
||||
* 用于What。
|
||||
*/
|
||||
private UUID forWhat;
|
||||
/**
|
||||
* 字段 category。
|
||||
*/
|
||||
private String category;
|
||||
/**
|
||||
* 日志。
|
||||
*/
|
||||
private String log;
|
||||
/**
|
||||
* 字段 reference。
|
||||
*/
|
||||
private DbObject reference;
|
||||
/**
|
||||
* 时间字段。
|
||||
*/
|
||||
private Date loggedAt;
|
||||
/**
|
||||
* 字段 logger;以 DBRef 引用其他文档。
|
||||
*
|
||||
* 注解:{@code @DBRef}。
|
||||
*/
|
||||
@DBRef
|
||||
private User logger;
|
||||
|
||||
/**
|
||||
* 构造 {@code MidmLog} 实例。
|
||||
* 使用默认字段值,后续通常由 Spring/Mongo 或调用方填充。
|
||||
*
|
||||
* 实现要点:主要调用:new Date。
|
||||
*/
|
||||
public MidmLog() {
|
||||
this.setUuid(UUID.randomUUID());
|
||||
this.setLoggedAt(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造 {@code MidmLog} 实例。
|
||||
*
|
||||
* 实现要点:包含 1 个条件分支、0 个循环。
|
||||
*
|
||||
* @param user 当前用户({@code User})
|
||||
* @param forWhat 参数 {@code forWhat}({@code UUID})
|
||||
* @param category 分类(app/ota/other/report 等)({@code String})
|
||||
* @param log 参数 {@code log}({@code String})
|
||||
*/
|
||||
public MidmLog(User user, UUID forWhat, String category, String log) {
|
||||
this();
|
||||
if (user != null) {
|
||||
@@ -47,38 +113,80 @@ public class MidmLog {
|
||||
this.setLog(log);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 {@code uuid}。
|
||||
* @return UUID
|
||||
*/
|
||||
public UUID getUuid() {
|
||||
return this.uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 {@code uuid}。
|
||||
*
|
||||
* @param uuid 对象 UUID({@code UUID})
|
||||
*/
|
||||
public void setUuid(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 {@code forWhat}。
|
||||
* @return UUID
|
||||
*/
|
||||
public UUID getForWhat() {
|
||||
return this.forWhat;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 {@code forWhat}。
|
||||
*
|
||||
* @param forWhat 参数 {@code forWhat}({@code UUID})
|
||||
*/
|
||||
public void setForWhat(UUID forWhat) {
|
||||
this.forWhat = forWhat;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 {@code category}。
|
||||
* @return 字符串结果
|
||||
*/
|
||||
public String getCategory() {
|
||||
return this.category;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 {@code category}。
|
||||
*
|
||||
* @param category 分类(app/ota/other/report 等)({@code String})
|
||||
*/
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 {@code log}。
|
||||
* @return 字符串结果
|
||||
*/
|
||||
public String getLog() {
|
||||
return this.log;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 {@code log}。
|
||||
*
|
||||
* @param log 参数 {@code log}({@code String})
|
||||
*/
|
||||
public void setLog(String log) {
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 {@code reference}。
|
||||
*
|
||||
* 实现要点:包含 1 个条件分支、0 个循环;主要调用:new DbObject。
|
||||
* @return MongoDB 文档扩展对象
|
||||
*/
|
||||
public DbObject getReference() {
|
||||
if (this.reference == null) {
|
||||
this.reference = new DbObject();
|
||||
@@ -87,14 +195,32 @@ public class MidmLog {
|
||||
return this.reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断 {@code reference}。
|
||||
* @return 字段/派生属性 {@code reference} 的值
|
||||
*/
|
||||
public boolean hasReference() {
|
||||
return this.reference != null && this.reference.size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 {@code reference}。
|
||||
*
|
||||
* @param reference 参数 {@code reference}({@code DbObject})
|
||||
*/
|
||||
public void setReference(DbObject reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置Reference。
|
||||
*
|
||||
* 实现要点:包含 3 个条件分支、0 个循环。
|
||||
*
|
||||
* @param agent 参数 {@code agent}({@code UserAgent})
|
||||
* @param sessionId 参数 {@code sessionId}({@code String})
|
||||
* @param remoteIp 参数 {@code remoteIp}({@code String})
|
||||
*/
|
||||
public void setReference(UserAgent agent, String sessionId, String remoteIp) {
|
||||
if (agent != null) {
|
||||
this.addReference("browser", agent.agentFamily());
|
||||
@@ -112,30 +238,65 @@ public class MidmLog {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加Reference。
|
||||
*
|
||||
* @param key 键/配置项({@code String})
|
||||
* @param value 值({@code Object})
|
||||
*/
|
||||
public void addReference(String key, Object value) {
|
||||
this.getReference().put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 {@code loggerUuid}。
|
||||
* @return UUID
|
||||
*/
|
||||
public UUID getLoggerUuid() {
|
||||
return this.logger != null ? this.logger.getUuid() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 {@code loggedAt}。
|
||||
* @return 字段/派生属性 {@code loggedAt} 的值
|
||||
*/
|
||||
public Date getLoggedAt() {
|
||||
return this.loggedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 {@code loggedAt}。
|
||||
*
|
||||
* @param loggedAt 参数 {@code loggedAt}({@code Date})
|
||||
*/
|
||||
public void setLoggedAt(Date loggedAt) {
|
||||
this.loggedAt = loggedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 {@code loggedAt}。
|
||||
*
|
||||
* 实现要点:主要调用:new Date。
|
||||
*
|
||||
* @param loggedAt 参数 {@code loggedAt}({@code long})
|
||||
*/
|
||||
public void setLoggedAt(long loggedAt) {
|
||||
this.loggedAt = new Date(loggedAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 {@code logger}。
|
||||
* @return 用户对象;未找到时返回 {@code null}
|
||||
*/
|
||||
public User getLogger() {
|
||||
return this.logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 {@code logger}。
|
||||
*
|
||||
* @param logger 参数 {@code logger}({@code User})
|
||||
*/
|
||||
public void setLogger(User logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* 审计与操作日志模型。
|
||||
*
|
||||
* <p>本包主要类型:
|
||||
* <ul>
|
||||
* <li>{@link MidmLog}</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>阅读建议:结合本包内类的 Javadoc 与 {@code docs/CODE_WALKTHROUGH.md} 一起看,
|
||||
* 先理解输入/输出,再跟踪 Service 与 MongoTemplate 的调用链。
|
||||
*/
|
||||
package com.midm.model.log;
|
||||
Reference in new issue
Block a user