Skip to content

Commit

Permalink
Fix code style in server/admin package
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill380 committed Sep 30, 2016
1 parent 144db68 commit 320d734
Show file tree
Hide file tree
Showing 50 changed files with 487 additions and 401 deletions.
Expand Up @@ -173,7 +173,8 @@ public void onSuccess(Void result) {
private void login(final String userName, String password) { private void login(final String userName, String password) {
String postData = preparePostData("j_username=" + userName, "j_password=" + password); String postData = preparePostData("j_username=" + userName, "j_password=" + password);


RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, GWT.getModuleBaseURL() + "j_spring_security_check?" + postData); RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
GWT.getModuleBaseURL() + "j_spring_security_check?" + postData);
try { try {
builder.sendRequest(null, new RequestCallback() { builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) { public void onError(Request request, Throwable exception) {
Expand Down Expand Up @@ -210,8 +211,8 @@ public void onCancel() {
} }
} }
}); });
} catch (RequestException e) { } catch (RequestException ex) {
Utils.handleException(e, view); Utils.handleException(ex, view);
} }
} }


Expand Down Expand Up @@ -308,15 +309,16 @@ public void onKeyDown(KeyDownEvent event) {
class ForgotPasswordHandler implements ClickHandler { class ForgotPasswordHandler implements ClickHandler {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
ResetPasswordDialog resetPasswordDialog = new ResetPasswordDialog(new ResetPasswordDialog.Listener() { ResetPasswordDialog resetPasswordDialog = new ResetPasswordDialog(
@Override new ResetPasswordDialog.Listener() {
public void onSendResetPasswordLink() { @Override
} public void onSendResetPasswordLink() {
}


@Override @Override
public void onCancel() { public void onCancel() {
} }
}); });


resetPasswordDialog.show(); resetPasswordDialog.show();
resetPasswordDialog.center(); resetPasswordDialog.center();
Expand Down
Expand Up @@ -38,10 +38,10 @@ public abstract class AbstractBaseCtlSchemaActivity<S extends BaseSchemaDto,
extends AbstractDetailsActivity<T, V, P> extends AbstractDetailsActivity<T, V, P>
implements ErrorMessageCustomizer, FormDataLoader { implements ErrorMessageCustomizer, FormDataLoader {


private static final ErrorMessageCustomizer schemaErrorMessageCustomizer = new SchemaErrorMessageCustomizer(); private static final ErrorMessageCustomizer schemaErrorMessageCustomizer =
new SchemaErrorMessageCustomizer();


public AbstractBaseCtlSchemaActivity(P place, public AbstractBaseCtlSchemaActivity(P place, ClientFactory clientFactory) {
ClientFactory clientFactory) {
super(place, clientFactory); super(place, clientFactory);
} }


Expand All @@ -51,7 +51,8 @@ protected P existingSchemaPlace(String applicationId, String schemaId) {
return null; return null;
} }


protected P existingSchemaPlaceForEvent(String ecfId, String ecfVersionId, int ecfVersion, String schemaId) { protected P existingSchemaPlaceForEvent(String ecfId, String ecfVersionId, int ecfVersion,
String schemaId) {
return null; return null;
} }


Expand All @@ -74,7 +75,8 @@ protected void bindDetailsView(boolean fireChanged) {
detailsView.getName().setValue(schema.getName()); detailsView.getName().setValue(schema.getName());
detailsView.getDescription().setValue(schema.getDescription()); detailsView.getDescription().setValue(schema.getDescription());
detailsView.getCreatedUsername().setValue(schema.getCreatedUsername()); detailsView.getCreatedUsername().setValue(schema.getCreatedUsername());
detailsView.getCreatedDateTime().setValue(Utils.millisecondsToDateTimeString(schema.getCreatedTime())); detailsView.getCreatedDateTime()
.setValue(Utils.millisecondsToDateTimeString(schema.getCreatedTime()));
if (entity.getCtlSchemaForm() != null) { if (entity.getCtlSchemaForm() != null) {
detailsView.getSchemaForm().setValue(entity.getCtlSchemaForm().getSchema(), fireChanged); detailsView.getSchemaForm().setValue(entity.getCtlSchemaForm().getSchema(), fireChanged);
} }
Expand Down
Expand Up @@ -69,7 +69,8 @@ protected void onEntityRetrieved() {
registrations.add(detailsView.getNewCtlButton().addClickHandler(new ClickHandler() { registrations.add(detailsView.getNewCtlButton().addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
CtlSchemaPlace newCtlPlace = new CtlSchemaPlace("", null, CTLSchemaScopeDto.APPLICATION, place.getApplicationId(), true, true); CtlSchemaPlace newCtlPlace = new CtlSchemaPlace("", null, CTLSchemaScopeDto.APPLICATION,
place.getApplicationId(), true, true);
newCtlPlace.setSchemaType(getPlaceSchemaType()); newCtlPlace.setSchemaType(getPlaceSchemaType());
newCtlPlace.setPreviousPlace(place); newCtlPlace.setPreviousPlace(place);
canceled = true; canceled = true;
Expand Down
Expand Up @@ -46,8 +46,7 @@ public abstract class AbstractBaseCtlSchemaActivityEvent<S extends BaseSchemaDto
protected String ecfVersionId; protected String ecfVersionId;
protected int ecfVersion; protected int ecfVersion;


public AbstractBaseCtlSchemaActivityEvent(P place, public AbstractBaseCtlSchemaActivityEvent(P place, ClientFactory clientFactory) {
ClientFactory clientFactory) {
super(place, clientFactory); super(place, clientFactory);
} }


Expand All @@ -70,7 +69,8 @@ protected void onEntityRetrieved() {
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
CtlSchemaPlace newCtlPlace = null; CtlSchemaPlace newCtlPlace = null;


newCtlPlace = new CtlSchemaPlace("", null, CTLSchemaScopeDto.TENANT, place.getEcfId(), place.getEcfVersionId(), place.getEcfVersion(), true, true); newCtlPlace = new CtlSchemaPlace("", null, CTLSchemaScopeDto.TENANT, place.getEcfId(),
place.getEcfVersionId(), place.getEcfVersion(), true, true);
newCtlPlace.setSchemaType(getPlaceSchemaType()); newCtlPlace.setSchemaType(getPlaceSchemaType());
newCtlPlace.setPreviousPlace(place); newCtlPlace.setPreviousPlace(place);
canceled = true; canceled = true;
Expand All @@ -79,18 +79,19 @@ public void onClick(ClickEvent event) {
} }
})); }));


KaaAdmin.getDataSource().getTenantLevelCtlSchemaReferenceForEcf(place.getEcfId(), place.getEventClassDtoList(), new BusyAsyncCallback<List<CtlSchemaReferenceDto>>() { KaaAdmin.getDataSource().getTenantLevelCtlSchemaReferenceForEcf(place.getEcfId(),
@Override place.getEventClassDtoList(), new BusyAsyncCallback<List<CtlSchemaReferenceDto>>() {
public void onFailureImpl(Throwable caught) { @Override
Utils.handleException(caught, detailsView); public void onFailureImpl(Throwable caught) {
} Utils.handleException(caught, detailsView);
}


@Override @Override
public void onSuccessImpl(List<CtlSchemaReferenceDto> result) { public void onSuccessImpl(List<CtlSchemaReferenceDto> result) {
detailsView.getCtlSchemaReference().setAcceptableValues(result); detailsView.getCtlSchemaReference().setAcceptableValues(result);
bindDetailsView(true); bindDetailsView(true);
} }
}); });
detailsView.getSchemaForm().setFormDataLoader(this); detailsView.getSchemaForm().setFormDataLoader(this);
} else { } else {
bindDetailsView(false); bindDetailsView(false);
Expand Down
Expand Up @@ -28,7 +28,8 @@
import org.kaaproject.kaa.server.admin.client.servlet.ServletHelper; import org.kaaproject.kaa.server.admin.client.servlet.ServletHelper;
import org.kaaproject.kaa.server.admin.client.util.Utils; import org.kaaproject.kaa.server.admin.client.util.Utils;


public abstract class AbstractBaseCtlSchemasActivity<T extends BaseSchemaDto, P extends TreePlace> extends AbstractListActivity<T, P> { public abstract class AbstractBaseCtlSchemasActivity<T extends BaseSchemaDto, P extends TreePlace>
extends AbstractListActivity<T, P> {


public AbstractBaseCtlSchemasActivity(P place, Class<T> dataClass, public AbstractBaseCtlSchemasActivity(P place, Class<T> dataClass,
ClientFactory clientFactory) { ClientFactory clientFactory) {
Expand Down Expand Up @@ -56,6 +57,9 @@ protected void onCustomRowAction(RowActionEvent<String> event) {
case KaaRowAction.CTL_EXPORT_LIBRARY: case KaaRowAction.CTL_EXPORT_LIBRARY:
exportSchema(schemaId, CTLSchemaExportMethod.LIBRARY); exportSchema(schemaId, CTLSchemaExportMethod.LIBRARY);
break; break;
default:
exportSchema(schemaId, CTLSchemaExportMethod.SHALLOW); // shallow is default export
break;
} }
} }


Expand Down
Expand Up @@ -36,7 +36,9 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;


public abstract class AbstractDetailsActivity<T, V extends BaseDetailsView, P extends TreePlace> extends AbstractActivity implements BaseDetailsView.Presenter { public abstract class AbstractDetailsActivity<T, V extends BaseDetailsView, P extends TreePlace>
extends AbstractActivity
implements BaseDetailsView.Presenter {


protected final ClientFactory clientFactory; protected final ClientFactory clientFactory;
protected final String entityId; protected final String entityId;
Expand Down
Expand Up @@ -30,7 +30,9 @@


import java.util.List; import java.util.List;


public abstract class AbstractPluginActivity<T extends PluginDto, V extends BasePluginView, P extends AbstractPluginPlace> extends AbstractDetailsActivity<T, V, P> { public abstract class AbstractPluginActivity
<T extends PluginDto, V extends BasePluginView, P extends AbstractPluginPlace>
extends AbstractDetailsActivity<T, V, P> {


protected String applicationId; protected String applicationId;


Expand Down Expand Up @@ -69,10 +71,15 @@ public void onFailureImpl(Throwable caught) {
detailsView.getName().setValue(entity.getName()); detailsView.getName().setValue(entity.getName());
detailsView.getDescription().setValue(entity.getDescription()); detailsView.getDescription().setValue(entity.getDescription());
detailsView.getCreatedUsername().setValue(entity.getCreatedUsername()); detailsView.getCreatedUsername().setValue(entity.getCreatedUsername());
detailsView.getCreatedDateTime().setValue(Utils.millisecondsToDateTimeString(entity.getCreatedTime())); detailsView
.getCreatedDateTime()
.setValue(Utils.millisecondsToDateTimeString(entity.getCreatedTime()));
detailsView.getConfiguration().setValue(entity.getFieldConfiguration()); detailsView.getConfiguration().setValue(entity.getFieldConfiguration());
PluginInfoDto appenderInfo = PluginInfoDto appenderInfo =
new PluginInfoDto(entity.getPluginTypeName(), entity.getFieldConfiguration(), entity.getPluginClassName()); new PluginInfoDto(entity.getPluginTypeName(),
entity.getFieldConfiguration(),
entity.getPluginClassName()
);
detailsView.getPluginInfo().setValue(appenderInfo); detailsView.getPluginInfo().setValue(appenderInfo);
} }
} }
Expand Down
Expand Up @@ -37,8 +37,7 @@
import java.util.List; import java.util.List;


public class AefMapActivity public class AefMapActivity
extends extends AbstractDetailsActivity<ApplicationEventFamilyMapDto, AefMapView, AefMapPlace> {
AbstractDetailsActivity<ApplicationEventFamilyMapDto, AefMapView, AefMapPlace> {


private EventMapDataProvider eventMapDataProvider; private EventMapDataProvider eventMapDataProvider;


Expand All @@ -57,14 +56,15 @@ public void start(AcceptsOneWidget containerWidget, EventBus eventBus) {
protected void bind(final EventBus eventBus) { protected void bind(final EventBus eventBus) {
super.bind(eventBus); super.bind(eventBus);
if (create) { if (create) {
registrations.add(detailsView.getEcf().addValueChangeHandler(new ValueChangeHandler<EcfInfoDto>() { registrations.add(detailsView.getEcf().addValueChangeHandler(
@Override new ValueChangeHandler<EcfInfoDto>() {
public void onValueChange(ValueChangeEvent<EcfInfoDto> event) { @Override
EcfInfoDto ecf = detailsView.getEcf().getValue(); public void onValueChange(ValueChangeEvent<EcfInfoDto> event) {
eventMapDataProvider.setEcf(ecf); EcfInfoDto ecf = detailsView.getEcf().getValue();
eventMapDataProvider.reload(); eventMapDataProvider.setEcf(ecf);
} eventMapDataProvider.reload();
})); }
}));
} }
} }


Expand Down Expand Up @@ -92,20 +92,22 @@ protected ApplicationEventFamilyMapDto newEntity() {
@Override @Override
protected void onEntityRetrieved() { protected void onEntityRetrieved() {
if (create) { if (create) {
KaaAdmin.getDataSource().getVacantEventClassFamilies(place.getApplicationId(), new BusyAsyncCallback<List<EcfInfoDto>>() { KaaAdmin.getDataSource().getVacantEventClassFamilies(place.getApplicationId(),
@Override new BusyAsyncCallback<List<EcfInfoDto>>() {
public void onFailureImpl(Throwable caught) { @Override
Utils.handleException(caught, detailsView); public void onFailureImpl(Throwable caught) {
} Utils.handleException(caught, detailsView);

}
@Override
public void onSuccessImpl(List<EcfInfoDto> result) { @Override
detailsView.updateEcfs(result); public void onSuccessImpl(List<EcfInfoDto> result) {
} detailsView.updateEcfs(result);
}); }
});
} else { } else {
detailsView.getCreatedUsername().setValue(entity.getCreatedUsername()); detailsView.getCreatedUsername().setValue(entity.getCreatedUsername());
detailsView.getCreatedDateTime().setValue(Utils.millisecondsToDateTimeString(entity.getCreatedTime())); detailsView.getCreatedDateTime()
.setValue(Utils.millisecondsToDateTimeString(entity.getCreatedTime()));
detailsView.getEcfName().setValue(entity.getEcfName()); detailsView.getEcfName().setValue(entity.getEcfName());
detailsView.getEcfVersion().setValue(entity.getVersion() + ""); detailsView.getEcfVersion().setValue(entity.getVersion() + "");
eventMapDataProvider.setEventMaps(entity.getEventMaps()); eventMapDataProvider.setEventMaps(entity.getEventMaps());
Expand Down
Expand Up @@ -28,7 +28,8 @@
import org.kaaproject.kaa.server.admin.client.mvp.place.AefMapsPlace; import org.kaaproject.kaa.server.admin.client.mvp.place.AefMapsPlace;
import org.kaaproject.kaa.server.admin.client.mvp.view.BaseListView; import org.kaaproject.kaa.server.admin.client.mvp.view.BaseListView;


public class AefMapsActivity extends AbstractListActivity<ApplicationEventFamilyMapDto, AefMapsPlace> { public class AefMapsActivity
extends AbstractListActivity<ApplicationEventFamilyMapDto, AefMapsPlace> {


private String applicationId; private String applicationId;


Expand Down
Expand Up @@ -33,8 +33,7 @@
import java.util.List; import java.util.List;


public class ApplicationActivity public class ApplicationActivity
extends extends AbstractDetailsActivity<ApplicationDto, ApplicationView, ApplicationPlace> {
AbstractDetailsActivity<ApplicationDto, ApplicationView, ApplicationPlace> {


public ApplicationActivity(ApplicationPlace place, public ApplicationActivity(ApplicationPlace place,
ClientFactory clientFactory) { ClientFactory clientFactory) {
Expand Down Expand Up @@ -92,7 +91,8 @@ public void onFailure(Throwable caught) {


@Override @Override
public void onSuccess(List<String> result) { public void onSuccess(List<String> result) {
ApplicationActivity.this.detailsView.getCredentialsServiceName().setAcceptableValues(result); ApplicationActivity.this.detailsView.getCredentialsServiceName()
.setAcceptableValues(result);
} }
}); });
serviceNames.setValue(this.entity.getCredentialsServiceName()); serviceNames.setValue(this.entity.getCredentialsServiceName());
Expand Down
Expand Up @@ -78,12 +78,13 @@ protected void getRecord(String endpointGroupId,
protected void bind(final EventBus eventBus) { protected void bind(final EventBus eventBus) {
super.bind(eventBus); super.bind(eventBus);
if (create) { if (create) {
registrations.add(recordView.getSchema().addValueChangeHandler(new ValueChangeHandler<VersionDto>() { registrations.add(recordView.getSchema().addValueChangeHandler(
@Override new ValueChangeHandler<VersionDto>() {
public void onValueChange(ValueChangeEvent<VersionDto> event) { @Override
schemaSelected(event.getValue()); public void onValueChange(ValueChangeEvent<VersionDto> event) {
} schemaSelected(event.getValue());
})); }
}));
} }
} }


Expand Down Expand Up @@ -124,7 +125,8 @@ public void onSuccessImpl(List<SchemaInfoDto> result) {
inactiveStruct.setSchemaId(record.getSchemaId()); inactiveStruct.setSchemaId(record.getSchemaId());
inactiveStruct.setSchemaVersion(record.getSchemaVersion()); inactiveStruct.setSchemaVersion(record.getSchemaVersion());
inactiveStruct.setDescription(record.getDescription()); inactiveStruct.setDescription(record.getDescription());
inactiveStruct.setConfigurationRecord(record.getActiveStructureDto().getConfigurationRecord()); inactiveStruct.setConfigurationRecord(
record.getActiveStructureDto().getConfigurationRecord());
record.setInactiveStructureDto(inactiveStruct); record.setInactiveStructureDto(inactiveStruct);
} }
recordView.getRecordPanel().setData(record); recordView.getRecordPanel().setData(record);
Expand Down Expand Up @@ -185,9 +187,12 @@ protected void deactivateStruct(String id,


@Override @Override
protected ConfigurationPlace getRecordPlaceImpl(String applicationId, protected ConfigurationPlace getRecordPlaceImpl(String applicationId,
String endpointGroupId, boolean create, boolean showActive, String endpointGroupId,
boolean create,
boolean showActive,
double random) { double random) {
return new ConfigurationPlace(applicationId, schemaId, endpointGroupId, create, showActive, random); return new ConfigurationPlace(applicationId, schemaId, endpointGroupId,
create, showActive, random);
} }


@Override @Override
Expand Down
Expand Up @@ -30,10 +30,10 @@
import org.kaaproject.kaa.server.admin.shared.schema.CtlSchemaFormDto; import org.kaaproject.kaa.server.admin.shared.schema.CtlSchemaFormDto;


public class ConfigurationSchemaActivity extends public class ConfigurationSchemaActivity extends
AbstractBaseCtlSchemaActivityApplication<ConfigurationSchemaDto, ConfigurationSchemaViewDto, BaseCtlSchemaView, ConfigurationSchemaPlace> { AbstractBaseCtlSchemaActivityApplication<ConfigurationSchemaDto, ConfigurationSchemaViewDto,
BaseCtlSchemaView, ConfigurationSchemaPlace> {


public ConfigurationSchemaActivity(ConfigurationSchemaPlace place, public ConfigurationSchemaActivity(ConfigurationSchemaPlace place, ClientFactory clientFactory) {
ClientFactory clientFactory) {
super(place, clientFactory); super(place, clientFactory);
} }


Expand All @@ -60,7 +60,8 @@ protected void getEntity(String id, AsyncCallback<ConfigurationSchemaViewDto> ca




@Override @Override
protected void editEntity(ConfigurationSchemaViewDto entity, AsyncCallback<ConfigurationSchemaViewDto> callback) { protected void editEntity(ConfigurationSchemaViewDto entity,
AsyncCallback<ConfigurationSchemaViewDto> callback) {
KaaAdmin.getDataSource().saveConfigurationSchemaView(entity, callback); KaaAdmin.getDataSource().saveConfigurationSchemaView(entity, callback);
} }


Expand Down

0 comments on commit 320d734

Please sign in to comment.