Changeset 2231
- Timestamp:
- 06/12/08 09:07:23
(4 months ago)
- Author:
- dsugar
- Message:
some cleanup
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1949 |
r2231 |
|
| 26 | 26 | implements INameValue, ILinkageItem |
|---|
| 27 | 27 | { |
|---|
| 28 | | protected AccessTarget accessTarget; |
|---|
| | 28 | protected AccessTarget m_accessTarget; |
|---|
| 29 | 29 | |
|---|
| 30 | | protected final Map interfaceMap = new HashMap (); |
|---|
| | 30 | protected final Map m_interfaceMap = new HashMap (); |
|---|
| 31 | 31 | |
|---|
| 32 | | private final AbstractToken token; |
|---|
| | 32 | private final AbstractToken m_token; |
|---|
| 33 | 33 | |
|---|
| 34 | | public final Map/*<String, NameValuePair<?>>*/NameValuePairs; |
|---|
| | 34 | public final Map/*<String, NameValuePair<?>>*/m_NameValuePairs; |
|---|
| 35 | 35 | |
|---|
| 36 | 36 | public Ability (Ability i_copyMe) |
|---|
| 37 | 37 | { |
|---|
| 38 | | NameValuePairs = new TreeMap/*<String, NameValuePair<?>>*/(); |
|---|
| | 38 | m_NameValuePairs = new TreeMap/*<String, NameValuePair<?>>*/(); |
|---|
| 39 | 39 | |
|---|
| 40 | | token = i_copyMe.token; |
|---|
| 41 | | accessTarget = i_copyMe.accessTarget; |
|---|
| 42 | | interfaceMap.putAll(i_copyMe.interfaceMap); |
|---|
| 43 | | NameValuePairs.putAll(i_copyMe.NameValuePairs); |
|---|
| | 40 | m_token = i_copyMe.m_token; |
|---|
| | 41 | m_accessTarget = i_copyMe.m_accessTarget; |
|---|
| | 42 | m_interfaceMap.putAll(i_copyMe.m_interfaceMap); |
|---|
| | 43 | m_NameValuePairs.putAll(i_copyMe.m_NameValuePairs); |
|---|
| 44 | 44 | } |
|---|
| 45 | 45 | |
|---|
| 46 | 46 | public Ability(AbstractToken nameToken) |
|---|
| 47 | 47 | { |
|---|
| 48 | | token = nameToken; |
|---|
| 49 | | NameValuePairs = new TreeMap/*<String, NameValuePair<?>>*/(); |
|---|
| | 48 | m_token = nameToken; |
|---|
| | 49 | m_NameValuePairs = new TreeMap/*<String, NameValuePair<?>>*/(); |
|---|
| 50 | 50 | } |
|---|
| 51 | 51 | |
|---|
| 52 | 52 | public void Erase () |
|---|
| 53 | 53 | { |
|---|
| 54 | | interfaceMap.clear (); |
|---|
| 55 | | NameValuePairs.clear (); |
|---|
| | 54 | m_interfaceMap.clear (); |
|---|
| | 55 | m_NameValuePairs.clear (); |
|---|
| 56 | 56 | } |
|---|
| 57 | 57 | |
|---|
| … | … | |
| 63 | 63 | { |
|---|
| 64 | 64 | // insert nvp into pairs map |
|---|
| 65 | | if(NameValuePairs.containsKey(pair.GetName())) |
|---|
| | 65 | if(m_NameValuePairs.containsKey(pair.GetName())) |
|---|
| 66 | 66 | { |
|---|
| 67 | 67 | return false; |
|---|
| 68 | 68 | } |
|---|
| 69 | 69 | |
|---|
| 70 | | NameValuePairs.put(pair.GetName(), pair); |
|---|
| | 70 | m_NameValuePairs.put(pair.GetName(), pair); |
|---|
| 71 | 71 | return true; |
|---|
| 72 | 72 | } |
|---|
| … | … | |
| 78 | 78 | public NameValuePair /*<?>*/GetNameValuePair(String name) |
|---|
| 79 | 79 | { |
|---|
| 80 | | return (NameValuePair) NameValuePairs.get(name); |
|---|
| | 80 | return (NameValuePair) m_NameValuePairs.get(name); |
|---|
| 81 | 81 | } |
|---|
| 82 | 82 | |
|---|
| … | … | |
| 87 | 87 | public Map/*<String, NameValuePair<?>>*/GetNameValuePairs() |
|---|
| 88 | 88 | { |
|---|
| 89 | | return NameValuePairs; |
|---|
| | 89 | return m_NameValuePairs; |
|---|
| 90 | 90 | } |
|---|
| 91 | 91 | |
|---|
| … | … | |
| 98 | 98 | public boolean addAccessTarget(AccessTarget target) |
|---|
| 99 | 99 | { |
|---|
| 100 | | if(target.getTargetName().intValue() == Target.self) |
|---|
| | 100 | if (target.getTargetName().intValue() == Target.self) |
|---|
| 101 | 101 | { |
|---|
| 102 | | accessTarget = target; |
|---|
| | 102 | m_accessTarget = target; |
|---|
| 103 | 103 | return true; |
|---|
| 104 | 104 | } |
|---|
| … | … | |
| 113 | 113 | public Map GetPermVectors() |
|---|
| 114 | 114 | { |
|---|
| 115 | | if (accessTarget == null) |
|---|
| | 115 | if (m_accessTarget == null) |
|---|
| 116 | 116 | return null; |
|---|
| 117 | 117 | |
|---|
| 118 | | return accessTarget.GetPermVectors(); |
|---|
| | 118 | return m_accessTarget.GetPermVectors(); |
|---|
| 119 | 119 | } |
|---|
| 120 | 120 | |
|---|
| 121 | 121 | public void AddPermVector (PermVector i_permission) |
|---|
| 122 | 122 | { |
|---|
| 123 | | accessTarget.AddPermVector (i_permission); |
|---|
| | 123 | if (m_accessTarget == null) |
|---|
| | 124 | m_accessTarget = new AccessTarget(new Integer (Target.self)); |
|---|
| | 125 | |
|---|
| | 126 | m_accessTarget.AddPermVector (i_permission); |
|---|
| 124 | 127 | } |
|---|
| 125 | | |
|---|
| 126 | | /** |
|---|
| 127 | | * Test BaseAccessDefn for validity. |
|---|
| 128 | | * |
|---|
| 129 | | * @return <code>true</code> if definition is valid. |
|---|
| 130 | | */ |
|---|
| 131 | | /* |
|---|
| 132 | | final boolean Validate() |
|---|
| 133 | | { |
|---|
| 134 | | boolean valid = true; |
|---|
| 135 | 128 | |
|---|
| 136 | | for (Iterator iter = accessTarget.GetPermVectors().values().iterator(); iter.hasNext(); ) |
|---|
| 137 | | { |
|---|
| 138 | | PermVector pv = (PermVector) iter.next(); |
|---|
| 139 | | if (pv.getPermissions().isEmpty()) |
|---|
| 140 | | { |
|---|
| 141 | | pv.getObjectClassToken().Error( |
|---|
| 142 | | "No permissions listed for the object class \"" |
|---|
| 143 | | + pv.getObjectClass() + "\""); |
|---|
| 144 | | valid &= false; |
|---|
| 145 | | } |
|---|
| 146 | | } |
|---|
| 147 | | return valid; |
|---|
| 148 | | } |
|---|
| 149 | | */ |
|---|
| 150 | | |
|---|
| 151 | 129 | /** |
|---|
| 152 | 130 | * Get the name of the ability |
|---|
| … | … | |
| 155 | 133 | public String getName() |
|---|
| 156 | 134 | { |
|---|
| 157 | | return token.image; |
|---|
| | 135 | return m_token.image; |
|---|
| 158 | 136 | } |
|---|
| 159 | 137 | |
|---|
| 160 | 138 | public void setName (String i_sName) |
|---|
| 161 | 139 | { |
|---|
| 162 | | token.image = i_sName; |
|---|
| | 140 | m_token.image = i_sName; |
|---|
| 163 | 141 | } |
|---|
| 164 | 142 | |
|---|
| 165 | 143 | public Map/*<String, Interface>*/getAllInterfaces() |
|---|
| 166 | 144 | { |
|---|
| 167 | | return interfaceMap; |
|---|
| | 145 | return m_interfaceMap; |
|---|
| 168 | 146 | } |
|---|
| 169 | 147 | |
|---|
| 170 | 148 | public boolean addInterface(Interface in) |
|---|
| 171 | 149 | { |
|---|
| 172 | | interfaceMap.put(in.getName(), in); |
|---|
| | 150 | m_interfaceMap.put(in.getName(), in); |
|---|
| 173 | 151 | return true; |
|---|
| 174 | 152 | } |
|---|
| … | … | |
| 176 | 154 | public Interface getInterface(String st) |
|---|
| 177 | 155 | { |
|---|
| 178 | | return (Interface) interfaceMap.get(st); |
|---|
| | 156 | return (Interface) m_interfaceMap.get(st); |
|---|
| 179 | 157 | } |
|---|
| 180 | 158 | |
|---|
| r2031 |
r2231 |
|
| 195 | 195 | { |
|---|
| 196 | 196 | if (getCastedModel ().exists()) |
|---|
| 197 | | refresh(); |
|---|
| | 197 | { |
|---|
| | 198 | if (getWidget () != null) |
|---|
| | 199 | refresh(); |
|---|
| | 200 | } |
|---|
| 198 | 201 | } |
|---|
| 199 | 202 | |
|---|
Download in other formats:
* Generating other formats may take time.