Lines 79-104
Link Here
|
79 |
public static final Profile JAVA_EE_7_FULL = new Profile(6, "1.7", null, "JavaEE7Full.displayName"); |
79 |
public static final Profile JAVA_EE_7_FULL = new Profile(6, "1.7", null, "JavaEE7Full.displayName"); |
80 |
|
80 |
|
81 |
public static final Profile JAVA_EE_7_WEB = new Profile(7, "1.7", "web", "JavaEE7Web.displayName"); |
81 |
public static final Profile JAVA_EE_7_WEB = new Profile(7, "1.7", "web", "JavaEE7Web.displayName"); |
82 |
|
82 |
|
83 |
private final int order; |
83 |
private final int order; |
84 |
|
84 |
|
|
|
85 |
private final String canonicalName; |
86 |
|
87 |
private final String profileType; |
88 |
|
85 |
// cache |
89 |
// cache |
86 |
private final String propertiesString; |
90 |
private final String propertiesString; |
87 |
|
91 |
|
88 |
private final String bundleKey; |
92 |
private final String bundleKey; |
89 |
|
93 |
|
90 |
private Profile(int order, String canonicalName, String profile, String bundleKey) { |
94 |
private Profile(int order, String canonicalName, String profileType, String bundleKey) { |
91 |
this.order = order; |
95 |
this.order = order; |
|
|
96 |
this.canonicalName = canonicalName; |
97 |
this.profileType = profileType; |
92 |
this.bundleKey = bundleKey; |
98 |
this.bundleKey = bundleKey; |
93 |
|
99 |
|
94 |
StringBuilder builder = new StringBuilder(canonicalName); |
100 |
StringBuilder builder = new StringBuilder(canonicalName); |
95 |
if (profile != null) { |
101 |
if (profileType != null) { |
96 |
builder.append("-").append(profile); // NOI18N |
102 |
builder.append("-").append(profileType); // NOI18N |
97 |
} |
103 |
} |
98 |
this.propertiesString = builder.toString(); |
104 |
this.propertiesString = builder.toString(); |
99 |
} |
105 |
} |
100 |
|
106 |
|
101 |
/** |
107 |
/** |
|
|
108 |
* Finds out if the current profile version is the same or higher in comparison |
109 |
* to the one from parameter. |
110 |
* |
111 |
* @since 1.16 |
112 |
* @param profile which we are comparing with |
113 |
* @return true if the profile version is equal or higher than the given one, false otherwise |
114 |
*/ |
115 |
public boolean isEqualOrHigher(Profile profile) { |
116 |
int comparison = UI_COMPARATOR.compare(this, profile); |
117 |
if (comparison < 0) { |
118 |
// This version is lower than profile version |
119 |
return false; |
120 |
|
121 |
} else if (comparison == 0) { |
122 |
// The same version for both |
123 |
return true; |
124 |
|
125 |
} else { |
126 |
// If the canonicalName is the same value we have to differ between Web and Full profile |
127 |
if (canonicalName.equals(profile.canonicalName)) { |
128 |
boolean isThisFullProfile = isFullProfile(this); |
129 |
boolean isParamFullProfile = isFullProfile(profile); |
130 |
|
131 |
if (isThisFullProfile && isParamFullProfile) { |
132 |
// Both profiles are Java EE Full |
133 |
return true; |
134 |
} |
135 |
if (!isThisFullProfile && !isParamFullProfile) { |
136 |
// Both profiles are Java EE Web |
137 |
return true; |
138 |
} |
139 |
return false; |
140 |
} else { |
141 |
return true; |
142 |
} |
143 |
} |
144 |
} |
145 |
|
146 |
private boolean isFullProfile(Profile profile) { |
147 |
return profile.profileType == null; |
148 |
} |
149 |
|
150 |
/** |
102 |
* Returns the UI visible description of the profile. |
151 |
* Returns the UI visible description of the profile. |
103 |
* |
152 |
* |
104 |
* @return the UI visible description of the profile |
153 |
* @return the UI visible description of the profile |