Exemplo n.º 1
0
 private void InitClass(User user, string action, string timestamp, string detectionSystemId, Interval interval) {
     setUser(user);
     setAction(action);
     setTimestamp(timestamp);
     setDetectionSystemId(detectionSystemId);
     setInterval(interval);
 }
Exemplo n.º 2
0
	public Threshold setInterval(Interval interval) {
		this.interval = interval;
		return this;
	}
Exemplo n.º 3
0
	public Threshold(int count, Interval interval) {
		setCount(count);
		setInterval(interval);
	}
    /// <exception cref="XMLStreamException"></exception>
	private Response readResponse(XmlReader xmlReader) {
		Response response = new Response();
		bool finished = false;
		
		while(!finished && xmlReader.MoveToNextAttribute()) {
			//int Event = xmlReader.next();
			string name = XmlUtils.getElementQualifiedName(xmlReader, namespaces);
			
			switch(xmlReader.NodeType) {
				case XmlNodeType.Element:
					if("config:action".Equals(name)) {
						response.setAction(xmlReader.ReadString().Trim());
					} else if("config:interval".Equals(name)) {
						Interval interval = new Interval();
                        // interval.setUnit(xmlReader.getAttributeValue(null, "unit").Trim());
                        interval.setUnit(xmlReader.GetAttribute("unit", null).Trim());
                        /*
                         * getAttributeValue takes as parameters namespaceURI and localName
                         * GetAttribute takes as parameters localName and namespaceURI
                         * 
                         * Migrator's note.
                         */
                        interval.setDuration(Int32.Parse(xmlReader.ReadString().Trim()));
						response.setInterval(interval);
					} else {
						/** unexpected start element **/
                    }
					break;
				case XmlNodeType.EndElement:
					if("config:response".Equals(name)) {
						finished = true;
					} else {
						/** unexpected end element **/
					}
					break;
				default:
					/** unused xml element - nothing to do **/
					break;
			}
		}
		
		return response;
	}
    /// <exception cref="XMLStreamException"></exception>
	private Threshold readThreshold(XmlReader xmlReader) {
		Threshold threshold = new Threshold();
		bool finished = false;
		
		while(!finished && xmlReader.MoveToNextAttribute()) {
			//int Event = xmlReader.next();
			string name = XmlUtils.getElementQualifiedName(xmlReader, namespaces);
			
			switch(xmlReader.NodeType) {
				case XmlNodeType.Element:
					if("config:count".Equals(name)) {
						threshold.setCount(Int32.Parse(xmlReader.ReadString().Trim()));
					} else if("config:interval".Equals(name)) {
						Interval interval = new Interval();
						//interval.setUnit(xmlReader.getAttributeValue(null, "unit").Trim());
                        interval.setUnit(xmlReader.GetAttribute("unit", null).Trim());
						interval.setDuration(Int32.Parse(xmlReader.ReadString().Trim()));
						threshold.setInterval(interval);
					} else {
						/** unexpected start element **/
					}
					break;
				case XmlNodeType.EndElement:
					if("config:threshold".Equals(name)) {
						finished = true;
					} else {
						/** unexpected end element **/
					}
					break;
				default:
					/** unused xml element - nothing to do **/
					break;
			}
		}
		
		return threshold;
	}
Exemplo n.º 6
0
	public Response setInterval(Interval interval) {
		this.interval = interval;
		return this;
	}
Exemplo n.º 7
0
	public Response (User user, string action, string timestamp, string detectionSystemId, Interval interval) {
        InitClass(user, action, timestamp, detectionSystemId, interval);
	}
Exemplo n.º 8
0
	public Response (User user, string action, string detectionSystemId, Interval interval) {
		InitClass(user, action, DateUtils.getCurrentTimestampAsString(), detectionSystemId, interval);
	}
Exemplo n.º 9
0
 public Threshold setInterval(Interval interval)
 {
     this.interval = interval;
     return(this);
 }
Exemplo n.º 10
0
 public Threshold(int count, Interval interval)
 {
     setCount(count);
     setInterval(interval);
 }