1 31 32 package org.opencms.db; 33 34 import org.opencms.main.CmsIllegalArgumentException; 35 36 import java.io.Serializable ; 37 import java.util.Arrays ; 38 import java.util.Collections ; 39 import java.util.Iterator ; 40 import java.util.List ; 41 42 61 public final class CmsProjectResourcesDisplayMode implements Serializable { 62 63 64 private static final long serialVersionUID = 923124162399716633L; 65 66 67 public static final CmsProjectResourcesDisplayMode ALL_CHANGES = new CmsProjectResourcesDisplayMode("all"); 68 69 70 public static final CmsProjectResourcesDisplayMode DELETED_FILES = new CmsProjectResourcesDisplayMode("deleted"); 71 72 73 public static final CmsProjectResourcesDisplayMode MODIFIED_FILES = new CmsProjectResourcesDisplayMode("changed"); 74 75 76 public static final CmsProjectResourcesDisplayMode NEW_FILES = new CmsProjectResourcesDisplayMode("new"); 77 78 79 private static final CmsProjectResourcesDisplayMode[] VALUE_ARRAY = { 80 ALL_CHANGES, 81 NEW_FILES, 82 DELETED_FILES, 83 MODIFIED_FILES}; 84 85 86 public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUE_ARRAY)); 87 88 89 private final String m_mode; 90 91 96 private CmsProjectResourcesDisplayMode(String mode) { 97 98 m_mode = mode; 99 } 100 101 111 public static CmsProjectResourcesDisplayMode valueOf(String value) throws CmsIllegalArgumentException { 112 113 Iterator iter = VALUES.iterator(); 114 while (iter.hasNext()) { 115 CmsProjectResourcesDisplayMode target = (CmsProjectResourcesDisplayMode)iter.next(); 116 if (value.equals(target.getMode())) { 117 return target; 118 } 119 } 120 throw new CmsIllegalArgumentException(Messages.get().container( 121 Messages.ERR_MODE_ENUM_PARSE_2, 122 value, 123 CmsProjectResourcesDisplayMode.class.getName())); 124 } 125 126 131 public String getMode() { 132 133 return m_mode; 134 } 135 136 139 public String toString() { 140 141 return m_mode; 142 } 143 } | Popular Tags |