use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode in project muikku by otavanopisto.
the class DeusNexMachinaRESTService method cleanMaterials.
private void cleanMaterials(List<WorkspaceNode> nodes) {
for (WorkspaceNode node : nodes) {
if (node.getType() != WorkspaceNodeType.MATERIAL) {
cleanMaterials(workspaceMaterialController.listWorkspaceNodesByParent(node));
} else {
WorkspaceMaterial workspaceMaterial = (WorkspaceMaterial) node;
Material material = workspaceMaterialController.getMaterialForWorkspaceMaterial(workspaceMaterial);
if ("html".equals(material.getType())) {
logger.info("Cleaning html material " + material.getId());
htmlMaterialCleaner.cleanMaterial((HtmlMaterial) material, workspaceMaterial);
}
}
}
}
use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode in project muikku by otavanopisto.
the class MaterialUnEmbedder method unembedWorkspaceMaterials.
@Lock
public void unembedWorkspaceMaterials(WorkspaceNode parentNode) throws DeusNexInternalException {
try {
loadHtmlMaterialPieces();
for (WorkspaceNode node : workspaceMaterialController.listWorkspaceNodesByParent(parentNode)) {
unembedWorkspaceNode(parentNode, node);
}
saveHtmlMaterialPieces();
} catch (XPathExpressionException | SAXException | IOException | ParserConfigurationException | TransformerException | WorkspaceMaterialContainsAnswersExeption e) {
throw new DeusNexInternalException(e.getClass().getName() + ": " + e.getMessage());
}
}
use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode in project muikku by otavanopisto.
the class WorkspaceNodeDAO method listByOrderNumberGreater.
public List<WorkspaceNode> listByOrderNumberGreater(WorkspaceNode node) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceNode> criteria = criteriaBuilder.createQuery(WorkspaceNode.class);
Root<WorkspaceNode> root = criteria.from(WorkspaceNode.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(WorkspaceNode_.parent), node.getParent()), criteriaBuilder.greaterThan(root.get(WorkspaceNode_.orderNumber), node.getOrderNumber())));
criteria.orderBy(criteriaBuilder.asc(root.get(WorkspaceNode_.orderNumber)));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode in project muikku by otavanopisto.
the class WorkspaceNodeDAO method listByOrderNumberEqualOrGreater.
public List<WorkspaceNode> listByOrderNumberEqualOrGreater(WorkspaceNode node) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceNode> criteria = criteriaBuilder.createQuery(WorkspaceNode.class);
Root<WorkspaceNode> root = criteria.from(WorkspaceNode.class);
criteria.select(root);
criteria.where(criteriaBuilder.and(criteriaBuilder.equal(root.get(WorkspaceNode_.parent), node.getParent()), criteriaBuilder.greaterThanOrEqualTo(root.get(WorkspaceNode_.orderNumber), node.getOrderNumber())));
return entityManager.createQuery(criteria).getResultList();
}
use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceNode in project muikku by otavanopisto.
the class WorkspaceMaterialController method listWorkspaceFrontPagesAsContentNodes.
public List<ContentNode> listWorkspaceFrontPagesAsContentNodes(WorkspaceEntity workspaceEntity) throws WorkspaceMaterialException {
List<ContentNode> contentNodes = new ArrayList<>();
List<WorkspaceMaterial> frontPages = listFrontPages(workspaceEntity);
for (WorkspaceNode frontPage : frontPages) {
ContentNode node = createContentNode(frontPage);
contentNodes.add(node);
}
return contentNodes;
}
Aggregations