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