use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class SearchFacade method searchDocumentsByQuery.
private List<Document> searchDocumentsByQuery(Query query) {
Set<String> collectionIdsFromFilters = collectionIdsFromFilters(parseAttributeFilters(query.getFilters()));
SearchQuery collectionQuery = createCollectionQuery(query, collectionIdsFromFilters);
Map<String, Collection> collections = getCollections(collectionQuery);
Map<String, DataDocument> dataDocuments = new HashMap<>();
for (Collection collection : collections.values()) {
SearchQuery usedSearchQuery = collectionIdsFromFilters.contains(collection.getId()) ? createSearchQuery(query) : createSearchQueryWithoutFilters(query);
dataDocuments.putAll(getDataDocuments(collection.getId(), usedSearchQuery));
}
return getDocuments(dataDocuments);
}
use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class ConfigurationManipulator method getConfigurations.
/**
* Returns an DataDocument containing all configurations for unique nameValue.
*
* @param collectionName
* the name of collection in system database
* @param nameValue
* the unique name value of stored configuration entry
* @return List storing all configurations
*/
public List<Config> getConfigurations(final String collectionName, final String nameValue) {
DataDocument document = systemDataStorage.readDocument(collectionName, entryFilter(nameValue));
List<DataDocument> configs = document != null ? document.getArrayList(CONFIGS, DataDocument.class) : Collections.emptyList();
return configs.stream().map(Config::new).collect(Collectors.toList());
}
use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class ConfigurationManipulator method setConfigurationEntry.
private void setConfigurationEntry(final String collectionName, final String nameValue, List<Config> configs) {
List<DataDocument> configsDocuments = configs.stream().map(Config::toDataDocument).collect(Collectors.toList());
DataDocument configDocument = new DataDocument().append(NAMEVALUE, nameValue).append(CONFIGS, configsDocuments);
systemDataStorage.updateDocument(collectionName, configDocument, entryFilter(nameValue));
}
use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class DocumentFacade method deleteDocument.
public void deleteDocument(String collectionId, String documentId) {
Collection collection = collectionDao.getCollectionById(collectionId);
permissionsChecker.checkRole(collection, Role.WRITE);
DataDocument data = dataDao.getData(collectionId, documentId);
updateCollectionMetadata(collection, Collections.emptySet(), data.keySet(), -1);
documentDao.deleteDocument(documentId);
dataDao.deleteData(collection.getId(), documentId);
linkInstanceDao.deleteLinkInstances(createQueryForLinkInstances(documentId));
}
use of io.lumeer.engine.api.data.DataDocument in project engine by Lumeer.
the class DocumentFacade method getDocuments.
public List<Document> getDocuments(String collectionId, Pagination pagination) {
Collection collection = collectionDao.getCollectionById(collectionId);
permissionsChecker.checkRole(collection, Role.READ);
Map<String, DataDocument> dataDocuments = getDataDocuments(collection.getId(), pagination);
return getDocuments(dataDocuments);
}
Aggregations