Fix default isolation and auto commit (#484)

* Switch to spring/DB default isolation.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix dependency to uncommited isolation level in rollout management.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Corrected UQ checks

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Remove modifying annotation.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Disable autocommit on connection pool. Cleanups. Flush at commit.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Cleanups.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix Rollout UI performance.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Typo fixed


Signed-off-by: Dominic Schabel <dominic.schabel@bosch-si.com>

* Remove empty lines

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-04-18 08:43:38 +02:00
committed by GitHub
parent 5958d1479c
commit f99da28185
56 changed files with 300 additions and 603 deletions

View File

@@ -8,11 +8,7 @@
*/
package org.eclipse.hawkbit.ui.rollout.rollout;
import java.util.Set;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
@@ -30,99 +26,24 @@ public class ProxyRollout {
private String modifiedDate;
private Integer numberOfGroups;
private int numberOfGroups;
private Boolean isActionRecieved = Boolean.FALSE;
private Boolean isRequiredMigrationStep = Boolean.FALSE;
private String totalTargetsCount;
private RolloutRendererData rolloutRendererData;
private String discription;
private String type;
private Set<SoftwareModule> swModules;
private Long id;
private String name;
private String version;
private String description;
private DistributionSet distributionSet;
private String createdBy;
private String lastModifiedBy;
private long forcedTime;
private RolloutStatus status;
private TotalTargetCountStatus totalTargetCountStatus;
/**
* @return the isRequiredMigrationStep
*/
public Boolean getIsRequiredMigrationStep() {
return isRequiredMigrationStep;
}
/**
* @param isRequiredMigrationStep
* the isRequiredMigrationStep to set
*/
public void setIsRequiredMigrationStep(final Boolean isRequiredMigrationStep) {
this.isRequiredMigrationStep = isRequiredMigrationStep;
}
/**
* @return the discription
*/
public String getDiscription() {
return discription;
}
/**
* @param discription
* the discription to set
*/
public void setDiscription(final String discription) {
this.discription = discription;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(final String type) {
this.type = type;
}
/**
*
* @return the Set of Software modules
*/
public Set<SoftwareModule> getSwModules() {
return swModules;
}
/**
* @param swModules
* Set<SoftwareModule> to set
*/
public void setSwModules(final Set<SoftwareModule> swModules) {
this.swModules = swModules;
}
public RolloutRendererData getRolloutRendererData() {
return rolloutRendererData;
}
@@ -149,7 +70,7 @@ public class ProxyRollout {
/**
* @return the numberOfGroups
*/
public Integer getNumberOfGroups() {
public int getNumberOfGroups() {
return numberOfGroups;
}
@@ -157,7 +78,7 @@ public class ProxyRollout {
* @param numberOfGroups
* the numberOfGroups to set
*/
public void setNumberOfGroups(final Integer numberOfGroups) {
public void setNumberOfGroups(final int numberOfGroups) {
this.numberOfGroups = numberOfGroups;
}
@@ -257,14 +178,6 @@ public class ProxyRollout {
this.description = description;
}
public DistributionSet getDistributionSet() {
return distributionSet;
}
public void setDistributionSet(final DistributionSet distributionSet) {
this.distributionSet = distributionSet;
}
public String getCreatedBy() {
return createdBy;
}

View File

@@ -10,9 +10,9 @@ package org.eclipse.hawkbit.ui.rollout.rollout;
import static org.apache.commons.lang3.ArrayUtils.isEmpty;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -104,36 +104,30 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
}
private static List<ProxyRollout> getProxyRolloutList(final Slice<Rollout> rolloutBeans) {
final List<ProxyRollout> proxyRolloutList = new ArrayList<>();
for (final Rollout rollout : rolloutBeans) {
final ProxyRollout proxyRollout = new ProxyRollout();
proxyRollout.setName(rollout.getName());
proxyRollout.setDescription(rollout.getDescription());
final DistributionSet distributionSet = rollout.getDistributionSet();
proxyRollout.setDistributionSetNameVersion(
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
proxyRollout.setDistributionSet(distributionSet);
proxyRollout.setNumberOfGroups(Integer.valueOf(rollout.getRolloutGroups().size()));
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
proxyRollout.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(rollout));
proxyRollout.setLastModifiedBy(UserDetailsFormatter.loadAndFormatLastModifiedBy(rollout));
proxyRollout.setForcedTime(rollout.getForcedTime());
proxyRollout.setId(rollout.getId());
proxyRollout.setStatus(rollout.getStatus());
proxyRollout
.setRolloutRendererData(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString()));
return rolloutBeans.getContent().stream().map(RolloutBeanQuery::createProxy).collect(Collectors.toList());
}
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
proxyRollout.setType(distributionSet.getType().getName());
proxyRollout.setIsRequiredMigrationStep(distributionSet.isRequiredMigrationStep());
proxyRollout.setSwModules(distributionSet.getModules());
private static ProxyRollout createProxy(final Rollout rollout) {
final ProxyRollout proxyRollout = new ProxyRollout();
proxyRollout.setName(rollout.getName());
proxyRollout.setDescription(rollout.getDescription());
final DistributionSet distributionSet = rollout.getDistributionSet();
proxyRollout.setDistributionSetNameVersion(
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
proxyRollout.setNumberOfGroups(rollout.getRolloutGroupsCreated());
proxyRollout.setCreatedDate(SPDateTimeUtil.getFormattedDate(rollout.getCreatedAt()));
proxyRollout.setModifiedDate(SPDateTimeUtil.getFormattedDate(rollout.getLastModifiedAt()));
proxyRollout.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(rollout));
proxyRollout.setLastModifiedBy(UserDetailsFormatter.loadAndFormatLastModifiedBy(rollout));
proxyRollout.setForcedTime(rollout.getForcedTime());
proxyRollout.setId(rollout.getId());
proxyRollout.setStatus(rollout.getStatus());
proxyRollout.setRolloutRendererData(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString()));
proxyRolloutList.add(proxyRollout);
}
return proxyRolloutList;
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
return proxyRollout;
}
@Override

View File

@@ -17,7 +17,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.EntityFactory;
@@ -26,7 +25,6 @@ import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus.Status;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -84,10 +82,6 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
private static final String DELETE_OPTION = "Delete";
private static final String DS_TYPE = "type";
private static final String SW_MODULES = "swModules";
private static final String IS_REQUIRED_MIGRATION_STEP = "isRequiredMigrationStep";
private static final String ROLLOUT_RENDERER_DATA = "rolloutRendererData";
@@ -223,8 +217,6 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
protected void addContainerProperties() {
final LazyQueryContainer rolloutGridContainer = (LazyQueryContainer) getContainerDataSource();
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_NAME, String.class, "", false, false);
rolloutGridContainer.addContainerProperty(DS_TYPE, String.class, null, false, false);
rolloutGridContainer.addContainerProperty(SW_MODULES, Set.class, null, false, false);
rolloutGridContainer.addContainerProperty(ROLLOUT_RENDERER_DATA, RolloutRendererData.class, null, false, false);
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, null, false, false);
rolloutGridContainer.addContainerProperty(IS_REQUIRED_MIGRATION_STEP, boolean.class, null, false, false);
@@ -307,8 +299,6 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
@Override
protected void setColumnHeaderNames() {
getColumn(ROLLOUT_RENDERER_DATA).setHeaderCaption(i18n.getMessage("header.name"));
getColumn(DS_TYPE).setHeaderCaption(i18n.getMessage("header.type"));
getColumn(SW_MODULES).setHeaderCaption(i18n.getMessage("header.swmodules"));
getColumn(IS_REQUIRED_MIGRATION_STEP).setHeaderCaption(i18n.getMessage("header.migrations.step"));
getColumn(SPUILabelDefinitions.VAR_DIST_NAME_VERSION)
.setHeaderCaption(i18n.getMessage("header.distributionset"));
@@ -362,8 +352,6 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
final List<Object> columnList = new ArrayList<>();
columnList.add(ROLLOUT_RENDERER_DATA);
columnList.add(SPUILabelDefinitions.VAR_DIST_NAME_VERSION);
columnList.add(DS_TYPE);
columnList.add(SW_MODULES);
columnList.add(IS_REQUIRED_MIGRATION_STEP);
columnList.add(SPUILabelDefinitions.VAR_STATUS);
columnList.add(SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS);
@@ -400,8 +388,6 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
columnsToBeHidden.add(SPUILabelDefinitions.VAR_MODIFIED_BY);
columnsToBeHidden.add(SPUILabelDefinitions.VAR_DESC);
columnsToBeHidden.add(IS_REQUIRED_MIGRATION_STEP);
columnsToBeHidden.add(DS_TYPE);
columnsToBeHidden.add(SW_MODULES);
for (final Object propertyId : columnsToBeHidden) {
getColumn(propertyId).setHidden(true);
}
@@ -561,51 +547,11 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
description = ((RolloutRendererData) cell.getProperty().getValue()).getName();
} else if (SPUILabelDefinitions.VAR_TOTAL_TARGETS_COUNT_STATUS.equals(cell.getPropertyId())) {
description = getTooltip(((TotalTargetCountStatus) cell.getValue()).getStatusTotalCountMap());
} else if (SPUILabelDefinitions.VAR_DIST_NAME_VERSION.equals(cell.getPropertyId())) {
description = getDSDetails(cell.getItem());
}
return description;
}
private static String getDSDetails(final Item rolloutItem) {
final StringBuilder swModuleNames = new StringBuilder();
final StringBuilder swModuleVendors = new StringBuilder();
@SuppressWarnings("unchecked")
final Set<SoftwareModule> swModules = (Set<SoftwareModule>) rolloutItem.getItemProperty(SW_MODULES).getValue();
swModules.forEach(swModule -> {
swModuleNames.append(swModule.getName());
swModuleNames.append(" , ");
swModuleVendors.append(swModule.getVendor());
swModuleVendors.append(" , ");
});
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(HawkbitCommonUtil.HTML_UL_OPEN_TAG);
stringBuilder.append(HawkbitCommonUtil.HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Description : ")
.append((String) rolloutItem.getItemProperty(SPUILabelDefinitions.VAR_DESC).getValue());
stringBuilder.append(HawkbitCommonUtil.HTML_LI_CLOSE_TAG);
stringBuilder.append(HawkbitCommonUtil.HTML_LI_OPEN_TAG);
stringBuilder.append(" DistributionSet Type : ")
.append((String) rolloutItem.getItemProperty(DS_TYPE).getValue());
stringBuilder.append(HawkbitCommonUtil.HTML_LI_CLOSE_TAG);
stringBuilder.append(HawkbitCommonUtil.HTML_LI_OPEN_TAG);
stringBuilder.append("Required Migration step : ")
.append((boolean) rolloutItem.getItemProperty(IS_REQUIRED_MIGRATION_STEP).getValue() ? "Yes" : "No");
stringBuilder.append(HawkbitCommonUtil.HTML_LI_CLOSE_TAG);
stringBuilder.append(HawkbitCommonUtil.HTML_LI_OPEN_TAG);
stringBuilder.append("SoftWare Modules : ").append(swModuleNames.toString());
stringBuilder.append(HawkbitCommonUtil.HTML_LI_CLOSE_TAG);
stringBuilder.append(HawkbitCommonUtil.HTML_LI_OPEN_TAG);
stringBuilder.append("Vendor(s) : ").append(swModuleVendors.toString());
stringBuilder.append(HawkbitCommonUtil.HTML_LI_CLOSE_TAG);
stringBuilder.append(HawkbitCommonUtil.HTML_UL_CLOSE_TAG);
return stringBuilder.toString();
}
private static class RollouStatusCellStyleGenerator implements CellStyleGenerator {
private static final List<RolloutStatus> DELETE_COPY_BUTTON_ENABLED = Arrays.asList(RolloutStatus.CREATING,

View File

@@ -15,6 +15,7 @@ import static org.springframework.data.domain.Sort.Direction.DESC;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
import org.eclipse.hawkbit.repository.RolloutManagement;
@@ -113,38 +114,34 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
}
private List<ProxyRolloutGroup> getProxyRolloutGroupList(final List<RolloutGroup> rolloutGroupBeans) {
final List<ProxyRolloutGroup> proxyRolloutGroupsList = new ArrayList<>();
for (final RolloutGroup rolloutGroup : rolloutGroupBeans) {
final ProxyRolloutGroup proxyRolloutGroup = new ProxyRolloutGroup();
proxyRolloutGroup.setName(rolloutGroup.getName());
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
proxyRolloutGroup.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(rolloutGroup));
proxyRolloutGroup.setLastModifiedBy(UserDetailsFormatter.loadAndFormatLastModifiedBy(rolloutGroup));
proxyRolloutGroup.setId(rolloutGroup.getId());
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
proxyRolloutGroup.setErrorActionExp(rolloutGroup.getErrorActionExp());
proxyRolloutGroup.setErrorCondition(rolloutGroup.getErrorCondition());
proxyRolloutGroup.setErrorConditionExp(rolloutGroup.getErrorConditionExp());
proxyRolloutGroup.setSuccessCondition(rolloutGroup.getSuccessCondition());
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
proxyRolloutGroup.setFinishedPercentage(calculateFinishedPercentage(rolloutGroup));
proxyRolloutGroup.setRolloutRendererData(new RolloutRendererData(rolloutGroup.getName(), null));
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
proxyRolloutGroupsList.add(proxyRolloutGroup);
}
return proxyRolloutGroupsList;
return rolloutGroupBeans.stream().map(RolloutGroupBeanQuery::createProxy).collect(Collectors.toList());
}
private String calculateFinishedPercentage(final RolloutGroup rolloutGroup) {
return HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup, getRolloutManagement()
.getFinishedPercentForRunningGroup(rolloutGroup.getRollout().getId(), rolloutGroup.getId()));
private static ProxyRolloutGroup createProxy(final RolloutGroup rolloutGroup) {
final ProxyRolloutGroup proxyRolloutGroup = new ProxyRolloutGroup();
proxyRolloutGroup.setName(rolloutGroup.getName());
proxyRolloutGroup.setDescription(rolloutGroup.getDescription());
proxyRolloutGroup.setCreatedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getCreatedAt()));
proxyRolloutGroup.setModifiedDate(SPDateTimeUtil.getFormattedDate(rolloutGroup.getLastModifiedAt()));
proxyRolloutGroup.setCreatedBy(UserDetailsFormatter.loadAndFormatCreatedBy(rolloutGroup));
proxyRolloutGroup.setLastModifiedBy(UserDetailsFormatter.loadAndFormatLastModifiedBy(rolloutGroup));
proxyRolloutGroup.setId(rolloutGroup.getId());
proxyRolloutGroup.setStatus(rolloutGroup.getStatus());
proxyRolloutGroup.setErrorAction(rolloutGroup.getErrorAction());
proxyRolloutGroup.setErrorActionExp(rolloutGroup.getErrorActionExp());
proxyRolloutGroup.setErrorCondition(rolloutGroup.getErrorCondition());
proxyRolloutGroup.setErrorConditionExp(rolloutGroup.getErrorConditionExp());
proxyRolloutGroup.setSuccessCondition(rolloutGroup.getSuccessCondition());
proxyRolloutGroup.setSuccessConditionExp(rolloutGroup.getSuccessConditionExp());
proxyRolloutGroup.setFinishedPercentage(HawkbitCommonUtil.formattingFinishedPercentage(rolloutGroup,
rolloutGroup.getTotalTargetCountStatus().getFinishedPercent()));
proxyRolloutGroup.setRolloutRendererData(new RolloutRendererData(rolloutGroup.getName(), null));
proxyRolloutGroup.setTotalTargetsCount(String.valueOf(rolloutGroup.getTotalTargets()));
proxyRolloutGroup.setTotalTargetCountStatus(rolloutGroup.getTotalTargetCountStatus());
return proxyRolloutGroup;
}
@Override