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

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

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

origin: kaaproject/kaa

@Override
public Optional<EndpointRegistrationDto> findEndpointRegistrationByCredentialsId(
    String credentialsId)
  throws EndpointRegistrationServiceException {
 try {
  Validate.notBlank(credentialsId, "Invalid credentials ID provided!");
  return this.endpointRegistrationDao.findByCredentialsId(credentialsId).map(
      EndpointRegistration::toDto);
 } catch (Exception cause) {
  LOG.error("An unexpected exception occured while searching for endpoint registration!",
      cause);
  throw new EndpointRegistrationServiceException(cause);
 }
}
origin: kaaproject/kaa

@Override
public Optional<EndpointRegistrationDto> findEndpointRegistrationByEndpointId(String endpointId)
  throws EndpointRegistrationServiceException {
 try {
  Validate.notBlank(endpointId, "Invalid endpoint ID provided!");
  return this.endpointRegistrationDao.findByEndpointId(endpointId)
      .map(EndpointRegistration::toDto);
 } catch (Exception cause) {
  LOG.error("An unexpected exception occured while searching for endpoint registration!",
      cause);
  throw new EndpointRegistrationServiceException(cause);
 }
}
origin: kaaproject/kaa

@Override
public void removeEndpointRegistrationByEndpointId(String endpointId)
    throws EndpointRegistrationServiceException {
 try {
  Validate.notBlank(endpointId, "Invalid endpoint ID provided!");
  this.endpointRegistrationDao.removeByEndpointId(endpointId);
 } catch (Exception cause) {
  LOG.error("An unexpected exception occured while removing endpoint registration!", cause);
  throw new EndpointRegistrationServiceException(cause);
 }
}
origin: kaaproject/kaa

 @Test
 public void testRemoveByEndpointId() throws Exception {
  EndpointRegistrationDto endpointRegistrationDto = this.generateEndpointRegistration(APPLICATION_ID, ENDPOINT_ID, CREDENTIALS_ID, null, null);
  Assert.assertNotNull(endpointRegistrationDto);
  Assert.assertNotNull(endpointRegistrationDto.getId());
  this.endpointRegistrationDao.removeByEndpointId(ENDPOINT_ID);
  Assert.assertNull(this.endpointRegistrationDao.findByEndpointId(ENDPOINT_ID).orElse(null));
 }
}
origin: kaaproject/kaa

@Override
public EndpointRegistrationDto saveEndpointRegistration(
    EndpointRegistrationDto endpointRegistration)
  throws EndpointRegistrationServiceException {
 try {
  Validate.notNull(endpointRegistration, "Invalid endpoint registration provided!");
  String credentialsId = endpointRegistration.getCredentialsId();
  Optional<EndpointRegistrationDto> oldRegistration =
      findEndpointRegistrationByCredentialsId(credentialsId);
  if (oldRegistration.isPresent()) {
   EndpointRegistrationDto oldRegistrationDto = oldRegistration.get();
   if (oldRegistrationDto.getEndpointId() != null
     && !oldRegistrationDto.getEndpointId().equals(endpointRegistration.getEndpointId())) {
    throw new IllegalStateException("The endpoint registration with such credentials "
                    + "already exists!");
   }
  }
  return this.endpointRegistrationDao.save(endpointRegistration).toDto();
 } catch (Exception cause) {
  LOG.error("An unexpected exception occured while saving endpoint registration!", cause);
  throw new EndpointRegistrationServiceException(cause);
 }
}
origin: kaaproject/kaa

 @Override
 public void removeEndpointRegistrationById(String registrationId)
     throws EndpointRegistrationServiceException {
  try {
   Validate.notBlank(registrationId, "Invalid registration ID provided!");
   this.endpointRegistrationDao.removeById(registrationId);
  } catch (Exception cause) {
   LOG.error("An unexpected exception occured while removing endpoint registration!", cause);
   throw new EndpointRegistrationServiceException(cause);
  }
 }
}
origin: kaaproject/kaa

 @Test
 public void testRemoveByEndpointId() throws Exception {
  EndpointRegistrationDto endpointRegistrationDto = this.generateEndpointRegistration(APPLICATION_ID, ENDPOINT_ID, CREDENTIALS_ID);
  Assert.assertNotNull(endpointRegistrationDto);
  Assert.assertNotNull(endpointRegistrationDto.getId());
  this.endpointRegistrationDao.removeByEndpointId(ENDPOINT_ID);
  Assert.assertNull(this.endpointRegistrationDao.findByEndpointId(ENDPOINT_ID).orElse(null));
 }
}
origin: kaaproject/kaa

