Revert Clean Code Changes

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-02-10 08:47:12 +01:00
parent d685c48f52
commit 7e69ead138
26 changed files with 66 additions and 63 deletions

View File

@@ -208,13 +208,14 @@ public class ArtifactDetailsLayout extends VerticalLayout {
}
private Container createArtifactLazyQueryContainer() {
final Map<String, Object> queryConfiguration = new HashMap<>();
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
return getArtifactLazyQueryContainer(queryConfiguration);
}
private LazyQueryContainer getArtifactLazyQueryContainer(final Map<String, Object> queryConfig) {
final BeanQueryFactory<ArtifactBeanQuery> artifactQF = new BeanQueryFactory<>(ArtifactBeanQuery.class);
final BeanQueryFactory<ArtifactBeanQuery> artifactQF = new BeanQueryFactory<ArtifactBeanQuery>(
ArtifactBeanQuery.class);
artifactQF.setQueryConfiguration(queryConfig);
final LazyQueryContainer artifactCont = new LazyQueryContainer(new LazyQueryDefinition(true, 10, "id"),
artifactQF);
@@ -430,7 +431,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
titleOfArtifactDetails.setContentMode(ContentMode.HTML);
}
}
final Map<String, Object> queryConfiguration = new HashMap<>();
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
if (baseSwModuleId != null) {
queryConfiguration.put(SPUIDefinitions.BY_BASE_SOFTWARE_MODULE, baseSwModuleId);
}

View File

