01: /*
02: * JBoss, Home of Professional Open Source
03: * Copyright 2005, JBoss Inc., and individual contributors as indicated
04: * by the @authors tag. See the copyright.txt in the distribution for a
05: * full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jbpm.context.def;
23:
24: import java.io.Serializable;
25:
26: /**
27: * specifies access to a variable.
28: * Variable access is used in 3 situations:
29: * 1) process-state
30: * 2) script
31: * 3) task controllers
32: */
33: public class VariableAccess implements Serializable {
34:
35: private static final long serialVersionUID = 1L;
36:
37: long id = 0;
38: protected String variableName = null;
39: protected Access access = null;
40: protected String mappedName = null;
41:
42: // constructors /////////////////////////////////////////////////////////////
43:
44: public VariableAccess() {
45: }
46:
47: public VariableAccess(String variableName, String access,
48: String mappedName) {
49: this .variableName = variableName;
50: if (access != null)
51: access = access.toLowerCase();
52: this .access = new Access(access);
53: this .mappedName = mappedName;
54: }
55:
56: // getters and setters //////////////////////////////////////////////////////
57:
58: /**
59: * the mapped name. The mappedName defaults to the variableName in case
60: * no mapped name is specified.
61: */
62: public String getMappedName() {
63: if (mappedName == null) {
64: return variableName;
65: }
66: return mappedName;
67: }
68:
69: /**
70: * specifies a comma separated list of access literals {read, write, required}.
71: */
72: public Access getAccess() {
73: return access;
74: }
75:
76: public String getVariableName() {
77: return variableName;
78: }
79:
80: public boolean isReadable() {
81: return access.isReadable();
82: }
83:
84: public boolean isWritable() {
85: return access.isWritable();
86: }
87:
88: public boolean isRequired() {
89: return access.isRequired();
90: }
91:
92: public boolean isLock() {
93: return access.isLock();
94: }
95: }
|