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