fix installed and assigned distribution set setting on the proxy target

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-04-29 12:57:25 +02:00
parent 59bec04c58
commit a946f51da4

View File

@@ -134,22 +134,21 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
prxyTarget.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(targ)); prxyTarget.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(targ));
prxyTarget.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(targ)); prxyTarget.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(targ));
if (pinnedDistId == null) { final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId());
prxyTarget.setInstalledDistributionSet(null); final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
prxyTarget.setAssignedDistributionSet(null); final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet();
} else { prxyTarget.setInstalledDistributionSet(installedDistributionSet);
final Target target = getTargetManagement().findTargetByControllerIDWithDetails(targ.getControllerId()); prxyTarget.setAssignedDistributionSet(assignedDistributionSet);
final DistributionSet installedDistributionSet = target.getTargetInfo().getInstalledDistributionSet();
if (installedDistributionSet != null) {
prxyTarget.setInstalledDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion( prxyTarget.setInstalledDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
installedDistributionSet.getName(), installedDistributionSet.getVersion())); installedDistributionSet.getName(), installedDistributionSet.getVersion()));
prxyTarget.setInstalledDistributionSet(installedDistributionSet); }
final DistributionSet assignedDistributionSet = target.getAssignedDistributionSet(); if (assignedDistributionSet != null) {
prxyTarget.setAssignedDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion( prxyTarget.setAssignedDistNameVersion(HawkbitCommonUtil.getFormattedNameVersion(
assignedDistributionSet.getName(), assignedDistributionSet.getVersion())); assignedDistributionSet.getName(), assignedDistributionSet.getVersion()));
prxyTarget.setAssignedDistributionSet(assignedDistributionSet);
} }
prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus()); prxyTarget.setUpdateStatus(targ.getTargetInfo().getUpdateStatus());
prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery()); prxyTarget.setLastTargetQuery(targ.getTargetInfo().getLastTargetQuery());
prxyTarget.setTargetInfo(targ.getTargetInfo()); prxyTarget.setTargetInfo(targ.getTargetInfo());