using System;
using System.Collections.Generic;
using System.Text;
namespace ScrewTurn.Wiki.SearchEngine {
///
/// Represents a document structured for easy dumped on disk or database.
///
/// The class is not thread-safe.
public class DumpedDocument {
///
/// The document unique ID.
///
protected uint id;
///
/// The document unique name.
///
protected string name;
///
/// The document title.
///
protected string title;
///
/// The document type tag.
///
protected string typeTag;
///
/// The document date/time.
///
protected DateTime dateTime;
///
/// Initializes a new instance of the class.
///
/// The document unique ID.
/// The document unique name.
/// The document title.
/// The document type tag.
/// The document date/time.
/// If , or are null.
/// If , or are empty.
public DumpedDocument(uint id, string name, string title, string typeTag, DateTime dateTime) {
if(name == null) throw new ArgumentNullException("name");
if(title == null) throw new ArgumentNullException("title");
if(typeTag == null) throw new ArgumentNullException("typeTag");
if(name.Length == 0) throw new ArgumentException("Name cannot be empty", "name");
if(title.Length == 0) throw new ArgumentException("Title cannot be empty", "title");
if(typeTag.Length == 0) throw new ArgumentException("Type Tag cannot be empty", "typeTag");
this.id = id;
this.name = name;
this.title = title;
this.typeTag = typeTag;
this.dateTime = dateTime;
}
///
/// Initializes a new instance of the class.
///
/// The document do wrap for dumping.
/// If is null.
public DumpedDocument(IDocument document) {
if(document == null) throw new ArgumentNullException("document");
id = document.ID;
name = document.Name;
title = document.Title;
typeTag = document.TypeTag;
dateTime = document.DateTime;
}
///
/// Gets or sets the document unique ID.
///
public uint ID {
get { return id; }
set { id = value; }
}
///
/// Gets the document unique name.
///
public string Name {
get { return name; }
}
///
/// Gets the title of the document.
///
public string Title {
get { return title; }
}
///
/// Gets the document type tag.
///
public string TypeTag {
get { return typeTag; }
}
///
/// Gets the document date/time.
///
public DateTime DateTime {
get { return dateTime; }
}
}
}