congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
EndpointUserConfigurationDao
Code IndexAdd Tabnine to your IDE (free)

How to use
EndpointUserConfigurationDao
in
org.kaaproject.kaa.server.common.dao.impl

Best Java code snippets using org.kaaproject.kaa.server.common.dao.impl.EndpointUserConfigurationDao (Showing top 8 results out of 315)

origin: kaaproject/kaa

@Override
public List<EndpointUserConfigurationDto> findUserConfigurationByUserId(String userId) {
 return convertDtoList(endpointUserConfigurationDao.findByUserId(userId));
}
origin: kaaproject/kaa

@Override
public EndpointUserConfigurationDto findUserConfigurationByUserIdAndAppTokenAndSchemaVersion(
    String userId, String appToken, Integer schemaVersion) {
 return getDto(endpointUserConfigurationDao.findByUserIdAndAppTokenAndSchemaVersion(
     userId, appToken, schemaVersion));
}
origin: kaaproject/kaa

@Override
public void removeByUserIdAndAppTokenAndSchemaVersion(String userId, String appToken,
                           Integer schemaVersion) {
 endpointUserConfigurationDao.removeByUserIdAndAppTokenAndSchemaVersion(userId, appToken,
     schemaVersion);
}
origin: kaaproject/kaa

@Test
public void removeByUserIdAndAppTokenAndSchemaVersionTest() throws IOException {
 EndpointUserDto userDto = generateEndpointUserDto(null);
 ApplicationDto appDto = generateApplicationDto();
 ConfigurationSchemaDto configurationSchemaDto = generateConfSchemaDto(null, appDto.getId(), 1).get(0);
 generateEndpointUserConfigurationDto(userDto, appDto, configurationSchemaDto, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON));
 generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON));
 generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON));
 endpointUserConfigurationDao.removeByUserIdAndAppTokenAndSchemaVersion(userDto.getId(), appDto.getApplicationToken(), configurationSchemaDto.getVersion());
 MongoEndpointUserConfiguration removed = endpointUserConfigurationDao.findByUserIdAndAppTokenAndSchemaVersion(userDto.getId(), appDto.getApplicationToken(), configurationSchemaDto.getVersion());
 Assert.assertNull(removed);
 List<MongoEndpointUserConfiguration> foundList = endpointUserConfigurationDao.findByUserId(userDto.getId());
 Assert.assertEquals(2, foundList.size());
}
origin: kaaproject/kaa

@Override
public EndpointUserConfigurationDto saveUserConfiguration(EndpointUserConfigurationDto userConfig) {
 EndpointUserConfigurationDto userConfigurationDto = null;
 if (userConfig != null) {
  String userConfigBody = userConfig.getBody();
  if (isNotBlank(userConfigBody)) {
   String appToken = userConfig.getAppToken();
   ApplicationDto applicationDto = applicationService.findAppByApplicationToken(appToken);
   if (applicationDto != null) {
    int schemaVersion = userConfig.getSchemaVersion();
    userConfig.setBody(configurationService.normalizeAccordingToOverrideConfigurationSchema(applicationDto.getId(), schemaVersion, userConfigBody));
    userConfigurationDto = getDto(endpointUserConfigurationDao.save(userConfig));
   } else {
    LOG.warn("Can't find application with token {} for endpoint user configuration.", appToken);
    throw new IncorrectParameterException("Can't find application for specified token.");
   }
  } else {
   LOG.warn("Invalid endpoint user configuration. Configuration body is empty");
   throw new IncorrectParameterException("Configuration body is empty.");
  }
 }
 return userConfigurationDto;
}
origin: kaaproject/kaa

@Override
public EndpointUserConfigurationDto findUserConfigurationByExternalUIdAndAppTokenAndSchemaVersion(
  String externalUid,
  String appToken,
  Integer schemaVersion,
  String tenantId) {
 if (isNotBlank(externalUid)) {
  EndpointUser endpointUser = endpointUserDao.findByExternalIdAndTenantId(
      externalUid, tenantId);
  if (endpointUser != null) {
   return getDto(endpointUserConfigurationDao.findByUserIdAndAppTokenAndSchemaVersion(
     endpointUser.getId(),
     appToken,
     schemaVersion));
  } else {
   LOG.warn("Could not find endpoint user by externalUid:", externalUid);
   throw new IncorrectParameterException("Could not find endpoint user by externalUid");
  }
 } else {
  LOG.warn("external user id could not be null!");
  throw new IncorrectParameterException("externalUid could not be null!");
 }
}
origin: kaaproject/kaa

 @Test
 @Ignore("invalid")
 public void findByUserIdTest() throws IOException {
  EndpointUserDto userDto = generateEndpointUserDto(null);
  ApplicationDto appDto = generateApplicationDto();
  EndpointUserConfigurationDto firstUserConfigurationDto = generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON));
  EndpointUserConfigurationDto secondUserConfigurationDto = generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON));
  List<MongoEndpointUserConfiguration> expectedList = new ArrayList<>();
  expectedList.add(new MongoEndpointUserConfiguration(firstUserConfigurationDto));
  expectedList.add(new MongoEndpointUserConfiguration(secondUserConfigurationDto));
  generateEndpointUserConfigurationDto(null, null, null);
  List<MongoEndpointUserConfiguration> foundList = endpointUserConfigurationDao.findByUserId(userDto.getId());
  Assert.assertEquals(expectedList.size(), foundList.size());
  Assert.assertEquals(expectedList, foundList);
 }
}
origin: kaaproject/kaa

@Test
public void findByUserIdAndAppTokenAndSchemaVersionTest() throws IOException {
 EndpointUserDto userDto = generateEndpointUserDto(null);
 ApplicationDto appDto = generateApplicationDto();
 ConfigurationSchemaDto schema = generateConfSchemaDto(null, appDto.getId(), 1).get(0);
 EndpointUserConfigurationDto firstUserConfigurationDto = generateEndpointUserConfigurationDto(userDto, appDto, schema, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON));
 generateEndpointUserConfigurationDto(userDto, appDto, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON));
 generateEndpointUserConfigurationDto(null, null, null, readSchemaFileAsString(OVERRIDE_USER_DATA_JSON));
 MongoEndpointUserConfiguration found = endpointUserConfigurationDao.findByUserIdAndAppTokenAndSchemaVersion(userDto.getId(), appDto.getApplicationToken(), schema.getVersion());
 Assert.assertEquals(firstUserConfigurationDto, found.toDto());
}
org.kaaproject.kaa.server.common.dao.implEndpointUserConfigurationDao

Javadoc

Provides CRUD methods for EndpointUserConfiguration.

Most used methods

  • findByUserId
    Find user configuration by user id.
  • findByUserIdAndAppTokenAndSchemaVersion
    Find endpoint user configuration by user id application token and schema version.
  • removeByUserIdAndAppTokenAndSchemaVersion
    Remove endpoint user configuration by user id application token and schema version.
  • save
    Find endpoint user configuration by key hash.

Popular in Java

  • Running tasks concurrently on multiple threads
  • setScale (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • setRequestProperty (URLConnection)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now