Skip to content

Commit

Permalink
KAA-1155: Bug with server-side profile schema version fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
vchizhevsky committed Jun 22, 2016
1 parent bc3a535 commit 52d674f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 59 deletions.
Expand Up @@ -19,6 +19,7 @@
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;


import com.google.gwt.activity.shared.AbstractActivity;
import org.kaaproject.avro.ui.gwt.client.util.BusyAsyncCallback; import org.kaaproject.avro.ui.gwt.client.util.BusyAsyncCallback;
import org.kaaproject.avro.ui.gwt.client.widget.grid.event.RowActionEvent; import org.kaaproject.avro.ui.gwt.client.widget.grid.event.RowActionEvent;
import org.kaaproject.avro.ui.gwt.client.widget.grid.event.RowActionEventHandler; import org.kaaproject.avro.ui.gwt.client.widget.grid.event.RowActionEventHandler;
Expand All @@ -32,7 +33,6 @@
import org.kaaproject.kaa.server.admin.client.mvp.view.EndpointProfilesView; import org.kaaproject.kaa.server.admin.client.mvp.view.EndpointProfilesView;
import org.kaaproject.kaa.server.admin.client.util.Utils; import org.kaaproject.kaa.server.admin.client.util.Utils;


import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeEvent;
Expand All @@ -49,22 +49,18 @@ public class EndpointProfilesActivity extends AbstractActivity implements BaseLi
private EndpointProfilesView listView; private EndpointProfilesView listView;
private EndpointProfilesPlace place; private EndpointProfilesPlace place;
private String applicationId; private String applicationId;
private boolean gridLoaded;
private EndpointProfileDataProvider dataProvider; private EndpointProfileDataProvider dataProvider;
private EndpointGroupDto groupAll; private EndpointGroupDto groupAll;

private List<HandlerRegistration> registrations = new ArrayList<>(); private List<HandlerRegistration> registrations = new ArrayList<>();


public EndpointProfilesActivity(EndpointProfilesPlace place, ClientFactory clientFactory) { public EndpointProfilesActivity(EndpointProfilesPlace place, ClientFactory clientFactory) {
this.place = place; this.place = place;
this.clientFactory = clientFactory; this.clientFactory = clientFactory;
this.applicationId = place.getApplicationId(); this.applicationId = place.getApplicationId();
this.gridLoaded = place.isGridLoaded();
} }


