Skip to content

Commit

Permalink
updated UI, changed AbstractTestControlServer class to be compatible …
Browse files Browse the repository at this point in the history
…with TenantDto
  • Loading branch information
Pyshankov committed Jul 15, 2016
1 parent a9c40a9 commit 4e13548
Show file tree
Hide file tree
Showing 23 changed files with 303 additions and 704 deletions.
Expand Up @@ -34,34 +34,13 @@
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.kaaproject.kaa.common.dto.ApplicationDto;
import org.kaaproject.kaa.common.dto.ConfigurationDto;
import org.kaaproject.kaa.common.dto.ConfigurationRecordDto;
import org.kaaproject.kaa.common.dto.ConfigurationSchemaDto;
import org.kaaproject.kaa.common.dto.EndpointGroupDto;
import org.kaaproject.kaa.common.dto.EndpointNotificationDto;
import org.kaaproject.kaa.common.dto.EndpointProfileBodyDto;
import org.kaaproject.kaa.common.dto.EndpointProfileDto;
import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto;
import org.kaaproject.kaa.common.dto.EndpointProfilesBodyDto;
import org.kaaproject.kaa.common.dto.EndpointProfilesPageDto;
import org.kaaproject.kaa.common.dto.EndpointUserConfigurationDto;
import org.kaaproject.kaa.common.dto.NotificationDto;
import org.kaaproject.kaa.common.dto.NotificationSchemaDto;
import org.kaaproject.kaa.common.dto.PageLinkDto;
import org.kaaproject.kaa.common.dto.ProfileFilterDto;
import org.kaaproject.kaa.common.dto.ProfileFilterRecordDto;
import org.kaaproject.kaa.common.dto.ProfileVersionPairDto;
import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto;
import org.kaaproject.kaa.common.dto.TopicDto;
import org.kaaproject.kaa.common.dto.VersionDto;
import org.kaaproject.kaa.common.dto.*;
import org.kaaproject.kaa.common.dto.admin.AuthResultDto;
import org.kaaproject.kaa.common.dto.admin.RecordKey;
import org.kaaproject.kaa.common.dto.admin.ResultCode;
import org.kaaproject.kaa.common.dto.admin.SchemaVersions;
import org.kaaproject.kaa.common.dto.admin.SdkPlatform;
import org.kaaproject.kaa.common.dto.admin.SdkProfileDto;
import org.kaaproject.kaa.common.dto.admin.TenantUserDto;
import org.kaaproject.kaa.common.dto.admin.UserDto;
import org.kaaproject.kaa.common.dto.credentials.CredentialsDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto;
Expand Down Expand Up @@ -190,19 +169,19 @@ public ResultCode changePassword(String username, String oldPassword, String new
return restTemplate.postForObject(restTemplate.getUrl() + "auth/changePassword", params, ResultCode.class);
}

