package entity;

import java.util.Date;

import com.mongodb.BasicDBList;
import com.mongodb.DBObject;

public class CommonEditEntity {

/** 数据库中查询记录结果 */
private DBObject record;

/** 数据库默认id */
private String _id;

/** 项目id */
private String project_id;

/** 项目名称 */
private String project_name;

/** 项目创建时间 */
private Date start_time;

/** 下一个项目激活时间 */
private Date end_time;

/** 项目激活的状态 */
private String status;

/** 标题内容 */
private ProContent[] proContent;

/**
* @return the record
*/
public DBObject getRecord() {
return record;
}

/**
* @param record the record to set
*/
public void setRecord(DBObject record) {
this.record = record;
}

/**
* 设置 数据库默认id
* @return the _id
*/
public String get_id() {
if (this._id == null && record.get("_id") != null) {
this._id = record.get("_id").toString();
}
return _id;
}

/**
* 返回 数据库默认id
* @param _id the _id to set
*/
public void set_id(String _id) {
this._id = _id;
}

/**
* 返回 项目id
* @return the project_id
*/
public String getProject_id() {
if (this.project_id == null && record.get("project_id") != null) {
this.project_id = record.get("project_id").toString();
}
return project_id;
}

/**
* 设置 项目id
* @param project_id the project_id to set
*/
public void setProject_id(String project_id) {
this.project_id = project_id;
}

/**
* 返回 项目名称
* @return the project_name 项目名称
*/
public String getProject_name() {
if (this.project_name == null && record.get("project_name") != null) {
this.project_name = record.get("project_name").toString();
}
return project_name;
}

/**
* 设置 项目名称
* @param project_name the project_name to set 项目名称
*/
public void setProject_name(String project_name) {
this.project_name = project_name;
}

/**
* 返回 项目创建时间
* @return the start_time 项目创建时间
*/
public Date getStart_time() {
if (this.start_time == null && record.get("start_time") != null) {
this.start_time = new Date(Long.parseLong(record.get("start_time").toString()));
}
return start_time;
}

/**
* 设置 项目创建时间
* @param start_time the start_time to set 项目创建时间
*/
public void setStart_time(Date start_time) {

this.start_time = start_time;
}

/**
* 返回 下一个项目激活时间
* @return the end_time 下一个项目激活时间
*/
public Date getEnd_time() {
if (this.end_time == null && record.get("end_time") != null) {
this.end_time = new Date(Long.parseLong(record.get("end_time").toString()));
}
return end_time;
}

/**
* 设置 下一个项目激活时间
* @param end_time the end_time to set 下一个项目激活时间
*/
public void setEnd_time(Date end_time) {
this.end_time = end_time;
}

/**
* 返回 项目激活的状态
* @return the status 项目激活的状态
*/
public String getStatus() {
if (this.status == null && record.get("status") != null) {
this.status = record.get("status").toString();
}
return status;
}

/**
* 设置 项目激活的状态
* @param status the status to set 项目激活的状态
*/
public void setStatus(String status) {
this.status = status;
}

/**
* 返回 标题内容
* @return the proContent 标题内容
*/
public ProContent[] getProContent() {
if (this.proContent == null && record.get("title_content") != null) {
BasicDBList itemList = (BasicDBList)record.get("title_content");
this.proContent = new ProContent[itemList.size()];
for (int i = 0; i < itemList.size(); i++) {
this.proContent[i] = new ProContent();
this.proContent[i].record = (DBObject)itemList.get(i);
}
}
return proContent;
}

/**
* 设置 标题内容
* @param proContent the proContent to set 标题内容
*/
public void setProContent(ProContent[] proContent) {
this.proContent = proContent;
}

class ProContent{

/** 数据库中查询记录结果 */
private DBObject record;

/** 标题 */
private String title;

/** 内容 */
private String content;

/**
* 返回 数据库中查询记录结果
* @return 数据库中查询记录结果
*/
public DBObject getRecord() {
return record;
}

/**
* 设置 数据库中查询记录结果
* @param record 数据库中查询记录结果
*/
public void setRecord(DBObject record) {
this.record = record;
}

/**
* 返回 标题
* @return the title
*/
public String getTitle() {
if (this.title == null && record.get("title") != null) {
this.title = record.get("title").toString();
}
return title;
}

/**
* 设置 标题
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}

/**
* 返回 内容
* @return the content
*/
public String getContent() {
if (this.content == null && record.get("content") != null) {
this.content = record.get("content").toString();
}
return content;
}

/**
* 设置 内容
* @param content the content to set
*/
public void setContent(String content) {
this.content = content;
}

}

}

