-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- implmentat in mare get controllerul
- implementat clasa XmlResult ce intoarce un model serializat ca fisier XML - implementat ca test in document manager o functie GetDocument - terminat DocumentEntityManager - creat clasa DocumentRespone, clasa ce va fi intoarce la cereri de tipul Get (contine starea documentului si documentul propriuzis) cu aceste schimbari se pot lua fisierele xml ce trebuiesc afisate, aflate la url-urile : /Get/TimeLine/id si /Get/Summary/id. exemple de fisiere rezultat se gasesc la adresa : http://pastebin.com/qHNV4GDP exemple de documente propriuze nu au fost adaugate inca
- Loading branch information
1 parent
0c3c1a4
commit 12bc0ad
Showing
10 changed files
with
225 additions
and
13 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Web.Mvc; | ||
using System.Xml.Serialization; | ||
|
||
namespace WebServer.Controllers | ||
{ | ||
public class XmlResult : ActionResult | ||
{ | ||
private Object _model = null; | ||
|
||
|
||
// ------------------------------------------------------------------------------------------ | ||
// ------------------------------------------------------------------------------------------ | ||
public XmlResult(Object model) | ||
{ | ||
if(model == null) | ||
throw new ArgumentNullException("The model cannot be null"); | ||
|
||
this._model = model; | ||
} | ||
// ------------------------------------------------------------------------------------------ | ||
// ------------------------------------------------------------------------------------------ | ||
public override void ExecuteResult(ControllerContext context) | ||
{ | ||
var response = context.HttpContext.Response; | ||
var serializer = new XmlSerializer(_model.GetType()); | ||
|
||
response.ContentType = "text/xml"; | ||
serializer.Serialize(response.OutputStream, this._model); | ||
} | ||
// ------------------------------------------------------------------------------------------ | ||
// ------------------------------------------------------------------------------------------ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Xml.Serialization; | ||
|
||
namespace WebServer.Models | ||
{ | ||
[Serializable] | ||
public class DocumentResponse : IXmlSerializable | ||
{ | ||
/// <summary> | ||
/// Starea in care se afla un document. | ||
/// </summary> | ||
public enum Status { Finished, Parsing, Empty, NotFound} | ||
|
||
public String Content {get; set;} | ||
public Status State { get; set; } | ||
|
||
public System.Xml.Schema.XmlSchema GetSchema() | ||
{ | ||
return null; | ||
} | ||
|
||
public void ReadXml(System.Xml.XmlReader reader) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void WriteXml(System.Xml.XmlWriter writer) | ||
{ | ||
writer.WriteElementString("State", State.ToString()); | ||
if (this.Content != null) | ||
{ | ||
writer.WriteRaw("<Content>"); | ||
writer.WriteRaw(Content); | ||
writer.WriteRaw("</Content>"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters