//
// This file is part of the OpenNMS(R) Application.
//
// OpenNMS(R) is Copyright (C) 2002-2003 The OpenNMS Group, Inc.  All rights reserved.
// OpenNMS(R) is a derivative work, containing both original code, included code and modified
// code that was published under the GNU General Public License. Copyrights for modified 
// and included code are below.
//
// OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
//
// Copyright (C) 1999-2001 Oculan Corp.  All rights reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// For more information contact:
//      OpenNMS Licensing       <license@opennms.org>
//      http://www.opennms.org/
//      http://www.opennms.com/
//

package org.opennms.web.outage;

import java.util.Date;

/**
 * A data structure holding information on all outages on a single IP address.
 * 
 * @author <A HREF="mailto:larry@opennms.org">Lawrence Karnowski </A>
 * @author <A HREF="http://www.opennms.org">OpenNMS </A>
 */
public class OutageSummary extends Object {
    protected int nodeId;

    protected String nodeLabel;

    protected Date timeDown;

    public OutageSummary(int nodeId, String nodeLabel, Date timeDown) {
        if (nodeLabel == null || timeDown == null) {
            throw new IllegalArgumentException("Cannot take null parameters.");
        }

        this.nodeId = nodeId;
        this.nodeLabel = nodeLabel;
        this.timeDown = timeDown;
    }

    public int getNodeId() {
        return (this.nodeId);
    }

    /** @deprecated Please use {@link #getNodeLabel getNodeLabel}instead. */
    public String getHostname() {
        return (this.nodeLabel);
    }

    public String getNodeLabel() {
        return (this.nodeLabel);
    }

    public Date getTimeDown() {
        return (this.timeDown);
    }

    public String toString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("<OutageSummary: ");
        buffer.append(this.nodeId);
        buffer.append(":");
        buffer.append(this.nodeLabel);
        buffer.append(", down since ");
        buffer.append(this.timeDown);

        return (buffer.toString());
    }

};

@@ -1697,16 +1697,22 @@
 otected 
+final 
 int node
@@ -1715,17 +1715,16 @@
 nodeId;%0A
-%0A
     prot
@@ -1729,16 +1729,22 @@
 otected 
+final 
 String n
@@ -1753,17 +1753,16 @@
 eLabel;%0A
-%0A
     prot
@@ -1767,16 +1767,22 @@
 otected 
+final 
 Date tim
@@ -1787,16 +1787,49 @@
 imeDown;
+%0A    protected final Date timeUp;
 %0A%0A    pu
@@ -1890,16 +1890,29 @@
 timeDown
+, Date timeUp
 ) %7B%0A    
@@ -2147,24 +2147,181 @@
 = timeDown;%0A
+        this.timeUp = timeUp;%0A    %7D%0A    public OutageSummary(int nodeId, String nodeLabel, Date timeDown) %7B%0A        this(nodeId, nodeLabel, timeDown, null);%0A
     %7D%0A%0A    p
@@ -2670,32 +2670,103 @@
 meDown);%0A    %7D%0A%0A
+    public Date getTimeUp() %7B%0A        return (this.timeUp);%0A    %7D%0A    %0A
     public Strin
@@ -3010,13 +3010,127 @@
 own 
-since
+at %22);%0A        buffer.append(this.timeDown);%0A        if (this.timeUp != null) %7B%0A            buffer.append(%22, back up at
  %22);
@@ -3130,32 +3130,36 @@
  at %22);%0A        
+   
+ 
 buffer.append(th
@@ -3165,23 +3165,30 @@
 his.time
-Down);%0A
+Up);%0A        %7D
 %0A       

add time up to the outage summary