use of io.lumeer.api.model.CurrencyData in project engine by Lumeer.
the class DocumentMatcher method initializeLocalizationData.
private void initializeLocalizationData() {
language = Language.fromString(ruleTask.getCurrentLocale());
final String timeZone = ruleTask.getTimeZone();
final TranslationManager translationManager = new TranslationManager();
constraintData = new ConstraintData(dao.getUserDao().getAllUsers(this.organization.getId()), ruleTask.getInitiator(), translationManager.translateDurationUnitsMap(language), new CurrencyData(translationManager.translateAbbreviations(language), translationManager.translateOrdinals(language)), timeZone != null ? timeZone : TimeZone.getDefault().getID(), dao.getGroupDao().getAllGroups(this.organization.getId()), dao.getSelectionListDao().getAllLists(Collections.singletonList(project.getId())));
}
use of io.lumeer.api.model.CurrencyData in project engine by Lumeer.
the class DocumentUtils method getDocuments.
public static List<Document> getDocuments(final CollectionDao collectionDao, final DocumentDao documentDao, final DataDao dataDao, final UserDao userDao, final GroupDao groupDao, final SelectionListDao selectionListDao, final Organization organization, final Project project, final Query query, final User user, final Language language, final AllowedPermissions permissions, final String timeZone) {
if (organization != null && query.getCollectionIds().size() > 0) {
final String collectionId = query.getCollectionIds().iterator().next();
final Collection collection = collectionDao.getCollectionById(collectionId);
final List<Document> documents = documentDao.getDocumentsByCollection(collectionId);
final Map<String, Document> documentsByIds = documents.stream().collect(Collectors.toMap(Document::getId, Function.identity()));
dataDao.getData(collectionId, documents.stream().map(Document::getId).collect(Collectors.toSet())).forEach(data -> {
final Document doc = documentsByIds.get(data.getId());
if (doc != null) {
doc.setData(data);
}
});
final TranslationManager translationManager = new TranslationManager();
final ConstraintData constraintData = new ConstraintData(userDao.getAllUsers(organization.getId()), user, translationManager.translateDurationUnitsMap(language), new CurrencyData(translationManager.translateAbbreviations(language), translationManager.translateOrdinals(language)), timeZone != null ? timeZone : TimeZone.getDefault().getID(), groupDao.getAllGroups(organization.getId()), selectionListDao.getAllLists(Collections.singletonList(project.getId())));
final Tuple<List<Document>, List<LinkInstance>> result = DataFilter.filterDocumentsAndLinksByQueryDecodingFromJson(documents, List.of(collection), List.of(), List.of(), query, Map.of(collectionId, permissions), Map.of(), constraintData, true, language);
return result.getFirst();
}
return List.of();
}
use of io.lumeer.api.model.CurrencyData in project engine by Lumeer.
the class AutoLinkBatchTask method setupBatch.
public void setupBatch(final AutoLinkRule rule, final LinkType linkType, final Collection collection, final Attribute attribute, final Collection otherCollection, final Attribute otherAttribute, final User user, final Map<String, AllowedPermissions> permissions) {
this.rule = rule;
this.linkType = linkType;
this.collection = collection;
this.attribute = attribute;
this.otherCollection = otherCollection;
this.otherAttribute = otherAttribute;
this.permissions = permissions;
this.user = user;
sourceDocuments = daoContextSnapshot.getDocumentDao().getDocumentsByCollection(collection.getId());
targetDocuments = daoContextSnapshot.getDocumentDao().getDocumentsByCollection(otherCollection.getId());
existingLinks = daoContextSnapshot.getLinkInstanceDao().getLinkInstancesByLinkType(linkType.getId());
language = requestDataKeeper.getUserLanguage();
timeZone = requestDataKeeper.getTimezone();
final TranslationManager translationManager = new TranslationManager();
final String organizationId = daoContextSnapshot.getSelectedWorkspace().getOrganization().get().getId();
final String projectId = daoContextSnapshot.getSelectedWorkspace().getProject().get().getId();
constraintData = new ConstraintData(daoContextSnapshot.getUserDao().getAllUsers(organizationId), user, translationManager.translateDurationUnitsMap(language), new CurrencyData(translationManager.translateAbbreviations(language), translationManager.translateOrdinals(language)), timeZone != null ? timeZone : TimeZone.getDefault().getID(), daoContextSnapshot.getGroupDao().getAllGroups(organizationId), daoContextSnapshot.getSelectionListDao().getAllLists(Collections.singletonList(projectId)));
matchQuery = MatchQueryFactory.getMatchQuery(attribute, otherCollection, otherAttribute);
}
Aggregations