View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 3 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, see
18   * <http://www.gnu.org/licenses/>.
19   */
20  
21  package org.jumpmind.symmetric.model;
22  
23  import org.jumpmind.symmetric.util.ICoded;
24  
25  /***
26   * {@link TriggerHistory}
27   * 
28   * @author chenson
29   */
30  public enum TriggerReBuildReason implements ICoded {
31  
32      NEW_TRIGGERS("N"), TABLE_SCHEMA_CHANGED("S"), TABLE_SYNC_CONFIGURATION_CHANGED("C"), FORCED("F"), TRIGGERS_MISSING(
33              "T");
34  
35      private String code;
36  
37      TriggerReBuildReason(String code) {
38          this.code = code;
39      }
40  
41      public String getCode() {
42          return this.code;
43      }
44  
45      public static TriggerReBuildReason fromCode(String code) {
46          if (code != null && code.length() > 0) {
47              if (code.equals(NEW_TRIGGERS.code)) {
48                  return NEW_TRIGGERS;
49              } else if (code.equals(TABLE_SCHEMA_CHANGED.code)) {
50                  return TABLE_SCHEMA_CHANGED;
51              } else if (code.equals(TABLE_SYNC_CONFIGURATION_CHANGED.code)) {
52                  return TABLE_SYNC_CONFIGURATION_CHANGED;
53              } else if (code.equals(FORCED.code)) {
54                  return FORCED;
55              }
56          }
57          return null;
58      }
59  
60  }