Refactoring after review

- changed label sentence
- remove I18N to parent class
- remove empty lines
- set variable for configurationEnabledChange directly 

Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
Jonathan Philip Knoblauch
2016-04-08 17:15:15 +02:00
parent d815aaf12c
commit 40478dd675
8 changed files with 15 additions and 35 deletions

View File

@@ -14,7 +14,9 @@ import java.util.List;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement; import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey; import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions; import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalLayout;
@@ -30,6 +32,9 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Autowired
private I18N i18n;
private final TenantConfigurationKey configurationKey; private final TenantConfigurationKey configurationKey;
private final transient TenantConfigurationManagement tenantConfigurationManagement; private final transient TenantConfigurationManagement tenantConfigurationManagement;
@@ -53,7 +58,7 @@ abstract class AbstractAuthenticationTenantConfigurationItem extends VerticalLay
*/ */
protected void init(final String labelText) { protected void init(final String labelText) {
setImmediate(true); setImmediate(true);
addComponent(SPUIComponentProvider.getLabel(labelText, SPUILabelDefinitions.SP_LABEL_SIMPLE)); addComponent(SPUIComponentProvider.getLabel(i18n.get(labelText), SPUILabelDefinitions.SP_LABEL_SIMPLE));
} }
@Override @Override

View File

@@ -12,7 +12,6 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement; import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey; import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent; import com.vaadin.spring.annotation.SpringComponent;
@@ -31,9 +30,6 @@ public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractAu
private boolean configurationEnabled = false; private boolean configurationEnabled = false;
private boolean configurationEnabledChange = false; private boolean configurationEnabledChange = false;
@Autowired
private I18N i18n;
@Autowired @Autowired
public AnonymousDownloadAuthenticationConfigurationItem( public AnonymousDownloadAuthenticationConfigurationItem(
final TenantConfigurationManagement tenantConfigurationManagement) { final TenantConfigurationManagement tenantConfigurationManagement) {
@@ -42,26 +38,19 @@ public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractAu
@PostConstruct @PostConstruct
public void init() { public void init() {
super.init("label.configuration.anonymous.download");
super.init(i18n.get("label.configuration.anonymous.download"));
configurationEnabled = isConfigEnabled(); configurationEnabled = isConfigEnabled();
} }
@Override @Override
public void configEnable() { public void configEnable() {
configurationEnabledChange = !configurationEnabled;
if (!configurationEnabled) {
configurationEnabledChange = true;
}
configurationEnabled = true; configurationEnabled = true;
} }
@Override @Override
public void configDisable() { public void configDisable() {
if (configurationEnabled) { configurationEnabledChange = configurationEnabled;
configurationEnabledChange = true;
}
configurationEnabled = false; configurationEnabled = false;
} }
@@ -71,16 +60,13 @@ public class AnonymousDownloadAuthenticationConfigurationItem extends AbstractAu
return; return;
} }
getTenantConfigurationManagement().addOrUpdateConfiguration(getConfigurationKey(), configurationEnabled); getTenantConfigurationManagement().addOrUpdateConfiguration(getConfigurationKey(), configurationEnabled);
} }
@Override @Override
public void undo() { public void undo() {
configurationEnabledChange = false; configurationEnabledChange = false;
configurationEnabled = getTenantConfigurationManagement() configurationEnabled = getTenantConfigurationManagement()
.getConfigurationValue(getConfigurationKey(), Boolean.class).getValue(); .getConfigurationValue(getConfigurationKey(), Boolean.class).getValue();
} }
} }

View File

@@ -13,7 +13,6 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement; import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey; import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions; import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -35,9 +34,6 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Autowired
private I18N i18n;
private boolean configurationEnabled = false; private boolean configurationEnabled = false;
private boolean configurationEnabledChange = false; private boolean configurationEnabledChange = false;
private boolean configurationCaRootAuthorityChanged = false; private boolean configurationCaRootAuthorityChanged = false;
@@ -60,7 +56,7 @@ public class CertificateAuthenticationConfigurationItem extends AbstractAuthenti
*/ */
@PostConstruct @PostConstruct
public void init() { public void init() {
super.init(i18n.get("label.configuration.auth.header")); super.init("label.configuration.auth.header");
configurationEnabled = isConfigEnabled(); configurationEnabled = isConfigEnabled();
detailLayout = new VerticalLayout(); detailLayout = new VerticalLayout();

View File

@@ -15,7 +15,6 @@ import org.eclipse.hawkbit.security.SecurityTokenGenerator;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey; import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider; import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall; import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions; import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -41,8 +40,6 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
@Autowired @Autowired
private transient SecurityTokenGenerator securityTokenGenerator; private transient SecurityTokenGenerator securityTokenGenerator;
@Autowired
private I18N i18n;
private TextField gatewayTokenNameTextField; private TextField gatewayTokenNameTextField;
@@ -72,7 +69,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
@PostConstruct @PostConstruct
public void init() { public void init() {
super.init(i18n.get("label.configuration.auth.gatewaytoken")); super.init("label.configuration.auth.gatewaytoken");
configurationEnabled = isConfigEnabled(); configurationEnabled = isConfigEnabled();
detailLayout = new VerticalLayout(); detailLayout = new VerticalLayout();

View File

@@ -12,7 +12,6 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement; import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey; import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.vaadin.spring.annotation.SpringComponent; import com.vaadin.spring.annotation.SpringComponent;
@@ -28,9 +27,6 @@ public class TargetSecurityTokenAuthenticationConfigurationItem extends Abstract
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Autowired
private I18N i18n;
private boolean configurationEnabled = false; private boolean configurationEnabled = false;
private boolean configurationEnabledChange = false; private boolean configurationEnabledChange = false;
@@ -49,7 +45,7 @@ public class TargetSecurityTokenAuthenticationConfigurationItem extends Abstract
*/ */
@PostConstruct @PostConstruct
public void init() { public void init() {
super.init(i18n.get("label.configuration.auth.targettoken")); super.init("label.configuration.auth.targettoken");
configurationEnabled = isConfigEnabled(); configurationEnabled = isConfigEnabled();
} }

View File

@@ -161,7 +161,7 @@ label.tag.name = Tag name
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
label.configuration.anonymous.download = Allow targets to download anonymous label.configuration.anonymous.download = Allow targets to download artifacts without security credentials
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
# Checkbox label prefix with - checkbox # Checkbox label prefix with - checkbox

View File

@@ -159,7 +159,7 @@ label.tag.name = Tag name
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
label.configuration.anonymous.download = Allow targets to download anonymous label.configuration.anonymous.download = Allow targets to download artifacts without security credentials
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
# Checkbox label prefix with - checkbox # Checkbox label prefix with - checkbox

View File

@@ -160,7 +160,7 @@ label.tag.name = Tag name
label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy label.configuration.auth.header = Allow targets to authenticate via a certificate authenticated by an reverse proxy
label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token label.configuration.auth.gatewaytoken = Allow a gateway to authenticate and manage multiple targets through a gateway security token
label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token label.configuration.auth.targettoken = Allow targets to authenticate directly with their target security token
label.configuration.anonymous.download = Allow targets to download anonymous label.configuration.anonymous.download = Allow targets to download artifacts without security credentials
label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above label.unsupported.browser.ie=Sorry! current browser is not supported. Please use Internet Explorer 11 and above
# Checkbox label prefix with - checkbox # Checkbox label prefix with - checkbox