MONGO the definition of a data structure when a property in a record in a database is an array case

Source: Internet
Author: User

Package entity;

Import Java.util.Date;

Import com.mongodb.BasicDBList;
Import Com.mongodb.DBObject;

public class Commoneditentity {

Query record results in/** database */
Private DBObject record;

/** database Default ID */
Private String _id;

/** Project ID */
Private String project_id;

/** Project Name */
Private String project_name;

/** Project Creation Time */
Private Date start_time;

/** next Project Activation time */
Private Date End_time;

/** Status of Project activation */
Private String status;

/** Title Content */
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;
}

/**
* Set database Default ID
* @return the _ID
*/
Public String get_id () {
if (this._id = = null && record.get ("_id") = null) {
this._id = Record.get ("_id"). ToString ();
}
return _id;
}

/**
* Returns the database default ID
* @param _id the _id to set
*/
public void set_id (String _id) {
this._id = _id;
}

/**
* Return item 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;
}


/**
* Set Project ID
* @param project_id the project_id to set
*/
public void setproject_id (String project_id) {
this.project_id = project_id;
}

/**
* Return project Name
* @return the PROJECT_NAME 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;
}

/**
* Set project Name
* @param project_name the PROJECT_NAME to set project name
*/
public void Setproject_name (String project_name) {
This.project_name = project_name;
}


/**
* Return Project creation time
* @return The Start_time project creation 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;
}

/**
* Set Project creation time
* @param start_time the start_time to set project creation time
*/
public void Setstart_time (Date start_time) {

This.start_time = start_time;
}


/**
* Returns the next item activation time
* @return The End_time next project activation 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;
}


/**
* Set the next project activation time
* @param end_time the end_time to set the next project activation time
*/
public void Setend_time (Date end_time) {
This.end_time = End_time;
}


/**
* Returns the status of Project activation
* @return State of the status project activation
*/
Public String GetStatus () {
if (This.status = = null && record.get ("status") = = null) {
This.status = Record.get ("status"). ToString ();
}
return status;
}

/**
* Set the status of Project activation
* @param status of the state to set project activation
*/
public void SetStatus (String status) {
This.status = status;
}


/**
* Return title Content
* @return the procontent title content
*/
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;
}

/**
* Set Title Content
* @param procontent the procontent to set title content
*/
public void Setprocontent (procontent[] procontent) {
This.procontent = procontent;
}

Class procontent{

Query record results in/** database */
Private DBObject record;

/** Title */
Private String title;

/** content */
Private String content;

/**
* Returns query record results in database
* Query record results in @return database
*/
Public DBObject Getrecord () {
return record;
}

/**
* Set query record results in database
* Query record results in @param record database
*/
public void Setrecord (DBObject record) {
This.record = record;
}

/**
* Return title
* @return the title
*/
Public String GetTitle () {
if (this.title = = null && record.get ("title")! = null) {
This.title = Record.get ("title"). ToString ();
}
return title;
}

/**
* Set Title
* @param title the title to set
*/
public void Settitle (String title) {
This.title = title;
}

/**
* Return content
* @return The content
*/
Public String getcontent () {
if (this.content = = null && record.get ("content")! = null) {
This.content = Record.get ("content"). ToString ();
}
return content;
}

/**
* Set Content
* @param content The content to set
*/
public void SetContent (String content) {
this.content = content;
}


}

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.