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

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

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

origin: kaaproject/kaa

@Override
public List<CTLSchemaDto> findCtlSchemas() {
 LOG.debug("Find all ctl schemas");
 return convertDtoList(ctlSchemaDao.find());
}
origin: kaaproject/kaa

@Override
public List<CtlSchemaMetaInfoDto> findAvailableCtlSchemasMetaInfoForTenant(String tenantId) {
 LOG.debug("Find system and tenant scopes ctl schemas by tenant id {}", tenantId);
 return getMetaInfoFromCtlSchema(ctlSchemaDao.findAvailableSchemasForTenant(tenantId));
}
origin: kaaproject/kaa

@Override
public List<CTLSchemaDto> findCtlSchemaDependents(String fqn, Integer version, String tenantId,
                         String applicationId) {
 if (isBlank(fqn) || version == null) {
  throw new IncorrectParameterException("Incorrect parameters for ctl schema request.");
 }
 LOG.debug("Find dependents schemas for schema with fqn {} version {}, tenantId {} and "
      + "applicationId ()", fqn, version, tenantId, applicationId);
 List<CTLSchemaDto> schemas = Collections.emptyList();
 CtlSchema schema = ctlSchemaDao.findByFqnAndVerAndTenantIdAndApplicationId(fqn, version,
     tenantId, applicationId);
 if (schema
   != null) {
  schemas = convertDtoList(ctlSchemaDao.findDependentSchemas(schema.getStringId()));
 }
 return schemas;
}
origin: kaaproject/kaa

@Override
public List<CTLSchemaDto> findCtlSchemaDependents(String schemaId) {
 validateSqlId(schemaId, "Incorrect schema id for ctl schema request.");
 LOG.debug("Find dependents schemas for schema with id [{}]", schemaId);
 List<CTLSchemaDto> list = Collections.emptyList();
 CtlSchema schemaDto = ctlSchemaDao.findById(schemaId);
 if (schemaDto
   != null) {
  list = convertDtoList(ctlSchemaDao.findDependentSchemas(schemaDto.getStringId()));
 }
 return list;
}
origin: kaaproject/kaa

CtlSchema ctlSchema = ctlSchemaDao.findByFqnAndVerAndTenantIdAndApplicationId(fqn, version,
    tenantId, applicationId);
