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. K均值聚类(C++)

    #include<math.h> #include<stdio.h> #include<stdlib.h> #include<iostream> usi ...

  2. rpm安装与卸载命令

    linux删除目录(文件夹):rmdir 目录名(目录需非空):直接删除可用: rm -rf 目录名 ,不需考虑是否为空 SecureCRT上传文件:rz  ,下载文件:sz rpm 安装:rpm - ...

  3. poj 1185 炮兵阵地 [经典状态压缩DP]

    题意:略. 思路:由于每个大炮射程为2,所以如果对每一行状态压缩的话,能对它造成影响的就是上面的两行. 这里用dp[row][state1][state2]表示第row行状态为state2,第row- ...

  4. java 两个int类型的数据相除并输出百分号保留两位有效数字

    java代码: public void IntA(int a , int b){ //首先判断分母不能为0 if(b!=0){ folat num = (float) a*100/b; Decimal ...

  5. Jsp2.0自定义标签(第三天)——EL表达式的使用

    1.提出问题: 我们经常会看到这样的jsp页面代码: 浏览器显示: 为什么会在页面输出:Hello World  ,${per}究竟是如何找到“Hello World”的呢? 2.分析问题: 要想解决 ...

  6. iOS7开发技巧

    和任何新的iOS版本一样,有着一堆堆的新技巧和修改需要处理.有些我并不会立即遇到,所以这篇文章并不是一套完整技巧汇总.只是分享一些我碰巧遇到的问题. 如果你有任何更多的发现,可以发Twitter或者e ...

  7. linux远程登录工具

    ssh协议原理

  8. linux中seq命令用法

    NAME seq - print a sequence of numbers SYNOPSIS seq [OPTION]... LAST seq [OPTION]... FIRST LAST seq ...

  9. AngularJS取得后台Jason数据显示在页面上

    代码下载:https://files.cnblogs.com/files/xiandedanteng/angularjsAjax.rar 前台代码: <%@ page language=&quo ...

  10. 性能指标 - OEE

    work center 是指 执行制造作业的资源, 可以是 一个人, 一组人, 一台自动机器, 一组自动机器, 一个半自动机器, 一组半自动机器, 或者是 一个区域组成的生产资源 基本参数 Time ...