package org.splat.service.dto;
+
/**
*
* @author Daniel Brunier-Coulin
- * @copyright OPEN CASCADE 2012
+ * @copyright OPEN CASCADE 2012-2015
*/
import java.text.DecimalFormat;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import java.util.Vector;
import org.splat.dal.bo.som.ProgressState;
import org.splat.som.Step;
-
+/**
+ * DTO for an open knowledge element.
+ */
public class KnowledgeElementDTO {
- private long rid;
- private KnowledgeElementTypeDTO type; // User extendable types
- private ProgressState state;
- private String title;
- private String value;
- private UserDTO author;
- private Date date;
- private List<Step> involving = new Vector<Step>();
- private String studyTitle;
- private String scenarioTitle;
+ /**
+ * Primary key.
+ */
+ private long _index;
+ /**
+ * User extendable knowledge type.
+ */
+ private KnowledgeElementTypeDTO _type;
+ /**
+ * Knowledge element progress state.
+ */
+ private ProgressState _progressState;
+ /**
+ * Knowledge title.
+ */
+ private String _title;
+ /**
+ * Knowledge text.
+ */
+ private String _value;
+ /**
+ * Knowledge author.
+ */
+ private UserDTO _author;
+ /**
+ * Knowledge modification date.
+ */
+ private Date _date;
+ /**
+ * Study steps involving this knowledge.
+ */
+ private transient final List<Step> _involving = new ArrayList<Step>();
+ /**
+ * Parent study title.
+ */
+ private String _studyTitle;
+ /**
+ * Parent scenario title.
+ */
+ private String _scenarioTitle;
+
+ /**
+ * Default constructor.
+ */
+ public KnowledgeElementDTO() {
+ // Create empty bean.
+ }
-// ==============================================================================================================================
-// Public member functions
-// ==============================================================================================================================
+ /**
+ * Constructor with fields values.
+ *
+ * @param index
+ * knowledge element primary key
+ * @param title
+ * knowledge title
+ * @param value
+ * knowledge value
+ */
+ public KnowledgeElementDTO(final long index, final String title,
+ final String value) {
+ _index = index;
+ _title = title;
+ _value = value;
+ }
- /**
- * @param given
- * @return
- */
- public boolean equals (KnowledgeElementDTO given) {
- if (!this.getType().equals(given.getType())) return false;
- if (this.getValue().equals(given.getValue())) return true;
- return false;
- }
+ /**
+ * Compare this knowledge element with the given one.
+ *
+ * @param given
+ * the knowledge element to compare to
+ * @return true if knowledge elements are equal
+ */
+ public boolean equals(final KnowledgeElementDTO given) { // NOPMD: RKV: TODO: to be refined
+ return (this.getType().equals(given.getType()) && this.getValue()
+ .equals(given.getValue()));
+ }
- public UserDTO getAuthor () {
- return author;
- }
+ /**
+ * Get knowledge author.
+ *
+ * @return the author as user DTO
+ */
+ public UserDTO getAuthor() {
+ return _author;
+ }
- public Date getDate () {
- return date;
- }
+ /**
+ * Get knowledge modification date.
+ *
+ * @return the modification date
+ */
+ public Date getDate() {
+ return _date;
+ }
- public ProgressState getProgressState () {
- return state;
- }
+ /**
+ * Get knowledge progress state.
+ *
+ * @return the knowledge state
+ */
+ public ProgressState getProgressState() {
+ return _progressState;
+ }
- public String getTitle () {
- return title;
- }
+ /**
+ * Get knowledge title.
+ *
+ * @return the title
+ */
+ public String getTitle() {
+ return _title;
+ }
- public String getReference () {
- DecimalFormat toString = new DecimalFormat("00000"); // Supports 99 999 knowledge elements
- return "KE" + toString.format(this.getIndex());
- }
+ /**
+ * Get knowledge reference.
+ *
+ * @return the reference
+ */
+ public String getReference() {
+ DecimalFormat toString = new DecimalFormat("00000"); // Supports 99 999 knowledge elements
+ return "KE" + toString.format(this.getIndex());
+ }
- public KnowledgeElementTypeDTO getType () {
- return type;
- }
+ /**
+ * Get knowledge type.
+ *
+ * @return the knowledge type
+ */
+ public KnowledgeElementTypeDTO getType() {
+ return _type;
+ }
- public String getValue () {
- return value;
- }
+ /**
+ * Get knowledge text.
+ *
+ * @return the knowledge text
+ */
+ public String getValue() {
+ return _value;
+ }
/**
- * Set a status of
- * @param aState knowledge element progress state to set
+ * Set a status of this knowledge.
+ *
+ * @param aState
+ * knowledge element progress state to set
*/
- public void setProgressState(ProgressState aState) {
- state = aState;
+ public void setProgressState(final ProgressState aState) {
+ _progressState = aState;
}
+
/**
* Set a title of the knowledge.
- * @param aTitle a title to set
+ *
+ * @param aTitle
+ * a title to set
*/
- public void setTitle(String aTitle) {
- title = aTitle;
+ public void setTitle(final String aTitle) {
+ _title = aTitle;
}
+
/**
* Set the value.
- * @param value the value to set
+ *
+ * @param value
+ * the value to set
*/
- public void setValue(String value) {
- this.value = value;
+ public void setValue(final String value) {
+ this._value = value;
}
+
/**
* Get list of involving steps.
+ *
* @return list of steps
*/
public List<Step> getInvolving() {
- return involving;
+ return _involving;
}
+
/**
* Get title of the parent study.
+ *
* @return study title
*/
public String getStudyTitle() {
- return studyTitle;
+ return _studyTitle;
}
+
/**
* Get title of the parent scenario.
+ *
* @return scenario title
*/
public String getScenarioTitle() {
- return scenarioTitle;
+ return _scenarioTitle;
}
/**
* Get the rid.
+ *
* @return the rid
*/
public long getIndex() {
- return rid;
+ return _index;
}
/**
* Set the rid.
- * @param rid the rid to set
+ *
+ * @param rid
+ * the rid to set
*/
- public void setIndex(long rid) {
- this.rid = rid;
+ public void setIndex(final long rid) {
+ this._index = rid;
}
/**
* Set the studyTitle.
- * @param studyTitle the studyTitle to set
+ *
+ * @param studyTitle
+ * the studyTitle to set
*/
- public void setStudyTitle(String studyTitle) {
- this.studyTitle = studyTitle;
+ public void setStudyTitle(final String studyTitle) {
+ this._studyTitle = studyTitle;
}
/**
* Set the scenarioTitle.
- * @param scenarioTitle the scenarioTitle to set
+ *
+ * @param scenarioTitle
+ * the scenarioTitle to set
*/
- public void setScenarioTitle(String scenarioTitle) {
- this.scenarioTitle = scenarioTitle;
+ public void setScenarioTitle(final String scenarioTitle) {
+ this._scenarioTitle = scenarioTitle;
}
/**
* Set the type.
- * @param type the type to set
+ *
+ * @param type
+ * the type to set
*/
- public void setType(KnowledgeElementTypeDTO type) {
- this.type = type;
+ public void setType(final KnowledgeElementTypeDTO type) {
+ this._type = type;
}
/**
* Set the author.
- * @param author the author to set
+ *
+ * @param author
+ * the author to set
*/
- public void setAuthor(UserDTO author) {
- this.author = author;
+ public void setAuthor(final UserDTO author) {
+ this._author = author;
}
/**
* Set the date.
- * @param date the date to set
+ *
+ * @param date
+ * the date to set
*/
- public void setDate(Date date) {
- this.date = date;
+ public void setDate(final Date date) {
+ this._date = date;
}
}
\ No newline at end of file