mongo数据库中一条记录中某个属性是数组情形时 数据结构的定义的更多相关文章

  1. 错误:违反并发性: DeleteCommand 影响了预期 1 条记录中的 0 条

    在access的mdb数据库动态更新的过程中,遇到了DeleteCommand出现DBConcurrencyException异常,错误:违反并发性: DeleteCommand 影响了预期 1 条记 ...

  2. 违反并发性: UpdateCommand影响了预期 1 条记录中的 0 条 解决办法

    本文转载:http://www.cnblogs.com/litianfei/archive/2007/08/16/858866.html UpdateCommand和DeleteCommand出现DB ...

  3. FPC报价模块配置 UpdateCommand影响了预期 1 条记录中的 0 条 解决办法

    今天在增加P4厂 FPC报价模块配置,增加刚挠信息节点,在保存时报错:UpdateCommand影响了预期 1 条记录中的 0 保存时使用:SqlDataAdapter批量更新DataTable,怎么 ...

  4. SQL 从100万条记录中的到 成绩最高的记录

    从100万条记录中的到 成绩最高的记录 问题分析:要从一张表中找到成绩最高的记录并不难,有很多种办法,最简单的就是利用TOP 1 select top 1 * from student order b ...

  5. jquery实现对象数组 筛选出每条记录中的特定属性字段 及根据某个属性值筛选出指定的元素

    jquery实现对象数组 筛选出每条记录中的特定属性字段 直接上图: 源码: /** * 对后端返回的数据,筛选出符合报表的列项,多余的列项去除 */ function filterParams(da ...

  6. 【原创】如何找到Oracle中哪条记录被锁

    通常有这种情况,某个表或者准确的说是表的某条记录被锁(TX锁),在业务层面排查之余,一般都会想知道是哪条记录被锁,每次被锁的是否是同一条记录?还是每次都不同?通过记录可以找到这条记录可以在哪个模块.哪 ...

  7. SQL 父子表,显示表中每条记录所在层级

    1.sqlserer 中有一张父子关系表,表结构如下: CREATE TABLE [dbo].[testparent]( [ID] [int] IDENTITY(1,1) NOT NULL, [nam ...

  8. 七种数据库中Select Top的使用方法 (只显示数据库的几条记录)

    七种数据库中Select Top的使用方法 1. Oracle数据库  SELECT * FROM TABLENAME WHERE ROWNUM <= N 2. Infomix数据库  SELE ...

  9. 15. "wm_concat"_数据库中将查询出来的多条记录中的某个字段用","拼接起来

    例子: select wm_concat(roleid) from lbmember where userid = ? 值的形式:1,2,3 下面是把1,2,3转换为1;2;3select repla ...

随机推荐

  1. Codeforces Round #490 (Div. 3)

    感觉现在\(div3\)的题目也不错啊? 或许是我变辣鸡了吧....... 代码戳这里 A. Mishka and Contes 从两边去掉所有\(≤k\)的数,统计剩余个数即可 B. Reversi ...

  2. c++ 幕客网

    http://m.imooc.com/course/list.html?c=cplusplus http://coding.imooc.com/ http://www.imooc.com/act/al ...

  3. 基于Bootstrap的页面排版知识

    标题: Bootstrap定义了所有HTML的标题样式,<h1>...<h6>标签或者在标签内加入.h1 class等可以得到一样的效果 效果: 副标题: 标签<smal ...

  4. ARM Linux系统调用的原理

    转载自:http://blog.csdn.net/hongjiujing/article/details/6831192 ARM Linux系统调用的原理 操作系统为在用户态运行的进程与硬件设备进行交 ...

  5. mysql数据对象

      学习目标:   了解掌握常见的几种数据库对象 学会如何创建具体的数据对象   mysql 常见的数据对象有哪些: DataBase/Schema Table Index View/Trigger/ ...

  6. Android Retrofit使用教程(二)

    上一篇文章讲述了Retrofit的简单使用,这次我们学习一下Retrofit的各种HTTP请求. Retrofit基础 在Retrofit中使用注解的方式来区分请求类型.比如@GET("&q ...

  7. 【redis】redis实现API接口调用调用次数的限制

    redis实现API接口调用调用次数的限制 参考地址:https://bbs.csdn.net/topics/391856106?page=1 参考地址:https://www.cnblogs.com ...

  8. hbase安装配置

    环境准备 Java HDFS zookeeper SSH,NTP时间同步 系统调优,这个可以等安装完后改,文件打开数(ulimit和nproc) 修改Hadoop HDFS Datanode同时处理文 ...

  9. nohup 输出重定向

    今天在使用nohup命令的时候,每次后台执行生成的日志文件名都为nohup.out,现需要改变nohup命令生成的文件名. 在shell中,文件描述符通常是:STDIN标准输入,STDOUT标准输出, ...

  10. Spark HA模式访问Hadoop HA下的数据

    首先是需要将hadoop的配置文件core-site,xml和hdfs-site.xml 拷贝到Spark conf目录下 然后启动提交即可 spark-submit \ --master spark ...