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