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

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

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

origin: kaaproject/kaa

@Override
public List<ApplicationEventFamilyMapDto> findApplicationEventFamilyMapsByIds(List<String> ids) {
 LOG.debug("Find application event family maps by ids [{}]", ids);
 List<ApplicationEventFamilyMapDto> eventFamilies = Collections.emptyList();
 if (ids != null && !ids.isEmpty()) {
  eventFamilies = convertDtoList(applicationEventFamilyMapDao.findByIds(ids));
 }
 return eventFamilies;
}
origin: kaaproject/kaa

@Override
public ApplicationDto findAppByApplicationToken(String applicationToken) {
 ApplicationDto applicationDto = null;
 if (isNotBlank(applicationToken)) {
  applicationDto = getDto(applicationDao.findByApplicationToken(applicationToken));
 }
 return applicationDto;
}
origin: kaaproject/kaa

public void setUserConfigurationHash(byte[] userConfigurationHash) {
 this.userConfigurationHash = getArrayCopy(userConfigurationHash);
}
origin: kaaproject/kaa

@Override
public ChangeConfigurationNotification deleteConfigurationRecord(
    String schemaId, String groupId, String deactivatedUsername) {
 ChangeConfigurationNotification configurationNotification = null;
 validateSqlId(schemaId, "Incorrect configuration schema id " + schemaId + ".");
 validateSqlId(groupId, "Incorrect group id " + groupId + ".");
 ConfigurationDto configurationDto = getDto(configurationDao.deactivateOldConfiguration(
     schemaId, groupId, deactivatedUsername));
 if (configurationDto != null) {
  HistoryDto historyDto = addHistory(configurationDto, ChangeType.REMOVE_CONF);
  ChangeNotificationDto changeNotificationDto = createNotification(
      configurationDto, historyDto);
  configurationNotification = new ChangeConfigurationNotification();
  configurationNotification.setConfigurationDto(configurationDto);
  configurationNotification.setChangeNotificationDto(changeNotificationDto);
 }
 Configuration configuration = configurationDao.findInactiveBySchemaIdAndGroupId(
     schemaId, groupId);
 if (configuration != null) {
  configurationDao.removeById(idToString(configuration));
 }
 return configurationNotification;
}
origin: kaaproject/kaa

@Override
public void removeConfSchemasByAppId(String appId) {
 validateSqlId(appId, "Incorrect application id " + appId
            + ". Can't remove configuration schema.");
 LOG.debug("Removing configuration schemas and correspond configuration by application id");
 List<ConfigurationSchema> configurationSchemaList =
     configurationSchemaDao.findByApplicationId(appId);
 for (ConfigurationSchema configurationSchema : configurationSchemaList) {
  if (configurationSchema != null) {
   removeCascadeConfigurationSchema(idToString(configurationSchema));
  }
 }
}
origin: kaaproject/kaa

@Override
public CTLSchemaDto getOrCreateEmptySystemSchema(String createdUsername) {
 CTLSchemaDto ctlSchema = findCtlSchemaByFqnAndVerAndTenantIdAndApplicationId(
     DEFAULT_SYSTEM_EMPTY_SCHEMA_FQN, DEFAULT_SYSTEM_EMPTY_SCHEMA_VERSION, null, null);
 if (ctlSchema == null) {
  ctlSchema = new CTLSchemaDto();
  CtlSchemaMetaInfoDto metaInfo = new CtlSchemaMetaInfoDto(DEFAULT_SYSTEM_EMPTY_SCHEMA_FQN);
  ctlSchema.setMetaInfo(metaInfo);
  ctlSchema.setVersion(DEFAULT_SYSTEM_EMPTY_SCHEMA_VERSION);
  ctlSchema.setCreatedUsername(createdUsername);
  ctlSchema.setDependencySet(new HashSet<CTLSchemaDto>());
  String body = getStringFromFile(DEFAULT_SYSTEM_EMPTY_SCHEMA_FILE, CtlServiceImpl.class);
  if (!body.isEmpty()) {
   ctlSchema.setBody(body);
  } else {
   throw new RuntimeException("Can't read default system schema."); // NOSONAR
  }
  ctlSchema = saveCtlSchema(ctlSchema);
 }
 return ctlSchema;
}
origin: kaaproject/kaa

