View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.data.provider.annotation;
17  
18  /**
19   * Defines different context(s) for serialization in Rice.
20   *
21   * @author Kuali Rice Team (rice.collab@kuali.org)
22   */
23  public enum SerializationContext {
24  
25      /**
26       * Matches all the other contexts defined in {@link SerializationContext}.
27       */
28      ALL,
29  
30      /**
31       * The context for serializing within the maintenance document framework.
32       */
33      MAINTENANCE;
34  
35  // TODO: implement respect for @Serialized in workflow doc serialization
36  //    /**
37  //     * The context for serializing to workflow document contents.
38  //     */
39  //    WORKFLOW;
40  
41      /**
42       * Does the given array of serializationContexts match this one?
43       *
44       * <p>Either an exact match, or SerializationContext.ALL will suffice</p>
45       *
46       * @param serializationContexts the serializationContexts to test against
47       * @return true if there is a matching context
48       */
49      public boolean matches(SerializationContext [] serializationContexts) {
50          if (serializationContexts != null) for (SerializationContext serializationContext : serializationContexts) {
51              if (serializationContext == this || serializationContext == SerializationContext.ALL) {
52                  return true;
53              }
54          }
55  
56          return false;
57      }
58  }