1
22
23 package com.liferay.portal.model;
24
25 import java.io.Serializable;
26
27
33 public class PermissionDisplay
34 implements Comparable<PermissionDisplay>, 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(PermissionDisplay permissionDisplay) {
84 int value = getPortletLabel().compareTo(
85 permissionDisplay.getPortletLabel());
86
87 if (value == 0) {
88 value = getModelLabel().compareTo(
89 permissionDisplay.getModelLabel());
90
91 if (value == 0) {
92 value = getActionLabel().compareTo(
93 permissionDisplay.getActionLabel());
94 }
95 }
96
97 return value;
98 }
99
100 public boolean equals(Object obj) {
101 if (obj == null) {
102 return false;
103 }
104
105 if (!(obj instanceof PermissionDisplay)) {
106 return false;
107 }
108
109 PermissionDisplay permissionDisplay = (PermissionDisplay)obj;
110
111 if (_portletName.equals(permissionDisplay.getPortletName()) &&
112 _modelName.equals(permissionDisplay.getModelName()) &&
113 _actionId.equals(permissionDisplay.getActionId())) {
114
115 return true;
116 }
117 else {
118 return false;
119 }
120 }
121
122 private Permission _permission;
123 private Resource _resource;
124 private String _portletName;
125 private String _portletLabel;
126 private String _modelName;
127 private String _modelLabel;
128 private String _actionId;
129 private String _actionLabel;
130
131 }