/**
 * Constructs an endpoint registration with the information provided and
 * saves it to the database.
 *
 * @param applicationId The application ID
 * @param endpointId    The endpoint ID
 * @param credentialsId The credentials ID
 * @return The endpoint registration saved
 */
protected EndpointRegistrationDto generateEndpointRegistration(String applicationId, String endpointId, String credentialsId) {
 EndpointRegistrationDto endpointRegistration = new EndpointRegistrationDto(applicationId, endpointId, credentialsId, null, null);
 return this.endpointRegistrationDao.save(endpointRegistration).toDto();
}
origin: kaaproject/kaa

@Test
public void testFindByCredentialsId() throws Exception {
 EndpointRegistrationDto endpointRegistrationDto = this.generateEndpointRegistration(APPLICATION_ID, ENDPOINT_ID, CREDENTIALS_ID, null, null);
 Assert.assertNotNull(endpointRegistrationDto);
 Assert.assertNotNull(endpointRegistrationDto.getId());
 EndpointRegistration endpointRegistration = this.endpointRegistrationDao.findByCredentialsId(CREDENTIALS_ID).orElse(null);
 Assert.assertNotNull(endpointRegistration);
 Assert.assertEquals(endpointRegistrationDto, endpointRegistration.toDto());
}
origin: kaaproject/kaa

@Test
public void testFindByEndpointId() throws Exception {
 EndpointRegistrationDto endpointRegistrationDto = this.generateEndpointRegistration(APPLICATION_ID, ENDPOINT_ID, CREDENTIALS_ID);
 Assert.assertNotNull(endpointRegistrationDto);
 Assert.assertNotNull(endpointRegistrationDto.getId());
 EndpointRegistration endpointRegistration = this.endpointRegistrationDao.findByEndpointId(ENDPOINT_ID).orElse(null);
 Assert.assertNotNull(endpointRegistration);
 Assert.assertEquals(endpointRegistrationDto, endpointRegistration.toDto());
}
origin: kaaproject/kaa

protected EndpointRegistrationDto generateEndpointRegistration(
  String applicationId,
  String endpointId,
  String credentialsId,
  Integer serverProfileVersion,
  String serverProfileBody) {
 EndpointRegistrationDto endpointRegistration = new EndpointRegistrationDto();
 endpointRegistration.setApplicationId(applicationId);
 endpointRegistration.setEndpointId(endpointId);
 endpointRegistration.setCredentialsId(credentialsId);
 endpointRegistration.setServerProfileVersion(serverProfileVersion);
 endpointRegistration.setServerProfileBody(serverProfileBody);
 return this.endpointRegistrationDao.save(endpointRegistration).toDto();
}
origin: kaaproject/kaa

@Test
public void testFindByCredentialsId() throws Exception {
 EndpointRegistrationDto endpointRegistrationDto = this.generateEndpointRegistration(APPLICATION_ID, ENDPOINT_ID, CREDENTIALS_ID);
 Assert.assertNotNull(endpointRegistrationDto);
 Assert.assertNotNull(endpointRegistrationDto.getId());
 EndpointRegistration endpointRegistration = this.endpointRegistrationDao.findByCredentialsId(CREDENTIALS_ID).orElse(null);
 Assert.assertNotNull(endpointRegistration);
 Assert.assertEquals(endpointRegistrationDto, endpointRegistration.toDto());
}
origin: kaaproject/kaa

@Test
public void testFindByEndpointId() throws Exception {
 EndpointRegistrationDto endpointRegistrationDto = this.generateEndpointRegistration(APPLICATION_ID, ENDPOINT_ID, CREDENTIALS_ID, null, null);
 Assert.assertNotNull(endpointRegistrationDto);
 Assert.assertNotNull(endpointRegistrationDto.getId());
 EndpointRegistration endpointRegistration = this.endpointRegistrationDao.findByEndpointId(ENDPOINT_ID).orElse(null);
 Assert.assertNotNull(endpointRegistration);
 Assert.assertEquals(endpointRegistrationDto, endpointRegistration.toDto());
}
org.kaaproject.kaa.server.common.dao.implEndpointRegistrationDao

Most used methods

  • findByCredentialsId
    Returns the endpoint registration by credentials ID.
  • findByEndpointId
    Returns the endpooint registration by endpoint ID.
  • removeByEndpointId
    Removes the endpoint registration by endpoint ID.
  • save
    Saves the given endpoint registration.
  • removeById

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JOptionPane (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • 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