1
22
23 package com.liferay.portal.model;
24
25 import java.io.Serializable;
26
27
34 public class PermissionDisplay implements Comparable, Serializable {
35
36 public PermissionDisplay(
37 Permission permission, Resource resource, String portletName,
38 String portletLabel, String modelName, String modelLabel,
39 String actionId, String actionLabel) {
40
41 _permission = permission;
42 _resource = resource;
43 _portletName = portletName;
44 _portletLabel = portletLabel;
45 _modelName = modelName;
46 _modelLabel = modelLabel;
47 _actionId = actionId;
48 _actionLabel = actionLabel;
49 }
50
51 public Permission getPermission() {
52 return _permission;
53 }
54
55 public Resource getResource() {
56 return _resource;
57 }
58
59 public String getPortletName() {
60 return _portletName;
61 }
62
63 public String getPortletLabel() {
64 return _portletLabel;
65 }
66
67 public String getModelName() {
68 return _modelName;
69 }
70
71 public String getModelLabel() {
72 return _modelLabel;
73 }
74
75 public String getActionId() {
76 return _actionId;
77 }
78
79 public String getActionLabel() {
80 return _actionLabel;
81 }
82
83 public int compareTo(Object obj) {
84 if (obj == null) {
85 return -1;
86 }
87
88 PermissionDisplay permissionDisplay = (PermissionDisplay)obj;
89
90 int value = getPortletLabel().compareTo(
91 permissionDisplay.getPortletLabel());
92
93 if (value == 0) {
94 value = getModelLabel().compareTo(
95 permissionDisplay.getModelLabel());
96
97 if (value == 0) {
98 value = getActionLabel().compareTo(
99 permissionDisplay.getActionLabel());
100 }
101 }
102
103 return value;
104 }
105
106 public boolean equals(Object obj) {
107 if (obj == null) {
108 return false;
109 }
110
111 if (!(obj instanceof PermissionDisplay)) {
112 return false;
113 }
114
115 PermissionDisplay permissionDisplay = (PermissionDisplay)obj;
116
117 if (_portletName.equals(permissionDisplay.getPortletName()) &&
118 _modelName.equals(permissionDisplay.getModelName()) &&
119 _actionId.equals(permissionDisplay.getActionId())) {
120
121 return true;
122 }
123 else {
124 return false;
125 }
126 }
127
128 private Permission _permission;
129 private Resource _resource;
130 private String _portletName;
131 private String _portletLabel;
132 private String _modelName;
133 private String _modelLabel;
134 private String _actionId;
135 private String _actionLabel;
136
137 }