From: <rm...@hy...> - 2008-04-02 21:30:48
|
Author: rmorgan Date: 2008-04-02 14:30:42 -0700 (Wed, 02 Apr 2008) New Revision: 8657 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=8657 Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceType.java Log: Add helper method getAppdefType() to convert from Authz type to Appdef type. Modified: trunk/src/org/hyperic/hq/authz/server/session/ResourceType.java =================================================================== --- trunk/src/org/hyperic/hq/authz/server/session/ResourceType.java 2008-04-02 21:29:57 UTC (rev 8656) +++ trunk/src/org/hyperic/hq/authz/server/session/ResourceType.java 2008-04-02 21:30:42 UTC (rev 8657) @@ -35,6 +35,7 @@ import org.hyperic.hq.authz.shared.AuthzConstants; import org.hyperic.hq.authz.shared.ResourceTypeValue; +import org.hyperic.hq.appdef.shared.AppdefEntityConstants; public class ResourceType extends AuthzNamedBean { private static final Map TYPE_TO_PROP = new HashMap(); @@ -91,8 +92,7 @@ } Operation createOperation(String name) { - Operation res = new Operation(this, name); - return res; + return new Operation(this, name); } public Collection getOperations() { @@ -100,6 +100,24 @@ } /** + * Convert an authz ResourceType to appdef type. Currently only platform + * server and service types are supported. + * @return One of AppdefEntityConstants.APPDEF_TYPE* + */ + public int getAppdefType() { + if (getId().equals(AuthzConstants.authzPlatform)) { + return AppdefEntityConstants.APPDEF_TYPE_PLATFORM; + } else if (getId().equals(AuthzConstants.authzServer)) { + return AppdefEntityConstants.APPDEF_TYPE_SERVER; + } else if (getId().equals(AuthzConstants.authzService)) { + return AppdefEntityConstants.APPDEF_TYPE_SERVICE; + } else { + throw new IllegalArgumentException("ResourceType " + getId() + + " not supported"); + } + } + + /** * @deprecated use (this) ResourceType instead */ public ResourceTypeValue getResourceTypeValue() { |