@Override public Optional<T> findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return Optional.ofNullable( mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName())); }
@Override public Optional<T> findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return Optional.ofNullable( mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName())); }
private ConfirmationRequestRecord findById(String token) { ConfirmationRequestRecord request = mongoTemplate.findById(token, ConfirmationRequestRecord.class); return request; }
private Document findSession(String id) { return this.mongoOperations.findById(id, Document.class, this.collectionName); }
@Override public boolean exists(String id) { boolean result = false; if (StringUtils.isNotBlank(id)) { R record = mongoTemplate.findById(id, recordClass); result = (record != null); } return result; }
private R findRecordById(String id) { R result = null; if (StringUtils.isNotBlank(id)) { result = mongoTemplate.findById(id, recordClass); } return result; }
public ApplicationSystem findById(final String asid) { log.debug("Trying to find applicationSystem with id " + asid); try { return mongoOperations.findById(asid, ApplicationSystem.class); } catch (RuntimeException e) { log.error("Failed to find application system " + asid, e); throw e; } }
@Override @Cacheable(key="#id" ,unless="#result == null") public T getById(Object id) throws DataAccessException { if (logger.isDebugEnabled()) logger.debug("type {} getById", type); try{ return mongoOperations.findById(id, type); }catch(Exception e){ throw new DataAccessException(e); } }
/** * The method provides the functionality to find a specific instance that matches the provided id * * @param id The id that an instance has to match in order to be retrieved * @return Returns an instance that matches the provided id */ @Override public D findOne(final I id) { Preconditions.checkNotNull(id, "The provided id cannot be null"); LOGGER.debug("Retrieving " + entityClass.getSimpleName() + " with id " + id); T type = mongoOperations.findById(id, entityClass); return type != null ? mapper.map(type, dtoClass) : null; }
/** * Retrieve the {@link GraphQLProject} id * for the {@link GraphQLApplication} with the provided id. * * @param applicationId The id of the {@link GraphQLApplication}. * @return The id of the project. */ @Override public String getProjectId(String applicationId) { GraphQLApplication applicationDocument = mongoOperations.findById(applicationId, GraphQLApplication.class); if (applicationDocument == null) { throw new IllegalArgumentException("Unable to find an application with the following id: " + applicationId); } return applicationDocument.getProjectId(); }
/** * Delete an instance that match the provided id * * @param soapProjectId The instance that matches the provided id will be deleted in the database */ @Override public SoapProject delete(final String soapProjectId) { Preconditions.checkNotNull(soapProjectId, "Project id cannot be null"); final SoapProjectDocument soapProject = mongoOperations.findById(soapProjectId, SoapProjectDocument.class); if (soapProject == null) { throw new IllegalArgumentException("Unable to find a SOAP project with id " + soapProjectId); } return super.delete(soapProjectId); }
/** * Retrieve the {@link SoapProject} id * for the {@link SoapPort} with the provided id. * * @param portId The id of the {@link SoapPort}. * @return The id of the project. */ @Override public String getProjectId(String portId) { SoapPortDocument soapPort = mongoOperations.findById(portId, SoapPortDocument.class); if (soapPort == null) { throw new IllegalArgumentException("Unable to find a port with the following id: " + portId); } return soapPort.getProjectId(); }
/** * Retrieve the {@link SoapOperation} id * for the {@link SoapMockResponse} with the provided id. * * @param mockResponseId The id of the {@link SoapMockResponse}. * @return The id of the operation. */ @Override public String getOperationId(String mockResponseId) { SoapMockResponseDocument mockResponse = mongoOperations.findById(mockResponseId, SoapMockResponseDocument.class); if (mockResponse == null) { throw new IllegalArgumentException("Unable to find a mock response with the following id: " + mockResponseId); } return mockResponse.getOperationId(); }
/** * Updates the current response sequence index. * * @param soapOperationId The operation id. * @param index The new response sequence index. */ @Override public void setCurrentResponseSequenceIndex(final String soapOperationId, final Integer index) { SoapOperationDocument soapOperation = mongoOperations.findById(soapOperationId, SoapOperationDocument.class); if (soapOperation == null) { throw new IllegalArgumentException("Unable to find an operation with the following id: " + soapOperationId); } soapOperation.setCurrentResponseSequenceIndex(index); }
/** * Retrieve the {@link RestResource} id * for the {@link RestMethod} with the provided id. * * @param methodId The id of the {@link RestMethod}. * @return The id of the resource. * @since 1.20 */ @Override public String getResourceId(String methodId) { RestMethodDocument methodDocument = mongoOperations.findById(methodId, RestMethodDocument.class); if (methodDocument == null) { throw new IllegalArgumentException("Unable to find a method with the following id: " + methodId); } return methodDocument.getResourceId(); }
/** * Retrieve the {@link SoapPort} id * for the {@link SoapOperation} with the provided id. * * @param operationId The id of the {@link SoapOperation}. * @return The id of the port. */ @Override public String getPortId(String operationId) { SoapOperationDocument soapOperation = mongoOperations.findById(operationId, SoapOperationDocument.class); if (soapOperation == null) { throw new IllegalArgumentException("Unable to find an operation with the following id: " + operationId); } return soapOperation.getPortId(); }
private boolean stateHasChange(final SyncResource resource) { boolean hasChange = true; // Get the current resource stored on MongoDB final Object currentResource = mongoOps.findById(resource.getId(), resource.getClass()); if (currentResource != null && Sensor.class.isAssignableFrom(resource.getClass())) { hasChange = sensorStateHasChange((Sensor) resource, (Sensor) currentResource); } else if (currentResource != null && Alert.class.isAssignableFrom(resource.getClass())) { hasChange = alertStateHasChange((Alert) resource, (Alert) currentResource); } return hasChange; }
@Override public RateLimit get(String rateLimitKey) { //because RateLimit has no default constructor, we have to manually map values Document result = mongoOperations.findById(rateLimitKey, Document.class, RATE_LIMIT_COLLECTION); RateLimit rateLimit = convert(result); return rateLimit == null ? new RateLimit(rateLimitKey) : rateLimit; }
@Override public E getById(String id) { R record = mongoTemplate.findById(id, recordClass); if (record == null) { throw new ObjectNotFoundException("Record "+id+" does not exist"); } return record.getObject(); }
private E getLastProcessedSnapshot(String id) { LastProcessedSnapshotRecord entitySnapshot = mongoTemplate.findById(id, LastProcessedSnapshotRecord.class, lastProcessedSnapshotCollection()); return entitySnapshot==null ? null : readEntityFromSnapshot(entitySnapshot); }