Skip to content

Commit

Permalink
Fix code style and some merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill380 committed Oct 5, 2016
1 parent af2aa9d commit 4e11ae4
Show file tree
Hide file tree
Showing 22 changed files with 139 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ public String getFilename() {
}



/**
* Gets the endpoint profile by endpoint group id.
*
* @param pageLink contains information about groupId, offset and limit
*/
public EndpointProfilesPageDto getEndpointProfileByEndpointGroupId(PageLinkDto pageLink)
throws Exception {
String endpointGroupId = pageLink.getEndpointGroupId();
Expand All @@ -171,6 +175,12 @@ public EndpointProfilesPageDto getEndpointProfileByEndpointGroupId(PageLinkDto p
return entity.getBody();
}


/**
* Gets the endpoint profile body by endpoint group id.
*
* @param pageLink contains information about groupId, offset and limit
*/
public EndpointProfilesBodyDto getEndpointProfileBodyByEndpointGroupId(PageLinkDto pageLink)
throws Exception {
String endpointGroupId = pageLink.getEndpointGroupId();
Expand All @@ -192,6 +202,11 @@ public EndpointProfileDto getEndpointProfileByKeyHash(String endpointProfileKeyH
return entity.getBody();
}


/**
* Gets the endpoint profile by endpoint key hash.
*
*/
public EndpointProfileBodyDto getEndpointProfileBodyByKeyHash(String endpointProfileKeyHash)
throws Exception {
ResponseEntity<EndpointProfileBodyDto> entity = restTemplate.exchange(restTemplate.getUrl()
Expand Down Expand Up @@ -898,6 +913,11 @@ public SdkProfileDto getSdkProfile(String sdkProfileId) throws Exception {
return entity.getBody();
}

/**
* Returns a list of SDK profiles for the given application.
*
* @param applicationToken the application token
*/
public List<SdkProfileDto> getSdkProfilesByApplicationToken(String applicationToken)
throws Exception {
ResponseEntity<List<SdkProfileDto>> entity = restTemplate.exchange(
Expand All @@ -906,6 +926,12 @@ public List<SdkProfileDto> getSdkProfilesByApplicationToken(String applicationTo
return entity.getBody();
}

/**
* Generates an SDK for the specified target platform from an SDK profile .
*
* @param sdkProfileId the sdk profile id
* @param targetPlatform the target platform
*/
public void downloadSdk(String sdkProfileId, SdkPlatform targetPlatform, String destination) {
FileResponseExtractor extractor = new FileResponseExtractor(new File(destination));
MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
Expand Down Expand Up @@ -972,6 +998,12 @@ public FileData downloadCtlSchemaByAppToken(CTLSchemaDto ctlSchemaDto,
HttpMethod.POST, request, extractor);
}



/**
* Flushes all cached Sdks within tenant.
*
*/
public void flushSdkCache() throws Exception {
restTemplate.postForLocation(restTemplate.getUrl() + "flushSdkCache", null);
}
Expand Down Expand Up @@ -1038,6 +1070,14 @@ public CTLSchemaDto getCTLSchemaById(String id) {
CTLSchemaDto.class, id);
}

/**
* Checks if CTL schema with same fqn is already exists in the sibling applications.
*
* @param fqn the full qualified name
* @param tenantId id of the tenant
* @param applicationToken the application token
* @return true if CTL schema with same fqn is already exists in other scope
*/
public boolean checkFqnExistsWithAppToken(String fqn, String tenantId,
String applicationToken) {
if (tenantId != null && applicationToken != null) {
Expand All @@ -1055,6 +1095,13 @@ public boolean checkFqnExistsWithAppToken(String fqn, String tenantId,
}
}

/**
* Promote existing CTL schema meta info from application to tenant scope
*
* @param applicationId the id of application where schema was created
* @param fqn the fqn of promoting CTL schema
* @return CtlSchemaMetaInfoDto the promoted CTL schema meta info object.
*/
public CtlSchemaMetaInfoDto promoteScopeToTenant(String applicationId, String fqn) {
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("applicationId", applicationId);
Expand Down Expand Up @@ -1091,15 +1138,33 @@ public List<CtlSchemaMetaInfoDto> getApplicationLevelCTLSchemasByAppToken(
return entity.getBody();
}


/**
* Gets the user profile of current user.
*
* @return the user dto
*/
public UserDto getUserProfile() throws Exception {
return restTemplate.getForObject(restTemplate.getUrl() + "userProfile", UserDto.class);
}

/**
* Edits user profile to all user profiles.
*
* @param userProfileUpdateDto the user profile dto
*/
public void editUserProfile(UserProfileUpdateDto userProfileUpdateDto) {
restTemplate.postForObject(restTemplate.getUrl() + "userProfile",
userProfileUpdateDto, Void.class);
}

/**
* Returns a list of endpoint profiles attached to the endpoint user with
* the given external id.
*
* @param endpointUserExternalId the endpoint user external id
* @return a list of endpoint profiles for the user with the given external id
*/
public List<EndpointProfileDto> getEndpointProfilesByUserExternalId(
String endpointUserExternalId) {
String address = restTemplate.getUrl() + "endpointProfiles?userExternalId="
Expand All @@ -1110,6 +1175,7 @@ public List<EndpointProfileDto> getEndpointProfilesByUserExternalId(
new ParameterizedTypeReference<List<EndpointProfileDto>>() {});
return response.getBody();
}

/**
* Provides security credentials, allowing an endpoint that uses them to
* interact with the specified application.
Expand Down Expand Up @@ -1190,6 +1256,13 @@ public void onCredentialsRevoked(String applicationToken, String credentialsId)
this.restTemplate.postForLocation(restTemplate.getUrl() + "notifyRevoked", parameters);
}

/**
* Get user configuration of by externalUID, schema version and application token.
*
* @param appToken the application token
* @param schemaVersion the schema version
* @param externalUId the external user id
*/
public EndpointUserConfigurationDto findUserConfigurationByUserId(String externalUId,
String appToken,
Integer schemaVersion) {
Expand All @@ -1198,6 +1271,11 @@ public EndpointUserConfigurationDto findUserConfigurationByUserId(String externa
EndpointUserConfigurationDto.class, externalUId, appToken, schemaVersion);
}

/**
* Get configuration of specific endpoint by endpointKeyHash.
*
* @param endpointKeyHash the endpoint key hash
*/
public String findEndpointConfigurationByEndpointKeyHash(String endpointKeyHash) {
return restTemplate.getForObject(restTemplate.getUrl() + "configuration/{endpointKeyHash}/",
String.class, endpointKeyHash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto;
import org.kaaproject.kaa.common.dto.logs.LogSchemaDto;
import org.kaaproject.kaa.server.common.dao.ApplicationService;
import org.kaaproject.kaa.server.common.dao.CtlService;
import org.kaaproject.kaa.server.common.dao.ConfigurationService;
import org.kaaproject.kaa.server.common.dao.CtlService;
import org.kaaproject.kaa.server.common.dao.EndpointService;
import org.kaaproject.kaa.server.common.dao.LogSchemaService;
import org.kaaproject.kaa.server.common.dao.NotificationService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
import org.kaaproject.kaa.server.common.core.schema.DataSchema;
import org.kaaproject.kaa.server.common.core.schema.OverrideSchema;
import org.kaaproject.kaa.server.common.core.schema.ProtocolSchema;
import org.kaaproject.kaa.server.common.dao.CtlService;
import org.kaaproject.kaa.server.common.dao.ConfigurationService;
import org.kaaproject.kaa.server.common.dao.CtlService;
import org.kaaproject.kaa.server.common.dao.HistoryService;
import org.kaaproject.kaa.server.common.dao.exception.DatabaseProcessingException;
import org.kaaproject.kaa.server.common.dao.exception.IncorrectParameterException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import org.hibernate.LockOptions;
import org.kaaproject.kaa.common.avro.GenericAvroConverter;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.file.FileData;
import org.kaaproject.kaa.server.common.core.algorithms.generation.ConfigurationGenerationException;
import org.kaaproject.kaa.server.common.core.algorithms.generation.DefaultRecordGenerationAlgorithm;
Expand All @@ -51,8 +51,8 @@
import org.kaaproject.kaa.server.common.dao.impl.CtlSchemaDao;
import org.kaaproject.kaa.server.common.dao.impl.CtlSchemaMetaInfoDao;
import org.kaaproject.kaa.server.common.dao.impl.DaoUtil;
import org.kaaproject.kaa.server.common.dao.model.sql.CtlSchemaMetaInfo;
import org.kaaproject.kaa.server.common.dao.model.sql.CtlSchema;
import org.kaaproject.kaa.server.common.dao.model.sql.CtlSchemaMetaInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
import org.kaaproject.kaa.server.common.dao.exception.KaaOptimisticLockingFailureException;
import org.kaaproject.kaa.server.common.dao.impl.EndpointProfileDao;
import org.kaaproject.kaa.server.common.nosql.cassandra.dao.filter.CassandraEpByAccessTokenDao;
import org.kaaproject.kaa.server.common.nosql.cassandra.dao.filter.CassandraEpByAppIdDao;
import org.kaaproject.kaa.server.common.nosql.cassandra.dao.filter.CassandraEpByEndpointGroupIdDao;
import org.kaaproject.kaa.server.common.nosql.cassandra.dao.filter.CassandraEpBySdkTokenDao;
import org.kaaproject.kaa.server.common.nosql.cassandra.dao.filter.CassandraEpByAppIdDao;
import org.kaaproject.kaa.server.common.nosql.cassandra.dao.model.CassandraEndpointProfile;
import org.kaaproject.kaa.server.common.nosql.cassandra.dao.model.CassandraEndpointUser;
import org.kaaproject.kaa.server.common.nosql.cassandra.dao.model.CassandraEpByAccessToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.kaaproject.kaa.server.flume.channel;

import org.apache.flume.Channel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ protected void doSave(final EventBus eventBus) {

if (create) {
KaaAdmin.getAuthService().checkUserNameOccupied(
entity.getUsername(), null, new BusyAsyncCallback<ResultCode>() {
@Override
public void onFailureImpl(Throwable caught) {
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccessImpl(ResultCode result) {
if (result != ResultCode.OK) {
detailsView.setErrorMessage(Utils.constants.getString(result.getResourceKey()));
} else {
checkEmail();
}
}
});
entity.getUsername(), null, new BusyAsyncCallback<ResultCode>() {
@Override
public void onFailureImpl(Throwable caught) {
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccessImpl(ResultCode result) {
if (result != ResultCode.OK) {
detailsView.setErrorMessage(Utils.constants.getString(result.getResourceKey()));
} else {
checkEmail();
}
}
});
} else {
checkEmail();
}
Expand All @@ -83,21 +83,21 @@ public void onSuccessImpl(ResultCode result) {
private void checkEmail() {
final Long userId = !create ? Long.valueOf(entity.getExternalUid()) : null;
KaaAdmin.getAuthService().checkEmailOccupied(
entity.getMail(), userId, new BusyAsyncCallback<ResultCode>() {
@Override
public void onFailureImpl(Throwable caught) {
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccessImpl(ResultCode result) {
if (result != ResultCode.OK) {
detailsView.setErrorMessage(Utils.constants.getString(result.getResourceKey()));
} else {
performSave();
}
}
});
entity.getMail(), userId, new BusyAsyncCallback<ResultCode>() {
@Override
public void onFailureImpl(Throwable caught) {
Utils.handleException(caught, detailsView);
}

@Override
public void onSuccessImpl(ResultCode result) {
if (result != ResultCode.OK) {
detailsView.setErrorMessage(Utils.constants.getString(result.getResourceKey()));
} else {
performSave();
}
}
});
}

private void performSave() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import com.google.gwt.place.shared.Place;

import org.kaaproject.avro.ui.gwt.client.widget.grid.AbstractGrid;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.server.admin.client.mvp.ClientFactory;
import org.kaaproject.kaa.server.admin.client.mvp.activity.grid.AbstractDataProvider;
import org.kaaproject.kaa.server.admin.client.mvp.data.ApplicationCtlSchemasDataProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import org.kaaproject.avro.ui.gwt.client.widget.dialog.ConfirmDialog;
import org.kaaproject.avro.ui.shared.RecordField;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
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.ConfigurationSchemasPlace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.rpc.AsyncCallback;

import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.server.admin.client.mvp.ClientFactory;
import org.kaaproject.kaa.server.admin.client.mvp.activity.grid.DataFilter;
import org.kaaproject.kaa.server.admin.client.mvp.place.TreePlace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import com.google.gwt.place.shared.Place;

import org.kaaproject.avro.ui.gwt.client.widget.grid.AbstractGrid;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.server.admin.client.mvp.ClientFactory;
import org.kaaproject.kaa.server.admin.client.mvp.activity.grid.AbstractDataProvider;
import org.kaaproject.kaa.server.admin.client.mvp.data.SystemCtlSchemasDataProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import com.google.gwt.place.shared.Place;

import org.kaaproject.avro.ui.gwt.client.widget.grid.AbstractGrid;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaScopeDto;
import org.kaaproject.kaa.common.dto.ctl.CtlSchemaMetaInfoDto;
import org.kaaproject.kaa.server.admin.client.mvp.ClientFactory;
import org.kaaproject.kaa.server.admin.client.mvp.activity.grid.AbstractDataProvider;
import org.kaaproject.kaa.server.admin.client.mvp.data.TenantCtlSchemasDataProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ public void deleteConfigurationRecord(
}

/**
* Get configuration of specific endpoint user bu externalUId.
* Get user configuration of by externalUID, schema version and application token.
*
* @param appToken the application token
* @param schemaVersion the schema version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
@Controller
public class CtlController extends AbstractAdminController {

/**
* The Constant BUFFER.
*/

private static final int BUFFER = 1024 * 100;

/**
Expand Down Expand Up @@ -199,9 +197,9 @@ public CTLSchemaDto getCtlSchemaById(
}

/**
* Checks if CTL schema with same fqn is already exists in the sibling application.
* Checks if CTL schema with same fqn is already exists in the sibling applications.
*
* @param fqn the fqn
* @param fqn the full qualified name
* @param tenantId id of the tenant
* @param applicationToken the application token
* @return true if CTL schema with same fqn is already exists in other scope
Expand Down

0 comments on commit 4e11ae4

Please sign in to comment.