use of io.lumeer.api.SelectedWorkspace in project engine by Lumeer.
the class LumeerBridge method printText.
@SuppressWarnings("unused")
public void printText(final String text) {
final SelectedWorkspace workspace = task.getDaoContextSnapshot().getSelectedWorkspace();
if (!printed && workspace.getOrganization().isPresent() && workspace.getProject().isPresent()) {
final TextPrintRequest pq = new TextPrintRequest(workspace.getOrganization().get().getCode(), workspace.getProject().get().getCode(), text);
operations.add(new PrintTextOperation(pq));
// we can trigger this only once per rule/function
printed = true;
}
}
use of io.lumeer.api.SelectedWorkspace in project engine by Lumeer.
the class LumeerBridge method shareView.
@SuppressWarnings("unused")
public void shareView(final String viewId, final String userEmail, final String roles) {
try {
final SelectedWorkspace workspace = task.getDaoContextSnapshot().getSelectedWorkspace();
if (workspace.getOrganization().isPresent() && workspace.getProject().isPresent()) {
final View view = task.getDaoContextSnapshot().getViewDao().getViewById(viewId);
if (view != null) {
// can the initiator share the view?
if (PermissionUtils.hasRole(workspace.getOrganization().get(), workspace.getProject().get(), view, RoleType.UserConfig, task.getInitiator(), task.getGroups())) {
final User newUser = task.getDaoContextSnapshot().getUserDao().getUserByEmail(userEmail);
final Set<RoleType> userRoles = StringUtils.isNotEmpty(roles) && !"none".equals(roles) ? Arrays.stream(roles.split(",")).map(RoleType::fromString).collect(toSet()) : Set.of();
operations.add(new ViewPermissionsOperation(view, newUser.getId(), userRoles));
}
}
}
} catch (Exception e) {
cause = e;
throw e;
}
}
use of io.lumeer.api.SelectedWorkspace in project engine by Lumeer.
the class LumeerBridge method printAttribute.
@SuppressWarnings("unused")
public void printAttribute(final LinkBridge l, final String attrId) {
final SelectedWorkspace workspace = task.getDaoContextSnapshot().getSelectedWorkspace();
if (!printed && workspace.getOrganization().isPresent() && workspace.getProject().isPresent()) {
final PrintRequest pq = new PrintRequest(workspace.getOrganization().get().getCode(), workspace.getProject().get().getCode(), l.getLink().getLinkTypeId(), l.getLink().getId(), attrId, ResourceType.LINK);
operations.add(new PrintAttributeOperation(pq));
// we can trigger this only once per rule/function
printed = true;
}
}
use of io.lumeer.api.SelectedWorkspace in project engine by Lumeer.
the class LumeerBridge method navigate.
@SuppressWarnings("unused")
private void navigate(final String viewId, final DocumentBridge documentBridge, final String search, final boolean sidebar, final boolean newWindow) {
try {
final SelectedWorkspace workspace = task.getDaoContextSnapshot().getSelectedWorkspace();
if (workspace.getOrganization().isPresent() && workspace.getProject().isPresent()) {
final View view = task.getDaoContextSnapshot().getViewDao().getViewById(viewId);
if (view != null && view.getQuery().getStems().size() > 0 && StringUtils.isNotEmpty(view.getQuery().getStems().get(0).getCollectionId())) {
final String collectionId = view.getQuery().getStems().get(0).getCollectionId();
final String documentId = documentBridge != null ? documentBridge.getDocument().getId() : null;
final Collection collection = task.getDaoContextSnapshot().getCollectionDao().getCollectionById(collectionId);
final String attributeId = StringUtils.isNotEmpty(collection.getDefaultAttributeId()) ? collection.getDefaultAttributeId() : (collection.getAttributes() != null && !collection.getAttributes().isEmpty() ? collection.getAttributes().iterator().next().getId() : "");
final NavigationRequest navigationRequest = new NavigationRequest(workspace.getOrganization().get().getCode(), workspace.getProject().get().getCode(), viewId, collectionId, documentId, attributeId, sidebar, newWindow, search);
operations.add(new NavigationOperation(navigationRequest));
}
}
} catch (Exception e) {
cause = e;
throw e;
}
}
use of io.lumeer.api.SelectedWorkspace in project engine by Lumeer.
the class LumeerBridge method printAttribute.
@SuppressWarnings("unused")
public void printAttribute(final DocumentBridge d, final String attrId) {
final SelectedWorkspace workspace = task.getDaoContextSnapshot().getSelectedWorkspace();
if (!printed && workspace.getOrganization().isPresent() && workspace.getProject().isPresent()) {
final PrintRequest pq = new PrintRequest(workspace.getOrganization().get().getCode(), workspace.getProject().get().getCode(), d.getDocument().getCollectionId(), d.getDocument().getId(), attrId, ResourceType.COLLECTION);
operations.add(new PrintAttributeOperation(pq));
// we can trigger this only once per rule/function
printed = true;
}
}
Aggregations