public TenantUserDto editTenant(TenantUserDto tenant) throws Exception {
return restTemplate.postForObject(restTemplate.getUrl() + "tenant", tenant, TenantUserDto.class);
public TenantDto editTenant(TenantDto tenant) throws Exception {
return restTemplate.postForObject(restTemplate.getUrl() + "tenant", tenant, TenantDto.class);
}

public List<TenantUserDto> getTenants() throws Exception {
ParameterizedTypeReference<List<TenantUserDto>> typeRef = new ParameterizedTypeReference<List<TenantUserDto>>() {
public List<TenantDto> getTenants() throws Exception {
ParameterizedTypeReference<List<TenantDto>> typeRef = new ParameterizedTypeReference<List<TenantDto>>() {
};
ResponseEntity<List<TenantUserDto>> entity = restTemplate.exchange(restTemplate.getUrl() + "tenants", HttpMethod.GET, null, typeRef);
ResponseEntity<List<TenantDto>> entity = restTemplate.exchange(restTemplate.getUrl() + "tenants", HttpMethod.GET, null, typeRef);
return entity.getBody();
}

public TenantUserDto getTenant(String userId) throws Exception {
return restTemplate.getForObject(restTemplate.getUrl() + "tenant/" + userId, TenantUserDto.class);
public TenantDto getTenant(String userId) throws Exception {
return restTemplate.getForObject(restTemplate.getUrl() + "tenant/" + userId, TenantDto.class);
}

public ApplicationDto editApplication(ApplicationDto application) throws Exception {
Expand Down

This file was deleted.

Expand Up @@ -16,15 +16,8 @@

package org.kaaproject.kaa.server.admin.client.mvp;

import org.kaaproject.kaa.common.dto.ApplicationDto;
import org.kaaproject.kaa.common.dto.ConfigurationSchemaDto;
import org.kaaproject.kaa.common.dto.EndpointGroupDto;
import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto;
import org.kaaproject.kaa.common.dto.NotificationSchemaDto;
import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto;
import org.kaaproject.kaa.common.dto.TopicDto;
import org.kaaproject.kaa.common.dto.*;
import org.kaaproject.kaa.common.dto.admin.SdkProfileDto;
import org.kaaproject.kaa.common.dto.admin.TenantUserDto;
import org.kaaproject.kaa.common.dto.admin.UserDto;
import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto;
import org.kaaproject.kaa.common.dto.event.EventClassFamilyDto;
Expand Down Expand Up @@ -78,7 +71,7 @@ public interface ClientFactory {

BasePropertiesView getMailPropertiesView();

BaseListView<TenantUserDto> getTenantsView();
BaseListView<TenantDto> getTenantsView();
TenantView getCreateTenantView();
TenantView getTenantView();

Expand Down
Expand Up @@ -16,16 +16,8 @@

package org.kaaproject.kaa.server.admin.client.mvp;

import org.kaaproject.kaa.common.dto.ApplicationDto;
import org.kaaproject.kaa.common.dto.ConfigurationSchemaDto;
import org.kaaproject.kaa.common.dto.EndpointGroupDto;
import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto;
import org.kaaproject.kaa.common.dto.KaaAuthorityDto;
import org.kaaproject.kaa.common.dto.NotificationSchemaDto;
import org.kaaproject.kaa.common.dto.ServerProfileSchemaDto;
import org.kaaproject.kaa.common.dto.TopicDto;
import org.kaaproject.kaa.common.dto.*;
import org.kaaproject.kaa.common.dto.admin.SdkProfileDto;
import org.kaaproject.kaa.common.dto.admin.TenantUserDto;
import org.kaaproject.kaa.common.dto.admin.UserDto;
import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto;
import org.kaaproject.kaa.common.dto.event.EventClassFamilyDto;
Expand Down Expand Up @@ -128,7 +120,7 @@ public class ClientFactoryImpl implements ClientFactory {

private final BasePropertiesView mailPropertiesView = new MailPropertiesViewImpl();

private final BaseListView<TenantUserDto> tenantsView = new TenantsViewImpl();
private final BaseListView<TenantDto> tenantsView = new TenantsViewImpl();
private final TenantView createTenantView = new TenantViewImpl(true);
private final TenantView tenantView = new TenantViewImpl(false);

Expand Down Expand Up @@ -251,7 +243,7 @@ public BasePropertiesView getMailPropertiesView() {
}

@Override
public BaseListView<TenantUserDto> getTenantsView() {
public BaseListView<TenantDto> getTenantsView() {
return tenantsView;
}

Expand Down
Expand Up @@ -16,8 +16,7 @@

package org.kaaproject.kaa.server.admin.client.mvp.activity;

import org.kaaproject.kaa.common.dto.KaaAuthorityDto;
import org.kaaproject.kaa.common.dto.admin.TenantUserDto;
import org.kaaproject.kaa.common.dto.TenantDto;
import org.kaaproject.kaa.server.admin.client.KaaAdmin;
import org.kaaproject.kaa.server.admin.client.mvp.ClientFactory;
import org.kaaproject.kaa.server.admin.client.mvp.place.TenantPlace;
Expand All @@ -26,12 +25,17 @@
import com.google.gwt.user.client.rpc.AsyncCallback;

public class TenantActivity extends
AbstractUserActivity<TenantUserDto, TenantView, TenantPlace> {
AbstractDetailsActivity<TenantDto, TenantView, TenantPlace> {

public TenantActivity(TenantPlace place, ClientFactory clientFactory) {
super(place, clientFactory);
}

@Override
protected String getEntityId(TenantPlace place) {
return place.getTenantId();
}

@Override
protected TenantView getView(boolean create) {
if (create) {
Expand All @@ -42,36 +46,32 @@ protected TenantView getView(boolean create) {
}

@Override
protected TenantUserDto newEntity() {
return new TenantUserDto();
protected TenantDto newEntity() {
return new TenantDto();
}

@Override
protected void onEntityRetrieved() {
super.onEntityRetrieved();
if (!create) {
detailsView.setTitle(entity.getTenantName());
detailsView.setTitle(entity.getName());
}
detailsView.getTenantName().setValue(entity.getTenantName());
detailsView.getTenantName().setValue(entity.getName());
}

@Override
protected void onSave() {
super.onSave();
entity.setTenantName(detailsView.getTenantName().getValue());
if (create) {
entity.setAuthority(KaaAuthorityDto.TENANT_ADMIN);
}
entity.setName(detailsView.getTenantName().getValue());

}

@Override
protected void getEntity(String id, AsyncCallback<TenantUserDto> callback) {
protected void getEntity(String id, AsyncCallback<TenantDto> callback) {
KaaAdmin.getDataSource().getTenant(id, callback);
}

@Override
protected void editEntity(TenantUserDto entity,
AsyncCallback<TenantUserDto> callback) {
protected void editEntity(TenantDto entity,
AsyncCallback<TenantDto> callback) {
KaaAdmin.getDataSource().editTenant(entity, callback);
}

Expand Down
Expand Up @@ -17,7 +17,7 @@
package org.kaaproject.kaa.server.admin.client.mvp.activity;

import org.kaaproject.avro.ui.gwt.client.widget.grid.AbstractGrid;
import org.kaaproject.kaa.common.dto.admin.TenantUserDto;
import org.kaaproject.kaa.common.dto.TenantDto;
import org.kaaproject.kaa.server.admin.client.KaaAdmin;
import org.kaaproject.kaa.server.admin.client.mvp.ClientFactory;
import org.kaaproject.kaa.server.admin.client.mvp.activity.grid.AbstractDataProvider;
Expand All @@ -30,20 +30,20 @@
import com.google.gwt.user.client.rpc.AsyncCallback;


public class TenantsActivity extends AbstractListActivity<TenantUserDto, TenantsPlace> {
public class TenantsActivity extends AbstractListActivity<TenantDto, TenantsPlace> {

public TenantsActivity(TenantsPlace place, ClientFactory clientFactory) {
super(place, TenantUserDto.class, clientFactory);
super(place, TenantDto.class, clientFactory);
}

@Override
protected BaseListView<TenantUserDto> getView() {
protected BaseListView<TenantDto> getView() {
return clientFactory.getTenantsView();
}

@Override
protected AbstractDataProvider<TenantUserDto, String> getDataProvider(
AbstractGrid<TenantUserDto, String> dataGrid) {
protected AbstractDataProvider<TenantDto, String> getDataProvider(
AbstractGrid<TenantDto, String> dataGrid) {
return new TenantsDataProvider(dataGrid, listView);
}

Expand Down

0 comments on commit 4e13548

Please sign in to comment.