View Javadoc

1   package uk.ac.ebi.intenz.domain.constants;
2   
3   /**
4    * Events for enzyme entries.
5    * @author rafalcan
6    *
7    */
8   public enum Event {
9   
10  	DELETION("DEL", "deleted"),
11  	TRANSFER("TRA", "transferred"),
12  	MODIFICATION("MOD", "modified"),
13  	CREATION("NEW", "created");
14  	
15  	/**
16  	 * Short code for the event.
17  	 */
18  	private String code;
19  	
20  	/**
21  	 * The attribute given to an enzyme entry after the event.
22  	 */
23  	private String attribute;
24  	
25  	private Event(String code, String attribute){
26  		this.code = code;
27  		this.attribute = attribute;
28  	}
29  	
30  	public Event fromCode(String code){
31  		for (Event e : Event.values()){
32  			if (e.code.equals(code)) return e;
33  		}
34  		return null;
35  	}
36  
37  	public String getCode() {
38  		return code;
39  	}
40  
41  	public String getAttribute() {
42  		return attribute;
43  	}
44  }