/*******************************************************************************
 * This file is part of OpenNMS(R).
 *
 * Copyright (C) 2007-2014 The OpenNMS Group, Inc.
 * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc.
 *
 * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
 *
 * OpenNMS(R) is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 *
 * OpenNMS(R) 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with OpenNMS(R).  If not, see:
 *      http://www.gnu.org/licenses/
 *
 * For more information contact:
 *     OpenNMS(R) Licensing <license@opennms.org>
 *     http://www.opennms.org/
 *     http://www.opennms.com/
 *******************************************************************************/

package org.opennms.netmgt.model;

/**
 * OpenNMS Trouble Ticket State Enumerations.
 *
 * @author <a href="mailto:brozow@opennms.org">Mathew Brozowski</a>
 * @author <a href="mailto:david@opennms.org">David Hustace</a>
 * @author <a href="mailto:dschlenk@convergeone.com">David Schlenk</a>
 * @version $Id: $
 */
public enum TroubleTicketState {
    /* KEEP THESE IN ORDER or the DEFAULT ALARM VACUUM QUERIES will BREAK */
    
    /* TODO: once JPA 2.1+ in use, change things that use this to also use a
     * javax.persistence.AttributeConverter<TroubleTicketState, Integer> that
     * returns TroubleTicketState.getValue() in the converter. That should
     * maintain backwords compatibility to the current default 
     * Enum.toOrdinal() JPA behavior and prevent breaking when reordering items
     * in the Enum. 
     */
    
    OPEN(0),
    CREATE_PENDING(1),
    CREATE_FAILED(2),
    UPDATE_PENDING(3),
    UPDATE_FAILED(4),
    CLOSED(5),
    CLOSE_PENDING(6),
    CLOSE_FAILED(7),
    RESOLVED(8),
    RESOLVE_PENDING(9),
    RESOLVE_FAILED(10),
    CANCELLED(11),
    CANCEL_PENDING(12),
    CANCEL_FAILED(13);

    private final int m_value;

    TroubleTicketState(int value) {
        m_value = value;
    }
    
    public int getValue() {
        return this.m_value;
    }

}

@@ -1495,27 +1495,8 @@
 /a%3E%0A
- * @version $Id: $%0A
  */%0A
@@ -1601,28 +1601,24 @@
 ll BREAK */%0A
-    
 %0A    /* TODO
@@ -2013,281 +2013,1172 @@
  */%0A
+%0A
     
-%0A    OPEN(0),%0A    CREATE_PENDING(1),%0A    CREATE_FAILED(2),%0A    UPDATE_PENDING(3),%0A    UPDATE_FAILED(4),%0A    CLOSED(5),%0A    CLOSE_PENDING(6),%0A    CLOSE_FAILED(7),%0A    RESOLVED(8),%0A    RESOLVE_PENDING(9),%0A    RESOLVE_FAILED(10),%0A    CANCELLED(11),%0A    CANCEL_PENDING(12),
+/** Trouble ticket is currently open */%0A    OPEN(0),%0A%0A    /** Trouble ticket is being created */%0A    CREATE_PENDING(1),%0A%0A    /** Trouble ticket creation has failed */%0A    CREATE_FAILED(2),%0A%0A    /** Trouble ticket is pending an update from the remote helpdesk system */%0A    UPDATE_PENDING(3),%0A%0A    /** Updating ticket state from the remote helpdesk system failed */%0A    UPDATE_FAILED(4),%0A%0A    /** Trouble ticket has been closed */%0A    CLOSED(5),%0A%0A    /** Trouble ticket is pending closure in the remote helpdesk system */%0A    CLOSE_PENDING(6),%0A%0A    /** An attempt to mark the ticket closed in the remote helpdesk system has failed */%0A    CLOSE_FAILED(7),%0A%0A    /** Trouble ticket has been resolved */%0A    RESOLVED(8),%0A%0A    /** Trouble ticket is in the process of being marked resolved */%0A    RESOLVE_PENDING(9),%0A%0A    /** Resolving ticket in the remote helpdesk system has failed */%0A    RESOLVE_FAILED(10),%0A%0A    /** Trouble ticket has been cancelled */%0A    CANCELLED(11),%0A%0A    /** Trouble ticket is in the process of being marked as cancelled */%0A    CANCEL_PENDING(12),%0A%0A    /** An attempt to mark the ticket cancelled in the remote helpdesk system has failed */
 %0A   
@@ -3297,20 +3297,16 @@
 ;%0A    %7D%0A
-    
 %0A    pub

document the various trouble ticket states