Skip to content

Commit

Permalink
Minor NPE and wrapper fix
Browse files Browse the repository at this point in the history
1. NPE wrong type send.
2. Hide unnecessary field.
  • Loading branch information
tchrapovic committed Sep 19, 2023
1 parent 315f3cb commit e5ee5a1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,11 @@ public void populateItem(Item<ICellPopulator<SelectableBean<RoleAnalysisSessionT
&& value.getSessionStatistic() != null
&& value.getSessionStatistic().getMeanDensity() != null) {

Double density = value.getSessionStatistic().getMeanDensity();
String meanDensity = new DecimalFormat("#.###")
.format(Math.round(value.getSessionStatistic().getMeanDensity() * 1000.0) / 1000.0);
.format(Math.round(density * 1000.0) / 1000.0);

String colorClass = densityBasedColor(meanDensity);
String colorClass = densityBasedColor(density);

Label label = new Label(componentId, meanDensity + " (%)");
label.setOutputMarkupId(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,11 @@ public void populateItem(Item<ICellPopulator<SelectableBean<RoleAnalysisClusterT
&& value.getClusterStatistics() != null
&& value.getClusterStatistics().getMembershipDensity() != null) {
AnalysisClusterStatisticType clusterStatistics = model.getObject().getValue().getClusterStatistics();
Double density = clusterStatistics.getMembershipDensity();
String pointsDensity = String.format("%.3f",
clusterStatistics.getMembershipDensity());
density);

String colorClass = densityBasedColor(pointsDensity);
String colorClass = densityBasedColor(density);

Label label = new Label(componentId, pointsDensity + " (%)");
label.setOutputMarkupId(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ protected void onInitialize() {
@Override
protected ItemVisibilityHandler getVisibilityHandler() {
return wrapper -> {
if (wrapper.getItemName().equals(RoleAnalysisSessionType.F_LIFECYCLE_STATE)
|| wrapper.getItemName().equals(RoleAnalysisSessionType.F_INDESTRUCTIBLE)
|| wrapper.getItemName().equivalent(RoleAnalysisSessionType.F_PROCESS_MODE)) {
return ItemVisibility.HIDDEN;
if (wrapper.getItemName().equals(RoleAnalysisSessionType.F_NAME)
|| wrapper.getItemName().equals(RoleAnalysisSessionType.F_DOCUMENTATION)
|| wrapper.getItemName().equivalent(RoleAnalysisSessionType.F_DESCRIPTION)) {
return ItemVisibility.AUTO;
}

return ItemVisibility.AUTO;
return ItemVisibility.HIDDEN;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

public class RoleAnalysisTableTools {

public static String densityBasedColor(String density) {
double densityValue = Double.parseDouble(density);
public static String densityBasedColor(double density) {
double densityValue = density;

if (densityValue >= 60) {
return "bg-success text-center";
Expand Down

0 comments on commit e5ee5a1

Please sign in to comment.