001
014
015 package com.liferay.portal.model;
016
017 import java.io.Serializable;
018
019
023 public class PermissionDisplay
024 implements Comparable<PermissionDisplay>, Serializable {
025
026 public PermissionDisplay(
027 Permission permission, Resource resource, String portletName,
028 String portletLabel, String modelName, String modelLabel,
029 String actionId, String actionLabel) {
030
031 _permission = permission;
032 _resource = resource;
033 _portletName = portletName;
034 _portletLabel = portletLabel;
035 _modelName = modelName;
036 _modelLabel = modelLabel;
037 _actionId = actionId;
038 _actionLabel = actionLabel;
039 }
040
041 public Permission getPermission() {
042 return _permission;
043 }
044
045 public Resource getResource() {
046 return _resource;
047 }
048
049 public String getPortletName() {
050 return _portletName;
051 }
052
053 public String getPortletLabel() {
054 return _portletLabel;
055 }
056
057 public String getModelName() {
058 return _modelName;
059 }
060
061 public String getModelLabel() {
062 return _modelLabel;
063 }
064
065 public String getActionId() {
066 return _actionId;
067 }
068
069 public String getActionLabel() {
070 return _actionLabel;
071 }
072
073 public int compareTo(PermissionDisplay permissionDisplay) {
074 int value = getPortletLabel().compareTo(
075 permissionDisplay.getPortletLabel());
076
077 if (value == 0) {
078 value = getModelLabel().compareTo(
079 permissionDisplay.getModelLabel());
080
081 if (value == 0) {
082 value = getActionLabel().compareTo(
083 permissionDisplay.getActionLabel());
084 }
085 }
086
087 return value;
088 }
089
090 public boolean equals(Object obj) {
091 if (obj == null) {
092 return false;
093 }
094
095 if (!(obj instanceof PermissionDisplay)) {
096 return false;
097 }
098
099 PermissionDisplay permissionDisplay = (PermissionDisplay)obj;
100
101 if (_portletName.equals(permissionDisplay.getPortletName()) &&
102 _modelName.equals(permissionDisplay.getModelName()) &&
103 _actionId.equals(permissionDisplay.getActionId())) {
104
105 return true;
106 }
107 else {
108 return false;
109 }
110 }
111
112 public int hashCode() {
113 return _portletName.concat(_modelName).concat(_actionId).hashCode();
114 }
115
116 private Permission _permission;
117 private Resource _resource;
118 private String _portletName;
119 private String _portletLabel;
120 private String _modelName;
121 private String _modelLabel;
122 private String _actionId;
123 private String _actionLabel;
124
125 }