stringBuilder.append(HTML_LI_CLOSE_TAG); stringBuilder.append(HTML_LI_OPEN_TAG); stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName()); stringBuilder.append(HTML_LI_CLOSE_TAG); stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(HTML_LI_CLOSE_TAG); stringBuilder.append(HTML_LI_OPEN_TAG); stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName()); stringBuilder.append(HTML_LI_CLOSE_TAG); stringBuilder.append(HTML_LI_OPEN_TAG);
private void populateValuesOfDistribution(final Long editDistId) { final Optional<DistributionSet> distSet = distributionSetManagement.getWithDetails(editDistId); if (!distSet.isPresent()) { return; } distNameTextField.setValue(distSet.get().getName()); distVersionTextField.setValue(distSet.get().getVersion()); if (distSet.get().getType().isDeleted()) { distsetTypeNameComboBox.addItem(distSet.get().getType().getId()); } distsetTypeNameComboBox.setValue(distSet.get().getType().getId()); distsetTypeNameComboBox.setEnabled(false); reqMigStepCheckbox.setValue(distSet.get().isRequiredMigrationStep()); descTextArea.setValue(distSet.get().getDescription()); }
private void populateValuesOfDistribution(final Long editDistId) { final Optional<DistributionSet> distSet = distributionSetManagement.getWithDetails(editDistId); if (!distSet.isPresent()) { return; } distNameTextField.setValue(distSet.get().getName()); distVersionTextField.setValue(distSet.get().getVersion()); if (distSet.get().getType().isDeleted()) { distsetTypeNameComboBox.addItem(distSet.get().getType().getId()); } distsetTypeNameComboBox.setValue(distSet.get().getType().getId()); distsetTypeNameComboBox.setEnabled(false); reqMigStepCheckbox.setValue(distSet.get().isRequiredMigrationStep()); descTextArea.setValue(distSet.get().getDescription()); }
public static JSONObject distributionSetCreateValidFieldsOnly(final DistributionSet set) throws JSONException { final List<JSONObject> modules = set.getModules().stream().map(module -> { try { return new JSONObject().put("id", module.getId()); } catch (final JSONException e) { e.printStackTrace(); return null; } }).collect(Collectors.toList()); return new JSONObject().put("name", set.getName()).put("description", set.getDescription()) .put("type", set.getType() == null ? null : set.getType().getKey()).put("version", set.getVersion()) .put("requiredMigrationStep", set.isRequiredMigrationStep()).put("modules", new JSONArray(modules)); }
/** * Populate software module table. * * @param distributionSet */ 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 static JSONObject distributionSet(final DistributionSet set) throws JSONException { final List<JSONObject> modules = set.getModules().stream().map(module -> { try { return new JSONObject().put("id", module.getId()); } catch (final JSONException e) { e.printStackTrace(); return null; } }).collect(Collectors.toList()); return new JSONObject().put("name", set.getName()).put("description", set.getDescription()) .put("type", set.getType() == null ? null : set.getType().getKey()).put("id", Long.MAX_VALUE) .put("version", set.getVersion()).put("createdAt", "0").put("updatedAt", "0") .put("createdBy", "fghdfkjghdfkjh").put("updatedBy", "fghdfkjghdfkjh") .put("requiredMigrationStep", set.isRequiredMigrationStep()).put("modules", new JSONArray(modules)); }
/** * Populate software module table. * * @param distributionSet */ 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()); } }
protected void populateDetails() { if (getSelectedBaseEntity() != null) { updateDistributionSetDetailsLayout(getSelectedBaseEntity().getType().getName(), getSelectedBaseEntity().isRequiredMigrationStep()); } else { updateDistributionSetDetailsLayout(null, null); } }
protected void populateDetails() { if (getSelectedBaseEntity() != null) { updateDistributionSetDetailsLayout(getSelectedBaseEntity().getType().getName(), getSelectedBaseEntity().isRequiredMigrationStep()); } else { updateDistributionSetDetailsLayout(null, null); } }
static MgmtDistributionSet toResponse(final DistributionSet distributionSet) { if (distributionSet == null) { return null; } final MgmtDistributionSet response = new MgmtDistributionSet(); MgmtRestModelMapper.mapNamedToNamed(response, distributionSet); response.setDsId(distributionSet.getId()); response.setVersion(distributionSet.getVersion()); response.setComplete(distributionSet.isComplete()); response.setType(distributionSet.getType().getKey()); response.setDeleted(distributionSet.isDeleted()); distributionSet.getModules() .forEach(module -> response.getModules().add(MgmtSoftwareModuleMapper.toResponse(module))); response.setRequiredMigrationStep(distributionSet.isRequiredMigrationStep()); response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getDistributionSet(response.getDsId())) .withSelfRel()); return response; }
static void addLinks(final DistributionSet distributionSet, final MgmtDistributionSet response) { response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getAssignedSoftwareModules(response.getDsId(), MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE, MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null)) .withRel(MgmtRestConstants.DISTRIBUTIONSET_V1_MODULE)); response.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class) .getDistributionSetType(distributionSet.getType().getId())).withRel("type")); response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getMetadata(response.getDsId(), MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE, MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null, null)).withRel("metadata")); }
return false; if (!ds.getType().containsModuleType(sm.getType())) {
return false; if (!ds.getType().containsModuleType(sm.getType())) {
@Test @Description("Handles the GET request of retrieving a single distribution set type within SP. Required Permission: READ_REPOSITORY") public void deleteDistributionSetType() throws Exception { final DistributionSetType testType = distributionSetTypeManagement.update(entityFactory.distributionSetType() .update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234")); mockMvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}", testType.getId())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andDo(this.document.document(pathParameters( parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID)))); }
@Test @Description("Handles the GET request of retrieving all distribution set types within SP with a defined page size and offset, sortet by name in descending order and filtered down to all targets which name starts with 'a'. Required Permission: READ_REPOSITORY.") public void getDistributionSetTypesWithParameters() throws Exception { distributionSetTypeManagement.update(entityFactory.distributionSetType() .update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234")); mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON) .param("offset", "1").param("limit", "2").param("sort", "name:DESC").param("q", "name==a*")) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andDo(this.document.document(getFilterRequestParamter())); }
public void putDistributionSetType() throws Exception { final DistributionSetType testType = distributionSetTypeManagement.update(entityFactory.distributionSetType() .update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234")); final String body = new JSONObject().put("description", "an updated desription").toString();
@Test @Description("Handles the GET request of retrieving all distribution set types within SP. Required Permission: READ_REPOSITORY.") public void getDistributionSetTypes() throws Exception { distributionSetTypeManagement.update(entityFactory.distributionSetType() .update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234")); mockMvc.perform( get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$.total", equalTo(4))) .andDo(this.document.document(responseFields( fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE), fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS), fieldWithPath("content").description(MgmtApiModelProperties.TARGET_LIST), fieldWithPath("content[].createdBy").description(ApiModelPropertiesGeneric.CREATED_BY), fieldWithPath("content[].createdAt").description(ApiModelPropertiesGeneric.CREATED_AT), fieldWithPath("content[].description").description(ApiModelPropertiesGeneric.DESCRPTION), fieldWithPath("content[].key").description(MgmtApiModelProperties.DS_TYPE_KEY), fieldWithPath("content[].id").description(ApiModelPropertiesGeneric.ITEM_ID), fieldWithPath("content[].lastModifiedAt") .description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT).type("Number"), fieldWithPath("content[].lastModifiedBy") .description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY).type("String"), fieldWithPath("content[].name").description(ApiModelPropertiesGeneric.NAME), fieldWithPath("content[]._links.self").ignored()))); }
@Test @Description("Handles the DELETE request for a single distribution set type within SP. Required Permission: DELETE_REPOSITORY.") public void getDistributionSetType() throws Exception { final DistributionSetType testType = distributionSetTypeManagement.update(entityFactory.distributionSetType() .update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234")); mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}", testType.getId()).accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()) .andExpect(status().isOk()) .andDo(this.document.document( pathParameters(parameterWithName("distributionSetTypeId") .description(ApiModelPropertiesGeneric.ITEM_ID)), responseFields(fieldWithPath("createdBy").description(ApiModelPropertiesGeneric.CREATED_BY), fieldWithPath("createdAt").description(ApiModelPropertiesGeneric.CREATED_AT), fieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION), fieldWithPath("key").description(MgmtApiModelProperties.DS_TYPE_KEY), fieldWithPath("id").description(ApiModelPropertiesGeneric.ITEM_ID), fieldWithPath("lastModifiedAt").description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT) .type("Number"), fieldWithPath("lastModifiedBy").description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY) .type("String"), fieldWithPath("name").description(ApiModelPropertiesGeneric.NAME), fieldWithPath("deleted").description(ApiModelPropertiesGeneric.DELETED), fieldWithPath("_links.self").ignored(), fieldWithPath("_links.mandatorymodules") .description(MgmtApiModelProperties.LINK_TO_MANDATORY_SMT), fieldWithPath("_links.optionalmodules") .description(MgmtApiModelProperties.LINK_TO_OPTIONAL_SMT)))); }