if (ctlSchema
  != null) {
 List<CtlSchema> dependsList = ctlSchemaDao.findDependentSchemas(ctlSchema.getStringId());
 if (dependsList.isEmpty()) {
  synchronized (this) {
   ctlSchemaMetaInfoDao.lockRequest(lockOptions).setScope(true).lock(metaInfo);
   try {
    ctlSchemaDao.removeById(ctlSchema.getStringId());
    List<CtlSchema> schemas = ctlSchemaDao.findAllByMetaInfoId(metaInfo.getStringId());
    if (schemas == null || schemas.isEmpty()) {
     ctlSchemaMetaInfoDao.removeById(metaInfo.getStringId());
origin: kaaproject/kaa

@Test(expected = Exception.class)
public void saveCTLSchemaWithSameFqnAndVersion() {
 ctlSchemaDao.save(generateCTLSchema(DEFAULT_FQN, new Tenant(tenant), 11, null));
 ctlSchemaDao.save(generateCTLSchema(DEFAULT_FQN, null, 11, null));
}
origin: kaaproject/kaa

@Override
public CTLSchemaDto findCtlSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn, Integer
    version, String tenantId, String applicationId) {
 if (isBlank(fqn) || version == null) {
  throw new IncorrectParameterException("Incorrect parameters for ctl schema request.");
 }
 LOG.debug("Find ctl schema by fqn {} version {}, tenant id {} and application id {}", fqn,
     version, tenantId, applicationId);
 return DaoUtil.getDto(ctlSchemaDao.findByFqnAndVerAndTenantIdAndApplicationId(fqn, version,
     tenantId, applicationId));
}
origin: kaaproject/kaa

@Override
public List<CTLSchemaDto> findSystemCtlSchemas() {
 LOG.debug("Find system ctl schemas");
 return convertDtoList(ctlSchemaDao.findSystemSchemas());
}
origin: kaaproject/kaa

@Override
public CTLSchemaDto updateCtlSchema(CTLSchemaDto ctlSchema) {
 validateCtlSchemaObject(ctlSchema);
 LOG.debug("Update ctl schema with id [{}]", ctlSchema.getId());
 CtlSchema schema = ctlSchemaDao.findById(ctlSchema.getId());
 if (schema != null) {
  synchronized (this) {
   if (ctlSchema.getVersion()
     != schema.getVersion()) {
    throw new DatabaseProcessingException("Can't change version of existing common type "
                       + "version.");
   }
   CtlSchemaMetaInfo metaInfo = schema.getMetaInfo();
   if (!ctlSchema.getMetaInfo().equals(metaInfo.toDto())) {
    throw new DatabaseProcessingException("Can't update scope of existing common type "
                       + "version within update procedure.");
   }
   ctlSchemaMetaInfoDao.lockRequest(lockOptions).setScope(true).lock(metaInfo);
   schema.update(ctlSchema);
   return DaoUtil.getDto(ctlSchemaDao.save(schema, true));
  }
 } else {
  throw new DatabaseProcessingException("Can't find common type version by id.");
 }
}
origin: kaaproject/kaa

@Override
public CTLSchemaDto findLatestCtlSchemaByFqnAndTenantIdAndApplicationId(String fqn, String
    tenantId, String applicationId) {
 validateString(fqn, "Incorrect fqn for ctl schema request.");
 LOG.debug("Find latest ctl schema by fqn {}, tenantId {} and applicationId {}", fqn,
     tenantId, applicationId);
 return DaoUtil.getDto(ctlSchemaDao.findLatestByFqnAndTenantIdAndApplicationId(fqn, tenantId,
     applicationId));
}
origin: kaaproject/kaa

@Test
public void saveCTLSchemaWithDependency() throws InterruptedException {
 List<CTLSchemaDto> dep = convertDtoList(ctlSchemaDao.findDependentSchemas(mainSchema.getId()));
 Assert.assertTrue(dep.isEmpty());
 List<CTLSchemaDto> expected = Arrays.asList(mainSchema);
 dep = convertDtoList(ctlSchemaDao.findDependentSchemas(firstSchema.getId()));
 Assert.assertEquals(expected.size(), dep.size());
 dep = convertDtoList(ctlSchemaDao.findDependentSchemas(secondSchema.getId()));
 Assert.assertEquals(expected.size(), dep.size());
 dep = convertDtoList(ctlSchemaDao.findDependentSchemas(thirdSchema.getId()));
 Assert.assertEquals(expected.size(), dep.size());
 dep = convertDtoList(ctlSchemaDao.findDependentSchemas(fourthSchema.getId()));
 Assert.assertEquals(expected.size(), dep.size());
}
origin: kaaproject/kaa

@Override
public CTLSchemaDto findAnyCtlSchemaByFqnAndVerAndTenantIdAndApplicationId(String fqn,
                                      Integer version,
                                      String tenantId,
                                      String applicationId) {
 if (isBlank(fqn) || version == null) {
  throw new IncorrectParameterException("Incorrect parameters for ctl schema request.");
 }
 LOG.debug("Find any ctl schema by fqn {} version {}, tenant id {} and application id {}",
     fqn, version, tenantId, applicationId);
 return DaoUtil.getDto(ctlSchemaDao.findAnyByFqnAndVerAndTenantIdAndApplicationId(fqn,
     version, tenantId, applicationId));
}
origin: kaaproject/kaa

@Override
public List<CTLSchemaDto> findAllCtlSchemasByFqnAndTenantIdAndApplicationId(String fqn, String
    tenantId, String applicationId) {
 validateString(fqn, "Incorrect fqn for ctl schema request.");
 LOG.debug("Find all ctl schemas by fqn {}, tenantId {} and applicationId {}", fqn, tenantId,
     applicationId);
 return convertDtoList(ctlSchemaDao.findAllByFqnAndTenantIdAndApplicationId(fqn, tenantId,
     applicationId));
}
origin: kaaproject/kaa

protected CtlSchema generateCTLSchema(String fqn, int version, Tenant tenant, CTLSchemaScopeDto scope) {
 if (scope == null) {
  if (tenant == null) {
   scope = CTLSchemaScopeDto.SYSTEM;
  } else {
   scope = CTLSchemaScopeDto.TENANT;
  }
 }
 CtlSchemaMetaInfo metaInfo = new CtlSchemaMetaInfo();
 metaInfo.setFqn(fqn);
 metaInfo.setTenant(tenant);
 metaInfo = ctlSchemaMetaInfoDao.save(metaInfo);
 CtlSchema ctlSchema = new CtlSchema();
 ctlSchema.setMetaInfo(metaInfo);
 ctlSchema.setVersion(version);
 ctlSchema.setBody(UUID.randomUUID().toString());
 ctlSchema.setDependencySet(new HashSet<CtlSchema>());
 ctlSchema = ctlSchemaDao.save(ctlSchema);
 return ctlSchema;
}
origin: kaaproject/kaa

@Test
public void testFindSystemByFqnAndVerAndTenantIdAndApplicationId() {
 CtlSchema found = ctlSchemaDao.findByFqnAndVerAndTenantIdAndApplicationId(systemSchema.getMetaInfo().getFqn(),
   systemSchema.getVersion(), null, null);
 Assert.assertEquals(systemSchema, found.toDto());
}
origin: kaaproject/kaa

@Override
public List<CtlSchemaMetaInfoDto> findSystemCtlSchemasMetaInfo() {
 LOG.debug("Find system ctl schemas");
 return getMetaInfoFromCtlSchema(ctlSchemaDao.findSystemSchemas());
}
origin: kaaproject/kaa

@Test
public void testFindLatestByFqn() {
 CtlSchema latest = ctlSchemaDao.findLatestByFqnAndTenantIdAndApplicationId(SYSTEM_FQN, null, null);
 Assert.assertEquals(systemSchema, latest.toDto());
}
origin: kaaproject/kaa

ctlSchemaMetaInfoDao.refresh(uniqueMetaInfo);
try {
 dto = getDto(ctlSchemaDao.save(ctlSchema, true));
} catch (DataIntegrityViolationException ex) {
 throw new DatabaseProcessingException("Can't save common type: such FQN and version "
origin: kaaproject/kaa

@Test
public void testFindByFqnAndVerAndTenantIdAndApplicationId() {
 CtlSchema found = ctlSchemaDao.findByFqnAndVerAndTenantIdAndApplicationId(firstSchema.getMetaInfo().getFqn(),
   firstSchema.getVersion(),
   firstSchema.getMetaInfo().getTenantId(),
   firstSchema.getMetaInfo().getApplicationId());
 Assert.assertEquals(firstSchema, found.toDto());
}
origin: kaaproject/kaa

@Test
public void testFindSystemSchemas() {
 List<CtlSchema> found = ctlSchemaDao.findSystemSchemas();
 Assert.assertEquals(getIdsDto(Arrays.asList(systemSchema)), getIds(found));
}
org.kaaproject.kaa.server.common.dao.implCtlSchemaDao

Javadoc

The interface CTL schema dao.

Most used methods

  • find
  • findAvailableSchemasForTenant
    Find available for tenant(include system scope) CTL schemas by given tenant identifier.
  • findByFqnAndVerAndTenantIdAndApplicationId
    Find CTL schema with the given fully qualified name, version, tenant and application identifiers.
  • findDependentSchemas
    Find dependents CTL schemas from the schema with the given schema identifier.
  • findLatestByFqnAndTenantIdAndApplicationId
    Find the last version of CTL schema with the given fully qualified name, tenant and application iden
  • findSystemSchemas
    Find CTL schemas available in the database.
  • save
  • findAllByFqnAndTenantIdAndApplicationId
    Find all available versions of CTL schema with the given fully qualified name, tenant and applicatio
  • findAllByMetaInfoId
    Find all available versions of CTL schema with the given meta info id.
  • findAnyByFqnAndVerAndTenantIdAndApplicationId
    Find any CTL schema with the given fully qualified name, version, tenant and application identifiers
  • findAvailableSchemasForApplication
    Find available for application(include system and tenant scope) CTL schemas by given tenant and appl
  • findById
  • findAvailableSchemasForApplication,
  • findById,
  • findByMetaInfoIdAndVer,
  • findLatestByMetaInfoId,
  • removeById

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • JTextField (javax.swing)
  • Github Copilot alternatives
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