@@ -126,7 +126,7 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
}
private static Map<String, List<String>> createDropConfigurations() {
final Map<String, List<String>> config = new HashMap<>();
final Map<String, List<String>> config = new HashMap<String, List<String>>();
// Delete drop area droppable components
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID, Arrays.asList(
SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX));
@@ -135,7 +135,7 @@ public class UploadViewAcceptCriteria extends AbstractAcceptCriteria {
}
private static Map<String, Object> createDropHintConfigurations() {
final Map<String, Object> config = new HashMap<>();
final Map<String, Object> config = new HashMap<String, Object>();
config.put(SPUIComponetIdProvider.UPLOAD_TYPE_BUTTON_PREFIX, UploadArtifactUIEvent.SOFTWARE_TYPE_DRAG_START);
config.put(SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UploadArtifactUIEvent.SOFTWARE_DRAG_START);
return config;

View File

@@ -76,7 +76,7 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
@Override
protected List<ProxyBaseSoftwareModuleItem> loadBeans(final int startIndex, final int count) {
final Slice<SoftwareModule> swModuleBeans;
final List<ProxyBaseSoftwareModuleItem> proxyBeans = new ArrayList<>();
final List<ProxyBaseSoftwareModuleItem> proxyBeans = new ArrayList<ProxyBaseSoftwareModuleItem>();
if (type == null && Strings.isNullOrEmpty(searchText)) {
swModuleBeans = getSoftwareManagementService()

View File

@@ -82,7 +82,6 @@ public class SoftwareModuleTable extends AbstractTable {
/**
* Initialize the filter layout.
*/
@Override
@PostConstruct
protected void init() {
super.init();
@@ -128,17 +127,20 @@ public class SoftwareModuleTable extends AbstractTable {
*/
@Override
protected Container createContainer() {
final Map<String, Object> queryConfiguration = new HashMap<>();
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
artifactUploadState.getSoftwareModuleFilters().getSearchText()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
.ifPresent(type -> queryConfiguration.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
final BeanQueryFactory<BaseSwModuleBeanQuery> swQF = new BeanQueryFactory<>(BaseSwModuleBeanQuery.class);
final BeanQueryFactory<BaseSwModuleBeanQuery> swQF = new BeanQueryFactory<BaseSwModuleBeanQuery>(
BaseSwModuleBeanQuery.class);
swQF.setQueryConfiguration(queryConfiguration);
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
final LazyQueryContainer container = new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
return container;
}
@Override
@@ -272,7 +274,7 @@ public class SoftwareModuleTable extends AbstractTable {
*/
@Override
protected List<TableColumn> getTableVisibleColumns() {
final List<TableColumn> columnList = new ArrayList<>();
final List<TableColumn> columnList = new ArrayList<TableColumn>();
if (isMaximized()) {
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));

View File

@@ -193,7 +193,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
getPreviewButtonColor(DEFAULT_COLOR);
tagColorPreviewBtn.setStyleName(TAG_DYNAMIC_STYLE);
selectors = new HashSet<>();
selectors = new HashSet<ColorSelector>();
selectedColor = new Color(44, 151, 32);
selPreview = new SpColorPickerPreview(selectedColor);

View File

@@ -106,7 +106,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
private IndexedContainer tabelContainer;
private final List<UploadStatus> uploadResultList = new ArrayList<>();
private final List<UploadStatus> uploadResultList = new ArrayList<UploadStatus>();
private VerticalLayout uploadArtifactDetails;

View File

@@ -102,7 +102,7 @@ public class UploadLayout extends VerticalLayout {
private final AtomicInteger numberOfFilesActuallyUpload = new AtomicInteger();
private final List<String> duplicateFileNamesList = new ArrayList<>();
private final List<String> duplicateFileNamesList = new ArrayList<String>();
private Button processBtn;

View File

@@ -44,7 +44,7 @@ public class UploadResultWindow implements Button.ClickListener {
private static final long serialVersionUID = 5205927189362269027L;
private List<UploadStatus> uploadResultList = new ArrayList<>();
private List<UploadStatus> uploadResultList = new ArrayList<UploadStatus>();
private Button closeBtn;

View File

@@ -83,7 +83,7 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
@Override
protected List<DistributionSetType> loadBeans(final int startIndex, final int count) {
Page<DistributionSetType> typeBeans;
final List<DistributionSetType> distSetTypeList = new ArrayList<>();
final List<DistributionSetType> distSetTypeList = new ArrayList<DistributionSetType>();
if (startIndex == 0 && firstPageDistSetType != null) {
typeBeans = firstPageDistSetType;
} else {

View File

@@ -80,7 +80,6 @@ public class DistributionTagToken extends AbstractTagToken {
// To Be Done : have to set this value based on view???
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
@Override
@PostConstruct
protected void init() {
super.init();
@@ -130,7 +129,7 @@ public class DistributionTagToken extends AbstractTagToken {
}
private DistributionSetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
final Set<Long> distributionList = new HashSet<>();
final Set<Long> distributionList = new HashSet<Long>();
distributionList.add(selectedDS.getId());
final DistributionSetTagAssigmentResult result = distributionSetManagement.toggleTagAssignment(distributionList,
tagNameSelected);
@@ -161,7 +160,7 @@ public class DistributionTagToken extends AbstractTagToken {
/* To Be Done : this implementation will vary in views */
private List<String> getClickedTagList() {
return new ArrayList<>();
return new ArrayList<String>();
}
/*

View File

@@ -78,7 +78,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
}
private TargetTagAssigmentResult toggleAssignment(final String tagNameSelected) {
final Set<String> targetList = new HashSet<>();
final Set<String> targetList = new HashSet<String>();
targetList.add(selectedTarget.getControllerId());
final TargetTagAssigmentResult result = targetManagement.toggleTagAssignment(targetList, tagNameSelected);
uinotification.displaySuccess(HawkbitCommonUtil.getTargetTagAssigmentMsg(tagNameSelected, result, i18n));
@@ -102,7 +102,7 @@ public class TargetTagToken extends AbstractTargetTagToken {
/* To Be Done : this implementation will vary in views */
private List<String> getClickedTagList() {
return new ArrayList<>();
return new ArrayList<String>();
}
@Override

View File

@@ -221,7 +221,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
getPreviewButtonColor(DEFAULT_COLOR);
selectors = new HashSet<>();
selectors = new HashSet<ColorSelector>();
selectedColor = new Color(44, 151, 32);
selPreview = new SpColorPickerPreview(selectedColor);
@@ -457,7 +457,6 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
sourceTable.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
private static final long serialVersionUID = 1L;
@Override
public String generateDescription(final Component source, final Object itemId, final Object propertyId) {
final Item item = sourceTable.getItem(itemId);
final String description = (String) item.getItemProperty(DIST_TYPE_DESCRIPTION).getValue();
@@ -476,15 +475,15 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
@SuppressWarnings("unchecked")
private void getSelectedTableItemData(final Long id) {
if (selectedTablecontainer == null) {
return;
Item saveTblitem = null;
if (null != selectedTablecontainer) {
saveTblitem = selectedTablecontainer.addItem(id);
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(
sourceTable.getContainerDataSource().getItem(id).getItemProperty(DIST_TYPE_NAME).getValue());
saveTblitem.getItemProperty(DIST_TYPE_MANDATORY).setValue(new CheckBox());
saveTblitem.getItemProperty(DIST_TYPE_DESCRIPTION).setValue(
sourceTable.getContainerDataSource().getItem(id).getItemProperty(DIST_TYPE_DESCRIPTION).getValue());
}
final Item saveTblitem = selectedTablecontainer.addItem(id);
saveTblitem.getItemProperty(DIST_TYPE_NAME)
.setValue(sourceTable.getContainerDataSource().getItem(id).getItemProperty(DIST_TYPE_NAME).getValue());
saveTblitem.getItemProperty(DIST_TYPE_MANDATORY).setValue(new CheckBox());
saveTblitem.getItemProperty(DIST_TYPE_DESCRIPTION).setValue(
sourceTable.getContainerDataSource().getItem(id).getItemProperty(DIST_TYPE_DESCRIPTION).getValue());
}
@SuppressWarnings("unchecked")
@@ -658,10 +657,10 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
DistributionSetType newDistType = new DistributionSetType(typeKeyValue, typeNameValue, typeDescValue);
for (final Long id : itemIds) {
final Item item = selectedTable.getItem(id);
final String distTypeName = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
final String dist_type_name = (String) item.getItemProperty(DIST_TYPE_NAME).getValue();
final CheckBox mandatoryCheckBox = (CheckBox) item.getItemProperty(DIST_TYPE_MANDATORY).getValue();
final Boolean isMandatory = mandatoryCheckBox.getValue();
final SoftwareModuleType swModuleType = softwareManagement.findSoftwareModuleTypeByName(distTypeName);
final SoftwareModuleType swModuleType = softwareManagement.findSoftwareModuleTypeByName(dist_type_name);
if (isMandatory) {
newDistType.addMandatoryModuleType(swModuleType);
@@ -1033,6 +1032,7 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
* as the selected tag from combo
*/
private void setTypeTagCombo(final String distSetTypeSelected) {
boolean mandatory = false;
typeName.setValue(distSetTypeSelected);
getSourceTableData();
selectedTable.getContainerDataSource().removeAllItems();
@@ -1053,11 +1053,13 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
saveDistSetType.setEnabled(false);
}
for (final SoftwareModuleType swModuleType : selectedTypeTag.getOptionalModuleTypes()) {
addTargetTableforUpdate(swModuleType, false);
mandatory = false;
addTargetTableforUpdate(swModuleType, mandatory);
}
for (final SoftwareModuleType swModuleType : selectedTypeTag.getMandatoryModuleTypes()) {
addTargetTableforUpdate(swModuleType, true);
mandatory = true;
addTargetTableforUpdate(swModuleType, mandatory);
}
if (null == selectedTypeTag.getColour()) {

View File

@@ -104,7 +104,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
@Override
protected List<ProxyDistribution> loadBeans(final int startIndex, final int count) {
Page<DistributionSet> distBeans;
final List<ProxyDistribution> proxyDistributions = new ArrayList<>();
final List<ProxyDistribution> proxyDistributions = new ArrayList<ProxyDistribution>();
if (startIndex == 0 && firstPageDistributionSets != null) {
distBeans = firstPageDistributionSets;
} else if (Strings.isNullOrEmpty(searchText)) {

View File

@@ -137,7 +137,7 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
}
private static Map<String, List<String>> createDropConfigurations() {
final Map<String, List<String>> config = new HashMap<>();
final Map<String, List<String>> config = new HashMap<String, List<String>>();
// Delete drop area droppable components
config.put(SPUIComponetIdProvider.DELETE_BUTTON_WRAPPER_ID,
@@ -153,7 +153,7 @@ public class DistributionsViewAcceptCriteria extends AbstractAcceptCriteria {
}
private static Map<String, Object> createDropHintConfigurations() {
final Map<String, Object> config = new HashMap<>();
final Map<String, Object> config = new HashMap<String, Object>();
config.put(SPUIDefinitions.DISTRIBUTION_TYPE_ID_PREFIXS, DragEvent.DISTRIBUTION_TYPE_DRAG);
config.put(SPUIComponetIdProvider.DIST_TABLE_ID, DragEvent.DISTRIBUTION_DRAG);
config.put(SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, DragEvent.SOFTWAREMODULE_DRAG);

View File

@@ -87,7 +87,7 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
@Override
protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) {
final Slice<CustomSoftwareModule> swModuleBeans;
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<>();
final List<ProxyBaseSwModuleItem> proxyBeans = new ArrayList<ProxyBaseSwModuleItem>();
swModuleBeans = getSoftwareManagement().findSoftwareModuleOrderByDistribution(
new OffsetBasedPageRequest(startIndex, count, new Sort(Direction.ASC, "name", "version")),

View File

@@ -98,7 +98,6 @@ public class SwModuleTable extends AbstractTable {
/**
* Initialize the filter layout.
*/
@Override
@PostConstruct
protected void init() {
super.init();
@@ -178,7 +177,7 @@ public class SwModuleTable extends AbstractTable {
*/
@Override
protected Container createContainer() {
final Map<String, Object> queryConfiguration = new HashMap<>();
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
manageDistUIState.getSoftwareModuleFilters().getSearchText()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
@@ -188,10 +187,13 @@ public class SwModuleTable extends AbstractTable {
manageDistUIState.getLastSelectedDistribution().ifPresent(
distIdName -> queryConfiguration.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, distIdName.getId()));
final BeanQueryFactory<SwModuleBeanQuery> swQF = new BeanQueryFactory<>(SwModuleBeanQuery.class);
final BeanQueryFactory<SwModuleBeanQuery> swQF = new BeanQueryFactory<SwModuleBeanQuery>(
SwModuleBeanQuery.class);
swQF.setQueryConfiguration(queryConfiguration);
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
final LazyQueryContainer container = new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
return container;
}
/*
@@ -307,7 +309,7 @@ public class SwModuleTable extends AbstractTable {
*/
@Override
protected List<TableColumn> getTableVisibleColumns() {
final List<TableColumn> columnList = new ArrayList<>();
final List<TableColumn> columnList = new ArrayList<TableColumn>();
if (isMaximized()) {
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get("header.name"), 0.2F));
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get("header.version"), 0.1F));