@Override
public CTLSchemaDto toDto() {
 CTLSchemaDto ctlSchemaDto = createDto();
 ctlSchemaDto.setId(getStringId());
 ctlSchemaDto.setMetaInfo(metaInfo.toDto());
 ctlSchemaDto.setVersion(version);
 ctlSchemaDto.setCreatedTime(createdTime);
 ctlSchemaDto.setCreatedUsername(createdUsername);
 ctlSchemaDto.setBody(body);
 ctlSchemaDto.setDefaultRecord(defaultRecord);
 ctlSchemaDto.setDependencySet(DaoUtil.convertDtoSet(dependencySet));
 return ctlSchemaDto;
}
origin: kaaproject/kaa

      schemaId, groupId);
  if (oldInactiveConfiguration != null) {
   configurationDto.setId(idToString(oldInactiveConfiguration.getId()));
   configurationDto.setSequenceNumber(oldInactiveConfiguration.getSequenceNumber());
  } else if (oldActiveConfiguration != null) {
return getDto(configurationDao.save(new Configuration(configurationDto)));
origin: kaaproject/kaa

@Override
public ConfigurationSchemaDto saveConfSchema(ConfigurationSchemaDto configurationSchema) {
 ConfigurationSchemaDto savedConfigSchema = null;
 if (configurationSchema != null) {
  String appId = configurationSchema.getApplicationId();
  if (isValidId(appId)) {
   LOG.debug("Finding default endpoint group for application id [{}]", appId);
   EndpointGroup endpointGroup = endpointGroupDao.findByAppIdAndWeight(appId, 0);
   if (endpointGroup != null) {
    savedConfigSchema = saveConfSchema(configurationSchema, idToString(endpointGroup));
   } else {
    LOG.warn("Can't find default group for application [{}]", appId);
   }
  } else {
   LOG.warn("Can't find endpoint group. Invalid application id [{}]", appId);
  }
 } else {
  LOG.warn("Configuration schema object is null");
 }
 return savedConfigSchema;
}
origin: kaaproject/kaa

@Override
public List<UserVerifierDto> findUserVerifiersByAppId(String appId) {
 LOG.debug("Find user verifiers by application id [{}]", appId);
 return convertDtoList(userVerifierDao.findByAppId(appId));
}
origin: kaaproject/kaa

@Override
public LogAppenderDto findLogAppenderById(String id) {
 LOG.debug("Find log appender by id  [{}]", id);
 return getDto(logAppenderDao.findById(id));
}
origin: kaaproject/kaa

public void setEndpointKeyHash(byte[] endpointKeyHash) {
 this.endpointKeyHash = getArrayCopy(endpointKeyHash);
}
origin: kaaproject/kaa

@Override
public List<VersionDto> findVacantSchemasByEndpointGroupId(String endpointGroupId) {
 validateId(endpointGroupId, "Can't find vacant schemas. Invalid endpoint group id: "
               + endpointGroupId);
 EndpointGroup group = endpointGroupDao.findById(endpointGroupId);
 List<Configuration> configurations = configurationDao.findActualByEndpointGroupId(
     endpointGroupId);
 List<String> usedSchemaIds = new ArrayList<>();
 for (Configuration configuration : configurations) {
  ConfigurationSchema schema = configuration.getConfigurationSchema();
  if (schema != null) {
   usedSchemaIds.add(idToString(schema.getId()));
  }
 }
 List<ConfigurationSchema> schemas = configurationSchemaDao.findVacantSchemas(
     group.getApplicationId(), usedSchemaIds);
 List<VersionDto> schemaDtoList = new ArrayList<>();
 for (ConfigurationSchema schema : schemas) {
  schemaDtoList.add(schema.toVersionDto());
 }
 return schemaDtoList;
}
origin: kaaproject/kaa

@Override
public List<LogAppenderDto> findAllAppendersByAppId(String appId) {
 LOG.debug("Find vacant log appenders by application id [{}]", appId);
 return convertDtoList(logAppenderDao.findByAppId(appId));
}
origin: kaaproject/kaa

@Override
public UserVerifierDto findUserVerifiersByAppIdAndVerifierToken(
    String appId, String verifierToken) {
 LOG.debug("Find user verifier by application id [{}] and verifier token [{}]",
     appId, verifierToken);
 return getDto(userVerifierDao.findByAppIdAndVerifierToken(appId, verifierToken));
}
origin: kaaproject/kaa

public void setTopicHash(byte[] topicHash) {
 this.topicHash = getArrayCopy(topicHash);
}
origin: kaaproject/kaa

private ChangeNotificationDto createNotification(ConfigurationDto configurationDto,
                         HistoryDto historyDto) {
 LOG.debug("Create notification after configuration update.");
 ChangeNotificationDto changeNotificationDto = null;
 if (historyDto != null) {
  changeNotificationDto = new ChangeNotificationDto();
  changeNotificationDto.setAppId(configurationDto.getApplicationId());
  changeNotificationDto.setAppSeqNumber(historyDto.getSequenceNumber());
  String endpointGroupId = configurationDto.getEndpointGroupId();
  if (isValidId(endpointGroupId)) {
   EndpointGroup group = endpointGroupDao.findById(endpointGroupId);
   if (group != null) {
    changeNotificationDto.setGroupId(idToString(group));
    changeNotificationDto.setGroupSeqNumber(group.getSequenceNumber());
   } else {
    LOG.debug("Can't find endpoint group by id [{}].", endpointGroupId);
   }
  } else {
   LOG.debug("Incorrect endpoint group id [{}].", endpointGroupId);
  }
 } else {
  LOG.debug("Can't save history information.");
 }
 return changeNotificationDto;
}
origin: kaaproject/kaa

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

@Override
public NotificationDto findNotificationById(String id) {
 NotificationDto dto = null;
 LOG.debug("Find notification by id [{}] ", id);
 if (StringUtils.isNotBlank(id)) {
  dto = getDto(notificationDao.findById(id));
 }
 LOG.trace("Found notification object {} by id [{}] ", dto, id);
 return dto;
}
origin: kaaproject/kaa

public void setProfileHash(byte[] profileHash) {
 this.profileHash = getArrayCopy(profileHash);
}
org.kaaproject.kaa.server.common.dao.implDaoUtil

Javadoc

The Class DaoUtil.

Most used methods

  • convertDtoList
    This method convert list of model objects to dto objects.
  • getDto
    This method convert model object to dto object.
  • convertDtoSet
    This method convert list of model objects to dto objects.
  • getArrayCopy
    This method use for coping array bytes.
  • getStringFromFile
    This method find file by name in context and convert input of file to string.
  • idToString
    This method take string id from GenericModel object.

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Permission (java.security)
    Legacy security code; do not use.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top plugins for Android Studio
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