1 package org.jbpm.context.def; 2 3 import java.io.Serializable ; 4 5 12 public class VariableAccess implements Serializable { 13 14 private static final long serialVersionUID = 1L; 15 16 long id = 0; 17 protected String variableName = null; 18 protected String access = null; 19 protected String mappedName = null; 20 21 23 public VariableAccess() { 24 } 25 26 public VariableAccess(String variableName, String access, String mappedName) { 27 this.variableName = variableName; 28 if (access!=null) access = access.toLowerCase(); 29 this.access = access; 30 this.mappedName = mappedName; 31 } 32 33 35 39 public String getMappedName() { 40 if (mappedName==null) { 41 return variableName; 42 } 43 return mappedName; 44 } 45 46 49 public String getAccess() { 50 return access; 51 } 52 public String getVariableName() { 53 return variableName; 54 } 55 56 public boolean isReadable() { 57 return hasAccess("read"); 58 } 59 60 public boolean isWritable() { 61 return hasAccess("write"); 62 } 63 64 public boolean isRequired() { 65 return hasAccess("required"); 66 } 67 68 71 public boolean hasAccess(String accessLiteral) { 72 if (access==null) return false; 73 return (access.indexOf(accessLiteral.toLowerCase())!=-1); 74 } 75 } 76 | Popular Tags |