repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/LabelBuilder.java | LabelBuilder.buildLabel | public Label buildLabel() {
final Label label = createLabel();
label.setImmediate(false);
label.setWidth("-1px");
label.setHeight("-1px");
if (StringUtils.hasText(caption)) {
label.setCaption(caption);
}
return label;
} | java | public Label buildLabel() {
final Label label = createLabel();
label.setImmediate(false);
label.setWidth("-1px");
label.setHeight("-1px");
if (StringUtils.hasText(caption)) {
label.setCaption(caption);
}
return label;
} | [
"public",
"Label",
"buildLabel",
"(",
")",
"{",
"final",
"Label",
"label",
"=",
"createLabel",
"(",
")",
";",
"label",
".",
"setImmediate",
"(",
"false",
")",
";",
"label",
".",
"setWidth",
"(",
"\"-1px\"",
")",
";",
"label",
".",
"setHeight",
"(",
"\"... | Build label.
@return Label | [
"Build",
"label",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/LabelBuilder.java#L86-L96 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java | TargetTable.updateTarget | @SuppressWarnings("unchecked")
public void updateTarget(final Target updatedTarget) {
if (updatedTarget != null) {
final Item item = getItem(updatedTarget.getId());
// TO DO update SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER
// &
// SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER
/*
* Update the status which will trigger the value change lister
* registered for the target update status. That listener will
* update the new status icon showing for this target in the table.
*/
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(updatedTarget.getUpdateStatus());
/*
* Update the last query which will trigger the value change lister
* registered for the target last query column. That listener will
* update the latest query date for this target in the tooltip.
*/
item.getItemProperty(SPUILabelDefinitions.LAST_QUERY_DATE).setValue(updatedTarget.getLastTargetQuery());
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
.setValue(UserDetailsFormatter.loadAndFormatLastModifiedBy(updatedTarget));
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
.setValue(SPDateTimeUtil.getFormattedDate(updatedTarget.getLastModifiedAt()));
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(updatedTarget.getDescription());
/* Update the new Name, Description and poll date */
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(updatedTarget.getName());
}
} | java | @SuppressWarnings("unchecked")
public void updateTarget(final Target updatedTarget) {
if (updatedTarget != null) {
final Item item = getItem(updatedTarget.getId());
// TO DO update SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER
// &
// SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER
/*
* Update the status which will trigger the value change lister
* registered for the target update status. That listener will
* update the new status icon showing for this target in the table.
*/
item.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).setValue(updatedTarget.getUpdateStatus());
/*
* Update the last query which will trigger the value change lister
* registered for the target last query column. That listener will
* update the latest query date for this target in the tooltip.
*/
item.getItemProperty(SPUILabelDefinitions.LAST_QUERY_DATE).setValue(updatedTarget.getLastTargetQuery());
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY)
.setValue(UserDetailsFormatter.loadAndFormatLastModifiedBy(updatedTarget));
item.getItemProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE)
.setValue(SPDateTimeUtil.getFormattedDate(updatedTarget.getLastModifiedAt()));
item.getItemProperty(SPUILabelDefinitions.VAR_DESC).setValue(updatedTarget.getDescription());
/* Update the new Name, Description and poll date */
item.getItemProperty(SPUILabelDefinitions.VAR_NAME).setValue(updatedTarget.getName());
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"updateTarget",
"(",
"final",
"Target",
"updatedTarget",
")",
"{",
"if",
"(",
"updatedTarget",
"!=",
"null",
")",
"{",
"final",
"Item",
"item",
"=",
"getItem",
"(",
"updatedTarget",
".",
"... | To update target details in the table.
@param updatedTarget
as reference | [
"To",
"update",
"target",
"details",
"in",
"the",
"table",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java#L608-L638 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java | TargetTable.resetTargetCountDetails | private void resetTargetCountDetails() {
final long totalTargetsCount = getTotalTargetsCount();
managementUIState.setTargetsCountAll(totalTargetsCount);
final boolean noTagClicked = managementUIState.getTargetTableFilters().isNoTagSelected();
final Long distributionId = managementUIState.getTargetTableFilters().getDistributionSet()
.map(DistributionSetIdName::getId).orElse(null);
final Long pinnedDistId = managementUIState.getTargetTableFilters().getPinnedDistId().orElse(null);
final String searchText = managementUIState.getTargetTableFilters().getSearchText().map(text -> {
if (StringUtils.isEmpty(text)) {
return null;
}
return String.format("%%%s%%", text);
}).orElse(null);
String[] targetTags = null;
if (isFilteredByTags()) {
targetTags = managementUIState.getTargetTableFilters().getClickedTargetTags().toArray(new String[0]);
}
Collection<TargetUpdateStatus> status = null;
if (isFilteredByStatus()) {
status = managementUIState.getTargetTableFilters().getClickedStatusTargetTags();
}
Boolean overdueState = null;
if (managementUIState.getTargetTableFilters().isOverdueFilterEnabled()) {
overdueState = managementUIState.getTargetTableFilters().isOverdueFilterEnabled();
}
final long size = getTargetsCountWithFilter(totalTargetsCount, pinnedDistId,
new FilterParams(status, overdueState, searchText, distributionId, noTagClicked, targetTags));
if (size > SPUIDefinitions.MAX_TABLE_ENTRIES) {
managementUIState.setTargetsTruncated(size - SPUIDefinitions.MAX_TABLE_ENTRIES);
}
} | java | private void resetTargetCountDetails() {
final long totalTargetsCount = getTotalTargetsCount();
managementUIState.setTargetsCountAll(totalTargetsCount);
final boolean noTagClicked = managementUIState.getTargetTableFilters().isNoTagSelected();
final Long distributionId = managementUIState.getTargetTableFilters().getDistributionSet()
.map(DistributionSetIdName::getId).orElse(null);
final Long pinnedDistId = managementUIState.getTargetTableFilters().getPinnedDistId().orElse(null);
final String searchText = managementUIState.getTargetTableFilters().getSearchText().map(text -> {
if (StringUtils.isEmpty(text)) {
return null;
}
return String.format("%%%s%%", text);
}).orElse(null);
String[] targetTags = null;
if (isFilteredByTags()) {
targetTags = managementUIState.getTargetTableFilters().getClickedTargetTags().toArray(new String[0]);
}
Collection<TargetUpdateStatus> status = null;
if (isFilteredByStatus()) {
status = managementUIState.getTargetTableFilters().getClickedStatusTargetTags();
}
Boolean overdueState = null;
if (managementUIState.getTargetTableFilters().isOverdueFilterEnabled()) {
overdueState = managementUIState.getTargetTableFilters().isOverdueFilterEnabled();
}
final long size = getTargetsCountWithFilter(totalTargetsCount, pinnedDistId,
new FilterParams(status, overdueState, searchText, distributionId, noTagClicked, targetTags));
if (size > SPUIDefinitions.MAX_TABLE_ENTRIES) {
managementUIState.setTargetsTruncated(size - SPUIDefinitions.MAX_TABLE_ENTRIES);
}
} | [
"private",
"void",
"resetTargetCountDetails",
"(",
")",
"{",
"final",
"long",
"totalTargetsCount",
"=",
"getTotalTargetsCount",
"(",
")",
";",
"managementUIState",
".",
"setTargetsCountAll",
"(",
"totalTargetsCount",
")",
";",
"final",
"boolean",
"noTagClicked",
"=",
... | Set total target count and count of targets truncated in target table. | [
"Set",
"total",
"target",
"count",
"and",
"count",
"of",
"targets",
"truncated",
"in",
"target",
"table",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetTable.java#L774-L810 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/dd/criteria/DistributionsViewClientCriterion.java | DistributionsViewClientCriterion.createViewComponentClientCriteria | static ServerViewComponentClientCriterion[] createViewComponentClientCriteria() {
final ServerViewComponentClientCriterion[] criteria = new ServerViewComponentClientCriterion[1];
// Upload software module table acceptable components.
criteria[0] = ServerViewComponentClientCriterion.createBuilder()
.dragSourceIdPrefix(UIComponentIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE)
.dropTargetIdPrefixes(UIComponentIdProvider.DIST_TABLE_ID)
.dropAreaIds(UIComponentIdProvider.DIST_TABLE_ID).build();
return criteria;
} | java | static ServerViewComponentClientCriterion[] createViewComponentClientCriteria() {
final ServerViewComponentClientCriterion[] criteria = new ServerViewComponentClientCriterion[1];
// Upload software module table acceptable components.
criteria[0] = ServerViewComponentClientCriterion.createBuilder()
.dragSourceIdPrefix(UIComponentIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE)
.dropTargetIdPrefixes(UIComponentIdProvider.DIST_TABLE_ID)
.dropAreaIds(UIComponentIdProvider.DIST_TABLE_ID).build();
return criteria;
} | [
"static",
"ServerViewComponentClientCriterion",
"[",
"]",
"createViewComponentClientCriteria",
"(",
")",
"{",
"final",
"ServerViewComponentClientCriterion",
"[",
"]",
"criteria",
"=",
"new",
"ServerViewComponentClientCriterion",
"[",
"1",
"]",
";",
"// Upload software module ... | Configures the elements of the composite accept criterion for the
Distributions View.
@return accept criterion elements | [
"Configures",
"the",
"elements",
"of",
"the",
"composite",
"accept",
"criterion",
"for",
"the",
"Distributions",
"View",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/dd/criteria/DistributionsViewClientCriterion.java#L48-L58 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java | RolloutListGrid.onEvent | @EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final RolloutEvent event) {
switch (event) {
case FILTER_BY_TEXT:
case CREATE_ROLLOUT:
case UPDATE_ROLLOUT:
case SHOW_ROLLOUTS:
refreshContainer();
break;
default:
break;
}
} | java | @EventBusListenerMethod(scope = EventScope.UI)
void onEvent(final RolloutEvent event) {
switch (event) {
case FILTER_BY_TEXT:
case CREATE_ROLLOUT:
case UPDATE_ROLLOUT:
case SHOW_ROLLOUTS:
refreshContainer();
break;
default:
break;
}
} | [
"@",
"EventBusListenerMethod",
"(",
"scope",
"=",
"EventScope",
".",
"UI",
")",
"void",
"onEvent",
"(",
"final",
"RolloutEvent",
"event",
")",
"{",
"switch",
"(",
"event",
")",
"{",
"case",
"FILTER_BY_TEXT",
":",
"case",
"CREATE_ROLLOUT",
":",
"case",
"UPDAT... | Handles the RolloutEvent to refresh Grid. | [
"Handles",
"the",
"RolloutEvent",
"to",
"refresh",
"Grid",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java#L187-L199 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java | RolloutListGrid.onRolloutChangeEvent | @EventBusListenerMethod(scope = EventScope.UI)
public void onRolloutChangeEvent(final RolloutChangeEventContainer eventContainer) {
eventContainer.getEvents().forEach(this::handleEvent);
} | java | @EventBusListenerMethod(scope = EventScope.UI)
public void onRolloutChangeEvent(final RolloutChangeEventContainer eventContainer) {
eventContainer.getEvents().forEach(this::handleEvent);
} | [
"@",
"EventBusListenerMethod",
"(",
"scope",
"=",
"EventScope",
".",
"UI",
")",
"public",
"void",
"onRolloutChangeEvent",
"(",
"final",
"RolloutChangeEventContainer",
"eventContainer",
")",
"{",
"eventContainer",
".",
"getEvents",
"(",
")",
".",
"forEach",
"(",
"t... | Handles the RolloutChangeEvent to refresh the item in the grid.
@param eventContainer
container which holds the rollout change event | [
"Handles",
"the",
"RolloutChangeEvent",
"to",
"refresh",
"the",
"item",
"in",
"the",
"grid",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/RolloutListGrid.java#L218-L221 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/detailslayout/TargetMetadataDetailsLayout.java | TargetMetadataDetailsLayout.populateMetadata | public void populateMetadata(final Target target) {
removeAllItems();
if (target == null) {
return;
}
selectedTargetId = target.getId();
final List<TargetMetadata> targetMetadataList = targetManagement
.findMetaDataByControllerId(PageRequest.of(0, MAX_METADATA_QUERY), target.getControllerId())
.getContent();
if (targetMetadataList != null && !targetMetadataList.isEmpty()) {
targetMetadataList.forEach(this::setMetadataProperties);
}
} | java | public void populateMetadata(final Target target) {
removeAllItems();
if (target == null) {
return;
}
selectedTargetId = target.getId();
final List<TargetMetadata> targetMetadataList = targetManagement
.findMetaDataByControllerId(PageRequest.of(0, MAX_METADATA_QUERY), target.getControllerId())
.getContent();
if (targetMetadataList != null && !targetMetadataList.isEmpty()) {
targetMetadataList.forEach(this::setMetadataProperties);
}
} | [
"public",
"void",
"populateMetadata",
"(",
"final",
"Target",
"target",
")",
"{",
"removeAllItems",
"(",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"return",
";",
"}",
"selectedTargetId",
"=",
"target",
".",
"getId",
"(",
")",
";",
"final",
... | Populate target metadata.
@param target | [
"Populate",
"target",
"metadata",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/detailslayout/TargetMetadataDetailsLayout.java#L60-L72 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java | JpaRolloutManagement.scheduleRolloutGroup | private boolean scheduleRolloutGroup(final JpaRollout rollout, final JpaRolloutGroup group) {
final long targetsInGroup = rolloutTargetGroupRepository.countByRolloutGroup(group);
final long countOfActions = actionRepository.countByRolloutAndRolloutGroup(rollout, group);
long actionsLeft = targetsInGroup - countOfActions;
if (actionsLeft > 0) {
actionsLeft -= createActionsForRolloutGroup(rollout, group);
}
if (actionsLeft <= 0) {
group.setStatus(RolloutGroupStatus.SCHEDULED);
rolloutGroupRepository.save(group);
return true;
}
return false;
} | java | private boolean scheduleRolloutGroup(final JpaRollout rollout, final JpaRolloutGroup group) {
final long targetsInGroup = rolloutTargetGroupRepository.countByRolloutGroup(group);
final long countOfActions = actionRepository.countByRolloutAndRolloutGroup(rollout, group);
long actionsLeft = targetsInGroup - countOfActions;
if (actionsLeft > 0) {
actionsLeft -= createActionsForRolloutGroup(rollout, group);
}
if (actionsLeft <= 0) {
group.setStatus(RolloutGroupStatus.SCHEDULED);
rolloutGroupRepository.save(group);
return true;
}
return false;
} | [
"private",
"boolean",
"scheduleRolloutGroup",
"(",
"final",
"JpaRollout",
"rollout",
",",
"final",
"JpaRolloutGroup",
"group",
")",
"{",
"final",
"long",
"targetsInGroup",
"=",
"rolloutTargetGroupRepository",
".",
"countByRolloutGroup",
"(",
"group",
")",
";",
"final"... | Schedules a group of the rollout. Scheduled Actions are created to
achieve this. The creation of those Actions is allowed to fail. | [
"Schedules",
"a",
"group",
"of",
"the",
"rollout",
".",
"Scheduled",
"Actions",
"are",
"created",
"to",
"achieve",
"this",
".",
"The",
"creation",
"of",
"those",
"Actions",
"is",
"allowed",
"to",
"fail",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java#L542-L557 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java | JpaRolloutManagement.createScheduledAction | private void createScheduledAction(final Collection<Target> targets, final DistributionSet distributionSet,
final ActionType actionType, final Long forcedTime, final Rollout rollout,
final RolloutGroup rolloutGroup) {
// cancel all current scheduled actions for this target. E.g. an action
// is already scheduled and a next action is created then cancel the
// current scheduled action to cancel. E.g. a new scheduled action is
// created.
final List<Long> targetIds = targets.stream().map(Target::getId).collect(Collectors.toList());
deploymentManagement.cancelInactiveScheduledActionsForTargets(targetIds);
targets.forEach(target -> {
assertActionsPerTargetQuota(target, 1);
final JpaAction action = new JpaAction();
action.setTarget(target);
action.setActive(false);
action.setDistributionSet(distributionSet);
action.setActionType(actionType);
action.setForcedTime(forcedTime);
action.setStatus(Status.SCHEDULED);
action.setRollout(rollout);
action.setRolloutGroup(rolloutGroup);
actionRepository.save(action);
});
} | java | private void createScheduledAction(final Collection<Target> targets, final DistributionSet distributionSet,
final ActionType actionType, final Long forcedTime, final Rollout rollout,
final RolloutGroup rolloutGroup) {
// cancel all current scheduled actions for this target. E.g. an action
// is already scheduled and a next action is created then cancel the
// current scheduled action to cancel. E.g. a new scheduled action is
// created.
final List<Long> targetIds = targets.stream().map(Target::getId).collect(Collectors.toList());
deploymentManagement.cancelInactiveScheduledActionsForTargets(targetIds);
targets.forEach(target -> {
assertActionsPerTargetQuota(target, 1);
final JpaAction action = new JpaAction();
action.setTarget(target);
action.setActive(false);
action.setDistributionSet(distributionSet);
action.setActionType(actionType);
action.setForcedTime(forcedTime);
action.setStatus(Status.SCHEDULED);
action.setRollout(rollout);
action.setRolloutGroup(rolloutGroup);
actionRepository.save(action);
});
} | [
"private",
"void",
"createScheduledAction",
"(",
"final",
"Collection",
"<",
"Target",
">",
"targets",
",",
"final",
"DistributionSet",
"distributionSet",
",",
"final",
"ActionType",
"actionType",
",",
"final",
"Long",
"forcedTime",
",",
"final",
"Rollout",
"rollout... | Creates an action entry into the action repository. In case of existing
scheduled actions the scheduled actions gets canceled. A scheduled action
is created in-active. | [
"Creates",
"an",
"action",
"entry",
"into",
"the",
"action",
"repository",
".",
"In",
"case",
"of",
"existing",
"scheduled",
"actions",
"the",
"scheduled",
"actions",
"gets",
"canceled",
".",
"A",
"scheduled",
"action",
"is",
"created",
"in",
"-",
"active",
... | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java#L602-L626 | train |
eclipse/hawkbit | hawkbit-rest/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/FileStreamingUtil.java | FileStreamingUtil.writeMD5FileResponse | public static ResponseEntity<Void> writeMD5FileResponse(final HttpServletResponse response, final String md5Hash,
final String filename) throws IOException {
if (md5Hash == null) {
return ResponseEntity.notFound().build();
}
final StringBuilder builder = new StringBuilder();
builder.append(md5Hash);
builder.append(" ");
builder.append(filename);
final byte[] content = builder.toString().getBytes(StandardCharsets.US_ASCII);
final StringBuilder header = new StringBuilder().append("attachment;filename=").append(filename)
.append(ARTIFACT_MD5_DWNL_SUFFIX);
response.setContentLength(content.length);
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, header.toString());
response.getOutputStream().write(content);
return ResponseEntity.ok().build();
} | java | public static ResponseEntity<Void> writeMD5FileResponse(final HttpServletResponse response, final String md5Hash,
final String filename) throws IOException {
if (md5Hash == null) {
return ResponseEntity.notFound().build();
}
final StringBuilder builder = new StringBuilder();
builder.append(md5Hash);
builder.append(" ");
builder.append(filename);
final byte[] content = builder.toString().getBytes(StandardCharsets.US_ASCII);
final StringBuilder header = new StringBuilder().append("attachment;filename=").append(filename)
.append(ARTIFACT_MD5_DWNL_SUFFIX);
response.setContentLength(content.length);
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, header.toString());
response.getOutputStream().write(content);
return ResponseEntity.ok().build();
} | [
"public",
"static",
"ResponseEntity",
"<",
"Void",
">",
"writeMD5FileResponse",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"String",
"md5Hash",
",",
"final",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"if",
"(",
"md5Hash",
"==",
... | Write a md5 file response.
@param response
the response
@param md5Hash
of the artifact
@param filename
as provided by the client
@return the response
@throws IOException
cannot write output stream | [
"Write",
"a",
"md5",
"file",
"response",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-rest/hawkbit-rest-core/src/main/java/org/eclipse/hawkbit/rest/util/FileStreamingUtil.java#L66-L88 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/DistributionSetSelectComboBox.java | DistributionSetSelectComboBox.getItemCaption | @Override
public String getItemCaption(final Object itemId) {
if (itemId != null && itemId.equals(getValue()) && !StringUtils.isEmpty(selectedValueCaption)) {
return selectedValueCaption;
}
return super.getItemCaption(itemId);
} | java | @Override
public String getItemCaption(final Object itemId) {
if (itemId != null && itemId.equals(getValue()) && !StringUtils.isEmpty(selectedValueCaption)) {
return selectedValueCaption;
}
return super.getItemCaption(itemId);
} | [
"@",
"Override",
"public",
"String",
"getItemCaption",
"(",
"final",
"Object",
"itemId",
")",
"{",
"if",
"(",
"itemId",
"!=",
"null",
"&&",
"itemId",
".",
"equals",
"(",
"getValue",
"(",
")",
")",
"&&",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"selectedV... | Overriden in order to return the caption for the selected distribution
set from cache. Otherwise, it could lead to multiple database queries,
trying to retrieve the caption from container, when it is not present in
filtered options.
@param itemId
the Id of the selected distribution set
@return the option caption (name:version) of the selected distribution
set | [
"Overriden",
"in",
"order",
"to",
"return",
"the",
"caption",
"for",
"the",
"selected",
"distribution",
"set",
"from",
"cache",
".",
"Otherwise",
"it",
"could",
"lead",
"to",
"multiple",
"database",
"queries",
"trying",
"to",
"retrieve",
"the",
"caption",
"fro... | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/DistributionSetSelectComboBox.java#L256-L263 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/DistributionSetSelectComboBox.java | DistributionSetSelectComboBox.setInitialValueFilter | public int setInitialValueFilter(final String initialFilterString) {
final Filter filter = buildFilter(initialFilterString, getFilteringMode());
if (filter != null) {
final LazyQueryContainer container = (LazyQueryContainer) getContainerDataSource();
try {
container.addContainerFilter(filter);
return container.size();
} finally {
container.removeContainerFilter(filter);
}
}
return 0;
} | java | public int setInitialValueFilter(final String initialFilterString) {
final Filter filter = buildFilter(initialFilterString, getFilteringMode());
if (filter != null) {
final LazyQueryContainer container = (LazyQueryContainer) getContainerDataSource();
try {
container.addContainerFilter(filter);
return container.size();
} finally {
container.removeContainerFilter(filter);
}
}
return 0;
} | [
"public",
"int",
"setInitialValueFilter",
"(",
"final",
"String",
"initialFilterString",
")",
"{",
"final",
"Filter",
"filter",
"=",
"buildFilter",
"(",
"initialFilterString",
",",
"getFilteringMode",
"(",
")",
")",
";",
"if",
"(",
"filter",
"!=",
"null",
")",
... | Before setting the value of the selected distribution set we need to
initialize the container and apply the right filter in order to limit the
number of entities and save them in container cache. Otherwise, combobox
will try to find the corresponding id from container, leading to multiple
database queries.
@param initialFilterString
value of initial distribution set caption (name:version)
@return the size of filtered options | [
"Before",
"setting",
"the",
"value",
"of",
"the",
"selected",
"distribution",
"set",
"we",
"need",
"to",
"initialize",
"the",
"container",
"and",
"apply",
"the",
"right",
"filter",
"in",
"order",
"to",
"limit",
"the",
"number",
"of",
"entities",
"and",
"save... | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/DistributionSetSelectComboBox.java#L313-L327 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/CreateOrUpdateFilterTable.java | CreateOrUpdateFilterTable.addContainerproperties | private void addContainerproperties() {
/* Create HierarchicalContainer container */
container.addContainerProperty(SPUILabelDefinitions.NAME, String.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_BY, String.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class, null, false, true);
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
container.addContainerProperty(SPUILabelDefinitions.VAR_TARGET_STATUS, TargetUpdateStatus.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
container.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true);
container.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true);
container.addContainerProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, String.class, "");
container.addContainerProperty(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, String.class, null);
} | java | private void addContainerproperties() {
/* Create HierarchicalContainer container */
container.addContainerProperty(SPUILabelDefinitions.NAME, String.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_BY, String.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_BY, String.class, null, false, true);
container.addContainerProperty(SPUILabelDefinitions.VAR_LAST_MODIFIED_DATE, String.class, null, false, true);
container.addContainerProperty(SPUILabelDefinitions.VAR_TARGET_STATUS, TargetUpdateStatus.class, null);
container.addContainerProperty(SPUILabelDefinitions.VAR_DESC, String.class, "", false, true);
container.addContainerProperty(ASSIGN_DIST_SET, DistributionSet.class, null, false, true);
container.addContainerProperty(INSTALL_DIST_SET, DistributionSet.class, null, false, true);
container.addContainerProperty(SPUILabelDefinitions.ASSIGNED_DISTRIBUTION_NAME_VER, String.class, "");
container.addContainerProperty(SPUILabelDefinitions.INSTALLED_DISTRIBUTION_NAME_VER, String.class, null);
} | [
"private",
"void",
"addContainerproperties",
"(",
")",
"{",
"/* Create HierarchicalContainer container */",
"container",
".",
"addContainerProperty",
"(",
"SPUILabelDefinitions",
".",
"NAME",
",",
"String",
".",
"class",
",",
"null",
")",
";",
"container",
".",
"addCo... | Create a empty HierarchicalContainer. | [
"Create",
"a",
"empty",
"HierarchicalContainer",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/filtermanagement/CreateOrUpdateFilterTable.java#L166-L180 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutHelper.java | JpaRolloutHelper.prepareRolloutGroupWithDefaultConditions | static JpaRolloutGroup prepareRolloutGroupWithDefaultConditions(final RolloutGroupCreate create,
final RolloutGroupConditions conditions) {
final JpaRolloutGroup group = ((JpaRolloutGroupCreate) create).build();
if (group.getSuccessCondition() == null) {
group.setSuccessCondition(conditions.getSuccessCondition());
}
if (group.getSuccessConditionExp() == null) {
group.setSuccessConditionExp(conditions.getSuccessConditionExp());
}
if (group.getSuccessAction() == null) {
group.setSuccessAction(conditions.getSuccessAction());
}
if (group.getSuccessActionExp() == null) {
group.setSuccessActionExp(conditions.getSuccessActionExp());
}
if (group.getErrorCondition() == null) {
group.setErrorCondition(conditions.getErrorCondition());
}
if (group.getErrorConditionExp() == null) {
group.setErrorConditionExp(conditions.getErrorConditionExp());
}
if (group.getErrorAction() == null) {
group.setErrorAction(conditions.getErrorAction());
}
if (group.getErrorActionExp() == null) {
group.setErrorActionExp(conditions.getErrorActionExp());
}
return group;
} | java | static JpaRolloutGroup prepareRolloutGroupWithDefaultConditions(final RolloutGroupCreate create,
final RolloutGroupConditions conditions) {
final JpaRolloutGroup group = ((JpaRolloutGroupCreate) create).build();
if (group.getSuccessCondition() == null) {
group.setSuccessCondition(conditions.getSuccessCondition());
}
if (group.getSuccessConditionExp() == null) {
group.setSuccessConditionExp(conditions.getSuccessConditionExp());
}
if (group.getSuccessAction() == null) {
group.setSuccessAction(conditions.getSuccessAction());
}
if (group.getSuccessActionExp() == null) {
group.setSuccessActionExp(conditions.getSuccessActionExp());
}
if (group.getErrorCondition() == null) {
group.setErrorCondition(conditions.getErrorCondition());
}
if (group.getErrorConditionExp() == null) {
group.setErrorConditionExp(conditions.getErrorConditionExp());
}
if (group.getErrorAction() == null) {
group.setErrorAction(conditions.getErrorAction());
}
if (group.getErrorActionExp() == null) {
group.setErrorActionExp(conditions.getErrorActionExp());
}
return group;
} | [
"static",
"JpaRolloutGroup",
"prepareRolloutGroupWithDefaultConditions",
"(",
"final",
"RolloutGroupCreate",
"create",
",",
"final",
"RolloutGroupConditions",
"conditions",
")",
"{",
"final",
"JpaRolloutGroup",
"group",
"=",
"(",
"(",
"JpaRolloutGroupCreate",
")",
"create",... | In case the given group is missing conditions or actions, they will be
set from the supplied default conditions.
@param create
group to check
@param conditions
default conditions and actions | [
"In",
"case",
"the",
"given",
"group",
"is",
"missing",
"conditions",
"or",
"actions",
"they",
"will",
"be",
"set",
"from",
"the",
"supplied",
"default",
"conditions",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutHelper.java#L42-L73 | train |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java | AmqpMessageHandlerService.onMessage | @RabbitListener(queues = "${hawkbit.dmf.rabbitmq.receiverQueue:dmf_receiver}", containerFactory = "listenerContainerFactory")
public Message onMessage(final Message message,
@Header(name = MessageHeaderKey.TYPE, required = false) final String type,
@Header(name = MessageHeaderKey.TENANT, required = false) final String tenant) {
return onMessage(message, type, tenant, getRabbitTemplate().getConnectionFactory().getVirtualHost());
} | java | @RabbitListener(queues = "${hawkbit.dmf.rabbitmq.receiverQueue:dmf_receiver}", containerFactory = "listenerContainerFactory")
public Message onMessage(final Message message,
@Header(name = MessageHeaderKey.TYPE, required = false) final String type,
@Header(name = MessageHeaderKey.TENANT, required = false) final String tenant) {
return onMessage(message, type, tenant, getRabbitTemplate().getConnectionFactory().getVirtualHost());
} | [
"@",
"RabbitListener",
"(",
"queues",
"=",
"\"${hawkbit.dmf.rabbitmq.receiverQueue:dmf_receiver}\"",
",",
"containerFactory",
"=",
"\"listenerContainerFactory\"",
")",
"public",
"Message",
"onMessage",
"(",
"final",
"Message",
"message",
",",
"@",
"Header",
"(",
"name",
... | Method to handle all incoming DMF amqp messages.
@param message
incoming message
@param type
the message type
@param tenant
the contentType of the message
@return a message if <null> no message is send back to sender | [
"Method",
"to",
"handle",
"all",
"incoming",
"DMF",
"amqp",
"messages",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java#L106-L111 | train |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java | AmqpMessageHandlerService.registerTarget | private void registerTarget(final Message message, final String virtualHost) {
final String thingId = getStringHeaderKey(message, MessageHeaderKey.THING_ID, "ThingId is null");
final String replyTo = message.getMessageProperties().getReplyTo();
if (StringUtils.isEmpty(replyTo)) {
logAndThrowMessageError(message, "No ReplyTo was set for the createThing message.");
}
final URI amqpUri = IpUtil.createAmqpUri(virtualHost, replyTo);
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotExist(thingId, amqpUri);
LOG.debug("Target {} reported online state.", thingId);
lookIfUpdateAvailable(target);
} | java | private void registerTarget(final Message message, final String virtualHost) {
final String thingId = getStringHeaderKey(message, MessageHeaderKey.THING_ID, "ThingId is null");
final String replyTo = message.getMessageProperties().getReplyTo();
if (StringUtils.isEmpty(replyTo)) {
logAndThrowMessageError(message, "No ReplyTo was set for the createThing message.");
}
final URI amqpUri = IpUtil.createAmqpUri(virtualHost, replyTo);
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotExist(thingId, amqpUri);
LOG.debug("Target {} reported online state.", thingId);
lookIfUpdateAvailable(target);
} | [
"private",
"void",
"registerTarget",
"(",
"final",
"Message",
"message",
",",
"final",
"String",
"virtualHost",
")",
"{",
"final",
"String",
"thingId",
"=",
"getStringHeaderKey",
"(",
"message",
",",
"MessageHeaderKey",
".",
"THING_ID",
",",
"\"ThingId is null\"",
... | Method to create a new target or to find the target if it already exists.
@param targetID
the ID of the target/thing
@param ip
the ip of the target/thing | [
"Method",
"to",
"create",
"a",
"new",
"target",
"or",
"to",
"find",
"the",
"target",
"if",
"it",
"already",
"exists",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java#L182-L195 | train |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java | AmqpMessageHandlerService.handleIncomingEvent | private void handleIncomingEvent(final Message message) {
switch (EventTopic.valueOf(getStringHeaderKey(message, MessageHeaderKey.TOPIC, "EventTopic is null"))) {
case UPDATE_ACTION_STATUS:
updateActionStatus(message);
break;
case UPDATE_ATTRIBUTES:
updateAttributes(message);
break;
default:
logAndThrowMessageError(message, "Got event without appropriate topic.");
break;
}
} | java | private void handleIncomingEvent(final Message message) {
switch (EventTopic.valueOf(getStringHeaderKey(message, MessageHeaderKey.TOPIC, "EventTopic is null"))) {
case UPDATE_ACTION_STATUS:
updateActionStatus(message);
break;
case UPDATE_ATTRIBUTES:
updateAttributes(message);
break;
default:
logAndThrowMessageError(message, "Got event without appropriate topic.");
break;
}
} | [
"private",
"void",
"handleIncomingEvent",
"(",
"final",
"Message",
"message",
")",
"{",
"switch",
"(",
"EventTopic",
".",
"valueOf",
"(",
"getStringHeaderKey",
"(",
"message",
",",
"MessageHeaderKey",
".",
"TOPIC",
",",
"\"EventTopic is null\"",
")",
")",
")",
"... | Method to handle the different topics to an event.
@param message
the incoming event message.
@param topic
the topic of the event. | [
"Method",
"to",
"handle",
"the",
"different",
"topics",
"to",
"an",
"event",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java#L234-L247 | train |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java | AmqpMessageHandlerService.updateActionStatus | private void updateActionStatus(final Message message) {
final DmfActionUpdateStatus actionUpdateStatus = convertMessage(message, DmfActionUpdateStatus.class);
final Action action = checkActionExist(message, actionUpdateStatus);
final List<String> messages = actionUpdateStatus.getMessage();
if (isCorrelationIdNotEmpty(message)) {
messages.add(RepositoryConstants.SERVER_MESSAGE_PREFIX + "DMF message correlation-id "
+ message.getMessageProperties().getCorrelationId());
}
final Status status = mapStatus(message, actionUpdateStatus, action);
final ActionStatusCreate actionStatus = entityFactory.actionStatus().create(action.getId()).status(status)
.messages(messages);
final Action addUpdateActionStatus = getUpdateActionStatus(status, actionStatus);
if (!addUpdateActionStatus.isActive() || (addUpdateActionStatus.hasMaintenanceSchedule()
&& addUpdateActionStatus.isMaintenanceWindowAvailable())) {
lookIfUpdateAvailable(action.getTarget());
}
} | java | private void updateActionStatus(final Message message) {
final DmfActionUpdateStatus actionUpdateStatus = convertMessage(message, DmfActionUpdateStatus.class);
final Action action = checkActionExist(message, actionUpdateStatus);
final List<String> messages = actionUpdateStatus.getMessage();
if (isCorrelationIdNotEmpty(message)) {
messages.add(RepositoryConstants.SERVER_MESSAGE_PREFIX + "DMF message correlation-id "
+ message.getMessageProperties().getCorrelationId());
}
final Status status = mapStatus(message, actionUpdateStatus, action);
final ActionStatusCreate actionStatus = entityFactory.actionStatus().create(action.getId()).status(status)
.messages(messages);
final Action addUpdateActionStatus = getUpdateActionStatus(status, actionStatus);
if (!addUpdateActionStatus.isActive() || (addUpdateActionStatus.hasMaintenanceSchedule()
&& addUpdateActionStatus.isMaintenanceWindowAvailable())) {
lookIfUpdateAvailable(action.getTarget());
}
} | [
"private",
"void",
"updateActionStatus",
"(",
"final",
"Message",
"message",
")",
"{",
"final",
"DmfActionUpdateStatus",
"actionUpdateStatus",
"=",
"convertMessage",
"(",
"message",
",",
"DmfActionUpdateStatus",
".",
"class",
")",
";",
"final",
"Action",
"action",
"... | Method to update the action status of an action through the event.
@param actionUpdateStatus
the object form the ampq message | [
"Method",
"to",
"update",
"the",
"action",
"status",
"of",
"an",
"action",
"through",
"the",
"event",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java#L263-L284 | train |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java | AmqpMessageHandlerService.checkActionExist | @SuppressWarnings("squid:S3655")
private Action checkActionExist(final Message message, final DmfActionUpdateStatus actionUpdateStatus) {
final Long actionId = actionUpdateStatus.getActionId();
LOG.debug("Target notifies intermediate about action {} with status {}.", actionId,
actionUpdateStatus.getActionStatus());
final Optional<Action> findActionWithDetails = controllerManagement.findActionWithDetails(actionId);
if (!findActionWithDetails.isPresent()) {
logAndThrowMessageError(message,
"Got intermediate notification about action " + actionId + " but action does not exist");
}
return findActionWithDetails.get();
} | java | @SuppressWarnings("squid:S3655")
private Action checkActionExist(final Message message, final DmfActionUpdateStatus actionUpdateStatus) {
final Long actionId = actionUpdateStatus.getActionId();
LOG.debug("Target notifies intermediate about action {} with status {}.", actionId,
actionUpdateStatus.getActionStatus());
final Optional<Action> findActionWithDetails = controllerManagement.findActionWithDetails(actionId);
if (!findActionWithDetails.isPresent()) {
logAndThrowMessageError(message,
"Got intermediate notification about action " + actionId + " but action does not exist");
}
return findActionWithDetails.get();
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S3655\"",
")",
"private",
"Action",
"checkActionExist",
"(",
"final",
"Message",
"message",
",",
"final",
"DmfActionUpdateStatus",
"actionUpdateStatus",
")",
"{",
"final",
"Long",
"actionId",
"=",
"actionUpdateStatus",
".",
"getA... | get will not be called | [
"get",
"will",
"not",
"be",
"called"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java#L349-L363 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/BaseUIEntityEvent.java | BaseUIEntityEvent.matchRemoteEvent | public boolean matchRemoteEvent(final TenantAwareEvent tenantAwareEvent) {
if (!(tenantAwareEvent instanceof RemoteIdEvent) || entityClass == null || entityIds == null) {
return false;
}
final RemoteIdEvent remoteIdEvent = (RemoteIdEvent) tenantAwareEvent;
try {
final Class<?> remoteEntityClass = Class.forName(remoteIdEvent.getEntityClass());
return entityClass.isAssignableFrom(remoteEntityClass) && entityIds.contains(remoteIdEvent.getEntityId());
} catch (final ClassNotFoundException e) {
LOG.error("Entity Class of remoteIdEvent cannot be found", e);
return false;
}
} | java | public boolean matchRemoteEvent(final TenantAwareEvent tenantAwareEvent) {
if (!(tenantAwareEvent instanceof RemoteIdEvent) || entityClass == null || entityIds == null) {
return false;
}
final RemoteIdEvent remoteIdEvent = (RemoteIdEvent) tenantAwareEvent;
try {
final Class<?> remoteEntityClass = Class.forName(remoteIdEvent.getEntityClass());
return entityClass.isAssignableFrom(remoteEntityClass) && entityIds.contains(remoteIdEvent.getEntityId());
} catch (final ClassNotFoundException e) {
LOG.error("Entity Class of remoteIdEvent cannot be found", e);
return false;
}
} | [
"public",
"boolean",
"matchRemoteEvent",
"(",
"final",
"TenantAwareEvent",
"tenantAwareEvent",
")",
"{",
"if",
"(",
"!",
"(",
"tenantAwareEvent",
"instanceof",
"RemoteIdEvent",
")",
"||",
"entityClass",
"==",
"null",
"||",
"entityIds",
"==",
"null",
")",
"{",
"r... | Checks if the remote event is the same as this UI event. Then maybe you
can skip the remote event because it is already executed.
@param tenantAwareEvent
the remote event
@return {@code true} match ; {@code false} not match | [
"Checks",
"if",
"the",
"remote",
"event",
"is",
"the",
"same",
"as",
"this",
"UI",
"event",
".",
"Then",
"maybe",
"you",
"can",
"skip",
"the",
"remote",
"event",
"because",
"it",
"is",
"already",
"executed",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/table/BaseUIEntityEvent.java#L92-L105 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/TenantConfigurationDashboardView.java | TenantConfigurationDashboardView.init | @PostConstruct
public void init() {
if (defaultDistributionSetTypeLayout.getComponentCount() > 0) {
configurationViews.add(defaultDistributionSetTypeLayout);
}
configurationViews.add(repositoryConfigurationView);
configurationViews.add(rolloutConfigurationView);
configurationViews.add(authenticationConfigurationView);
configurationViews.add(pollingConfigurationView);
if (customConfigurationViews != null) {
configurationViews.addAll(
customConfigurationViews.stream().filter(ConfigurationGroup::show).collect(Collectors.toList()));
}
final Panel rootPanel = new Panel();
rootPanel.setStyleName("tenantconfig-root");
final VerticalLayout rootLayout = new VerticalLayout();
rootLayout.setSizeFull();
rootLayout.setMargin(true);
rootLayout.setSpacing(true);
configurationViews.forEach(rootLayout::addComponent);
final HorizontalLayout buttonContent = saveConfigurationButtonsLayout();
rootLayout.addComponent(buttonContent);
rootLayout.setComponentAlignment(buttonContent, Alignment.BOTTOM_LEFT);
rootPanel.setContent(rootLayout);
setCompositionRoot(rootPanel);
configurationViews.forEach(view -> view.addChangeListener(this));
} | java | @PostConstruct
public void init() {
if (defaultDistributionSetTypeLayout.getComponentCount() > 0) {
configurationViews.add(defaultDistributionSetTypeLayout);
}
configurationViews.add(repositoryConfigurationView);
configurationViews.add(rolloutConfigurationView);
configurationViews.add(authenticationConfigurationView);
configurationViews.add(pollingConfigurationView);
if (customConfigurationViews != null) {
configurationViews.addAll(
customConfigurationViews.stream().filter(ConfigurationGroup::show).collect(Collectors.toList()));
}
final Panel rootPanel = new Panel();
rootPanel.setStyleName("tenantconfig-root");
final VerticalLayout rootLayout = new VerticalLayout();
rootLayout.setSizeFull();
rootLayout.setMargin(true);
rootLayout.setSpacing(true);
configurationViews.forEach(rootLayout::addComponent);
final HorizontalLayout buttonContent = saveConfigurationButtonsLayout();
rootLayout.addComponent(buttonContent);
rootLayout.setComponentAlignment(buttonContent, Alignment.BOTTOM_LEFT);
rootPanel.setContent(rootLayout);
setCompositionRoot(rootPanel);
configurationViews.forEach(view -> view.addChangeListener(this));
} | [
"@",
"PostConstruct",
"public",
"void",
"init",
"(",
")",
"{",
"if",
"(",
"defaultDistributionSetTypeLayout",
".",
"getComponentCount",
"(",
")",
">",
"0",
")",
"{",
"configurationViews",
".",
"add",
"(",
"defaultDistributionSetTypeLayout",
")",
";",
"}",
"confi... | Init method adds all Configuration Views to the list of Views. | [
"Init",
"method",
"adds",
"all",
"Configuration",
"Views",
"to",
"the",
"list",
"of",
"Views",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/TenantConfigurationDashboardView.java#L105-L136 | train |
eclipse/hawkbit | hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDownloadArtifactResource.java | MgmtDownloadArtifactResource.downloadArtifact | @Override
public ResponseEntity<InputStream> downloadArtifact(@PathVariable("softwareModuleId") final Long softwareModuleId,
@PathVariable("artifactId") final Long artifactId) {
final SoftwareModule module = softwareModuleManagement.get(softwareModuleId)
.orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, softwareModuleId));
final Artifact artifact = module.getArtifact(artifactId)
.orElseThrow(() -> new EntityNotFoundException(Artifact.class, artifactId));
final AbstractDbArtifact file = artifactManagement.loadArtifactBinary(artifact.getSha1Hash())
.orElseThrow(() -> new ArtifactBinaryNotFoundException(artifact.getSha1Hash()));
final HttpServletRequest request = requestResponseContextHolder.getHttpServletRequest();
final String ifMatch = request.getHeader(HttpHeaders.IF_MATCH);
if (ifMatch != null && !HttpUtil.matchesHttpHeader(ifMatch, artifact.getSha1Hash())) {
return new ResponseEntity<>(HttpStatus.PRECONDITION_FAILED);
}
return FileStreamingUtil.writeFileResponse(file, artifact.getFilename(), artifact.getCreatedAt(),
requestResponseContextHolder.getHttpServletResponse(), request, null);
} | java | @Override
public ResponseEntity<InputStream> downloadArtifact(@PathVariable("softwareModuleId") final Long softwareModuleId,
@PathVariable("artifactId") final Long artifactId) {
final SoftwareModule module = softwareModuleManagement.get(softwareModuleId)
.orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, softwareModuleId));
final Artifact artifact = module.getArtifact(artifactId)
.orElseThrow(() -> new EntityNotFoundException(Artifact.class, artifactId));
final AbstractDbArtifact file = artifactManagement.loadArtifactBinary(artifact.getSha1Hash())
.orElseThrow(() -> new ArtifactBinaryNotFoundException(artifact.getSha1Hash()));
final HttpServletRequest request = requestResponseContextHolder.getHttpServletRequest();
final String ifMatch = request.getHeader(HttpHeaders.IF_MATCH);
if (ifMatch != null && !HttpUtil.matchesHttpHeader(ifMatch, artifact.getSha1Hash())) {
return new ResponseEntity<>(HttpStatus.PRECONDITION_FAILED);
}
return FileStreamingUtil.writeFileResponse(file, artifact.getFilename(), artifact.getCreatedAt(),
requestResponseContextHolder.getHttpServletResponse(), request, null);
} | [
"@",
"Override",
"public",
"ResponseEntity",
"<",
"InputStream",
">",
"downloadArtifact",
"(",
"@",
"PathVariable",
"(",
"\"softwareModuleId\"",
")",
"final",
"Long",
"softwareModuleId",
",",
"@",
"PathVariable",
"(",
"\"artifactId\"",
")",
"final",
"Long",
"artifac... | Handles the GET request for downloading an artifact.
@param softwareModuleId
of the parent SoftwareModule
@param artifactId
of the related Artifact
@return responseEntity with status ok if successful | [
"Handles",
"the",
"GET",
"request",
"for",
"downloading",
"an",
"artifact",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDownloadArtifactResource.java#L60-L79 | train |
eclipse/hawkbit | hawkbit-security-integration/src/main/java/org/eclipse/hawkbit/security/DmfTenantSecurityToken.java | DmfTenantSecurityToken.putHeader | public String putHeader(final String name, final String value) {
if (headers == null) {
headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
}
return headers.put(name, value);
} | java | public String putHeader(final String name, final String value) {
if (headers == null) {
headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
}
return headers.put(name, value);
} | [
"public",
"String",
"putHeader",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"headers",
"==",
"null",
")",
"{",
"headers",
"=",
"new",
"TreeMap",
"<>",
"(",
"String",
".",
"CASE_INSENSITIVE_ORDER",
")",
";",
"}",... | Associates the specified header value with the specified name.
@param name
of the header
@param value
of the header
@return the previous value associated with the <tt>name</tt>, or
<tt>null</tt> if there was no mapping for <tt>name</tt>. | [
"Associates",
"the",
"specified",
"header",
"value",
"with",
"the",
"specified",
"name",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-security-integration/src/main/java/org/eclipse/hawkbit/security/DmfTenantSecurityToken.java#L163-L168 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/polling/DurationConfigField.java | DurationConfigField.setValue | public void setValue(final Duration tenantDuration) {
if (tenantDuration == null) {
// no tenant specific configuration
checkBox.setValue(false);
durationField.setDuration(globalDuration);
durationField.setEnabled(false);
return;
}
checkBox.setValue(true);
durationField.setDuration(tenantDuration);
durationField.setEnabled(true);
} | java | public void setValue(final Duration tenantDuration) {
if (tenantDuration == null) {
// no tenant specific configuration
checkBox.setValue(false);
durationField.setDuration(globalDuration);
durationField.setEnabled(false);
return;
}
checkBox.setValue(true);
durationField.setDuration(tenantDuration);
durationField.setEnabled(true);
} | [
"public",
"void",
"setValue",
"(",
"final",
"Duration",
"tenantDuration",
")",
"{",
"if",
"(",
"tenantDuration",
"==",
"null",
")",
"{",
"// no tenant specific configuration",
"checkBox",
".",
"setValue",
"(",
"false",
")",
";",
"durationField",
".",
"setDuration"... | Set the value of the duration field
@param tenantDuration
duration which will be set in to the duration field, when
{@code null} the global configuration will be used. | [
"Set",
"the",
"value",
"of",
"the",
"duration",
"field"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/polling/DurationConfigField.java#L96-L108 | train |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpControllerAuthentication.java | AmqpControllerAuthentication.doAuthenticate | public Authentication doAuthenticate(final DmfTenantSecurityToken securityToken) {
resolveTenant(securityToken);
PreAuthenticatedAuthenticationToken authentication = new PreAuthenticatedAuthenticationToken(null, null);
for (final PreAuthenticationFilter filter : filterChain) {
final PreAuthenticatedAuthenticationToken authenticationRest = createAuthentication(filter, securityToken);
if (authenticationRest != null) {
authentication = authenticationRest;
authentication.setDetails(new TenantAwareAuthenticationDetails(securityToken.getTenant(), true));
break;
}
}
return preAuthenticatedAuthenticationProvider.authenticate(authentication);
} | java | public Authentication doAuthenticate(final DmfTenantSecurityToken securityToken) {
resolveTenant(securityToken);
PreAuthenticatedAuthenticationToken authentication = new PreAuthenticatedAuthenticationToken(null, null);
for (final PreAuthenticationFilter filter : filterChain) {
final PreAuthenticatedAuthenticationToken authenticationRest = createAuthentication(filter, securityToken);
if (authenticationRest != null) {
authentication = authenticationRest;
authentication.setDetails(new TenantAwareAuthenticationDetails(securityToken.getTenant(), true));
break;
}
}
return preAuthenticatedAuthenticationProvider.authenticate(authentication);
} | [
"public",
"Authentication",
"doAuthenticate",
"(",
"final",
"DmfTenantSecurityToken",
"securityToken",
")",
"{",
"resolveTenant",
"(",
"securityToken",
")",
";",
"PreAuthenticatedAuthenticationToken",
"authentication",
"=",
"new",
"PreAuthenticatedAuthenticationToken",
"(",
"... | Performs authentication with the security token.
@param securityToken
the authentication request object
@return the authentication object | [
"Performs",
"authentication",
"with",
"the",
"security",
"token",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpControllerAuthentication.java#L124-L137 | train |
eclipse/hawkbit | hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java | MgmtTargetMapper.addTargetLinks | public static void addTargetLinks(final MgmtTarget response) {
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAssignedDistributionSet(response.getControllerId()))
.withRel(MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET));
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getInstalledDistributionSet(response.getControllerId()))
.withRel(MgmtRestConstants.TARGET_V1_INSTALLED_DISTRIBUTION_SET));
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAttributes(response.getControllerId()))
.withRel(MgmtRestConstants.TARGET_V1_ATTRIBUTES));
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getActionHistory(response.getControllerId(), 0,
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE,
ActionFields.ID.getFieldName() + ":" + SortDirection.DESC, null))
.withRel(MgmtRestConstants.TARGET_V1_ACTIONS).expand());
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getMetadata(response.getControllerId(),
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata"));
} | java | public static void addTargetLinks(final MgmtTarget response) {
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAssignedDistributionSet(response.getControllerId()))
.withRel(MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET));
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getInstalledDistributionSet(response.getControllerId()))
.withRel(MgmtRestConstants.TARGET_V1_INSTALLED_DISTRIBUTION_SET));
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAttributes(response.getControllerId()))
.withRel(MgmtRestConstants.TARGET_V1_ATTRIBUTES));
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getActionHistory(response.getControllerId(), 0,
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE,
ActionFields.ID.getFieldName() + ":" + SortDirection.DESC, null))
.withRel(MgmtRestConstants.TARGET_V1_ACTIONS).expand());
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getMetadata(response.getControllerId(),
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata"));
} | [
"public",
"static",
"void",
"addTargetLinks",
"(",
"final",
"MgmtTarget",
"response",
")",
"{",
"response",
".",
"add",
"(",
"linkTo",
"(",
"methodOn",
"(",
"MgmtTargetRestApi",
".",
"class",
")",
".",
"getAssignedDistributionSet",
"(",
"response",
".",
"getCont... | Add links to a target response.
@param response
the target response | [
"Add",
"links",
"to",
"a",
"target",
"response",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java#L66-L80 | train |
eclipse/hawkbit | hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java | MgmtTargetMapper.toResponse | public static List<MgmtTarget> toResponse(final Collection<Target> targets) {
if (targets == null) {
return Collections.emptyList();
}
return new ResponseList<>(targets.stream().map(MgmtTargetMapper::toResponse).collect(Collectors.toList()));
} | java | public static List<MgmtTarget> toResponse(final Collection<Target> targets) {
if (targets == null) {
return Collections.emptyList();
}
return new ResponseList<>(targets.stream().map(MgmtTargetMapper::toResponse).collect(Collectors.toList()));
} | [
"public",
"static",
"List",
"<",
"MgmtTarget",
">",
"toResponse",
"(",
"final",
"Collection",
"<",
"Target",
">",
"targets",
")",
"{",
"if",
"(",
"targets",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"return",
... | Create a response for targets.
@param targets
list of targets
@return the response | [
"Create",
"a",
"response",
"for",
"targets",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java#L102-L108 | train |
eclipse/hawkbit | hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java | MgmtTargetMapper.toResponse | public static MgmtTarget toResponse(final Target target) {
if (target == null) {
return null;
}
final MgmtTarget targetRest = new MgmtTarget();
targetRest.setControllerId(target.getControllerId());
targetRest.setDescription(target.getDescription());
targetRest.setName(target.getName());
targetRest.setUpdateStatus(target.getUpdateStatus().name().toLowerCase());
final URI address = target.getAddress();
if (address != null) {
if (IpUtil.isIpAddresKnown(address)) {
targetRest.setIpAddress(address.getHost());
}
targetRest.setAddress(address.toString());
}
targetRest.setCreatedBy(target.getCreatedBy());
targetRest.setLastModifiedBy(target.getLastModifiedBy());
targetRest.setCreatedAt(target.getCreatedAt());
targetRest.setLastModifiedAt(target.getLastModifiedAt());
targetRest.setSecurityToken(target.getSecurityToken());
targetRest.setRequestAttributes(target.isRequestControllerAttributes());
// last target query is the last controller request date
final Long lastTargetQuery = target.getLastTargetQuery();
final Long installationDate = target.getInstallationDate();
if (lastTargetQuery != null) {
targetRest.setLastControllerRequestAt(lastTargetQuery);
}
if (installationDate != null) {
targetRest.setInstalledAt(installationDate);
}
targetRest.add(linkTo(methodOn(MgmtTargetRestApi.class).getTarget(target.getControllerId())).withSelfRel());
return targetRest;
} | java | public static MgmtTarget toResponse(final Target target) {
if (target == null) {
return null;
}
final MgmtTarget targetRest = new MgmtTarget();
targetRest.setControllerId(target.getControllerId());
targetRest.setDescription(target.getDescription());
targetRest.setName(target.getName());
targetRest.setUpdateStatus(target.getUpdateStatus().name().toLowerCase());
final URI address = target.getAddress();
if (address != null) {
if (IpUtil.isIpAddresKnown(address)) {
targetRest.setIpAddress(address.getHost());
}
targetRest.setAddress(address.toString());
}
targetRest.setCreatedBy(target.getCreatedBy());
targetRest.setLastModifiedBy(target.getLastModifiedBy());
targetRest.setCreatedAt(target.getCreatedAt());
targetRest.setLastModifiedAt(target.getLastModifiedAt());
targetRest.setSecurityToken(target.getSecurityToken());
targetRest.setRequestAttributes(target.isRequestControllerAttributes());
// last target query is the last controller request date
final Long lastTargetQuery = target.getLastTargetQuery();
final Long installationDate = target.getInstallationDate();
if (lastTargetQuery != null) {
targetRest.setLastControllerRequestAt(lastTargetQuery);
}
if (installationDate != null) {
targetRest.setInstalledAt(installationDate);
}
targetRest.add(linkTo(methodOn(MgmtTargetRestApi.class).getTarget(target.getControllerId())).withSelfRel());
return targetRest;
} | [
"public",
"static",
"MgmtTarget",
"toResponse",
"(",
"final",
"Target",
"target",
")",
"{",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"MgmtTarget",
"targetRest",
"=",
"new",
"MgmtTarget",
"(",
")",
";",
"targetRest",... | Create a response for target.
@param target
the target
@return the response | [
"Create",
"a",
"response",
"for",
"target",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-rest/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetMapper.java#L117-L158 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/DefaultDistributionSetTypeLayout.java | DefaultDistributionSetTypeLayout.selectDistributionSetValue | private void selectDistributionSetValue() {
selectedDefaultDisSetType = (Long) combobox.getValue();
if (!selectedDefaultDisSetType.equals(currentDefaultDisSetType)) {
changeIcon.setVisible(true);
notifyConfigurationChanged();
} else {
changeIcon.setVisible(false);
}
} | java | private void selectDistributionSetValue() {
selectedDefaultDisSetType = (Long) combobox.getValue();
if (!selectedDefaultDisSetType.equals(currentDefaultDisSetType)) {
changeIcon.setVisible(true);
notifyConfigurationChanged();
} else {
changeIcon.setVisible(false);
}
} | [
"private",
"void",
"selectDistributionSetValue",
"(",
")",
"{",
"selectedDefaultDisSetType",
"=",
"(",
"Long",
")",
"combobox",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"selectedDefaultDisSetType",
".",
"equals",
"(",
"currentDefaultDisSetType",
")",
")",
... | Method that is called when combobox event is performed. | [
"Method",
"that",
"is",
"called",
"when",
"combobox",
"event",
"is",
"performed",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/DefaultDistributionSetTypeLayout.java#L132-L140 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryGrid.java | ActionHistoryGrid.confirmAndForceAction | private void confirmAndForceAction(final Long actionId) {
/* Display the confirmation */
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
i18n.getMessage("caption.force.action.confirmbox"), i18n.getMessage("message.force.action.confirm"),
i18n.getMessage(UIMessageIdProvider.BUTTON_OK), i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL),
ok -> {
if (!ok) {
return;
}
deploymentManagement.forceTargetAction(actionId);
populateAndUpdateTargetDetails(selectedTarget);
notification.displaySuccess(i18n.getMessage("message.force.action.success"));
}, UIComponentIdProvider.CONFIRMATION_POPUP_ID);
UI.getCurrent().addWindow(confirmDialog.getWindow());
confirmDialog.getWindow().bringToFront();
} | java | private void confirmAndForceAction(final Long actionId) {
/* Display the confirmation */
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
i18n.getMessage("caption.force.action.confirmbox"), i18n.getMessage("message.force.action.confirm"),
i18n.getMessage(UIMessageIdProvider.BUTTON_OK), i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL),
ok -> {
if (!ok) {
return;
}
deploymentManagement.forceTargetAction(actionId);
populateAndUpdateTargetDetails(selectedTarget);
notification.displaySuccess(i18n.getMessage("message.force.action.success"));
}, UIComponentIdProvider.CONFIRMATION_POPUP_ID);
UI.getCurrent().addWindow(confirmDialog.getWindow());
confirmDialog.getWindow().bringToFront();
} | [
"private",
"void",
"confirmAndForceAction",
"(",
"final",
"Long",
"actionId",
")",
"{",
"/* Display the confirmation */",
"final",
"ConfirmationDialog",
"confirmDialog",
"=",
"new",
"ConfirmationDialog",
"(",
"i18n",
".",
"getMessage",
"(",
"\"caption.force.action.confirmbo... | Show confirmation window and if ok then only, force the action.
@param actionId
as Id if the action needs to be forced. | [
"Show",
"confirmation",
"window",
"and",
"if",
"ok",
"then",
"only",
"force",
"the",
"action",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryGrid.java#L312-L328 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryGrid.java | ActionHistoryGrid.confirmAndForceQuitAction | private void confirmAndForceQuitAction(final Long actionId) {
/* Display the confirmation */
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
i18n.getMessage("caption.forcequit.action.confirmbox"),
i18n.getMessage("message.forcequit.action.confirm"), i18n.getMessage(UIMessageIdProvider.BUTTON_OK),
i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL), ok -> {
if (!ok) {
return;
}
final boolean cancelResult = forceQuitActiveAction(actionId);
if (cancelResult) {
populateAndUpdateTargetDetails(selectedTarget);
notification.displaySuccess(i18n.getMessage("message.forcequit.action.success"));
} else {
notification.displayValidationError(i18n.getMessage("message.forcequit.action.failed"));
}
}, FontAwesome.WARNING, UIComponentIdProvider.CONFIRMATION_POPUP_ID, null);
UI.getCurrent().addWindow(confirmDialog.getWindow());
confirmDialog.getWindow().bringToFront();
} | java | private void confirmAndForceQuitAction(final Long actionId) {
/* Display the confirmation */
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
i18n.getMessage("caption.forcequit.action.confirmbox"),
i18n.getMessage("message.forcequit.action.confirm"), i18n.getMessage(UIMessageIdProvider.BUTTON_OK),
i18n.getMessage(UIMessageIdProvider.BUTTON_CANCEL), ok -> {
if (!ok) {
return;
}
final boolean cancelResult = forceQuitActiveAction(actionId);
if (cancelResult) {
populateAndUpdateTargetDetails(selectedTarget);
notification.displaySuccess(i18n.getMessage("message.forcequit.action.success"));
} else {
notification.displayValidationError(i18n.getMessage("message.forcequit.action.failed"));
}
}, FontAwesome.WARNING, UIComponentIdProvider.CONFIRMATION_POPUP_ID, null);
UI.getCurrent().addWindow(confirmDialog.getWindow());
confirmDialog.getWindow().bringToFront();
} | [
"private",
"void",
"confirmAndForceQuitAction",
"(",
"final",
"Long",
"actionId",
")",
"{",
"/* Display the confirmation */",
"final",
"ConfirmationDialog",
"confirmDialog",
"=",
"new",
"ConfirmationDialog",
"(",
"i18n",
".",
"getMessage",
"(",
"\"caption.forcequit.action.c... | Show confirmation window and if ok then only, force quit action.
@param actionId
as Id if the action needs to be forced. | [
"Show",
"confirmation",
"window",
"and",
"if",
"ok",
"then",
"only",
"force",
"quit",
"action",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryGrid.java#L336-L356 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryGrid.java | ActionHistoryGrid.updateDistributionTableStyle | private void updateDistributionTableStyle() {
managementUIState.getDistributionTableFilters().getPinnedTarget().ifPresent(pinnedTarget -> {
if (pinnedTarget.getTargetId().equals(selectedTarget.getId())) {
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
}
});
} | java | private void updateDistributionTableStyle() {
managementUIState.getDistributionTableFilters().getPinnedTarget().ifPresent(pinnedTarget -> {
if (pinnedTarget.getTargetId().equals(selectedTarget.getId())) {
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
}
});
} | [
"private",
"void",
"updateDistributionTableStyle",
"(",
")",
"{",
"managementUIState",
".",
"getDistributionTableFilters",
"(",
")",
".",
"getPinnedTarget",
"(",
")",
".",
"ifPresent",
"(",
"pinnedTarget",
"->",
"{",
"if",
"(",
"pinnedTarget",
".",
"getTargetId",
... | Update the colors of Assigned and installed distribution set in Target
Pinning. | [
"Update",
"the",
"colors",
"of",
"Assigned",
"and",
"installed",
"distribution",
"set",
"in",
"Target",
"Pinning",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryGrid.java#L404-L410 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryGrid.java | ActionHistoryGrid.setColumnsSize | private void setColumnsSize(final double min, final double max, final String... columnPropertyIds) {
for (final String columnPropertyId : columnPropertyIds) {
getColumn(columnPropertyId).setMinimumWidth(min);
getColumn(columnPropertyId).setMaximumWidth(max);
}
} | java | private void setColumnsSize(final double min, final double max, final String... columnPropertyIds) {
for (final String columnPropertyId : columnPropertyIds) {
getColumn(columnPropertyId).setMinimumWidth(min);
getColumn(columnPropertyId).setMaximumWidth(max);
}
} | [
"private",
"void",
"setColumnsSize",
"(",
"final",
"double",
"min",
",",
"final",
"double",
"max",
",",
"final",
"String",
"...",
"columnPropertyIds",
")",
"{",
"for",
"(",
"final",
"String",
"columnPropertyId",
":",
"columnPropertyIds",
")",
"{",
"getColumn",
... | Conveniently sets min- and max-width for a bunch of columns.
@param min
minimum width
@param max
maximum width
@param columnPropertyIds
all the columns the min and max should be set for. | [
"Conveniently",
"sets",
"min",
"-",
"and",
"max",
"-",
"width",
"for",
"a",
"bunch",
"of",
"columns",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryGrid.java#L496-L501 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autocleanup/AutoCleanupScheduler.java | AutoCleanupScheduler.run | @Scheduled(initialDelayString = PROP_AUTO_CLEANUP_INTERVAL, fixedDelayString = PROP_AUTO_CLEANUP_INTERVAL)
public void run() {
LOGGER.debug("Auto cleanup scheduler has been triggered.");
// run this code in system code privileged to have the necessary
// permission to query and create entities
if (!cleanupTasks.isEmpty()) {
systemSecurityContext.runAsSystem(this::executeAutoCleanup);
}
} | java | @Scheduled(initialDelayString = PROP_AUTO_CLEANUP_INTERVAL, fixedDelayString = PROP_AUTO_CLEANUP_INTERVAL)
public void run() {
LOGGER.debug("Auto cleanup scheduler has been triggered.");
// run this code in system code privileged to have the necessary
// permission to query and create entities
if (!cleanupTasks.isEmpty()) {
systemSecurityContext.runAsSystem(this::executeAutoCleanup);
}
} | [
"@",
"Scheduled",
"(",
"initialDelayString",
"=",
"PROP_AUTO_CLEANUP_INTERVAL",
",",
"fixedDelayString",
"=",
"PROP_AUTO_CLEANUP_INTERVAL",
")",
"public",
"void",
"run",
"(",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Auto cleanup scheduler has been triggered.\"",
")",
"... | Scheduler method which kicks off the cleanup process. | [
"Scheduler",
"method",
"which",
"kicks",
"off",
"the",
"cleanup",
"process",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autocleanup/AutoCleanupScheduler.java#L62-L70 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autocleanup/AutoCleanupScheduler.java | AutoCleanupScheduler.executeAutoCleanup | @SuppressWarnings("squid:S3516")
private Void executeAutoCleanup() {
systemManagement.forEachTenant(tenant -> cleanupTasks.forEach(task -> {
final Lock lock = obtainLock(task, tenant);
if (!lock.tryLock()) {
return;
}
try {
task.run();
} catch (final RuntimeException e) {
LOGGER.error("Cleanup task failed.", e);
} finally {
lock.unlock();
}
}));
return null;
} | java | @SuppressWarnings("squid:S3516")
private Void executeAutoCleanup() {
systemManagement.forEachTenant(tenant -> cleanupTasks.forEach(task -> {
final Lock lock = obtainLock(task, tenant);
if (!lock.tryLock()) {
return;
}
try {
task.run();
} catch (final RuntimeException e) {
LOGGER.error("Cleanup task failed.", e);
} finally {
lock.unlock();
}
}));
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S3516\"",
")",
"private",
"Void",
"executeAutoCleanup",
"(",
")",
"{",
"systemManagement",
".",
"forEachTenant",
"(",
"tenant",
"->",
"cleanupTasks",
".",
"forEach",
"(",
"task",
"->",
"{",
"final",
"Lock",
"lock",
"=",
"... | Method which executes each registered cleanup task for each tenant. | [
"Method",
"which",
"executes",
"each",
"registered",
"cleanup",
"task",
"for",
"each",
"tenant",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autocleanup/AutoCleanupScheduler.java#L75-L91 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java | DistributionTable.styleDistributionSetTable | public void styleDistributionSetTable(final Long installedDistItemId, final Long assignedDistTableItemId) {
setCellStyleGenerator((source, itemId, propertyId) -> getPinnedDistributionStyle(installedDistItemId,
assignedDistTableItemId, itemId));
} | java | public void styleDistributionSetTable(final Long installedDistItemId, final Long assignedDistTableItemId) {
setCellStyleGenerator((source, itemId, propertyId) -> getPinnedDistributionStyle(installedDistItemId,
assignedDistTableItemId, itemId));
} | [
"public",
"void",
"styleDistributionSetTable",
"(",
"final",
"Long",
"installedDistItemId",
",",
"final",
"Long",
"assignedDistTableItemId",
")",
"{",
"setCellStyleGenerator",
"(",
"(",
"source",
",",
"itemId",
",",
"propertyId",
")",
"->",
"getPinnedDistributionStyle",... | Added by Saumya Target pin listener.
@param installedDistItemId
Item ids of installed distribution set
@param assignedDistTableItemId
Item ids of assigned distribution set | [
"Added",
"by",
"Saumya",
"Target",
"pin",
"listener",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionTable.java#L712-L715 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/AbstractGridButtonConverter.java | AbstractGridButtonConverter.createFontIconData | private static FontIconData createFontIconData(StatusFontIcon meta) {
FontIconData result = new FontIconData();
result.setFontIconHtml(meta.getFontIcon().getHtml());
result.setTitle(meta.getTitle());
result.setStyle(meta.getStyle());
result.setId(meta.getId());
result.setDisabled(meta.isDisabled());
return result;
} | java | private static FontIconData createFontIconData(StatusFontIcon meta) {
FontIconData result = new FontIconData();
result.setFontIconHtml(meta.getFontIcon().getHtml());
result.setTitle(meta.getTitle());
result.setStyle(meta.getStyle());
result.setId(meta.getId());
result.setDisabled(meta.isDisabled());
return result;
} | [
"private",
"static",
"FontIconData",
"createFontIconData",
"(",
"StatusFontIcon",
"meta",
")",
"{",
"FontIconData",
"result",
"=",
"new",
"FontIconData",
"(",
")",
";",
"result",
".",
"setFontIconHtml",
"(",
"meta",
".",
"getFontIcon",
"(",
")",
".",
"getHtml",
... | Creates a data transport object for the icon meta data.
@param meta
icon metadata
@return icon metadata transport object | [
"Creates",
"a",
"data",
"transport",
"object",
"for",
"the",
"icon",
"meta",
"data",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/AbstractGridButtonConverter.java#L54-L63 | train |
eclipse/hawkbit | hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/SpPermission.java | SpPermission.getAllAuthorities | public static List<String> getAllAuthorities() {
final List<String> allPermissions = new ArrayList<>();
final Field[] declaredFields = SpPermission.class.getDeclaredFields();
for (final Field field : declaredFields) {
if (Modifier.isPublic(field.getModifiers()) && Modifier.isStatic(field.getModifiers())) {
field.setAccessible(true);
try {
final String role = (String) field.get(null);
allPermissions.add(role);
} catch (final IllegalAccessException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
return allPermissions;
} | java | public static List<String> getAllAuthorities() {
final List<String> allPermissions = new ArrayList<>();
final Field[] declaredFields = SpPermission.class.getDeclaredFields();
for (final Field field : declaredFields) {
if (Modifier.isPublic(field.getModifiers()) && Modifier.isStatic(field.getModifiers())) {
field.setAccessible(true);
try {
final String role = (String) field.get(null);
allPermissions.add(role);
} catch (final IllegalAccessException e) {
LOGGER.error(e.getMessage(), e);
}
}
}
return allPermissions;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getAllAuthorities",
"(",
")",
"{",
"final",
"List",
"<",
"String",
">",
"allPermissions",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"Field",
"[",
"]",
"declaredFields",
"=",
"SpPermission",
".",... | Return all permission.
@param exclusionRoles
roles which will excluded
@return all permissions | [
"Return",
"all",
"permission",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/SpPermission.java#L165-L180 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/dd/client/criteria/ViewComponentClientCriterion.java | ViewComponentClientCriterion.isValidDragSource | @SuppressWarnings({ "squid:S1166", "squid:S2221" })
boolean isValidDragSource(final VDragEvent drag, final UIDL configuration) {
try {
final String dragSource = drag.getTransferable().getDragSource().getWidget().getElement().getId();
final String dragSourcePrefix = configuration.getStringAttribute(DRAG_SOURCE);
if (dragSource.startsWith(dragSourcePrefix)) {
return true;
}
} catch (final Exception e) {
// log and continue
LOGGER.log(Level.SEVERE, "Error verifying drag source: " + e.getLocalizedMessage());
}
return false;
} | java | @SuppressWarnings({ "squid:S1166", "squid:S2221" })
boolean isValidDragSource(final VDragEvent drag, final UIDL configuration) {
try {
final String dragSource = drag.getTransferable().getDragSource().getWidget().getElement().getId();
final String dragSourcePrefix = configuration.getStringAttribute(DRAG_SOURCE);
if (dragSource.startsWith(dragSourcePrefix)) {
return true;
}
} catch (final Exception e) {
// log and continue
LOGGER.log(Level.SEVERE, "Error verifying drag source: " + e.getLocalizedMessage());
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"squid:S1166\"",
",",
"\"squid:S2221\"",
"}",
")",
"boolean",
"isValidDragSource",
"(",
"final",
"VDragEvent",
"drag",
",",
"final",
"UIDL",
"configuration",
")",
"{",
"try",
"{",
"final",
"String",
"dragSource",
"=",
"drag",... | Exception semantics changes | [
"Exception",
"semantics",
"changes"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/dd/client/criteria/ViewComponentClientCriterion.java#L83-L97 | train |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpAuthenticationMessageHandler.java | AmqpAuthenticationMessageHandler.onAuthenticationRequest | @RabbitListener(queues = "${hawkbit.dmf.rabbitmq.authenticationReceiverQueue:authentication_receiver}", containerFactory = "listenerContainerFactory")
public Message onAuthenticationRequest(final Message message) {
checkContentTypeJson(message);
final SecurityContext oldContext = SecurityContextHolder.getContext();
try {
return handleAuthenticationMessage(message);
} catch (final RuntimeException ex) {
throw new AmqpRejectAndDontRequeueException(ex);
} finally {
SecurityContextHolder.setContext(oldContext);
}
} | java | @RabbitListener(queues = "${hawkbit.dmf.rabbitmq.authenticationReceiverQueue:authentication_receiver}", containerFactory = "listenerContainerFactory")
public Message onAuthenticationRequest(final Message message) {
checkContentTypeJson(message);
final SecurityContext oldContext = SecurityContextHolder.getContext();
try {
return handleAuthenticationMessage(message);
} catch (final RuntimeException ex) {
throw new AmqpRejectAndDontRequeueException(ex);
} finally {
SecurityContextHolder.setContext(oldContext);
}
} | [
"@",
"RabbitListener",
"(",
"queues",
"=",
"\"${hawkbit.dmf.rabbitmq.authenticationReceiverQueue:authentication_receiver}\"",
",",
"containerFactory",
"=",
"\"listenerContainerFactory\"",
")",
"public",
"Message",
"onAuthenticationRequest",
"(",
"final",
"Message",
"message",
")"... | Executed on an authentication request.
@param message
the amqp message
@return the rpc message back to supplier. | [
"Executed",
"on",
"an",
"authentication",
"request",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpAuthenticationMessageHandler.java#L103-L114 | train |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpAuthenticationMessageHandler.java | AmqpAuthenticationMessageHandler.checkIfArtifactIsAssignedToTarget | private void checkIfArtifactIsAssignedToTarget(final DmfTenantSecurityToken secruityToken, final String sha1Hash) {
if (secruityToken.getControllerId() != null) {
checkByControllerId(sha1Hash, secruityToken.getControllerId());
} else if (secruityToken.getTargetId() != null) {
checkByTargetId(sha1Hash, secruityToken.getTargetId());
} else {
LOG.info("anonymous download no authentication check for artifact {}", sha1Hash);
}
} | java | private void checkIfArtifactIsAssignedToTarget(final DmfTenantSecurityToken secruityToken, final String sha1Hash) {
if (secruityToken.getControllerId() != null) {
checkByControllerId(sha1Hash, secruityToken.getControllerId());
} else if (secruityToken.getTargetId() != null) {
checkByTargetId(sha1Hash, secruityToken.getTargetId());
} else {
LOG.info("anonymous download no authentication check for artifact {}", sha1Hash);
}
} | [
"private",
"void",
"checkIfArtifactIsAssignedToTarget",
"(",
"final",
"DmfTenantSecurityToken",
"secruityToken",
",",
"final",
"String",
"sha1Hash",
")",
"{",
"if",
"(",
"secruityToken",
".",
"getControllerId",
"(",
")",
"!=",
"null",
")",
"{",
"checkByControllerId",
... | check action for this download purposes, the method will throw an
EntityNotFoundException in case the controller is not allowed to download
this file because it's not assigned to an action and not assigned to this
controller. Otherwise no controllerId is set = anonymous download
@param secruityToken
the security token which holds the target ID to check on
@param sha1Hash
of the artifact to verify if the given target is allowed to
download it | [
"check",
"action",
"for",
"this",
"download",
"purposes",
"the",
"method",
"will",
"throw",
"an",
"EntityNotFoundException",
"in",
"case",
"the",
"controller",
"is",
"not",
"allowed",
"to",
"download",
"this",
"file",
"because",
"it",
"s",
"not",
"assigned",
"... | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpAuthenticationMessageHandler.java#L128-L138 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/TotalTargetCountStatus.java | TotalTargetCountStatus.getTotalTargetCountByStatus | public Long getTotalTargetCountByStatus(final Status status) {
final Long count = statusTotalCountMap.get(status);
return count == null ? 0L : count;
} | java | public Long getTotalTargetCountByStatus(final Status status) {
final Long count = statusTotalCountMap.get(status);
return count == null ? 0L : count;
} | [
"public",
"Long",
"getTotalTargetCountByStatus",
"(",
"final",
"Status",
"status",
")",
"{",
"final",
"Long",
"count",
"=",
"statusTotalCountMap",
".",
"get",
"(",
"status",
")",
";",
"return",
"count",
"==",
"null",
"?",
"0L",
":",
"count",
";",
"}"
] | Gets the total target count from a state.
@param status
the state key
@return the current target count cannot be <null> | [
"Gets",
"the",
"total",
"target",
"count",
"from",
"a",
"state",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/TotalTargetCountStatus.java#L108-L111 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/TotalTargetCountStatus.java | TotalTargetCountStatus.addToTotalCount | private void addToTotalCount(final List<TotalTargetCountActionStatus> targetCountActionStatus) {
if (targetCountActionStatus == null) {
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, totalTargetCount);
return;
}
statusTotalCountMap.put(Status.RUNNING, 0L);
Long notStartedTargetCount = totalTargetCount;
for (final TotalTargetCountActionStatus item : targetCountActionStatus) {
addToTotalCount(item);
notStartedTargetCount -= item.getCount();
}
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, notStartedTargetCount);
} | java | private void addToTotalCount(final List<TotalTargetCountActionStatus> targetCountActionStatus) {
if (targetCountActionStatus == null) {
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, totalTargetCount);
return;
}
statusTotalCountMap.put(Status.RUNNING, 0L);
Long notStartedTargetCount = totalTargetCount;
for (final TotalTargetCountActionStatus item : targetCountActionStatus) {
addToTotalCount(item);
notStartedTargetCount -= item.getCount();
}
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, notStartedTargetCount);
} | [
"private",
"void",
"addToTotalCount",
"(",
"final",
"List",
"<",
"TotalTargetCountActionStatus",
">",
"targetCountActionStatus",
")",
"{",
"if",
"(",
"targetCountActionStatus",
"==",
"null",
")",
"{",
"statusTotalCountMap",
".",
"put",
"(",
"TotalTargetCountStatus",
"... | Populate all target status to a the given map
@param statusTotalCountMap
the map
@param rolloutStatusCountItems
all target {@link Status} with total count | [
"Populate",
"all",
"target",
"status",
"to",
"a",
"the",
"given",
"map"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/TotalTargetCountStatus.java#L128-L140 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/TotalTargetCountStatus.java | TotalTargetCountStatus.convertStatus | @SuppressWarnings("squid:MethodCyclomaticComplexity")
private Status convertStatus(final Action.Status status){
switch (status) {
case SCHEDULED:
return Status.SCHEDULED;
case ERROR:
return Status.ERROR;
case FINISHED:
return Status.FINISHED;
case CANCELED:
return Status.CANCELLED;
case RETRIEVED:
case RUNNING:
case WARNING:
case DOWNLOAD:
case CANCELING:
return Status.RUNNING;
case DOWNLOADED:
return Action.ActionType.DOWNLOAD_ONLY.equals(rolloutType) ? Status.FINISHED : Status.RUNNING;
default:
throw new IllegalArgumentException("State " + status + "is not valid");
}
} | java | @SuppressWarnings("squid:MethodCyclomaticComplexity")
private Status convertStatus(final Action.Status status){
switch (status) {
case SCHEDULED:
return Status.SCHEDULED;
case ERROR:
return Status.ERROR;
case FINISHED:
return Status.FINISHED;
case CANCELED:
return Status.CANCELLED;
case RETRIEVED:
case RUNNING:
case WARNING:
case DOWNLOAD:
case CANCELING:
return Status.RUNNING;
case DOWNLOADED:
return Action.ActionType.DOWNLOAD_ONLY.equals(rolloutType) ? Status.FINISHED : Status.RUNNING;
default:
throw new IllegalArgumentException("State " + status + "is not valid");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:MethodCyclomaticComplexity\"",
")",
"private",
"Status",
"convertStatus",
"(",
"final",
"Action",
".",
"Status",
"status",
")",
"{",
"switch",
"(",
"status",
")",
"{",
"case",
"SCHEDULED",
":",
"return",
"Status",
".",
"SCH... | really complex. | [
"really",
"complex",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/TotalTargetCountStatus.java#L149-L171 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/detailslayout/SoftwareModuleDetailsTable.java | SoftwareModuleDetailsTable.populateModule | public void populateModule(final DistributionSet distributionSet) {
removeAllItems();
if (distributionSet != null) {
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateRepositoryPermission()) {
try {
isTargetAssigned = false;
} catch (final EntityReadOnlyException exception) {
isTargetAssigned = true;
LOG.info("Target already assigned for the distribution set: " + distributionSet.getName(),
exception);
}
}
final Set<SoftwareModuleType> swModuleMandatoryTypes = distributionSet.getType().getMandatoryModuleTypes();
final Set<SoftwareModuleType> swModuleOptionalTypes = distributionSet.getType().getOptionalModuleTypes();
if (!CollectionUtils.isEmpty(swModuleMandatoryTypes)) {
swModuleMandatoryTypes.forEach(swModule -> setSwModuleProperties(swModule, true, distributionSet));
}
if (!CollectionUtils.isEmpty(swModuleOptionalTypes)) {
swModuleOptionalTypes.forEach(swModule -> setSwModuleProperties(swModule, false, distributionSet));
}
setAmountOfTableRows(getContainerDataSource().size());
}
} | java | public void populateModule(final DistributionSet distributionSet) {
removeAllItems();
if (distributionSet != null) {
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateRepositoryPermission()) {
try {
isTargetAssigned = false;
} catch (final EntityReadOnlyException exception) {
isTargetAssigned = true;
LOG.info("Target already assigned for the distribution set: " + distributionSet.getName(),
exception);
}
}
final Set<SoftwareModuleType> swModuleMandatoryTypes = distributionSet.getType().getMandatoryModuleTypes();
final Set<SoftwareModuleType> swModuleOptionalTypes = distributionSet.getType().getOptionalModuleTypes();
if (!CollectionUtils.isEmpty(swModuleMandatoryTypes)) {
swModuleMandatoryTypes.forEach(swModule -> setSwModuleProperties(swModule, true, distributionSet));
}
if (!CollectionUtils.isEmpty(swModuleOptionalTypes)) {
swModuleOptionalTypes.forEach(swModule -> setSwModuleProperties(swModule, false, distributionSet));
}
setAmountOfTableRows(getContainerDataSource().size());
}
} | [
"public",
"void",
"populateModule",
"(",
"final",
"DistributionSet",
"distributionSet",
")",
"{",
"removeAllItems",
"(",
")",
";",
"if",
"(",
"distributionSet",
"!=",
"null",
")",
"{",
"if",
"(",
"isUnassignSoftModAllowed",
"&&",
"permissionChecker",
".",
"hasUpda... | Populate software module table.
@param distributionSet | [
"Populate",
"software",
"module",
"table",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/detailslayout/SoftwareModuleDetailsTable.java#L145-L169 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/DefaultGridHeader.java | DefaultGridHeader.buildTitleLabel | protected Label buildTitleLabel() {
// create default title - even shown when no data is available
title = new LabelBuilder().name(titleText).buildCaptionLabel();
title.setImmediate(true);
title.setContentMode(ContentMode.HTML);
return title;
} | java | protected Label buildTitleLabel() {
// create default title - even shown when no data is available
title = new LabelBuilder().name(titleText).buildCaptionLabel();
title.setImmediate(true);
title.setContentMode(ContentMode.HTML);
return title;
} | [
"protected",
"Label",
"buildTitleLabel",
"(",
")",
"{",
"// create default title - even shown when no data is available",
"title",
"=",
"new",
"LabelBuilder",
"(",
")",
".",
"name",
"(",
"titleText",
")",
".",
"buildCaptionLabel",
"(",
")",
";",
"title",
".",
"setIm... | Builds the title label.
@return title-label | [
"Builds",
"the",
"title",
"label",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/DefaultGridHeader.java#L81-L88 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/DefaultGridHeader.java | DefaultGridHeader.buildTitleLayout | protected HorizontalLayout buildTitleLayout() {
titleLayout = new HorizontalLayout();
titleLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
titleLayout.setSpacing(false);
titleLayout.setMargin(false);
titleLayout.setSizeFull();
titleLayout.addComponent(title);
titleLayout.setComponentAlignment(title, Alignment.TOP_LEFT);
titleLayout.setExpandRatio(title, 0.8F);
if (hasHeaderMaximizeSupport()) {
titleLayout.addComponents(getHeaderMaximizeSupport().maxMinButton);
titleLayout.setComponentAlignment(getHeaderMaximizeSupport().maxMinButton, Alignment.TOP_RIGHT);
titleLayout.setExpandRatio(getHeaderMaximizeSupport().maxMinButton, 0.2F);
}
return titleLayout;
} | java | protected HorizontalLayout buildTitleLayout() {
titleLayout = new HorizontalLayout();
titleLayout.addStyleName(SPUIStyleDefinitions.WIDGET_TITLE);
titleLayout.setSpacing(false);
titleLayout.setMargin(false);
titleLayout.setSizeFull();
titleLayout.addComponent(title);
titleLayout.setComponentAlignment(title, Alignment.TOP_LEFT);
titleLayout.setExpandRatio(title, 0.8F);
if (hasHeaderMaximizeSupport()) {
titleLayout.addComponents(getHeaderMaximizeSupport().maxMinButton);
titleLayout.setComponentAlignment(getHeaderMaximizeSupport().maxMinButton, Alignment.TOP_RIGHT);
titleLayout.setExpandRatio(getHeaderMaximizeSupport().maxMinButton, 0.2F);
}
return titleLayout;
} | [
"protected",
"HorizontalLayout",
"buildTitleLayout",
"(",
")",
"{",
"titleLayout",
"=",
"new",
"HorizontalLayout",
"(",
")",
";",
"titleLayout",
".",
"addStyleName",
"(",
"SPUIStyleDefinitions",
".",
"WIDGET_TITLE",
")",
";",
"titleLayout",
".",
"setSpacing",
"(",
... | Builds the title layout.
@return title-layout | [
"Builds",
"the",
"title",
"layout",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/DefaultGridHeader.java#L95-L112 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/DefaultGridHeader.java | DefaultGridHeader.buildComponent | protected void buildComponent() {
addComponent(titleLayout);
setComponentAlignment(titleLayout, Alignment.TOP_LEFT);
setWidth(100, Unit.PERCENTAGE);
setImmediate(true);
addStyleName("action-history-header");
addStyleName("bordered-layout");
addStyleName("no-border-bottom");
} | java | protected void buildComponent() {
addComponent(titleLayout);
setComponentAlignment(titleLayout, Alignment.TOP_LEFT);
setWidth(100, Unit.PERCENTAGE);
setImmediate(true);
addStyleName("action-history-header");
addStyleName("bordered-layout");
addStyleName("no-border-bottom");
} | [
"protected",
"void",
"buildComponent",
"(",
")",
"{",
"addComponent",
"(",
"titleLayout",
")",
";",
"setComponentAlignment",
"(",
"titleLayout",
",",
"Alignment",
".",
"TOP_LEFT",
")",
";",
"setWidth",
"(",
"100",
",",
"Unit",
".",
"PERCENTAGE",
")",
";",
"s... | Builds the layout for the header component. | [
"Builds",
"the",
"layout",
"for",
"the",
"header",
"component",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/DefaultGridHeader.java#L117-L125 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/TargetAssignmentOperations.java | TargetAssignmentOperations.isMaintenanceWindowValid | public static boolean isMaintenanceWindowValid(final MaintenanceWindowLayout maintenanceWindowLayout,
final UINotification notification) {
if (maintenanceWindowLayout.isEnabled()) {
try {
MaintenanceScheduleHelper.validateMaintenanceSchedule(maintenanceWindowLayout.getMaintenanceSchedule(),
maintenanceWindowLayout.getMaintenanceDuration(),
maintenanceWindowLayout.getMaintenanceTimeZone());
} catch (final InvalidMaintenanceScheduleException e) {
LOG.error("Maintenance window is not valid", e);
notification.displayValidationError(e.getMessage());
return false;
}
}
return true;
} | java | public static boolean isMaintenanceWindowValid(final MaintenanceWindowLayout maintenanceWindowLayout,
final UINotification notification) {
if (maintenanceWindowLayout.isEnabled()) {
try {
MaintenanceScheduleHelper.validateMaintenanceSchedule(maintenanceWindowLayout.getMaintenanceSchedule(),
maintenanceWindowLayout.getMaintenanceDuration(),
maintenanceWindowLayout.getMaintenanceTimeZone());
} catch (final InvalidMaintenanceScheduleException e) {
LOG.error("Maintenance window is not valid", e);
notification.displayValidationError(e.getMessage());
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isMaintenanceWindowValid",
"(",
"final",
"MaintenanceWindowLayout",
"maintenanceWindowLayout",
",",
"final",
"UINotification",
"notification",
")",
"{",
"if",
"(",
"maintenanceWindowLayout",
".",
"isEnabled",
"(",
")",
")",
"{",
"try",
... | Check wether the maintenance window is valid or not
@param maintenanceWindowLayout
the maintenance window layout
@param notification
the UI Notification
@return boolean if maintenance window is valid or not | [
"Check",
"wether",
"the",
"maintenance",
"window",
"is",
"valid",
"or",
"not"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/TargetAssignmentOperations.java#L166-L180 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/TargetAssignmentOperations.java | TargetAssignmentOperations.createAssignmentTab | public static ConfirmationTab createAssignmentTab(
final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout,
final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle,
final VaadinMessageSource i18n, final UiProperties uiProperties) {
final CheckBox maintenanceWindowControl = maintenanceWindowControl(i18n, maintenanceWindowLayout,
saveButtonToggle);
final Link maintenanceWindowHelpLink = maintenanceWindowHelpLinkControl(uiProperties, i18n);
final HorizontalLayout layout = createHorizontalLayout(maintenanceWindowControl, maintenanceWindowHelpLink);
actionTypeOptionGroupLayout.selectDefaultOption();
initMaintenanceWindow(maintenanceWindowLayout, saveButtonToggle);
addValueChangeListener(actionTypeOptionGroupLayout, maintenanceWindowControl, maintenanceWindowHelpLink);
return createAssignmentTab(actionTypeOptionGroupLayout, layout, maintenanceWindowLayout);
} | java | public static ConfirmationTab createAssignmentTab(
final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout,
final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle,
final VaadinMessageSource i18n, final UiProperties uiProperties) {
final CheckBox maintenanceWindowControl = maintenanceWindowControl(i18n, maintenanceWindowLayout,
saveButtonToggle);
final Link maintenanceWindowHelpLink = maintenanceWindowHelpLinkControl(uiProperties, i18n);
final HorizontalLayout layout = createHorizontalLayout(maintenanceWindowControl, maintenanceWindowHelpLink);
actionTypeOptionGroupLayout.selectDefaultOption();
initMaintenanceWindow(maintenanceWindowLayout, saveButtonToggle);
addValueChangeListener(actionTypeOptionGroupLayout, maintenanceWindowControl, maintenanceWindowHelpLink);
return createAssignmentTab(actionTypeOptionGroupLayout, layout, maintenanceWindowLayout);
} | [
"public",
"static",
"ConfirmationTab",
"createAssignmentTab",
"(",
"final",
"ActionTypeOptionGroupAssignmentLayout",
"actionTypeOptionGroupLayout",
",",
"final",
"MaintenanceWindowLayout",
"maintenanceWindowLayout",
",",
"final",
"Consumer",
"<",
"Boolean",
">",
"saveButtonToggle... | Create the Assignment Confirmation Tab
@param actionTypeOptionGroupLayout
the action Type Option Group Layout
@param maintenanceWindowLayout
the Maintenance Window Layout
@param saveButtonToggle
The event listener to derimne if save button should be enabled or not
@param i18n
the Vaadin Message Source for multi language
@param uiProperties
the UI Properties
@return the Assignment Confirmation tab | [
"Create",
"the",
"Assignment",
"Confirmation",
"Tab"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/TargetAssignmentOperations.java#L197-L211 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java | SPDateTimeUtil.getBrowserTimeZone | public static TimeZone getBrowserTimeZone() {
if (!StringUtils.isEmpty(fixedTimeZoneProperty)) {
return TimeZone.getTimeZone(fixedTimeZoneProperty);
}
final WebBrowser webBrowser = com.vaadin.server.Page.getCurrent().getWebBrowser();
final String[] timeZones = TimeZone.getAvailableIDs(webBrowser.getRawTimezoneOffset());
TimeZone tz = TimeZone.getDefault();
for (final String string : timeZones) {
final TimeZone t = TimeZone.getTimeZone(string);
if (t.getRawOffset() == webBrowser.getRawTimezoneOffset()) {
tz = t;
}
}
return tz;
} | java | public static TimeZone getBrowserTimeZone() {
if (!StringUtils.isEmpty(fixedTimeZoneProperty)) {
return TimeZone.getTimeZone(fixedTimeZoneProperty);
}
final WebBrowser webBrowser = com.vaadin.server.Page.getCurrent().getWebBrowser();
final String[] timeZones = TimeZone.getAvailableIDs(webBrowser.getRawTimezoneOffset());
TimeZone tz = TimeZone.getDefault();
for (final String string : timeZones) {
final TimeZone t = TimeZone.getTimeZone(string);
if (t.getRawOffset() == webBrowser.getRawTimezoneOffset()) {
tz = t;
}
}
return tz;
} | [
"public",
"static",
"TimeZone",
"getBrowserTimeZone",
"(",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"fixedTimeZoneProperty",
")",
")",
"{",
"return",
"TimeZone",
".",
"getTimeZone",
"(",
"fixedTimeZoneProperty",
")",
";",
"}",
"final",
"We... | Get browser time zone or fixed time zone if configured
@return TimeZone | [
"Get",
"browser",
"time",
"zone",
"or",
"fixed",
"time",
"zone",
"if",
"configured"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java#L62-L79 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java | SPDateTimeUtil.getTimeZoneId | public static ZoneId getTimeZoneId(final TimeZone tz) {
return ZoneId.of(tz.getID(), ZoneId.SHORT_IDS);
} | java | public static ZoneId getTimeZoneId(final TimeZone tz) {
return ZoneId.of(tz.getID(), ZoneId.SHORT_IDS);
} | [
"public",
"static",
"ZoneId",
"getTimeZoneId",
"(",
"final",
"TimeZone",
"tz",
")",
"{",
"return",
"ZoneId",
".",
"of",
"(",
"tz",
".",
"getID",
"(",
")",
",",
"ZoneId",
".",
"SHORT_IDS",
")",
";",
"}"
] | Get time zone id .ZoneId.SHORT_IDS used get id if time zone is
abbreviated like 'IST'.
@param tz
@return ZoneId | [
"Get",
"time",
"zone",
"id",
".",
"ZoneId",
".",
"SHORT_IDS",
"used",
"get",
"id",
"if",
"time",
"zone",
"is",
"abbreviated",
"like",
"IST",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java#L88-L90 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java | SPDateTimeUtil.getFormattedDate | public static String getFormattedDate(final Long lastQueryDate, final String datePattern) {
return formatDate(lastQueryDate, null, datePattern);
} | java | public static String getFormattedDate(final Long lastQueryDate, final String datePattern) {
return formatDate(lastQueryDate, null, datePattern);
} | [
"public",
"static",
"String",
"getFormattedDate",
"(",
"final",
"Long",
"lastQueryDate",
",",
"final",
"String",
"datePattern",
")",
"{",
"return",
"formatDate",
"(",
"lastQueryDate",
",",
"null",
",",
"datePattern",
")",
";",
"}"
] | Get formatted date with browser time zone.
@param lastQueryDate
@param datePattern
pattern how to format the date (cp. {@code SimpleDateFormat})
@return String formatted date | [
"Get",
"formatted",
"date",
"with",
"browser",
"time",
"zone",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java#L110-L112 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java | SPDateTimeUtil.formatLastModifiedAt | public static String formatLastModifiedAt(final BaseEntity baseEntity, final String datePattern) {
if (baseEntity == null) {
return "";
}
return formatDate(baseEntity.getLastModifiedAt(), "", datePattern);
} | java | public static String formatLastModifiedAt(final BaseEntity baseEntity, final String datePattern) {
if (baseEntity == null) {
return "";
}
return formatDate(baseEntity.getLastModifiedAt(), "", datePattern);
} | [
"public",
"static",
"String",
"formatLastModifiedAt",
"(",
"final",
"BaseEntity",
"baseEntity",
",",
"final",
"String",
"datePattern",
")",
"{",
"if",
"(",
"baseEntity",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"return",
"formatDate",
"(",
"baseEnti... | Get formatted date 'last modified at' by entity.
@param baseEntity
the entity
@param datePattern
pattern how to format the date (cp. {@code SimpleDateFormat})
@return String formatted date | [
"Get",
"formatted",
"date",
"last",
"modified",
"at",
"by",
"entity",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java#L151-L156 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java | SPDateTimeUtil.getDurationFormattedString | public static String getDurationFormattedString(final long startMillis, final long endMillis,
final VaadinMessageSource i18N) {
final String formatDuration = DurationFormatUtils.formatPeriod(startMillis, endMillis, DURATION_FORMAT, false,
getBrowserTimeZone());
final StringBuilder formattedDuration = new StringBuilder();
final String[] split = formatDuration.split(",");
for (int index = 0; index < split.length; index++) {
if (index != 0 && formattedDuration.length() > 0) {
formattedDuration.append(' ');
}
final int value = Integer.parseInt(split[index]);
if (value != 0) {
final String suffix = (value == 1) ? i18N.getMessage(DURATION_I18N.get(index).getSingle())
: i18N.getMessage(DURATION_I18N.get(index).getPlural());
formattedDuration.append(value).append(' ').append(suffix);
}
}
return formattedDuration.toString();
} | java | public static String getDurationFormattedString(final long startMillis, final long endMillis,
final VaadinMessageSource i18N) {
final String formatDuration = DurationFormatUtils.formatPeriod(startMillis, endMillis, DURATION_FORMAT, false,
getBrowserTimeZone());
final StringBuilder formattedDuration = new StringBuilder();
final String[] split = formatDuration.split(",");
for (int index = 0; index < split.length; index++) {
if (index != 0 && formattedDuration.length() > 0) {
formattedDuration.append(' ');
}
final int value = Integer.parseInt(split[index]);
if (value != 0) {
final String suffix = (value == 1) ? i18N.getMessage(DURATION_I18N.get(index).getSingle())
: i18N.getMessage(DURATION_I18N.get(index).getPlural());
formattedDuration.append(value).append(' ').append(suffix);
}
}
return formattedDuration.toString();
} | [
"public",
"static",
"String",
"getDurationFormattedString",
"(",
"final",
"long",
"startMillis",
",",
"final",
"long",
"endMillis",
",",
"final",
"VaadinMessageSource",
"i18N",
")",
"{",
"final",
"String",
"formatDuration",
"=",
"DurationFormatUtils",
".",
"formatPeri... | Creates a formatted string of a duration in format '1 year 2 months 3
days 4 hours 5 minutes 6 seconds' zero values will be ignored in the
formatted string.
@param startMillis
the start milliseconds of the duration
@param endMillis
the end milliseconds of the duration
@param i18N
the i18n service to determine the correct string for e.g.
'year'
@return a formatted string for duration label | [
"Creates",
"a",
"formatted",
"string",
"of",
"a",
"duration",
"in",
"format",
"1",
"year",
"2",
"months",
"3",
"days",
"4",
"hours",
"5",
"minutes",
"6",
"seconds",
"zero",
"values",
"will",
"be",
"ignored",
"in",
"the",
"formatted",
"string",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java#L185-L207 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/DistributionSetInfoPanel.java | DistributionSetInfoPanel.getSWModlabel | private Label getSWModlabel(final String labelName, final SoftwareModule swModule) {
return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion());
} | java | private Label getSWModlabel(final String labelName, final SoftwareModule swModule) {
return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion());
} | [
"private",
"Label",
"getSWModlabel",
"(",
"final",
"String",
"labelName",
",",
"final",
"SoftwareModule",
"swModule",
")",
"{",
"return",
"SPUIComponentProvider",
".",
"createNameValueLabel",
"(",
"labelName",
"+",
"\" : \"",
",",
"swModule",
".",
"getName",
"(",
... | Create Label for SW Module.
@param labelName
as Name
@param swModule
as Module (JVM|OS|AH)
@return Label as UI | [
"Create",
"Label",
"for",
"SW",
"Module",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/DistributionSetInfoPanel.java#L90-L92 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/SpecificationsBuilder.java | SpecificationsBuilder.combineWithAnd | public static <T> Specification<T> combineWithAnd(final List<Specification<T>> specList) {
if (specList.isEmpty()) {
return null;
}
Specification<T> specs = Specification.where(specList.get(0));
for (final Specification<T> specification : specList.subList(1, specList.size())) {
specs = specs.and(specification);
}
return specs;
} | java | public static <T> Specification<T> combineWithAnd(final List<Specification<T>> specList) {
if (specList.isEmpty()) {
return null;
}
Specification<T> specs = Specification.where(specList.get(0));
for (final Specification<T> specification : specList.subList(1, specList.size())) {
specs = specs.and(specification);
}
return specs;
} | [
"public",
"static",
"<",
"T",
">",
"Specification",
"<",
"T",
">",
"combineWithAnd",
"(",
"final",
"List",
"<",
"Specification",
"<",
"T",
">",
">",
"specList",
")",
"{",
"if",
"(",
"specList",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";... | Combine all given specification with and. The first specification is the
where clause.
@param specList
all specification which will combine
@return <null> if the given specification list is empty | [
"Combine",
"all",
"given",
"specification",
"with",
"and",
".",
"The",
"first",
"specification",
"is",
"the",
"where",
"clause",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/specifications/SpecificationsBuilder.java#L33-L42 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/DistributionBarHelper.java | DistributionBarHelper.getDistributionBarAsHTMLString | public static String getDistributionBarAsHTMLString(final Map<Status, Long> statusTotalCountMap) {
final StringBuilder htmlString = new StringBuilder();
final Map<Status, Long> statusMapWithNonZeroValues = getStatusMapWithNonZeroValues(statusTotalCountMap);
final Long totalValue = getTotalSizes(statusTotalCountMap);
if (statusMapWithNonZeroValues.size() <= 0) {
return getUnintialisedBar();
}
int partIndex = 1;
htmlString.append(getParentDivStart());
for (final Map.Entry<Status, Long> entry : statusMapWithNonZeroValues.entrySet()) {
if (entry.getValue() > 0) {
htmlString.append(getPart(partIndex, entry.getKey(), entry.getValue(), totalValue,
statusMapWithNonZeroValues.size()));
partIndex++;
}
}
htmlString.append(HTML_DIV_END);
return htmlString.toString();
} | java | public static String getDistributionBarAsHTMLString(final Map<Status, Long> statusTotalCountMap) {
final StringBuilder htmlString = new StringBuilder();
final Map<Status, Long> statusMapWithNonZeroValues = getStatusMapWithNonZeroValues(statusTotalCountMap);
final Long totalValue = getTotalSizes(statusTotalCountMap);
if (statusMapWithNonZeroValues.size() <= 0) {
return getUnintialisedBar();
}
int partIndex = 1;
htmlString.append(getParentDivStart());
for (final Map.Entry<Status, Long> entry : statusMapWithNonZeroValues.entrySet()) {
if (entry.getValue() > 0) {
htmlString.append(getPart(partIndex, entry.getKey(), entry.getValue(), totalValue,
statusMapWithNonZeroValues.size()));
partIndex++;
}
}
htmlString.append(HTML_DIV_END);
return htmlString.toString();
} | [
"public",
"static",
"String",
"getDistributionBarAsHTMLString",
"(",
"final",
"Map",
"<",
"Status",
",",
"Long",
">",
"statusTotalCountMap",
")",
"{",
"final",
"StringBuilder",
"htmlString",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"Map",
"<",
"Statu... | Returns a string with details of status and count .
@param statusTotalCountMap
map with status and count
@return string of format "status1:count,status2:count" | [
"Returns",
"a",
"string",
"with",
"details",
"of",
"status",
"and",
"count",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/DistributionBarHelper.java#L43-L61 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/DistributionBarHelper.java | DistributionBarHelper.getStatusMapWithNonZeroValues | public static Map<Status, Long> getStatusMapWithNonZeroValues(final Map<Status, Long> statusTotalCountMap) {
return statusTotalCountMap.entrySet().stream().filter(p -> p.getValue() > 0)
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
} | java | public static Map<Status, Long> getStatusMapWithNonZeroValues(final Map<Status, Long> statusTotalCountMap) {
return statusTotalCountMap.entrySet().stream().filter(p -> p.getValue() > 0)
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
} | [
"public",
"static",
"Map",
"<",
"Status",
",",
"Long",
">",
"getStatusMapWithNonZeroValues",
"(",
"final",
"Map",
"<",
"Status",
",",
"Long",
">",
"statusTotalCountMap",
")",
"{",
"return",
"statusTotalCountMap",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
... | Returns the map with status having non zero values.
@param statusTotalCountMap
map with status and count
@return map with non zero values | [
"Returns",
"the",
"map",
"with",
"status",
"having",
"non",
"zero",
"values",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/DistributionBarHelper.java#L70-L73 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/DistributionBarHelper.java | DistributionBarHelper.getTooltip | public static String getTooltip(final Map<Status, Long> statusCountMap) {
final Map<Status, Long> nonZeroStatusCountMap = DistributionBarHelper
.getStatusMapWithNonZeroValues(statusCountMap);
final StringBuilder tooltip = new StringBuilder();
for (final Entry<Status, Long> entry : nonZeroStatusCountMap.entrySet()) {
tooltip.append(entry.getKey().toString().toLowerCase()).append(" : ").append(entry.getValue())
.append("<br>");
}
return tooltip.toString();
} | java | public static String getTooltip(final Map<Status, Long> statusCountMap) {
final Map<Status, Long> nonZeroStatusCountMap = DistributionBarHelper
.getStatusMapWithNonZeroValues(statusCountMap);
final StringBuilder tooltip = new StringBuilder();
for (final Entry<Status, Long> entry : nonZeroStatusCountMap.entrySet()) {
tooltip.append(entry.getKey().toString().toLowerCase()).append(" : ").append(entry.getValue())
.append("<br>");
}
return tooltip.toString();
} | [
"public",
"static",
"String",
"getTooltip",
"(",
"final",
"Map",
"<",
"Status",
",",
"Long",
">",
"statusCountMap",
")",
"{",
"final",
"Map",
"<",
"Status",
",",
"Long",
">",
"nonZeroStatusCountMap",
"=",
"DistributionBarHelper",
".",
"getStatusMapWithNonZeroValue... | Returns tool tip for progress bar.
@param statusCountMap
map with status and count details
@return tool tip | [
"Returns",
"tool",
"tip",
"for",
"progress",
"bar",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/DistributionBarHelper.java#L82-L91 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java | DurationHelper.durationToFormattedString | public static String durationToFormattedString(final Duration duration) {
if (duration == null) {
return null;
}
return LocalTime.ofNanoOfDay(duration.toNanos()).format(DateTimeFormatter.ofPattern(DURATION_FORMAT));
} | java | public static String durationToFormattedString(final Duration duration) {
if (duration == null) {
return null;
}
return LocalTime.ofNanoOfDay(duration.toNanos()).format(DateTimeFormatter.ofPattern(DURATION_FORMAT));
} | [
"public",
"static",
"String",
"durationToFormattedString",
"(",
"final",
"Duration",
"duration",
")",
"{",
"if",
"(",
"duration",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"LocalTime",
".",
"ofNanoOfDay",
"(",
"duration",
".",
"toNanos",
... | Converts a Duration into a formatted String
@param duration
duration, which will be converted into a formatted String
@return String in the duration format, specified at
{@link #DURATION_FORMAT} | [
"Converts",
"a",
"Duration",
"into",
"a",
"formatted",
"String"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java#L81-L87 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java | DurationHelper.formattedStringToDuration | public static Duration formattedStringToDuration(final String formattedDuration) {
if (formattedDuration == null) {
return null;
}
final TemporalAccessor ta = DateTimeFormatter.ofPattern(DURATION_FORMAT).parse(formattedDuration.trim());
return Duration.between(LocalTime.MIDNIGHT, LocalTime.from(ta));
} | java | public static Duration formattedStringToDuration(final String formattedDuration) {
if (formattedDuration == null) {
return null;
}
final TemporalAccessor ta = DateTimeFormatter.ofPattern(DURATION_FORMAT).parse(formattedDuration.trim());
return Duration.between(LocalTime.MIDNIGHT, LocalTime.from(ta));
} | [
"public",
"static",
"Duration",
"formattedStringToDuration",
"(",
"final",
"String",
"formattedDuration",
")",
"{",
"if",
"(",
"formattedDuration",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"TemporalAccessor",
"ta",
"=",
"DateTimeFormatter",
"."... | Converts a formatted String into a Duration object.
@param formattedDuration
String in {@link #DURATION_FORMAT}
@return duration
@throws DateTimeParseException
when String is in wrong format | [
"Converts",
"a",
"formatted",
"String",
"into",
"a",
"Duration",
"object",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java#L98-L105 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java | DurationHelper.getDurationByTimeValues | public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
} | java | public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
} | [
"public",
"static",
"Duration",
"getDurationByTimeValues",
"(",
"final",
"long",
"hours",
",",
"final",
"long",
"minutes",
",",
"final",
"long",
"seconds",
")",
"{",
"return",
"Duration",
".",
"ofHours",
"(",
"hours",
")",
".",
"plusMinutes",
"(",
"minutes",
... | converts values of time constants to a Duration object..
@param hours
count of hours
@param minutes
count of minutes
@param seconds
count of seconds
@return duration | [
"converts",
"values",
"of",
"time",
"constants",
"to",
"a",
"Duration",
"object",
".."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java#L118-L120 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/AddUpdateRolloutWindowLayout.java | AddUpdateRolloutWindowLayout.resetComponents | private void resetComponents() {
defineGroupsLayout.resetComponents();
editRolloutEnabled = false;
rolloutName.clear();
targetFilterQuery.clear();
resetFields();
enableFields();
populateDistributionSet();
populateTargetFilterQuery();
setDefaultSaveStartGroupOption();
groupsLegendLayout.reset();
groupSizeLabel.setVisible(false);
noOfGroups.setVisible(true);
removeComponent(1, 2);
addComponent(targetFilterQueryCombo, 1, 2);
addGroupsLegendLayout();
addGroupsDefinitionTabs();
actionTypeOptionGroupLayout.selectDefaultOption();
autoStartOptionGroupLayout.selectDefaultOption();
totalTargetsCount = 0L;
rollout = null;
groupsDefinitionTabs.setVisible(true);
groupsDefinitionTabs.setSelectedTab(0);
approvalLabel.setVisible(false);
approvalButtonsLayout.setVisible(false);
approveButtonsGroup.clear();
approvalRemarkField.clear();
approveButtonsGroup.removeAllValidators();
} | java | private void resetComponents() {
defineGroupsLayout.resetComponents();
editRolloutEnabled = false;
rolloutName.clear();
targetFilterQuery.clear();
resetFields();
enableFields();
populateDistributionSet();
populateTargetFilterQuery();
setDefaultSaveStartGroupOption();
groupsLegendLayout.reset();
groupSizeLabel.setVisible(false);
noOfGroups.setVisible(true);
removeComponent(1, 2);
addComponent(targetFilterQueryCombo, 1, 2);
addGroupsLegendLayout();
addGroupsDefinitionTabs();
actionTypeOptionGroupLayout.selectDefaultOption();
autoStartOptionGroupLayout.selectDefaultOption();
totalTargetsCount = 0L;
rollout = null;
groupsDefinitionTabs.setVisible(true);
groupsDefinitionTabs.setSelectedTab(0);
approvalLabel.setVisible(false);
approvalButtonsLayout.setVisible(false);
approveButtonsGroup.clear();
approvalRemarkField.clear();
approveButtonsGroup.removeAllValidators();
} | [
"private",
"void",
"resetComponents",
"(",
")",
"{",
"defineGroupsLayout",
".",
"resetComponents",
"(",
")",
";",
"editRolloutEnabled",
"=",
"false",
";",
"rolloutName",
".",
"clear",
"(",
")",
";",
"targetFilterQuery",
".",
"clear",
"(",
")",
";",
"resetField... | Reset the field values. | [
"Reset",
"the",
"field",
"values",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/rollout/AddUpdateRolloutWindowLayout.java#L412-L442 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBulkUpdateWindowLayout.java | TargetBulkUpdateWindowLayout.resetComponents | public void resetComponents() {
dsNamecomboBox.clear();
descTextArea.clear();
targetBulkTokenTags.getTokenField().clear();
targetBulkTokenTags.populateContainer();
progressBar.setValue(0F);
progressBar.setVisible(false);
managementUIState.getTargetTableFilters().getBulkUpload().setProgressBarCurrentValue(0F);
targetsCountLabel.setVisible(false);
} | java | public void resetComponents() {
dsNamecomboBox.clear();
descTextArea.clear();
targetBulkTokenTags.getTokenField().clear();
targetBulkTokenTags.populateContainer();
progressBar.setValue(0F);
progressBar.setVisible(false);
managementUIState.getTargetTableFilters().getBulkUpload().setProgressBarCurrentValue(0F);
targetsCountLabel.setVisible(false);
} | [
"public",
"void",
"resetComponents",
"(",
")",
"{",
"dsNamecomboBox",
".",
"clear",
"(",
")",
";",
"descTextArea",
".",
"clear",
"(",
")",
";",
"targetBulkTokenTags",
".",
"getTokenField",
"(",
")",
".",
"clear",
"(",
")",
";",
"targetBulkTokenTags",
".",
... | Reset the values in popup. | [
"Reset",
"the",
"values",
"in",
"popup",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBulkUpdateWindowLayout.java#L286-L295 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBulkUpdateWindowLayout.java | TargetBulkUpdateWindowLayout.restoreComponentsValue | public void restoreComponentsValue() {
targetBulkTokenTags.populateContainer();
final TargetBulkUpload targetBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload();
progressBar.setValue(targetBulkUpload.getProgressBarCurrentValue());
dsNamecomboBox.setValue(targetBulkUpload.getDsNameAndVersion());
descTextArea.setValue(targetBulkUpload.getDescription());
targetBulkTokenTags.addAlreadySelectedTags();
if (targetBulkUpload.getProgressBarCurrentValue() >= 1) {
targetsCountLabel.setVisible(true);
targetsCountLabel.setCaption(getFormattedCountLabelValue(targetBulkUpload.getSucessfulUploadCount(),
targetBulkUpload.getFailedUploadCount()));
}
} | java | public void restoreComponentsValue() {
targetBulkTokenTags.populateContainer();
final TargetBulkUpload targetBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload();
progressBar.setValue(targetBulkUpload.getProgressBarCurrentValue());
dsNamecomboBox.setValue(targetBulkUpload.getDsNameAndVersion());
descTextArea.setValue(targetBulkUpload.getDescription());
targetBulkTokenTags.addAlreadySelectedTags();
if (targetBulkUpload.getProgressBarCurrentValue() >= 1) {
targetsCountLabel.setVisible(true);
targetsCountLabel.setCaption(getFormattedCountLabelValue(targetBulkUpload.getSucessfulUploadCount(),
targetBulkUpload.getFailedUploadCount()));
}
} | [
"public",
"void",
"restoreComponentsValue",
"(",
")",
"{",
"targetBulkTokenTags",
".",
"populateContainer",
"(",
")",
";",
"final",
"TargetBulkUpload",
"targetBulkUpload",
"=",
"managementUIState",
".",
"getTargetTableFilters",
"(",
")",
".",
"getBulkUpload",
"(",
")"... | Restore the target bulk upload layout field values. | [
"Restore",
"the",
"target",
"bulk",
"upload",
"layout",
"field",
"values",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBulkUpdateWindowLayout.java#L310-L323 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBulkUpdateWindowLayout.java | TargetBulkUpdateWindowLayout.onUploadCompletion | public void onUploadCompletion() {
final TargetBulkUpload targetBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload();
final String targetCountLabel = getFormattedCountLabelValue(targetBulkUpload.getSucessfulUploadCount(),
targetBulkUpload.getFailedUploadCount());
getTargetsCountLabel().setVisible(true);
getTargetsCountLabel().setCaption(targetCountLabel);
closeButton.setEnabled(true);
minimizeButton.setEnabled(false);
} | java | public void onUploadCompletion() {
final TargetBulkUpload targetBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload();
final String targetCountLabel = getFormattedCountLabelValue(targetBulkUpload.getSucessfulUploadCount(),
targetBulkUpload.getFailedUploadCount());
getTargetsCountLabel().setVisible(true);
getTargetsCountLabel().setCaption(targetCountLabel);
closeButton.setEnabled(true);
minimizeButton.setEnabled(false);
} | [
"public",
"void",
"onUploadCompletion",
"(",
")",
"{",
"final",
"TargetBulkUpload",
"targetBulkUpload",
"=",
"managementUIState",
".",
"getTargetTableFilters",
"(",
")",
".",
"getBulkUpload",
"(",
")",
";",
"final",
"String",
"targetCountLabel",
"=",
"getFormattedCoun... | Actions once bulk upload is completed. | [
"Actions",
"once",
"bulk",
"upload",
"is",
"completed",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBulkUpdateWindowLayout.java#L328-L338 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBulkUpdateWindowLayout.java | TargetBulkUpdateWindowLayout.getWindow | public Window getWindow() {
managementUIState.setBulkUploadWindowMinimised(false);
bulkUploadWindow = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW).caption("").content(this)
.buildWindow();
bulkUploadWindow.addStyleName("bulk-upload-window");
bulkUploadWindow.setImmediate(true);
if (managementUIState.getTargetTableFilters().getBulkUpload().getProgressBarCurrentValue() <= 0) {
bulkUploader.getUpload().setEnabled(true);
} else {
bulkUploader.getUpload().setEnabled(false);
}
return bulkUploadWindow;
} | java | public Window getWindow() {
managementUIState.setBulkUploadWindowMinimised(false);
bulkUploadWindow = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW).caption("").content(this)
.buildWindow();
bulkUploadWindow.addStyleName("bulk-upload-window");
bulkUploadWindow.setImmediate(true);
if (managementUIState.getTargetTableFilters().getBulkUpload().getProgressBarCurrentValue() <= 0) {
bulkUploader.getUpload().setEnabled(true);
} else {
bulkUploader.getUpload().setEnabled(false);
}
return bulkUploadWindow;
} | [
"public",
"Window",
"getWindow",
"(",
")",
"{",
"managementUIState",
".",
"setBulkUploadWindowMinimised",
"(",
"false",
")",
";",
"bulkUploadWindow",
"=",
"new",
"WindowBuilder",
"(",
"SPUIDefinitions",
".",
"CREATE_UPDATE_WINDOW",
")",
".",
"caption",
"(",
"\"\"",
... | create and return window
@return Window window | [
"create",
"and",
"return",
"window"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/targettable/TargetBulkUpdateWindowLayout.java#L356-L369 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/AbstractGridComponentLayout.java | AbstractGridComponentLayout.init | protected void init() {
this.gridHeader = createGridHeader();
this.grid = createGrid();
buildLayout();
setSizeFull();
setImmediate(true);
if (doSubscribeToEventBus()) {
eventBus.subscribe(this);
}
} | java | protected void init() {
this.gridHeader = createGridHeader();
this.grid = createGrid();
buildLayout();
setSizeFull();
setImmediate(true);
if (doSubscribeToEventBus()) {
eventBus.subscribe(this);
}
} | [
"protected",
"void",
"init",
"(",
")",
"{",
"this",
".",
"gridHeader",
"=",
"createGridHeader",
"(",
")",
";",
"this",
".",
"grid",
"=",
"createGrid",
"(",
")",
";",
"buildLayout",
"(",
")",
";",
"setSizeFull",
"(",
")",
";",
"setImmediate",
"(",
"true... | Initializes this layout that presents a header and a grid. | [
"Initializes",
"this",
"layout",
"that",
"presents",
"a",
"header",
"and",
"a",
"grid",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/AbstractGridComponentLayout.java#L54-L63 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/AbstractGridComponentLayout.java | AbstractGridComponentLayout.buildLayout | protected void buildLayout() {
setSizeFull();
setSpacing(true);
setMargin(false);
setStyleName("group");
final VerticalLayout gridHeaderLayout = new VerticalLayout();
gridHeaderLayout.setSizeFull();
gridHeaderLayout.setSpacing(false);
gridHeaderLayout.setMargin(false);
gridHeaderLayout.setStyleName("table-layout");
gridHeaderLayout.addComponent(gridHeader);
gridHeaderLayout.setComponentAlignment(gridHeader, Alignment.TOP_CENTER);
gridHeaderLayout.addComponent(grid);
gridHeaderLayout.setComponentAlignment(grid, Alignment.TOP_CENTER);
gridHeaderLayout.setExpandRatio(grid, 1.0F);
addComponent(gridHeaderLayout);
setComponentAlignment(gridHeaderLayout, Alignment.TOP_CENTER);
setExpandRatio(gridHeaderLayout, 1.0F);
if (hasFooterSupport()) {
final Layout footerLayout = getFooterSupport().createFooterMessageComponent();
addComponent(footerLayout);
setComponentAlignment(footerLayout, Alignment.BOTTOM_CENTER);
}
} | java | protected void buildLayout() {
setSizeFull();
setSpacing(true);
setMargin(false);
setStyleName("group");
final VerticalLayout gridHeaderLayout = new VerticalLayout();
gridHeaderLayout.setSizeFull();
gridHeaderLayout.setSpacing(false);
gridHeaderLayout.setMargin(false);
gridHeaderLayout.setStyleName("table-layout");
gridHeaderLayout.addComponent(gridHeader);
gridHeaderLayout.setComponentAlignment(gridHeader, Alignment.TOP_CENTER);
gridHeaderLayout.addComponent(grid);
gridHeaderLayout.setComponentAlignment(grid, Alignment.TOP_CENTER);
gridHeaderLayout.setExpandRatio(grid, 1.0F);
addComponent(gridHeaderLayout);
setComponentAlignment(gridHeaderLayout, Alignment.TOP_CENTER);
setExpandRatio(gridHeaderLayout, 1.0F);
if (hasFooterSupport()) {
final Layout footerLayout = getFooterSupport().createFooterMessageComponent();
addComponent(footerLayout);
setComponentAlignment(footerLayout, Alignment.BOTTOM_CENTER);
}
} | [
"protected",
"void",
"buildLayout",
"(",
")",
"{",
"setSizeFull",
"(",
")",
";",
"setSpacing",
"(",
"true",
")",
";",
"setMargin",
"(",
"false",
")",
";",
"setStyleName",
"(",
"\"group\"",
")",
";",
"final",
"VerticalLayout",
"gridHeaderLayout",
"=",
"new",
... | Layouts header, grid and optional footer. | [
"Layouts",
"header",
"grid",
"and",
"optional",
"footer",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/AbstractGridComponentLayout.java#L77-L104 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/AbstractGridComponentLayout.java | AbstractGridComponentLayout.registerDetails | public void registerDetails(final AbstractGrid<?>.DetailsSupport details) {
grid.addSelectionListener(event -> {
final Long masterId = (Long) event.getSelected().stream().findFirst().orElse(null);
details.populateMasterDataAndRecalculateContainer(masterId);
});
} | java | public void registerDetails(final AbstractGrid<?>.DetailsSupport details) {
grid.addSelectionListener(event -> {
final Long masterId = (Long) event.getSelected().stream().findFirst().orElse(null);
details.populateMasterDataAndRecalculateContainer(masterId);
});
} | [
"public",
"void",
"registerDetails",
"(",
"final",
"AbstractGrid",
"<",
"?",
">",
".",
"DetailsSupport",
"details",
")",
"{",
"grid",
".",
"addSelectionListener",
"(",
"event",
"->",
"{",
"final",
"Long",
"masterId",
"=",
"(",
"Long",
")",
"event",
".",
"g... | Registers the selection of this grid as master for another grid that
displays the details.
@param details
the details of another grid the selection of this grid should
be registered for as master. | [
"Registers",
"the",
"selection",
"of",
"this",
"grid",
"as",
"master",
"for",
"another",
"grid",
"that",
"displays",
"the",
"details",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/grid/AbstractGridComponentLayout.java#L114-L119 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/NoCountPagingRepository.java | NoCountPagingRepository.findAll | public <T, I extends Serializable> Slice<T> findAll(final Specification<T> spec, final Pageable pageable,
final Class<T> domainClass) {
final SimpleJpaNoCountRepository<T, I> noCountDao = new SimpleJpaNoCountRepository<>(domainClass, em);
return noCountDao.findAll(spec, pageable);
} | java | public <T, I extends Serializable> Slice<T> findAll(final Specification<T> spec, final Pageable pageable,
final Class<T> domainClass) {
final SimpleJpaNoCountRepository<T, I> noCountDao = new SimpleJpaNoCountRepository<>(domainClass, em);
return noCountDao.findAll(spec, pageable);
} | [
"public",
"<",
"T",
",",
"I",
"extends",
"Serializable",
">",
"Slice",
"<",
"T",
">",
"findAll",
"(",
"final",
"Specification",
"<",
"T",
">",
"spec",
",",
"final",
"Pageable",
"pageable",
",",
"final",
"Class",
"<",
"T",
">",
"domainClass",
")",
"{",
... | Searches without the need for an extra count query.
@param spec
to search for
@param pageable
information
@param domainClass
of the {@link Entity}
@return {@link Slice} of data
@see org.springframework.data.jpa.repository.JpaSpecificationExecutor#findAll(org.springframework
.data.jpa.domain.Specification,
org.springframework.data.domain.Pageable) | [
"Searches",
"without",
"the",
"need",
"for",
"an",
"extra",
"count",
"query",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/NoCountPagingRepository.java#L55-L59 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/report/model/TenantUsage.java | TenantUsage.addUsageData | public TenantUsage addUsageData(final String key, final String value) {
getLazyUsageData().put(key, value);
return this;
} | java | public TenantUsage addUsageData(final String key, final String value) {
getLazyUsageData().put(key, value);
return this;
} | [
"public",
"TenantUsage",
"addUsageData",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"getLazyUsageData",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add a key and value as usage data to the system usage stats.
@param key
the key to set
@param value
the value to set
@return tenant stats element with new usage added | [
"Add",
"a",
"key",
"and",
"value",
"as",
"usage",
"data",
"to",
"the",
"system",
"usage",
"stats",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/report/model/TenantUsage.java#L97-L100 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/groupschart/GroupsPieChart.java | GroupsPieChart.setChartState | public void setChartState(final List<Long> groupTargetCounts, final Long totalTargetsCount) {
getState().setGroupTargetCounts(groupTargetCounts);
getState().setTotalTargetCount(totalTargetsCount);
markAsDirty();
} | java | public void setChartState(final List<Long> groupTargetCounts, final Long totalTargetsCount) {
getState().setGroupTargetCounts(groupTargetCounts);
getState().setTotalTargetCount(totalTargetsCount);
markAsDirty();
} | [
"public",
"void",
"setChartState",
"(",
"final",
"List",
"<",
"Long",
">",
"groupTargetCounts",
",",
"final",
"Long",
"totalTargetsCount",
")",
"{",
"getState",
"(",
")",
".",
"setGroupTargetCounts",
"(",
"groupTargetCounts",
")",
";",
"getState",
"(",
")",
".... | Updates the state of the chart
@param groupTargetCounts
list of target counts
@param totalTargetsCount
total count of targets that are represented by the pie | [
"Updates",
"the",
"state",
"of",
"the",
"chart"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/groupschart/GroupsPieChart.java#L32-L36 | train |
eclipse/hawkbit | hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java | EventPublisherAutoConfiguration.applicationEventMulticaster | @Bean(name = AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME)
ApplicationEventMulticaster applicationEventMulticaster(@Qualifier("asyncExecutor") final Executor executor,
final TenantAware tenantAware) {
final SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new TenantAwareApplicationEventPublisher(
tenantAware, applicationEventFilter());
simpleApplicationEventMulticaster.setTaskExecutor(executor);
return simpleApplicationEventMulticaster;
} | java | @Bean(name = AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME)
ApplicationEventMulticaster applicationEventMulticaster(@Qualifier("asyncExecutor") final Executor executor,
final TenantAware tenantAware) {
final SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new TenantAwareApplicationEventPublisher(
tenantAware, applicationEventFilter());
simpleApplicationEventMulticaster.setTaskExecutor(executor);
return simpleApplicationEventMulticaster;
} | [
"@",
"Bean",
"(",
"name",
"=",
"AbstractApplicationContext",
".",
"APPLICATION_EVENT_MULTICASTER_BEAN_NAME",
")",
"ApplicationEventMulticaster",
"applicationEventMulticaster",
"(",
"@",
"Qualifier",
"(",
"\"asyncExecutor\"",
")",
"final",
"Executor",
"executor",
",",
"final... | Server internal event publisher that allows parallel event processing if
the event listener is marked as so.
@return publisher bean | [
"Server",
"internal",
"event",
"publisher",
"that",
"allows",
"parallel",
"event",
"processing",
"if",
"the",
"event",
"listener",
"is",
"marked",
"as",
"so",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/repository/event/EventPublisherAutoConfiguration.java#L53-L60 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autoassign/AutoAssignChecker.java | AutoAssignChecker.check | @Transactional(propagation = Propagation.REQUIRES_NEW)
public void check() {
LOGGER.debug("Auto assigned check call");
final PageRequest pageRequest = PageRequest.of(0, PAGE_SIZE);
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement.findWithAutoAssignDS(pageRequest);
for (final TargetFilterQuery filterQuery : filterQueries) {
checkByTargetFilterQueryAndAssignDS(filterQuery);
}
} | java | @Transactional(propagation = Propagation.REQUIRES_NEW)
public void check() {
LOGGER.debug("Auto assigned check call");
final PageRequest pageRequest = PageRequest.of(0, PAGE_SIZE);
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement.findWithAutoAssignDS(pageRequest);
for (final TargetFilterQuery filterQuery : filterQueries) {
checkByTargetFilterQueryAndAssignDS(filterQuery);
}
} | [
"@",
"Transactional",
"(",
"propagation",
"=",
"Propagation",
".",
"REQUIRES_NEW",
")",
"public",
"void",
"check",
"(",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Auto assigned check call\"",
")",
";",
"final",
"PageRequest",
"pageRequest",
"=",
"PageRequest",
".... | Checks all target filter queries with an auto assign distribution set and
triggers the check and assignment to targets that don't have the design
DS yet | [
"Checks",
"all",
"target",
"filter",
"queries",
"with",
"an",
"auto",
"assign",
"distribution",
"set",
"and",
"triggers",
"the",
"check",
"and",
"assignment",
"to",
"targets",
"that",
"don",
"t",
"have",
"the",
"design",
"DS",
"yet"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autoassign/AutoAssignChecker.java#L93-L105 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autoassign/AutoAssignChecker.java | AutoAssignChecker.checkByTargetFilterQueryAndAssignDS | private void checkByTargetFilterQueryAndAssignDS(final TargetFilterQuery targetFilterQuery) {
try {
final DistributionSet distributionSet = targetFilterQuery.getAutoAssignDistributionSet();
int count;
do {
count = runTransactionalAssignment(targetFilterQuery, distributionSet.getId());
} while (count == PAGE_SIZE);
} catch (PersistenceException | AbstractServerRtException e) {
LOGGER.error("Error during auto assign check of target filter query " + targetFilterQuery.getId(), e);
}
} | java | private void checkByTargetFilterQueryAndAssignDS(final TargetFilterQuery targetFilterQuery) {
try {
final DistributionSet distributionSet = targetFilterQuery.getAutoAssignDistributionSet();
int count;
do {
count = runTransactionalAssignment(targetFilterQuery, distributionSet.getId());
} while (count == PAGE_SIZE);
} catch (PersistenceException | AbstractServerRtException e) {
LOGGER.error("Error during auto assign check of target filter query " + targetFilterQuery.getId(), e);
}
} | [
"private",
"void",
"checkByTargetFilterQueryAndAssignDS",
"(",
"final",
"TargetFilterQuery",
"targetFilterQuery",
")",
"{",
"try",
"{",
"final",
"DistributionSet",
"distributionSet",
"=",
"targetFilterQuery",
".",
"getAutoAssignDistributionSet",
"(",
")",
";",
"int",
"cou... | Fetches the distribution set, gets all controllerIds and assigns the DS
to them. Catches PersistenceException and own exceptions derived from
AbstractServerRtException
@param targetFilterQuery
the target filter query | [
"Fetches",
"the",
"distribution",
"set",
"gets",
"all",
"controllerIds",
"and",
"assigns",
"the",
"DS",
"to",
"them",
".",
"Catches",
"PersistenceException",
"and",
"own",
"exceptions",
"derived",
"from",
"AbstractServerRtException"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autoassign/AutoAssignChecker.java#L115-L130 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autoassign/AutoAssignChecker.java | AutoAssignChecker.runTransactionalAssignment | private int runTransactionalAssignment(final TargetFilterQuery targetFilterQuery, final Long dsId) {
final String actionMessage = String.format(ACTION_MESSAGE, targetFilterQuery.getName());
return DeploymentHelper.runInNewTransaction(transactionManager, "autoAssignDSToTargets",
Isolation.READ_COMMITTED.value(), status -> {
final List<TargetWithActionType> targets = getTargetsWithActionType(targetFilterQuery.getQuery(),
dsId, targetFilterQuery.getAutoAssignActionType(), PAGE_SIZE);
final int count = targets.size();
if (count > 0) {
deploymentManagement.assignDistributionSet(dsId, targets, actionMessage);
}
return count;
});
} | java | private int runTransactionalAssignment(final TargetFilterQuery targetFilterQuery, final Long dsId) {
final String actionMessage = String.format(ACTION_MESSAGE, targetFilterQuery.getName());
return DeploymentHelper.runInNewTransaction(transactionManager, "autoAssignDSToTargets",
Isolation.READ_COMMITTED.value(), status -> {
final List<TargetWithActionType> targets = getTargetsWithActionType(targetFilterQuery.getQuery(),
dsId, targetFilterQuery.getAutoAssignActionType(), PAGE_SIZE);
final int count = targets.size();
if (count > 0) {
deploymentManagement.assignDistributionSet(dsId, targets, actionMessage);
}
return count;
});
} | [
"private",
"int",
"runTransactionalAssignment",
"(",
"final",
"TargetFilterQuery",
"targetFilterQuery",
",",
"final",
"Long",
"dsId",
")",
"{",
"final",
"String",
"actionMessage",
"=",
"String",
".",
"format",
"(",
"ACTION_MESSAGE",
",",
"targetFilterQuery",
".",
"g... | Runs one page of target assignments within a dedicated transaction
@param targetFilterQuery
the target filter query
@param dsId
distribution set id to assign
@return count of targets | [
"Runs",
"one",
"page",
"of",
"target",
"assignments",
"within",
"a",
"dedicated",
"transaction"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autoassign/AutoAssignChecker.java#L141-L154 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autoassign/AutoAssignChecker.java | AutoAssignChecker.getTargetsWithActionType | private List<TargetWithActionType> getTargetsWithActionType(final String targetFilterQuery, final Long dsId,
final ActionType type, final int count) {
final Page<Target> targets = targetManagement.findByTargetFilterQueryAndNonDS(PageRequest.of(0, count), dsId,
targetFilterQuery);
// the action type is set to FORCED per default (when not explicitly
// specified)
final ActionType autoAssignActionType = type == null ? ActionType.FORCED : type;
return targets.getContent().stream().map(t -> new TargetWithActionType(t.getControllerId(),
autoAssignActionType, RepositoryModelConstants.NO_FORCE_TIME)).collect(Collectors.toList());
} | java | private List<TargetWithActionType> getTargetsWithActionType(final String targetFilterQuery, final Long dsId,
final ActionType type, final int count) {
final Page<Target> targets = targetManagement.findByTargetFilterQueryAndNonDS(PageRequest.of(0, count), dsId,
targetFilterQuery);
// the action type is set to FORCED per default (when not explicitly
// specified)
final ActionType autoAssignActionType = type == null ? ActionType.FORCED : type;
return targets.getContent().stream().map(t -> new TargetWithActionType(t.getControllerId(),
autoAssignActionType, RepositoryModelConstants.NO_FORCE_TIME)).collect(Collectors.toList());
} | [
"private",
"List",
"<",
"TargetWithActionType",
">",
"getTargetsWithActionType",
"(",
"final",
"String",
"targetFilterQuery",
",",
"final",
"Long",
"dsId",
",",
"final",
"ActionType",
"type",
",",
"final",
"int",
"count",
")",
"{",
"final",
"Page",
"<",
"Target"... | Gets all matching targets with the designated action from the target
management
@param targetFilterQuery
the query the targets have to match
@param dsId
dsId the targets are not allowed to have in their action
history
@param type
action type for targets auto assignment
@param count
maximum amount of targets to retrieve
@return list of targets with action type | [
"Gets",
"all",
"matching",
"targets",
"with",
"the",
"designated",
"action",
"from",
"the",
"target",
"management"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/autoassign/AutoAssignChecker.java#L171-L181 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/AbstractHtmlLabelConverter.java | AbstractHtmlLabelConverter.convert | private String convert(final T status) {
if (adapter == null) {
throw new IllegalStateException(
"Adapter must be set before usage! Convertion without adapter is not possible!");
}
final StatusFontIcon statusProps = adapter.adapt(status);
// fail fast
if (statusProps == null) {
return "";
}
final String codePoint = getCodePoint(statusProps);
final String title = statusProps.getTitle();
return getStatusLabelDetailsInString(codePoint, statusProps.getStyle(), title, statusProps.getId(),
statusProps.isDisabled());
} | java | private String convert(final T status) {
if (adapter == null) {
throw new IllegalStateException(
"Adapter must be set before usage! Convertion without adapter is not possible!");
}
final StatusFontIcon statusProps = adapter.adapt(status);
// fail fast
if (statusProps == null) {
return "";
}
final String codePoint = getCodePoint(statusProps);
final String title = statusProps.getTitle();
return getStatusLabelDetailsInString(codePoint, statusProps.getStyle(), title, statusProps.getId(),
statusProps.isDisabled());
} | [
"private",
"String",
"convert",
"(",
"final",
"T",
"status",
")",
"{",
"if",
"(",
"adapter",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Adapter must be set before usage! Convertion without adapter is not possible!\"",
")",
";",
"}",
"fina... | Converts the model data to a string representation of the presentation
label that is used on client-side to style the label.
@param status
model data
@return string representation of label | [
"Converts",
"the",
"model",
"data",
"to",
"a",
"string",
"representation",
"of",
"the",
"presentation",
"label",
"that",
"is",
"used",
"on",
"client",
"-",
"side",
"to",
"style",
"the",
"label",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/customrenderers/renderers/AbstractHtmlLabelConverter.java#L68-L82 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java | DashboardMenu.buildLabelWrapper | private static Component buildLabelWrapper(final ValoMenuItemButton menuItemButton,
final Component notificationLabel) {
final CssLayout dashboardWrapper = new CssLayout(menuItemButton);
dashboardWrapper.addStyleName("labelwrapper");
dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM);
notificationLabel.addStyleName(ValoTheme.MENU_BADGE);
notificationLabel.setWidthUndefined();
notificationLabel.setVisible(false);
notificationLabel.setId(UIComponentIdProvider.NOTIFICATION_MENU_ID + menuItemButton.getCaption().toLowerCase());
dashboardWrapper.addComponent(notificationLabel);
return dashboardWrapper;
} | java | private static Component buildLabelWrapper(final ValoMenuItemButton menuItemButton,
final Component notificationLabel) {
final CssLayout dashboardWrapper = new CssLayout(menuItemButton);
dashboardWrapper.addStyleName("labelwrapper");
dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM);
notificationLabel.addStyleName(ValoTheme.MENU_BADGE);
notificationLabel.setWidthUndefined();
notificationLabel.setVisible(false);
notificationLabel.setId(UIComponentIdProvider.NOTIFICATION_MENU_ID + menuItemButton.getCaption().toLowerCase());
dashboardWrapper.addComponent(notificationLabel);
return dashboardWrapper;
} | [
"private",
"static",
"Component",
"buildLabelWrapper",
"(",
"final",
"ValoMenuItemButton",
"menuItemButton",
",",
"final",
"Component",
"notificationLabel",
")",
"{",
"final",
"CssLayout",
"dashboardWrapper",
"=",
"new",
"CssLayout",
"(",
"menuItemButton",
")",
";",
"... | Creates the wrapper which contains the menu item and the adjacent label
for displaying the occurred events
@param menuItemButton
the menu item
@param notificationLabel
the label for displaying the occurred events
@return Component of type CssLayout | [
"Creates",
"the",
"wrapper",
"which",
"contains",
"the",
"menu",
"item",
"and",
"the",
"adjacent",
"label",
"for",
"displaying",
"the",
"occurred",
"events"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java#L267-L278 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java | DashboardMenu.getAccessibleViews | private List<DashboardMenuItem> getAccessibleViews() {
return this.dashboardVaadinViews.stream()
.filter(view -> permissionService.hasAtLeastOnePermission(view.getPermissions()))
.collect(Collectors.toList());
} | java | private List<DashboardMenuItem> getAccessibleViews() {
return this.dashboardVaadinViews.stream()
.filter(view -> permissionService.hasAtLeastOnePermission(view.getPermissions()))
.collect(Collectors.toList());
} | [
"private",
"List",
"<",
"DashboardMenuItem",
">",
"getAccessibleViews",
"(",
")",
"{",
"return",
"this",
".",
"dashboardVaadinViews",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"view",
"->",
"permissionService",
".",
"hasAtLeastOnePermission",
"(",
"view",
"."... | Returns all views which are currently accessible by the current logged in
user.
@return a list of all views which are currently visible and accessible
for the current logged in user | [
"Returns",
"all",
"views",
"which",
"are",
"currently",
"accessible",
"by",
"the",
"current",
"logged",
"in",
"user",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java#L287-L291 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java | DashboardMenu.getByViewName | public DashboardMenuItem getByViewName(final String viewName) {
final Optional<DashboardMenuItem> findFirst = dashboardVaadinViews.stream()
.filter(view -> view.getViewName().equals(viewName)).findAny();
if (!findFirst.isPresent()) {
return null;
}
return findFirst.get();
} | java | public DashboardMenuItem getByViewName(final String viewName) {
final Optional<DashboardMenuItem> findFirst = dashboardVaadinViews.stream()
.filter(view -> view.getViewName().equals(viewName)).findAny();
if (!findFirst.isPresent()) {
return null;
}
return findFirst.get();
} | [
"public",
"DashboardMenuItem",
"getByViewName",
"(",
"final",
"String",
"viewName",
")",
"{",
"final",
"Optional",
"<",
"DashboardMenuItem",
">",
"findFirst",
"=",
"dashboardVaadinViews",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"view",
"->",
"view",
".",
... | Returns the dashboard view type by a given view name.
@param viewName
the name of the view to retrieve
@return the dashboard view for a given viewname or {@code null} if view
with given viewname does not exists | [
"Returns",
"the",
"dashboard",
"view",
"type",
"by",
"a",
"given",
"view",
"name",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java#L339-L348 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java | DashboardMenu.isAccessDenied | public boolean isAccessDenied(final String viewName) {
final List<DashboardMenuItem> accessibleViews = getAccessibleViews();
boolean accessDeined = Boolean.TRUE.booleanValue();
for (final DashboardMenuItem dashboardViewType : accessibleViews) {
if (dashboardViewType.getViewName().equals(viewName)) {
accessDeined = Boolean.FALSE.booleanValue();
}
}
return accessDeined;
} | java | public boolean isAccessDenied(final String viewName) {
final List<DashboardMenuItem> accessibleViews = getAccessibleViews();
boolean accessDeined = Boolean.TRUE.booleanValue();
for (final DashboardMenuItem dashboardViewType : accessibleViews) {
if (dashboardViewType.getViewName().equals(viewName)) {
accessDeined = Boolean.FALSE.booleanValue();
}
}
return accessDeined;
} | [
"public",
"boolean",
"isAccessDenied",
"(",
"final",
"String",
"viewName",
")",
"{",
"final",
"List",
"<",
"DashboardMenuItem",
">",
"accessibleViews",
"=",
"getAccessibleViews",
"(",
")",
";",
"boolean",
"accessDeined",
"=",
"Boolean",
".",
"TRUE",
".",
"boolea... | Is the given view accessible.
@param viewName
the view name
@return <code>true</code> = denied, <code>false</code> = accessible | [
"Is",
"the",
"given",
"view",
"accessible",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java#L357-L366 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/utils/DeploymentHelper.java | DeploymentHelper.successCancellation | public static void successCancellation(final JpaAction action, final ActionRepository actionRepository,
final TargetRepository targetRepository) {
// set action inactive
action.setActive(false);
action.setStatus(Status.CANCELED);
final JpaTarget target = (JpaTarget) action.getTarget();
final List<Action> nextActiveActions = actionRepository.findByTargetAndActiveOrderByIdAsc(target, true).stream()
.filter(a -> !a.getId().equals(action.getId())).collect(Collectors.toList());
if (nextActiveActions.isEmpty()) {
target.setAssignedDistributionSet(target.getInstalledDistributionSet());
target.setUpdateStatus(TargetUpdateStatus.IN_SYNC);
} else {
target.setAssignedDistributionSet(nextActiveActions.get(0).getDistributionSet());
}
targetRepository.save(target);
} | java | public static void successCancellation(final JpaAction action, final ActionRepository actionRepository,
final TargetRepository targetRepository) {
// set action inactive
action.setActive(false);
action.setStatus(Status.CANCELED);
final JpaTarget target = (JpaTarget) action.getTarget();
final List<Action> nextActiveActions = actionRepository.findByTargetAndActiveOrderByIdAsc(target, true).stream()
.filter(a -> !a.getId().equals(action.getId())).collect(Collectors.toList());
if (nextActiveActions.isEmpty()) {
target.setAssignedDistributionSet(target.getInstalledDistributionSet());
target.setUpdateStatus(TargetUpdateStatus.IN_SYNC);
} else {
target.setAssignedDistributionSet(nextActiveActions.get(0).getDistributionSet());
}
targetRepository.save(target);
} | [
"public",
"static",
"void",
"successCancellation",
"(",
"final",
"JpaAction",
"action",
",",
"final",
"ActionRepository",
"actionRepository",
",",
"final",
"TargetRepository",
"targetRepository",
")",
"{",
"// set action inactive",
"action",
".",
"setActive",
"(",
"fals... | This method is called, when cancellation has been successful. It sets the
action to canceled, resets the meta data of the target and in case there
is a new action this action is triggered.
@param action
the action which is set to canceled
@param actionRepository
for the operation
@param targetRepository
for the operation | [
"This",
"method",
"is",
"called",
"when",
"cancellation",
"has",
"been",
"successful",
".",
"It",
"sets",
"the",
"action",
"to",
"canceled",
"resets",
"the",
"meta",
"data",
"of",
"the",
"target",
"and",
"in",
"case",
"there",
"is",
"a",
"new",
"action",
... | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/utils/DeploymentHelper.java#L52-L71 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/UINotification.java | UINotification.displaySuccess | public void displaySuccess(final String message) {
notificationMessage.showNotification(SPUIStyleDefinitions.SP_NOTIFICATION_SUCCESS_MESSAGE_STYLE, null, message,
true);
} | java | public void displaySuccess(final String message) {
notificationMessage.showNotification(SPUIStyleDefinitions.SP_NOTIFICATION_SUCCESS_MESSAGE_STYLE, null, message,
true);
} | [
"public",
"void",
"displaySuccess",
"(",
"final",
"String",
"message",
")",
"{",
"notificationMessage",
".",
"showNotification",
"(",
"SPUIStyleDefinitions",
".",
"SP_NOTIFICATION_SUCCESS_MESSAGE_STYLE",
",",
"null",
",",
"message",
",",
"true",
")",
";",
"}"
] | Display success type of notification message.
@param message
is the message to displayed as success. | [
"Display",
"success",
"type",
"of",
"notification",
"message",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/UINotification.java#L41-L44 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/UINotification.java | UINotification.displayWarning | public void displayWarning(final String message) {
notificationMessage.showNotification(SPUIStyleDefinitions.SP_NOTIFICATION_WARNING_MESSAGE_STYLE, null, message,
true);
} | java | public void displayWarning(final String message) {
notificationMessage.showNotification(SPUIStyleDefinitions.SP_NOTIFICATION_WARNING_MESSAGE_STYLE, null, message,
true);
} | [
"public",
"void",
"displayWarning",
"(",
"final",
"String",
"message",
")",
"{",
"notificationMessage",
".",
"showNotification",
"(",
"SPUIStyleDefinitions",
".",
"SP_NOTIFICATION_WARNING_MESSAGE_STYLE",
",",
"null",
",",
"message",
",",
"true",
")",
";",
"}"
] | Display warning type of notification message.
@param message
is the message to displayed as warning. | [
"Display",
"warning",
"type",
"of",
"notification",
"message",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/UINotification.java#L52-L55 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/UINotification.java | UINotification.displayValidationError | public void displayValidationError(final String message) {
final StringBuilder updatedMsg = new StringBuilder(FontAwesome.EXCLAMATION_TRIANGLE.getHtml());
updatedMsg.append(' ');
updatedMsg.append(message);
notificationMessage.showNotification(SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, null,
updatedMsg.toString(), true);
} | java | public void displayValidationError(final String message) {
final StringBuilder updatedMsg = new StringBuilder(FontAwesome.EXCLAMATION_TRIANGLE.getHtml());
updatedMsg.append(' ');
updatedMsg.append(message);
notificationMessage.showNotification(SPUIStyleDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE, null,
updatedMsg.toString(), true);
} | [
"public",
"void",
"displayValidationError",
"(",
"final",
"String",
"message",
")",
"{",
"final",
"StringBuilder",
"updatedMsg",
"=",
"new",
"StringBuilder",
"(",
"FontAwesome",
".",
"EXCLAMATION_TRIANGLE",
".",
"getHtml",
"(",
")",
")",
";",
"updatedMsg",
".",
... | Display error type of notification message.
@param message
as message. | [
"Display",
"error",
"type",
"of",
"notification",
"message",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/UINotification.java#L63-L69 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java | CommonDialogWindow.setOrginaleValues | public final void setOrginaleValues() {
for (final AbstractField<?> field : allComponents) {
Object value = field.getValue();
if (field instanceof Table) {
value = ((Table) field).getContainerDataSource().getItemIds();
}
orginalValues.put(field, value);
}
saveButton.setEnabled(isSaveButtonEnabledAfterValueChange(null, null));
} | java | public final void setOrginaleValues() {
for (final AbstractField<?> field : allComponents) {
Object value = field.getValue();
if (field instanceof Table) {
value = ((Table) field).getContainerDataSource().getItemIds();
}
orginalValues.put(field, value);
}
saveButton.setEnabled(isSaveButtonEnabledAfterValueChange(null, null));
} | [
"public",
"final",
"void",
"setOrginaleValues",
"(",
")",
"{",
"for",
"(",
"final",
"AbstractField",
"<",
"?",
">",
"field",
":",
"allComponents",
")",
"{",
"Object",
"value",
"=",
"field",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"field",
"instanceof"... | saves the original values in a Map so we can use them for detecting
changes | [
"saves",
"the",
"original",
"values",
"in",
"a",
"Map",
"so",
"we",
"can",
"use",
"them",
"for",
"detecting",
"changes"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java#L236-L246 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java | CommonDialogWindow.addComponentListeners | public void addComponentListeners() {
// avoid duplicate registration
removeListeners();
for (final AbstractField<?> field : allComponents) {
if (field instanceof TextChangeNotifier) {
((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field));
}
if (field instanceof Table) {
((Table) field).addItemSetChangeListener(new ChangeListener(field));
}
field.addValueChangeListener(new ChangeListener(field));
}
} | java | public void addComponentListeners() {
// avoid duplicate registration
removeListeners();
for (final AbstractField<?> field : allComponents) {
if (field instanceof TextChangeNotifier) {
((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field));
}
if (field instanceof Table) {
((Table) field).addItemSetChangeListener(new ChangeListener(field));
}
field.addValueChangeListener(new ChangeListener(field));
}
} | [
"public",
"void",
"addComponentListeners",
"(",
")",
"{",
"// avoid duplicate registration",
"removeListeners",
"(",
")",
";",
"for",
"(",
"final",
"AbstractField",
"<",
"?",
">",
"field",
":",
"allComponents",
")",
"{",
"if",
"(",
"field",
"instanceof",
"TextCh... | adds a listener to a component. Depending on the type of component a
valueChange-, textChange- or itemSetChangeListener will be added. | [
"adds",
"a",
"listener",
"to",
"a",
"component",
".",
"Depending",
"on",
"the",
"type",
"of",
"component",
"a",
"valueChange",
"-",
"textChange",
"-",
"or",
"itemSetChangeListener",
"will",
"be",
"added",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java#L267-L281 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java | CommonDialogWindow.updateAllComponents | public void updateAllComponents(final AbstractField<?> component) {
allComponents.add(component);
component.addValueChangeListener(new ChangeListener(component));
} | java | public void updateAllComponents(final AbstractField<?> component) {
allComponents.add(component);
component.addValueChangeListener(new ChangeListener(component));
} | [
"public",
"void",
"updateAllComponents",
"(",
"final",
"AbstractField",
"<",
"?",
">",
"component",
")",
"{",
"allComponents",
".",
"add",
"(",
"component",
")",
";",
"component",
".",
"addValueChangeListener",
"(",
"new",
"ChangeListener",
"(",
"component",
")"... | Adds the component manually to the allComponents-List and adds a
ValueChangeListener to it. Necessary in Update Distribution Type as the
CheckBox concerned is an ItemProperty...
@param component
AbstractField | [
"Adds",
"the",
"component",
"manually",
"to",
"the",
"allComponents",
"-",
"List",
"and",
"adds",
"a",
"ValueChangeListener",
"to",
"it",
".",
"Necessary",
"in",
"Update",
"Distribution",
"Type",
"as",
"the",
"CheckBox",
"concerned",
"is",
"an",
"ItemProperty",
... | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java#L531-L535 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/WindowBuilder.java | WindowBuilder.buildCommonDialogWindow | public CommonDialogWindow buildCommonDialogWindow() {
final CommonDialogWindow window = new CommonDialogWindow(caption, content, helpLink, saveDialogCloseListener,
cancelButtonClickListener, layout, i18n);
decorateWindow(window);
return window;
} | java | public CommonDialogWindow buildCommonDialogWindow() {
final CommonDialogWindow window = new CommonDialogWindow(caption, content, helpLink, saveDialogCloseListener,
cancelButtonClickListener, layout, i18n);
decorateWindow(window);
return window;
} | [
"public",
"CommonDialogWindow",
"buildCommonDialogWindow",
"(",
")",
"{",
"final",
"CommonDialogWindow",
"window",
"=",
"new",
"CommonDialogWindow",
"(",
"caption",
",",
"content",
",",
"helpLink",
",",
"saveDialogCloseListener",
",",
"cancelButtonClickListener",
",",
"... | Build the common dialog window.
@return the window. | [
"Build",
"the",
"common",
"dialog",
"window",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/WindowBuilder.java#L146-L152 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/WindowBuilder.java | WindowBuilder.buildWindow | public Window buildWindow() {
final Window window = new Window(caption);
window.setContent(content);
window.setSizeUndefined();
window.setModal(true);
window.setResizable(false);
decorateWindow(window);
if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setClosable(false);
}
return window;
} | java | public Window buildWindow() {
final Window window = new Window(caption);
window.setContent(content);
window.setSizeUndefined();
window.setModal(true);
window.setResizable(false);
decorateWindow(window);
if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setClosable(false);
}
return window;
} | [
"public",
"Window",
"buildWindow",
"(",
")",
"{",
"final",
"Window",
"window",
"=",
"new",
"Window",
"(",
"caption",
")",
";",
"window",
".",
"setContent",
"(",
"content",
")",
";",
"window",
".",
"setSizeUndefined",
"(",
")",
";",
"window",
".",
"setMod... | Build window based on type.
@return Window | [
"Build",
"window",
"based",
"on",
"type",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/builder/WindowBuilder.java#L175-L189 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/NotificationMessage.java | NotificationMessage.showNotification | void showNotification(final String styleName, final String caption, final String description,
final Boolean autoClose) {
decorate(styleName, caption, description, autoClose);
this.show(Page.getCurrent());
} | java | void showNotification(final String styleName, final String caption, final String description,
final Boolean autoClose) {
decorate(styleName, caption, description, autoClose);
this.show(Page.getCurrent());
} | [
"void",
"showNotification",
"(",
"final",
"String",
"styleName",
",",
"final",
"String",
"caption",
",",
"final",
"String",
"description",
",",
"final",
"Boolean",
"autoClose",
")",
"{",
"decorate",
"(",
"styleName",
",",
"caption",
",",
"description",
",",
"a... | Notification message component.
@param styleName
style name of message
@param caption
message caption
@param description
message description
@param autoClose
flag to indicate enable close option | [
"Notification",
"message",
"component",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/NotificationMessage.java#L45-L49 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelper.java | MaintenanceScheduleHelper.getNextMaintenanceWindow | @SuppressWarnings("squid:S1166")
public static Optional<ZonedDateTime> getNextMaintenanceWindow(final String cronSchedule, final String duration,
final String timezone) {
try {
final ExecutionTime scheduleExecutor = ExecutionTime.forCron(getCronFromExpression(cronSchedule));
final ZonedDateTime now = ZonedDateTime.now(ZoneOffset.of(timezone));
final ZonedDateTime after = now.minus(convertToISODuration(duration));
final ZonedDateTime next = scheduleExecutor.nextExecution(after);
return Optional.of(next);
} catch (final RuntimeException ignored) {
return Optional.empty();
}
} | java | @SuppressWarnings("squid:S1166")
public static Optional<ZonedDateTime> getNextMaintenanceWindow(final String cronSchedule, final String duration,
final String timezone) {
try {
final ExecutionTime scheduleExecutor = ExecutionTime.forCron(getCronFromExpression(cronSchedule));
final ZonedDateTime now = ZonedDateTime.now(ZoneOffset.of(timezone));
final ZonedDateTime after = now.minus(convertToISODuration(duration));
final ZonedDateTime next = scheduleExecutor.nextExecution(after);
return Optional.of(next);
} catch (final RuntimeException ignored) {
return Optional.empty();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S1166\"",
")",
"public",
"static",
"Optional",
"<",
"ZonedDateTime",
">",
"getNextMaintenanceWindow",
"(",
"final",
"String",
"cronSchedule",
",",
"final",
"String",
"duration",
",",
"final",
"String",
"timezone",
")",
"{",
"... | expression or duration is wrong), we simply return empty value | [
"expression",
"or",
"duration",
"is",
"wrong",
")",
"we",
"simply",
"return",
"empty",
"value"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelper.java#L65-L77 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelper.java | MaintenanceScheduleHelper.validateDuration | public static void validateDuration(final String duration) {
try {
if (StringUtils.hasText(duration)) {
convertDurationToLocalTime(duration);
}
} catch (final DateTimeParseException e) {
throw new InvalidMaintenanceScheduleException("Provided duration is not valid", e, e.getErrorIndex());
}
} | java | public static void validateDuration(final String duration) {
try {
if (StringUtils.hasText(duration)) {
convertDurationToLocalTime(duration);
}
} catch (final DateTimeParseException e) {
throw new InvalidMaintenanceScheduleException("Provided duration is not valid", e, e.getErrorIndex());
}
} | [
"public",
"static",
"void",
"validateDuration",
"(",
"final",
"String",
"duration",
")",
"{",
"try",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"duration",
")",
")",
"{",
"convertDurationToLocalTime",
"(",
"duration",
")",
";",
"}",
"}",
"catch",
... | Validates the format of the maintenance window duration
@param duration
in "HH:mm:ss" string format. This format is popularly used but
can be confused with time of the day, hence conversion to ISO
specified format for time duration is required.
@throws InvalidMaintenanceScheduleException
if the duration doesn't have a valid format to be converted
to ISO. | [
"Validates",
"the",
"format",
"of",
"the",
"maintenance",
"window",
"duration"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelper.java#L178-L186 | train |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelper.java | MaintenanceScheduleHelper.validateCronSchedule | public static void validateCronSchedule(final String cronSchedule) {
try {
if (StringUtils.hasText(cronSchedule)) {
getCronFromExpression(cronSchedule);
}
} catch (final IllegalArgumentException e) {
throw new InvalidMaintenanceScheduleException(e.getMessage(), e);
}
} | java | public static void validateCronSchedule(final String cronSchedule) {
try {
if (StringUtils.hasText(cronSchedule)) {
getCronFromExpression(cronSchedule);
}
} catch (final IllegalArgumentException e) {
throw new InvalidMaintenanceScheduleException(e.getMessage(), e);
}
} | [
"public",
"static",
"void",
"validateCronSchedule",
"(",
"final",
"String",
"cronSchedule",
")",
"{",
"try",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"cronSchedule",
")",
")",
"{",
"getCronFromExpression",
"(",
"cronSchedule",
")",
";",
"}",
"}",
... | Validates the format of the maintenance window cron expression
@param cronSchedule
is a cron expression with 6 mandatory fields and 1 last
optional field: "second minute hour dayofmonth month weekday
year".
@throws InvalidMaintenanceScheduleException
if the cron expression doesn't have a valid quartz format. | [
"Validates",
"the",
"format",
"of",
"the",
"maintenance",
"window",
"cron",
"expression"
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/MaintenanceScheduleHelper.java#L199-L207 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryLayout.java | ActionHistoryLayout.populateActionHistoryDetails | public void populateActionHistoryDetails(final Target target) {
if (null != target) {
((ActionHistoryHeader) getHeader()).updateActionHistoryHeader(target.getName());
((ActionHistoryGrid) getGrid()).populateSelectedTarget(target);
} else {
((ActionHistoryHeader) getHeader()).updateActionHistoryHeader(" ");
}
} | java | public void populateActionHistoryDetails(final Target target) {
if (null != target) {
((ActionHistoryHeader) getHeader()).updateActionHistoryHeader(target.getName());
((ActionHistoryGrid) getGrid()).populateSelectedTarget(target);
} else {
((ActionHistoryHeader) getHeader()).updateActionHistoryHeader(" ");
}
} | [
"public",
"void",
"populateActionHistoryDetails",
"(",
"final",
"Target",
"target",
")",
"{",
"if",
"(",
"null",
"!=",
"target",
")",
"{",
"(",
"(",
"ActionHistoryHeader",
")",
"getHeader",
"(",
")",
")",
".",
"updateActionHistoryHeader",
"(",
"target",
".",
... | Populate action header and table for the target.
@param target
the target | [
"Populate",
"action",
"header",
"and",
"table",
"for",
"the",
"target",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/actionhistory/ActionHistoryLayout.java#L140-L147 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java | NotificationUnreadButton.incrementUnreadNotification | public void incrementUnreadNotification(final AbstractNotificationView view,
final EventContainer<?> newEventContainer) {
if (!view.equals(currentView) || newEventContainer.getUnreadNotificationMessageKey() == null) {
return;
}
NotificationUnreadValue notificationUnreadValue = unreadNotifications.get(newEventContainer.getClass());
if (notificationUnreadValue == null) {
notificationUnreadValue = new NotificationUnreadValue(0,
newEventContainer.getUnreadNotificationMessageKey());
unreadNotifications.put(newEventContainer.getClass(), notificationUnreadValue);
}
notificationUnreadValue.incrementUnreadNotifications();
unreadNotificationCounter++;
refreshCaption();
} | java | public void incrementUnreadNotification(final AbstractNotificationView view,
final EventContainer<?> newEventContainer) {
if (!view.equals(currentView) || newEventContainer.getUnreadNotificationMessageKey() == null) {
return;
}
NotificationUnreadValue notificationUnreadValue = unreadNotifications.get(newEventContainer.getClass());
if (notificationUnreadValue == null) {
notificationUnreadValue = new NotificationUnreadValue(0,
newEventContainer.getUnreadNotificationMessageKey());
unreadNotifications.put(newEventContainer.getClass(), notificationUnreadValue);
}
notificationUnreadValue.incrementUnreadNotifications();
unreadNotificationCounter++;
refreshCaption();
} | [
"public",
"void",
"incrementUnreadNotification",
"(",
"final",
"AbstractNotificationView",
"view",
",",
"final",
"EventContainer",
"<",
"?",
">",
"newEventContainer",
")",
"{",
"if",
"(",
"!",
"view",
".",
"equals",
"(",
"currentView",
")",
"||",
"newEventContaine... | Increment the counter.
@param view
the view
@param newEventContainer
the event container | [
"Increment",
"the",
"counter",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/NotificationUnreadButton.java#L148-L163 | train |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionBeanQuery.java | DistributionBeanQuery.loadBeans | @Override
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
Page<DistributionSet> distBeans;
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
if (startIndex == 0 && firstPageDistributionSets != null) {
distBeans = firstPageDistributionSets;
} else if (pinnedTarget != null) {
final DistributionSetFilterBuilder distributionSetFilterBuilder = new DistributionSetFilterBuilder()
.setIsDeleted(false).setIsComplete(true).setSearchText(searchText)
.setSelectDSWithNoTag(noTagClicked).setTagNames(distributionTags);
distBeans = getDistributionSetManagement().findByFilterAndAssignedInstalledDsOrderedByLinkTarget(
new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilterBuilder,
pinnedTarget.getControllerId());
} else if (distributionTags.isEmpty() && StringUtils.isEmpty(searchText) && !noTagClicked) {
// if no search filters available
distBeans = getDistributionSetManagement()
.findByCompleted(new OffsetBasedPageRequest(startIndex, count, sort), true);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
.setTagNames(distributionTags).build();
distBeans = getDistributionSetManagement().findByDistributionSetFilter(
new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilter);
}
for (final DistributionSet distributionSet : distBeans) {
final ProxyDistribution proxyDistribution = new ProxyDistribution();
proxyDistribution.setName(distributionSet.getName());
proxyDistribution.setDescription(distributionSet.getDescription());
proxyDistribution.setId(distributionSet.getId());
proxyDistribution.setDistId(distributionSet.getId());
proxyDistribution.setVersion(distributionSet.getVersion());
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
proxyDistribution.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(distributionSet));
proxyDistribution.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(distributionSet));
proxyDistribution.setNameVersion(
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
proxyDistributions.add(proxyDistribution);
}
return proxyDistributions;
} | java | @Override
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
Page<DistributionSet> distBeans;
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
if (startIndex == 0 && firstPageDistributionSets != null) {
distBeans = firstPageDistributionSets;
} else if (pinnedTarget != null) {
final DistributionSetFilterBuilder distributionSetFilterBuilder = new DistributionSetFilterBuilder()
.setIsDeleted(false).setIsComplete(true).setSearchText(searchText)
.setSelectDSWithNoTag(noTagClicked).setTagNames(distributionTags);
distBeans = getDistributionSetManagement().findByFilterAndAssignedInstalledDsOrderedByLinkTarget(
new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilterBuilder,
pinnedTarget.getControllerId());
} else if (distributionTags.isEmpty() && StringUtils.isEmpty(searchText) && !noTagClicked) {
// if no search filters available
distBeans = getDistributionSetManagement()
.findByCompleted(new OffsetBasedPageRequest(startIndex, count, sort), true);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
.setTagNames(distributionTags).build();
distBeans = getDistributionSetManagement().findByDistributionSetFilter(
new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilter);
}
for (final DistributionSet distributionSet : distBeans) {
final ProxyDistribution proxyDistribution = new ProxyDistribution();
proxyDistribution.setName(distributionSet.getName());
proxyDistribution.setDescription(distributionSet.getDescription());
proxyDistribution.setId(distributionSet.getId());
proxyDistribution.setDistId(distributionSet.getId());
proxyDistribution.setVersion(distributionSet.getVersion());
proxyDistribution.setCreatedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getCreatedAt()));
proxyDistribution.setLastModifiedDate(SPDateTimeUtil.getFormattedDate(distributionSet.getLastModifiedAt()));
proxyDistribution.setCreatedByUser(UserDetailsFormatter.loadAndFormatCreatedBy(distributionSet));
proxyDistribution.setModifiedByUser(UserDetailsFormatter.loadAndFormatLastModifiedBy(distributionSet));
proxyDistribution.setNameVersion(
HawkbitCommonUtil.getFormattedNameVersion(distributionSet.getName(), distributionSet.getVersion()));
proxyDistributions.add(proxyDistribution);
}
return proxyDistributions;
} | [
"@",
"Override",
"protected",
"List",
"<",
"ProxyDistribution",
">",
"loadBeans",
"(",
"final",
"int",
"startIndex",
",",
"final",
"int",
"count",
")",
"{",
"Page",
"<",
"DistributionSet",
">",
"distBeans",
";",
"final",
"List",
"<",
"ProxyDistribution",
">",
... | Load all the Distribution set.
@param startIndex
as page start
@param count
as total data | [
"Load",
"all",
"the",
"Distribution",
"set",
"."
] | 9884452ad42f3b4827461606d8a9215c8625a7fe | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/management/dstable/DistributionBeanQuery.java#L97-L139 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.