@Override @Override
public void start(AcceptsOneWidget containerWidget, EventBus eventBus) { public void start(AcceptsOneWidget containerWidget, EventBus eventBus) {
gridLoaded = false;
listView = clientFactory.getEndpointProfilesView(); listView = clientFactory.getEndpointProfilesView();
dataProvider = new EndpointProfileDataProvider(listView.getListWidget(), listView, this.applicationId); dataProvider = new EndpointProfileDataProvider(listView.getListWidget(), listView, this.applicationId);
listView.setPresenter(this); listView.setPresenter(this);
Expand All @@ -88,7 +84,7 @@ public void onClick(ClickEvent clickEvent) {
public void onRowAction(RowActionEvent<String> event) { public void onRowAction(RowActionEvent<String> event) {
String id = event.getClickedId(); String id = event.getClickedId();
if (event.getAction()==RowActionEvent.CLICK) { if (event.getAction()==RowActionEvent.CLICK) {
goTo(new EndpointProfilePlace(applicationId, id, gridLoaded)); goTo(new EndpointProfilePlace(applicationId, id));
} else if (event.getAction()==RowActionEvent.DELETE) { } else if (event.getAction()==RowActionEvent.DELETE) {
deleteEntity(id, new BusyAsyncCallback<Void>() { deleteEntity(id, new BusyAsyncCallback<Void>() {
@Override @Override
Expand Down Expand Up @@ -162,32 +158,24 @@ private void findByEndpointKeyHash() {


private void reset() { private void reset() {
listView.getEndpointKeyHashTextBox().setValue(""); listView.getEndpointKeyHashTextBox().setValue("");
if (!gridLoaded) { listView.getEndpointKeyHashButton().setValue(false);
listView.getEndpointGroupButton().setValue(true); listView.getEndpointGroupButton().setValue(true);
listView.getEndpointKeyHashButton().setValue(false); listView.getEndpointGroupsInfo().reset();
getGroupsList(); getGroupsList();
} else {
listView.getEndpointGroupsInfo().setValue(groupAll);
listView.getEndpointGroupButton().setValue(true);
listView.getEndpointKeyHashButton().setValue(false);
findByEndpointGroup();
}
} }


private void getGroupsList() { private void getGroupsList() {
if (!gridLoaded) { KaaAdmin.getDataSource().loadEndpointGroups(applicationId, new AsyncCallback<List<EndpointGroupDto>>() {
KaaAdmin.getDataSource().loadEndpointGroups(applicationId, new AsyncCallback<List<EndpointGroupDto>>() { @Override
@Override public void onFailure(Throwable caught) {
public void onFailure(Throwable caught) { Utils.handleException(caught, listView);
Utils.handleException(caught, listView); }
}


@Override @Override
public void onSuccess(List<EndpointGroupDto> result) { public void onSuccess(List<EndpointGroupDto> result) {
populateListBoxAndGrid(result); populateListBoxAndGrid(result);
} }
}); });
}
} }


private void populateListBoxAndGrid(List<EndpointGroupDto> result) { private void populateListBoxAndGrid(List<EndpointGroupDto> result) {
Expand All @@ -198,7 +186,6 @@ private void populateListBoxAndGrid(List<EndpointGroupDto> result) {
} }
} }
listView.getEndpointGroupsInfo().setAcceptableValues(result); listView.getEndpointGroupsInfo().setAcceptableValues(result);
gridLoaded = true;
} }


@Override @Override
Expand Down
Expand Up @@ -23,19 +23,12 @@
public class EndpointProfilePlace extends EndpointProfilesPlace { public class EndpointProfilePlace extends EndpointProfilesPlace {


private String endpointKeyHash; private String endpointKeyHash;
private boolean gridLoaded;


public EndpointProfilePlace(String applicationId, String endpointKeyHash) { public EndpointProfilePlace(String applicationId, String endpointKeyHash) {
super(applicationId); super(applicationId);
this.endpointKeyHash = endpointKeyHash; this.endpointKeyHash = endpointKeyHash;
} }


public EndpointProfilePlace(String applicationId, String endpointKeyHash, boolean gridLoaded) {
super(applicationId);
this.endpointKeyHash = endpointKeyHash;
this.gridLoaded = gridLoaded;
}

@Override @Override
public String getName() { public String getName() {
return Utils.constants.profile(); return Utils.constants.profile();
Expand All @@ -45,11 +38,6 @@ public String getEndpointKeyHash() {
return endpointKeyHash; return endpointKeyHash;
} }


@Override
public boolean isGridLoaded() {
return gridLoaded;
}

@Prefix(value = "endProfKeyHash") @Prefix(value = "endProfKeyHash")
public static class Tokenizer implements PlaceTokenizer<EndpointProfilePlace>, PlaceConstants { public static class Tokenizer implements PlaceTokenizer<EndpointProfilePlace>, PlaceConstants {


Expand Down Expand Up @@ -98,7 +86,7 @@ public boolean isLeaf() {


@Override @Override
public TreePlace createDefaultPreviousPlace() { public TreePlace createDefaultPreviousPlace() {
return new EndpointProfilesPlace(applicationId, gridLoaded); return new EndpointProfilesPlace(applicationId);
} }




Expand Down
Expand Up @@ -24,26 +24,15 @@
public class EndpointProfilesPlace extends TreePlace { public class EndpointProfilesPlace extends TreePlace {


protected String applicationId; protected String applicationId;
private boolean gridLoaded;


public EndpointProfilesPlace(String applicationId) { public EndpointProfilesPlace(String applicationId) {
this.applicationId = applicationId; this.applicationId = applicationId;
this.gridLoaded = false;
}

public EndpointProfilesPlace(String applicationId, boolean gridLoaded) {
this.applicationId = applicationId;
this.gridLoaded = gridLoaded;
} }


public String getApplicationId() { public String getApplicationId() {
return applicationId; return applicationId;
} }


public boolean isGridLoaded() {
return gridLoaded;
}

@Override @Override
public String getName() { public String getName() {
return Utils.constants.endpointProfiles(); return Utils.constants.endpointProfiles();
Expand Down
Expand Up @@ -19,13 +19,12 @@
import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.ValueListBox;
import org.kaaproject.kaa.common.dto.EndpointGroupDto;
import org.kaaproject.kaa.common.dto.EndpointProfileDto; import org.kaaproject.kaa.common.dto.EndpointProfileDto;
import org.kaaproject.kaa.server.admin.client.mvp.view.widget.EndpointGroupsInfoListBox;


public interface EndpointProfilesView extends BaseListView<EndpointProfileDto>{ public interface EndpointProfilesView extends BaseListView<EndpointProfileDto>{


ValueListBox<EndpointGroupDto> getEndpointGroupsInfo(); EndpointGroupsInfoListBox getEndpointGroupsInfo();


Button getResetButton(); Button getResetButton();
Button getFindEndpointButton(); Button getFindEndpointButton();
Expand Down
Expand Up @@ -17,7 +17,6 @@
package org.kaaproject.kaa.server.admin.client.mvp.view.endpoint; package org.kaaproject.kaa.server.admin.client.mvp.view.endpoint;


import org.kaaproject.avro.ui.gwt.client.widget.grid.AbstractGrid; import org.kaaproject.avro.ui.gwt.client.widget.grid.AbstractGrid;
import org.kaaproject.kaa.common.dto.EndpointGroupDto;
import org.kaaproject.kaa.common.dto.EndpointProfileDto; import org.kaaproject.kaa.common.dto.EndpointProfileDto;
import org.kaaproject.kaa.server.admin.client.mvp.view.EndpointProfilesView; import org.kaaproject.kaa.server.admin.client.mvp.view.EndpointProfilesView;
import org.kaaproject.kaa.server.admin.client.mvp.view.base.BaseListViewImpl; import org.kaaproject.kaa.server.admin.client.mvp.view.base.BaseListViewImpl;
Expand All @@ -34,7 +33,6 @@
import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.ValueListBox;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;


public class EndpointProfilesViewImpl extends BaseListViewImpl<EndpointProfileDto> implements EndpointProfilesView { public class EndpointProfilesViewImpl extends BaseListViewImpl<EndpointProfileDto> implements EndpointProfilesView {
Expand Down Expand Up @@ -99,7 +97,7 @@ protected Widget createAndBindUi() {
} }


@Override @Override
public ValueListBox<EndpointGroupDto> getEndpointGroupsInfo() { public EndpointGroupsInfoListBox getEndpointGroupsInfo() {
return listBox; return listBox;
} }


Expand Down

0 comments on commit 52d674f

Please sign in to comment.