View Javadoc
1   /**
2    *
3    */
4   package fr.paris.lutece.plugins.dila.business.enums;
5   
6   
7   /**
8    *
9    */
10  public enum AudienceCategoryEnum
11  {INDIVIDUALS( 1L, "Particuliers" ),
12      ASSOCIATIONS( 2L, "Associations" ),
13      PROFESSIONNALS( 3L, "Professionnels" );
14  
15      private Long _lId;
16      private String _strLabel;
17  
18      /**
19       * Constructor
20       * @param lId the id
21       * @param strLabel the label
22       */
23      private AudienceCategoryEnum( Long lId, String strLabel )
24      {
25          this._lId = lId;
26          this._strLabel = strLabel;
27      }
28  
29      /**
30       * Get the enum from its id
31       * @param lId the id to search
32       * @return the corresponding enum
33       */
34      public static AudienceCategoryEnum fromId( Long lId )
35      {
36          for ( AudienceCategoryEnum e : AudienceCategoryEnum.values(  ) )
37          {
38              if ( e.getId(  ).equals( lId ) )
39              {
40                  return e;
41              }
42          }
43  
44          return null;
45      }
46  
47      /**
48       * @return the _lId
49       */
50      public Long getId(  )
51      {
52          return _lId;
53      }
54  
55      /**
56       * @return the _strLabel
57       */
58      public String getLabel(  )
59      {
60          return _strLabel;
61      }
62  
63      /**
64       * Get the enum from its label
65       * @param strLabel the label
66       * @return the corresponding enum, null if not found
67       */
68      public static AudienceCategoryEnum fromLabel( String strLabel )
69      {
70          for ( AudienceCategoryEnum e : AudienceCategoryEnum.values(  ) )
71          {
72              if ( e.getLabel(  ).equalsIgnoreCase( strLabel ) )
73              {
74                  return e;
75              }
76          }
77  
78          return null;
79      }
80  }