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

How to use
findById
method
in
org.kaaproject.kaa.server.common.dao.impl.EventClassFamilyDao

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

origin: kaaproject/kaa

@Override
public EventClassFamilyDto findEventClassFamilyById(String id) {
 validateSqlId(id, "Event class family id is incorrect. Can't find event class family by id "
          + id);
 return getDto(eventClassFamilyDao.findById(id));
}
origin: kaaproject/kaa

 @Override
 public Set<String> getFqnSetForEcf(String ecfId) {
  if (isValidSqlId(ecfId)) {
   LOG.debug("Get fqn list for event class family by id [{}] ", ecfId);
   Set<String> storedFqns = new HashSet<>();
   EventClassFamily ecf = eventClassFamilyDao.findById(ecfId);
   ecf.getSchemas().forEach(ecfv -> ecfv.getRecords()
       .forEach(ec -> storedFqns.add(ec.getFqn())));
   return storedFqns;
  } else {
   throw new IncorrectParameterException("Incorrect event class family id: " + ecfId);
  }
 }
}
origin: kaaproject/kaa

@Override
public boolean isValidEcfListInSdkProfile(List<AefMapInfoDto> aefList) {
 Set<EventClass> ecList = new HashSet<>();
 for (AefMapInfoDto aef : aefList) {
  EventClassFamily ecf = eventClassFamilyDao.findById(aef.getEcfId());
  Optional<EventClassFamilyVersion> optEcfv = ecf.getSchemas().stream()
    .filter(ecfv -> ecfv.getVersion() == aef.getVersion())
    .findFirst();
  if (optEcfv.isPresent()) {
   for (EventClass ec : optEcfv.get().getRecords()) {
    if (!ecList.add(ec)) {
     return false;
    }
   }
  }
 }
 return true;
}
origin: kaaproject/kaa

@Override
public List<EventClassFamilyVersionDto> findEventClassFamilyVersionsByEcfId(String ecfId) {
 validateSqlId(ecfId, "Event class family id is incorrect. Can't find event class family by id "
            + ecfId);
 EventClassFamily ecf = eventClassFamilyDao.findById(ecfId);
 return convertDtoList(ecf.getSchemas());
}
origin: kaaproject/kaa

@Override
public List<EventClassDto> findEventClassesByFamilyIdVersionAndType(String ecfId, int version,
                                  EventClassType type) {
 List<EventClassDto> eventClasses = new ArrayList<>();
 if (isValidSqlId(ecfId)) {
  LOG.debug("Find event classes by family id [{}] version [{}] and type [{}]",
      ecfId, version, type);
  EventClassFamily ecf = eventClassFamilyDao.findById(ecfId);
  Optional<EventClassFamilyVersion> ecfv = ecf.getSchemas().stream()
      .filter(s -> s.getVersion() == version).findFirst();
  if (type == null) {
   ecfv.ifPresent(
     e -> eventClasses.addAll(convertDtoList(e.getRecords())));
  } else {
   ecfv.ifPresent(
     e -> eventClasses.addAll(convertDtoList(e.getRecords().stream()
       .filter(ec -> ec.getType() == type)
       .collect(Collectors.toList()))));
  }
 } else {
  throw new IncorrectParameterException("Incorrect event class family id: " + ecfId);
 }
 return eventClasses;
}
origin: kaaproject/kaa

@Test
public void removeById() {
 List<EventClassFamily> eventClassFamilies = generateEventClassFamily(null, 2);
 EventClassFamily eventClassFamily = eventClassFamilies.get(0);
 EventClassFamily dto = eventClassFamilyDao.findById(eventClassFamily.getStringId());
 Assert.assertNotNull(dto);
 eventClassFamilyDao.removeById(eventClassFamily.getStringId());
 dto = eventClassFamilyDao.findById(eventClassFamily.getStringId());
 Assert.assertNull(dto);
}
origin: kaaproject/kaa

@Test
public void removeByTenantId() {
 List<EventClassFamily> eventClassFamilies = generateEventClassFamily(null, 2);
 EventClassFamily eventClassFamily = eventClassFamilies.get(0);
 EventClassFamily dto = eventClassFamilyDao.findById(eventClassFamily.getStringId());
 Assert.assertNotNull(dto);
 Assert.assertNotNull(dto.getTenant());
 eventClassFamilyDao.removeByTenantId(dto.getTenant().getStringId());
 dto = eventClassFamilyDao.findById(eventClassFamily.getStringId());
 Assert.assertNull(dto);
}
origin: kaaproject/kaa

@Test
public void findByTenantIdTest() {
 List<EventClassFamily> eventClassFamilies = generateEventClassFamily(null, 2);
 EventClassFamily dto = eventClassFamilyDao.findById(eventClassFamilies.get(0).getStringId());
 Assert.assertNotNull(dto);
 List<EventClassFamily> eventClassFamilyList = eventClassFamilyDao.findByTenantId(dto.getTenant().getStringId());
 EventClassFamily eventClassFamily = null;
 for (EventClassFamily found : eventClassFamilyList) {
  if (dto.getId().equals(found.getId())) {
   eventClassFamily = found;
  }
 }
 Assert.assertNotNull(eventClassFamily);
 Assert.assertEquals(dto, eventClassFamily);
}
origin: kaaproject/kaa

@Test
public void findByTenantIdAndNameTest() {
 List<EventClassFamily> eventClassFamilies = generateEventClassFamily(null, 2);
 EventClassFamily dto = eventClassFamilyDao.findById(eventClassFamilies.get(0).getStringId());
 Assert.assertNotNull(dto);
 EventClassFamily eventClassFamily = eventClassFamilyDao.findByTenantIdAndName(dto.getTenant().getStringId(), dto.getName());
 Assert.assertNotNull(eventClassFamily);
 Assert.assertEquals(dto, eventClassFamily);
}
org.kaaproject.kaa.server.common.dao.implEventClassFamilyDaofindById

Popular methods of EventClassFamilyDao

  • findByEcfvId
    Find EventClassFamily by ECF version id.
  • findByTenantId
    Find EventClassFamily by tenant id.
  • findByTenantIdAndName
    Find EventClassFamily by tenant id and name.
  • save
  • removeById
  • removeByTenantId
    Remove all EventClassFamily objects by tenant id.
  • validateClassName
    Validate event class family class name for uniqueness within the tenant.
  • validateName
    Validate event class family name for uniqueness within the tenant.

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • getResourceAsStream (ClassLoader)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • JFrame (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Option (scala)
  • Top 12 Jupyter Notebook extensions
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