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.ArrayList;
import java.util.List; import java.util.List;


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


private String applicationId; private String applicationId;


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


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


@Override @Override
public void onSuccess( public void onSuccess(final List<AefMapInfoDto> ecfs) {
List<UserVerifierDto> userVerifiers) { KaaAdmin.getDataSource().loadUserVerifiers(applicationId,
BusyPopup.hidePopup(); new AsyncCallback<List<UserVerifierDto>>() {
onInfoRetrieved(schemaVersions, ecfs, userVerifiers); @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, private void onInfoRetrieved(SchemaVersions schemaVersions,
Expand Down Expand Up @@ -141,14 +145,14 @@ private void onInfoRetrieved(SchemaVersions schemaVersions,
protected void onSave() { protected void onSave() {
entity.setName(detailsView.getName().getValue()); entity.setName(detailsView.getName().getValue());


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


} }


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




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

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


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

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

AddSdkProfileActivity.this.goTo(new SdkProfilesPlace(applicationId));
@Override }
public void onFailureImpl(Throwable caught) {
Utils.handleException(caught, detailsView); @Override
} public void onFailureImpl(Throwable caught) {
}); Utils.handleException(caught, detailsView);
}
});
} }
} }

}); });

} }


@Override @Override
Expand Down
Expand Up @@ -51,7 +51,9 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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) { public EndpointProfileActivity(EndpointProfilePlace place, ClientFactory clientFactory) {
super(place, clientFactory); super(place, clientFactory);
Expand All @@ -65,25 +67,28 @@ 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);


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


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


@Override @Override
Expand Down Expand Up @@ -121,11 +126,15 @@ protected void onEntityRetrieved() {
final SdkProfileDto sdkDto = entity.getSdkProfileDto(); final SdkProfileDto sdkDto = entity.getSdkProfileDto();
if (sdkDto != null) { if (sdkDto != null) {
String sdkName = sdkDto.getName(); 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() { registrations.add(detailsView.getSdkAnchor().addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent clickEvent) { public void onClick(ClickEvent clickEvent) {
SdkProfilePlace sdkProfilePlace = new SdkProfilePlace(place.getApplicationId(), sdkDto.getId()); SdkProfilePlace sdkProfilePlace = new SdkProfilePlace(place.getApplicationId(),
sdkDto.getId());

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


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


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


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


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


registrations.add(detailsView.getDownloadEndpointConfigurationButton().addClickHandler(new ClickHandler() { registrations.add(detailsView.getDownloadEndpointConfigurationButton().addClickHandler(
@Override new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
KaaAdmin.getDataSource().findEndpointConfigurationByEndpointKeyHash(BaseEncoding.base64().encode(entity.getEndpointKeyHash()), new BusyAsyncCallback<String>() {
@Override @Override
public void onFailureImpl(Throwable throwable) { public void onClick(ClickEvent clickEvent) {
Utils.handleException(throwable, detailsView); 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 @Override
public void onSuccessImpl(String s) { public void onClick(ClickEvent event) {
ServletHelper.downloadEndpointConfiguration(BaseEncoding.base64().encode(entity.getEndpointKeyHash())); 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() { registrations.add(detailsView.getEditServerProfileButton().addClickHandler(new ClickHandler() {


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


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


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


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


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


@Override @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.