Skip to content

Commit

Permalink
Fix style in some classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill380 committed Sep 29, 2016
1 parent 649df63 commit 14dcddb
Show file tree
Hide file tree
Showing 9 changed files with 576 additions and 394 deletions.
Expand Up @@ -39,7 +39,8 @@
import java.util.ArrayList;
import java.util.List;

public class AddSdkProfileActivity extends AbstractDetailsActivity<SdkProfileDto, AddSdkProfileView, AddSdkProfilePlace> {
public class AddSdkProfileActivity
extends AbstractDetailsActivity<SdkProfileDto, AddSdkProfileView, AddSdkProfilePlace> {

private String applicationId;

Expand Down Expand Up @@ -73,43 +74,46 @@ protected SdkProfileDto newEntity() {
@Override
protected void onEntityRetrieved() {
BusyPopup.showPopup();
KaaAdmin.getDataSource().getSchemaVersionsByApplicationId(applicationId, new AsyncCallback<SchemaVersions>() {
@Override
public void onFailure(Throwable caught) {
BusyPopup.hidePopup();
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccess(final SchemaVersions schemaVersions) {
KaaAdmin.getDataSource().getAefMaps(applicationId, new AsyncCallback<List<AefMapInfoDto>>() {
KaaAdmin.getDataSource().getSchemaVersionsByApplicationId(applicationId,
new AsyncCallback<SchemaVersions>() {
@Override
public void onFailure(Throwable caught) {
BusyPopup.hidePopup();
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccess(final List<AefMapInfoDto> ecfs) {
KaaAdmin.getDataSource().loadUserVerifiers(applicationId,
new AsyncCallback<List<UserVerifierDto>>() {
public void onSuccess(final SchemaVersions schemaVersions) {
KaaAdmin.getDataSource().getAefMaps(applicationId,
new AsyncCallback<List<AefMapInfoDto>>() {
@Override
public void onFailure(Throwable caught) {
BusyPopup.hidePopup();
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccess(
List<UserVerifierDto> userVerifiers) {
BusyPopup.hidePopup();
onInfoRetrieved(schemaVersions, ecfs, userVerifiers);
public void onSuccess(final List<AefMapInfoDto> ecfs) {
KaaAdmin.getDataSource().loadUserVerifiers(applicationId,
new AsyncCallback<List<UserVerifierDto>>() {
@Override
public void onFailure(Throwable caught) {
BusyPopup.hidePopup();
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccess(
List<UserVerifierDto> userVerifiers) {
BusyPopup.hidePopup();
onInfoRetrieved(schemaVersions, ecfs, userVerifiers);
}
}
);
}
});
}
});
}
});
}

private void onInfoRetrieved(SchemaVersions schemaVersions,
Expand Down Expand Up @@ -141,14 +145,14 @@ private void onInfoRetrieved(SchemaVersions schemaVersions,
protected void onSave() {
entity.setName(detailsView.getName().getValue());

entity.setConfigurationSchemaVersion(detailsView.getConfigurationSchemaVersion().
getValue().getVersion());
entity.setProfileSchemaVersion(detailsView.getProfileSchemaVersion().
getValue().getVersion());
entity.setNotificationSchemaVersion(detailsView.getNotificationSchemaVersion().
getValue().getVersion());
entity.setLogSchemaVersion(detailsView.getLogSchemaVersion().
getValue().getVersion());
entity.setConfigurationSchemaVersion(detailsView.getConfigurationSchemaVersion()
.getValue().getVersion());
entity.setProfileSchemaVersion(detailsView.getProfileSchemaVersion()
.getValue().getVersion());
entity.setNotificationSchemaVersion(detailsView.getNotificationSchemaVersion()
.getValue().getVersion());
entity.setLogSchemaVersion(detailsView.getLogSchemaVersion()
.getValue().getVersion());

}

Expand All @@ -172,13 +176,14 @@ protected void doSave(final EventBus eventBus) {


KaaAdmin.getDataSource().validateEcfListInSdkProfile(aefMaps, new AsyncCallback<Void>() {

@Override
public void onFailure(Throwable caught) {
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccess(Void aVoid) {
public void onSuccess(Void callback) {
List<String> aefMapIds = new ArrayList<>();
if (aefMaps != null) {
for (AefMapInfoDto aefMap : aefMaps) {
Expand All @@ -191,24 +196,30 @@ public void onSuccess(Void aVoid) {
.getValue().getVerifierToken());
}
entity = sdkProfileDto;
if (!sdkProfileDto.getAefMapIds().isEmpty() && sdkProfileDto.getDefaultVerifierToken() == null) {
if (!sdkProfileDto.getAefMapIds().isEmpty()
&& sdkProfileDto.getDefaultVerifierToken() == null) {

detailsView.setErrorMessage(Utils.constants.specifyVerifier());
} else {
KaaAdmin.getDataSource().addSdkProfile(sdkProfileDto, new BusyAsyncCallback<SdkProfileDto>() {
@Override
public void onSuccessImpl(SdkProfileDto result) {
detailsView.reset();
AddSdkProfileActivity.this.goTo(new SdkProfilesPlace(applicationId));
}

@Override
public void onFailureImpl(Throwable caught) {
Utils.handleException(caught, detailsView);
}
});

KaaAdmin.getDataSource().addSdkProfile(sdkProfileDto,
new BusyAsyncCallback<SdkProfileDto>() {
@Override
public void onSuccessImpl(SdkProfileDto result) {
detailsView.reset();
AddSdkProfileActivity.this.goTo(new SdkProfilesPlace(applicationId));
}

@Override
public void onFailureImpl(Throwable caught) {
Utils.handleException(caught, detailsView);
}
});
}
}

});

}

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

public class EndpointProfileActivity extends AbstractDetailsActivity<EndpointProfileViewDto, EndpointProfileView, EndpointProfilePlace> {
public class EndpointProfileActivity
extends AbstractDetailsActivity
<EndpointProfileViewDto, EndpointProfileView, EndpointProfilePlace> {

public EndpointProfileActivity(EndpointProfilePlace place, ClientFactory clientFactory) {
super(place, clientFactory);
Expand All @@ -65,25 +67,28 @@ public void start(AcceptsOneWidget containerWidget, EventBus eventBus) {
protected void bind(final EventBus eventBus) {
super.bind(eventBus);

registrations.add(detailsView.getGroupsGrid().addRowActionHandler(new RowActionEventHandler<String>() {
@Override
public void onRowAction(RowActionEvent<String> rowActionEvent) {
String id = rowActionEvent.getClickedId();
EndpointGroupPlace endpointGroupPlace = new EndpointGroupPlace(place.getApplicationId(), id, false, false);
endpointGroupPlace.setPreviousPlace(place);
goTo(endpointGroupPlace);
}
}));
registrations.add(detailsView.getGroupsGrid().addRowActionHandler(
new RowActionEventHandler<String>() {
@Override
public void onRowAction(RowActionEvent<String> rowActionEvent) {
String id = rowActionEvent.getClickedId();
EndpointGroupPlace endpointGroupPlace = new EndpointGroupPlace(
place.getApplicationId(), id, false, false);
endpointGroupPlace.setPreviousPlace(place);
goTo(endpointGroupPlace);
}
}));

registrations.add(detailsView.getTopicsGrid().addRowActionHandler(new RowActionEventHandler<String>() {
@Override
public void onRowAction(RowActionEvent<String> rowActionEvent) {
String id = rowActionEvent.getClickedId();
TopicPlace topicPlace = new TopicPlace(place.getApplicationId(), id);
topicPlace.setPreviousPlace(place);
goTo(topicPlace);
}
}));
registrations.add(detailsView.getTopicsGrid().addRowActionHandler(
new RowActionEventHandler<String>() {
@Override
public void onRowAction(RowActionEvent<String> rowActionEvent) {
String id = rowActionEvent.getClickedId();
TopicPlace topicPlace = new TopicPlace(place.getApplicationId(), id);
topicPlace.setPreviousPlace(place);
goTo(topicPlace);
}
}));
}

@Override
Expand Down Expand Up @@ -121,11 +126,15 @@ protected void onEntityRetrieved() {
final SdkProfileDto sdkDto = entity.getSdkProfileDto();
if (sdkDto != null) {
String sdkName = sdkDto.getName();
detailsView.getSdkAnchor().setText((sdkName != null && !sdkName.isEmpty()) ? sdkName : sdkDto.getToken());
detailsView.getSdkAnchor()
.setText((sdkName != null && !sdkName.isEmpty()) ? sdkName : sdkDto.getToken());

registrations.add(detailsView.getSdkAnchor().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
SdkProfilePlace sdkProfilePlace = new SdkProfilePlace(place.getApplicationId(), sdkDto.getId());
SdkProfilePlace sdkProfilePlace = new SdkProfilePlace(place.getApplicationId(),
sdkDto.getId());

sdkProfilePlace.setPreviousPlace(place);
goTo(sdkProfilePlace);
}
Expand Down Expand Up @@ -160,22 +169,27 @@ public void onClick(ClickEvent clickEvent) {

detailsView.getEndpointProfSchemaName().setText(entity.getProfileSchemaName());

registrations.add(detailsView.getEndpointProfSchemaName().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
ProfileSchemaPlace endpointProfSchemaPlace = new ProfileSchemaPlace(place.getApplicationId(), entity
.getProfileSchemaVersion().getId());
endpointProfSchemaPlace.setPreviousPlace(place);
goTo(endpointProfSchemaPlace);
}
}));
registrations.add(detailsView.getEndpointProfSchemaName().addClickHandler(
new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
ProfileSchemaPlace endpointProfSchemaPlace = new ProfileSchemaPlace(
place.getApplicationId(),
entity.getProfileSchemaVersion().getId());
endpointProfSchemaPlace.setPreviousPlace(place);
goTo(endpointProfSchemaPlace);
}
}));

registrations.add(detailsView.getDownloadEndpointProfileJsonButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ServletHelper.downloadEndpointProfile(BaseEncoding.base64().encode(entity.getEndpointKeyHash()), ProfileType.CLIENT);
}
}));
registrations.add(detailsView.getDownloadEndpointProfileJsonButton().addClickHandler(
new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ServletHelper.downloadEndpointProfile(
BaseEncoding.base64().encode(entity.getEndpointKeyHash()), ProfileType.CLIENT
);
}
}));

detailsView.getEndpointProfForm().setValue(entity.getProfileRecord());
detailsView.getServerProfForm().setValue(entity.getServerProfileRecord());
Expand All @@ -185,42 +199,50 @@ public void onClick(ClickEvent event) {
registrations.add(detailsView.getServerProfSchemaName().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
ServerProfileSchemaPlace serverProfSchemaPlace = new ServerProfileSchemaPlace(place.getApplicationId(), entity
.getServerProfileSchemaVersion().getId());
ServerProfileSchemaPlace serverProfSchemaPlace = new ServerProfileSchemaPlace(
place.getApplicationId(), entity.getServerProfileSchemaVersion().getId());
serverProfSchemaPlace.setPreviousPlace(place);
goTo(serverProfSchemaPlace);
}
}));

registrations.add(detailsView.getDownloadEndpointConfigurationButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
KaaAdmin.getDataSource().findEndpointConfigurationByEndpointKeyHash(BaseEncoding.base64().encode(entity.getEndpointKeyHash()), new BusyAsyncCallback<String>() {
registrations.add(detailsView.getDownloadEndpointConfigurationButton().addClickHandler(
new ClickHandler() {
@Override
public void onFailureImpl(Throwable throwable) {
Utils.handleException(throwable, detailsView);
public void onClick(ClickEvent clickEvent) {
KaaAdmin.getDataSource().findEndpointConfigurationByEndpointKeyHash(
BaseEncoding.base64().encode(entity.getEndpointKeyHash()),
new BusyAsyncCallback<String>() {
@Override
public void onFailureImpl(Throwable throwable) {
Utils.handleException(throwable, detailsView);
}

@Override
public void onSuccessImpl(String str) {
ServletHelper.downloadEndpointConfiguration(
BaseEncoding.base64().encode(entity.getEndpointKeyHash()));
}
}
);
}
}));

registrations.add(detailsView.getDownloadServerProfileJsonButton().addClickHandler(
new ClickHandler() {
@Override
public void onSuccessImpl(String s) {
ServletHelper.downloadEndpointConfiguration(BaseEncoding.base64().encode(entity.getEndpointKeyHash()));
public void onClick(ClickEvent event) {
ServletHelper.downloadEndpointProfile(
BaseEncoding.base64().encode(entity.getEndpointKeyHash()), ProfileType.SERVER);
}
});
}
}));

registrations.add(detailsView.getDownloadServerProfileJsonButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ServletHelper.downloadEndpointProfile(BaseEncoding.base64().encode(entity.getEndpointKeyHash()), ProfileType.SERVER);
}
}));
}));

registrations.add(detailsView.getEditServerProfileButton().addClickHandler(new ClickHandler() {

@Override
public void onClick(ClickEvent event) {
KaaAdmin.getDataSource().getServerProfileSchemaInfosByEndpointKey(place.getEndpointKeyHash(),
KaaAdmin.getDataSource().getServerProfileSchemaInfosByEndpointKey(
place.getEndpointKeyHash(),
new BusyAsyncCallback<List<SchemaInfoDto>>() {
@Override
public void onFailureImpl(Throwable caught) {
Expand All @@ -229,11 +251,13 @@ public void onFailureImpl(Throwable caught) {

@Override
public void onSuccessImpl(List<SchemaInfoDto> result) {
EditSchemaRecordDialog.Listener editSchemaListener = new EditSchemaRecordDialog.Listener() {
EditSchemaRecordDialog.Listener editSchemaListener =
new EditSchemaRecordDialog.Listener() {

@Override
public void onSave(SchemaInfoDto newValue) {
AsyncCallback<EndpointProfileDto> callback = new BusyAsyncCallback<EndpointProfileDto>() {
AsyncCallback<EndpointProfileDto> callback =
new BusyAsyncCallback<EndpointProfileDto>() {

@Override
public void onFailureImpl(Throwable caught) {
Expand All @@ -246,15 +270,16 @@ public void onSuccessImpl(EndpointProfileDto result) {
}
};
KaaAdmin.getDataSource().updateServerProfile(
BaseEncoding.base64().encode(entity.getEndpointKeyHash()), newValue.getVersion(),
BaseEncoding.base64().encode(entity.getEndpointKeyHash()),
newValue.getVersion(),
newValue.getSchemaForm(), callback);
}

@Override
public void onCancel() {
}
public void onCancel() {}
};
EditSchemaRecordDialog.showEditSchemaRecordDialog(editSchemaListener, Utils.constants.editServerProfile(),
EditSchemaRecordDialog.showEditSchemaRecordDialog(editSchemaListener,
Utils.constants.editServerProfile(),
result, entity.getServerProfileSchemaVersion().getVersion());
}
});
Expand All @@ -272,6 +297,6 @@ protected void getEntity(String id, final AsyncCallback<EndpointProfileViewDto>
}

@Override
protected void editEntity(EndpointProfileViewDto entity, AsyncCallback<EndpointProfileViewDto> callback) {
}
protected void editEntity(EndpointProfileViewDto entity,
AsyncCallback<EndpointProfileViewDto> callback) {}
}

0 comments on commit 14dcddb

Please sign in to comment.