Tabnine Logo
ProfileSchemaDao
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: kaaproject/kaa

@Override
public EndpointProfileSchemaDto findProfileSchemaByAppIdAndVersion(
    String appId, int schemaVersion) {
 validateId(appId, "Can't find profile schema. Invalid application id: " + appId);
 return getDto(profileSchemaDao.findByAppIdAndVersion(appId, schemaVersion));
}
origin: kaaproject/kaa

@Override
public List<VersionDto> findProfileSchemaVersionsByAppId(String applicationId) {
 validateSqlId(applicationId, "Can't find profile schemas. Invalid application id: "
                + applicationId);
 List<EndpointProfileSchema> endpointProfileSchemas =
     profileSchemaDao.findByApplicationId(applicationId);
 List<VersionDto> schemas = new ArrayList<>();
 for (EndpointProfileSchema endpointProfileSchema : endpointProfileSchemas) {
  schemas.add(endpointProfileSchema.toVersionDto());
 }
 return schemas;
}
origin: kaaproject/kaa

@Override
public EndpointProfileSchemaDto findProfileSchemaById(String id) {
 validateSqlId(id, "Can't find profile schema. Invalid profile schema id: " + id);
 return getDto(profileSchemaDao.findById(id));
}
origin: kaaproject/kaa

 String id = profileSchemaDto.getId();
 if (StringUtils.isBlank(id)) {
  EndpointProfileSchema endpointProfileSchema = profileSchemaDao.findLatestByAppId(appId);
  int version = -1;
  if (endpointProfileSchema != null) {
  profileSchemaDto.setCreatedTime(System.currentTimeMillis());
 } else {
  EndpointProfileSchemaDto oldProfileSchemaDto = getDto(profileSchemaDao.findById(id));
  if (oldProfileSchemaDto != null) {
   oldProfileSchemaDto.editFields(profileSchemaDto);
   profileSchemaDto = oldProfileSchemaDto;
   return getDto(profileSchemaDao.save(new EndpointProfileSchema(profileSchemaDto)));
  } else {
   LOG.error("Can't find profile schema with given id [{}].", id);
 return getDto(profileSchemaDao.save(new EndpointProfileSchema(profileSchemaDto)));
} else {
 throw new IncorrectParameterException("Invalid profile schema object. "
origin: kaaproject/kaa

@Test
public void findLatestByAppId() {
 List<EndpointProfileSchema> schemas = generateProfSchema(null, 4);
 Assert.assertEquals(4, schemas.size());
 EndpointProfileSchema schema = schemas.get(0);
 Application app = schema.getApplication();
 EndpointProfileSchema found = profileSchemaDao.findLatestByAppId(app.getId().toString());
 Assert.assertNotNull(found);
 Assert.assertEquals(4, found.getVersion());
}
origin: kaaproject/kaa

protected List<EndpointProfileSchema> generateProfSchema(Application app, int count) {
 List<EndpointProfileSchema> schemas = Collections.emptyList();
 try {
  if (app == null) {
   app = generateApplication(null);
  }
  CtlSchema ctlSchema = generateCTLSchema(DEFAULT_FQN, 1, app.getTenant(), null);
  EndpointProfileSchema schemaDto;
  schemas = new ArrayList<>(count);
  for (int i = 0; i < count; i++) {
   schemaDto = new EndpointProfileSchema();
   schemaDto.setApplication(app);
   schemaDto.setCreatedUsername("Test User");
   schemaDto.setCtlSchema(ctlSchema);
   schemaDto.setVersion(i + 1);
   schemaDto.setName("Test Name");
   schemaDto = profileSchemaDao.save(schemaDto);
   Assert.assertNotNull(schemaDto);
   schemas.add(schemaDto);
  }
 } catch (Exception e) {
  LOG.error("Can't generate profile schema {}", e);
  Assert.fail("Can't generate profile schema." + e.getMessage());
 }
 return schemas;
}
origin: kaaproject/kaa

@Override
public void removeProfileSchemaById(String id) {
 validateSqlId(id, "Can't remove profile schema. Invalid profile schema id: " + id);
 profileSchemaDao.removeById(id);
 LOG.debug("Removed profile schema [{}] with filters.", id);
}
origin: kaaproject/kaa

@Override
public void removeProfileSchemasByAppId(String applicationId) {
 validateSqlId(applicationId, "Can't remove profile schema. Invalid application id: "
                + applicationId);
 List<EndpointProfileSchema> schemas = profileSchemaDao.findByApplicationId(applicationId);
 if (schemas != null && !schemas.isEmpty()) {
  LOG.debug("Remove profile shemas by application id {}", applicationId);
  for (EndpointProfileSchema schema : schemas) {
   removeProfileSchemaById(schema.getId().toString());
  }
 }
}
origin: kaaproject/kaa

@Test
public void findByAppIdAndVersion() {
 List<EndpointProfileSchema> schemas = generateProfSchema(null, 4);
 Assert.assertEquals(4, schemas.size());
 EndpointProfileSchema schema = schemas.get(2);
 Application app = schema.getApplication();
 EndpointProfileSchema found = profileSchemaDao.findByAppIdAndVersion(app.getId().toString(), schema.getVersion());
 Assert.assertNotNull(found);
 Assert.assertEquals(3, found.getVersion());
}
origin: kaaproject/kaa

@Override
public List<EndpointProfileSchemaDto> findProfileSchemasByAppId(String applicationId) {
 validateSqlId(applicationId, "Can't find profile schema. Invalid application id: "
                + applicationId);
 return convertDtoList(profileSchemaDao.findByApplicationId(applicationId));
}
origin: kaaproject/kaa

@Test
public void findByApplicationId() {
 List<EndpointProfileSchema> schemas = generateProfSchema(null, 3);
 Assert.assertEquals(3, schemas.size());
 EndpointProfileSchema schema = schemas.get(0);
 Application app = schema.getApplication();
 List<EndpointProfileSchema> found = profileSchemaDao.findByApplicationId(app.getId().toString());
 Assert.assertEquals(3, found.size());
 Assert.assertEquals(schemas, found);
}
org.kaaproject.kaa.server.common.dao.implProfileSchemaDao

Javadoc

The interface Profile schema dao.

Most used methods

  • findByAppIdAndVersion
    Find profile schema by application id and version.
  • findByApplicationId
    Find profile schemas by application id.
  • findLatestByAppId
    Find latest profile schema by application id.
  • save
  • findById
  • removeById

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • getContentResolver (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Top plugins for WebStorm
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