CCM NG: First part of sites/pages application

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5035 8810af33-2d31-482b-a856-94f89814c4df

Former-commit-id: 5d7e6356f4
pull/2/head
jensp 2017-10-10 17:27:02 +00:00
parent eefea0afbe
commit b73cab6b34
31 changed files with 1090 additions and 2214 deletions

View File

@ -545,6 +545,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
*/
public static String getItemURL(final ContentItem item,
final int tab) {
final ContentSection section = item.getContentType().getContentSection();
if (section == null) {

View File

@ -65,7 +65,10 @@ import org.apache.logging.log4j.LogManager;
import org.arsdigita.cms.CMSConfig;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.workflow.Task;
import org.libreccm.workflow.TaskRepository;
import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItem;
import org.librecms.contenttypes.AuthoringKit;
@ -576,7 +579,17 @@ public class AuthoringKitWizard extends LayoutPanel implements Resettable {
.getSelectedKey(state)
.toString();
return CmsTaskType.valueOf(key);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final TaskRepository taskRepo = cdiUtil
.findBean(TaskRepository.class);
final Task task = taskRepo
.findById(Long.parseLong(key))
.orElseThrow(() -> new UnexpectedErrorException(String
.format("No Task with ID %s in the database.",
key)));
return task;
}
}

View File

@ -18,16 +18,37 @@
*/
package com.arsdigita.cms.ui.lifecycle;
import com.arsdigita.cms.ui.ContentItemPage;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.arsdigita.cms.CMSConfig;
import org.libreccm.categorization.Categorization;
import org.libreccm.categorization.Category;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.security.User;
import org.libreccm.workflow.Task;
import org.libreccm.workflow.TaskManager;
import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowManager;
import org.libreccm.workflow.WorkflowRepository;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.lifecycle.Lifecycle;
import org.librecms.lifecycle.LifecycleDefinition;
import org.librecms.lifecycle.LifecycleDefinitionRepository;
import org.librecms.lifecycle.LifecycleManager;
import org.librecms.lifecycle.Phase;
import org.librecms.lifecycle.PhaseRepository;
import org.librecms.workflow.CmsTask;
import org.librecms.workflow.CmsTaskType;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped;
@ -41,12 +62,39 @@ import javax.transaction.Transactional;
@RequestScoped
public class ItemLifecycleAdminController {
private static final Logger LOGGER = LogManager
.getLogger(ItemLifecycleAdminController.class);
@Inject
private ConfigurationManager confManager;
@Inject
private ContentItemRepository itemRepo;
@Inject
private ContentItemManager itemManager;
@Inject
private LifecycleDefinitionRepository lifecycleDefRepo;
@Inject
private LifecycleManager lifecycleManager;
@Inject
private PhaseRepository phaseRepo;
@Inject
private ContentSectionRepository sectionRepo;
@Inject
private TaskManager taskManager;
@Inject
private WorkflowManager workflowManager;
@Inject
private WorkflowRepository workflowRepo;
@Transactional(Transactional.TxType.REQUIRED)
public boolean isAssignedToAbstractCategory(final ContentItem item) {
@ -91,7 +139,135 @@ public class ItemLifecycleAdminController {
.format("No ContentItem with ID %d in the database.",
item.getObjectId())));
return contentItem.getContentType().getDefaultLifecycle();
final LifecycleDefinition definition = contentItem
.getContentType()
.getDefaultLifecycle();
return lifecycleDefRepo
.findById(definition.getDefinitionId())
.get();
}
@Transactional(Transactional.TxType.REQUIRED)
public LifecycleDefinition getDefinitionOfLifecycle(final ContentItem item) {
final ContentItem contentItem = itemRepo
.findById(item.getObjectId())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No ContentItem with ID %d in the database.",
item.getObjectId())));
final ContentItem liveItem = itemManager
.getLiveVersion(item, ContentItem.class)
.get();
return liveItem.getLifecycle().getDefinition();
}
@Transactional(Transactional.TxType.REQUIRED)
public String getPublishingTabUrl(final ContentItem item) {
final ContentItem contentItem = itemRepo
.findById(item.getObjectId())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No ContentItem with ID %d in the database.",
item.getObjectId())));
return ContentItemPage.getItemURL(contentItem,
ContentItemPage.PUBLISHING_TAB);
}
@Transactional(Transactional.TxType.REQUIRED)
public void publish(final String itemUuid,
final long cycleDefId,
final Date endDate,
final String workflowUuid,
final User user) {
final ContentItem contentItem = itemRepo
.findByUuid(itemUuid)
.orElseThrow(() -> new IllegalArgumentException(String
.format("No ContentItem with UUID %s in the database.",
itemUuid)));
final LifecycleDefinition cycleDef = lifecycleDefRepo
.findById(cycleDefId)
.orElseThrow(() -> new IllegalArgumentException(String
.format("No LifecycleDefinition with ID %d in the database.",
cycleDefId)));
if (itemManager.isLive(contentItem)) {
contentItem.setLifecycle(null);
itemRepo.save(contentItem);
}
final ContentItem pending = itemManager.publish(contentItem, cycleDef);
final Lifecycle lifecycle = pending.getLifecycle();
if (endDate != null) {
// update individual phases
final List<Phase> phases = lifecycle.getPhases();
for (final Phase phase : phases) {
final Date thisStart = phase.getStartDateTime();
if (thisStart.compareTo(endDate) > 0) {
phase.setStartDateTime(endDate);
phaseRepo.save(phase);
}
}
}
lifecycleManager.startLifecycle(lifecycle);
if (workflowUuid != null) {
final Workflow workflow = workflowRepo
.findByUuid(workflowUuid)
.get();
finish(workflow, contentItem, user);
}
}
private void finish(final Workflow workflow,
final ContentItem item,
final User user) {
if (workflow != null && user != null) {
final List<Task> enabledTasks = workflowManager
.findEnabledTasks(workflow);
for (final Task task : enabledTasks) {
LOGGER.debug("Task is {}.", task.getUuid());
if (task instanceof CmsTask) {
final CmsTask cmsTask = (CmsTask) task;
if (cmsTask.getTaskType() == CmsTaskType.DEPLOY) {
LOGGER.debug("Found DEPLOY task.");
taskManager.finish(cmsTask);
}
}
}
final CMSConfig cmsConfig = confManager
.findConfiguration(CMSConfig.class);
if (cmsConfig.isDeleteWorkflowAfterPublication()) {
workflowRepo.delete(workflow);
} else {
// restart the workflow by recreating it
// from the same workflow template
final Workflow template = workflow.getTemplate();
if (template == null) {
return;
}
workflowRepo.delete(workflow);
final Workflow restarted = workflowManager.createWorkflow(
template, item);
// Startring the workflow will probably do the wrong thing, because most of the time
// the current user would be a publisher, not an author
workflowRepo.save(restarted);
}
}
}
}

View File

@ -84,6 +84,7 @@ import org.librecms.workflow.CmsTaskType;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
@ -284,14 +285,16 @@ class ItemLifecycleSelectForm extends BaseForm {
final Locale locale = globalizationHelper.getNegotiatedLocale();
for (final LifecycleDefinition definition : definitions) {
final List<PhaseDefinition> phaseDefinitions = definition
.getPhaseDefinitions();
if (!phaseDefinitions.isEmpty()) {
target.addOption(new Option(
// final List<PhaseDefinition> phaseDefinitions = definition
// .getPhaseDefinitions();
//
// if (!phaseDefinitions.isEmpty()) {
target.addOption(
new Option(
Long.toString(definition.getDefinitionId()),
new Text(definition.getLabel().getValue(locale))));
}
new Text(globalizationHelper
.getValueFromLocalizedString(definition.getLabel()))));
// }
}
}
@ -301,13 +304,14 @@ class ItemLifecycleSelectForm extends BaseForm {
@Override
public final void init(final FormSectionEvent event) {
final PageState state = event.getPageState();
final ContentItem item = itemRequestLocal.getContentItem(state);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ContentItemManager itemManager = cdiUtil.findBean(
ContentItemManager.class);
final ContentItemManager itemManager = cdiUtil
.findBean(ContentItemManager.class);
final ItemLifecycleAdminController controller = cdiUtil
.findBean(ItemLifecycleAdminController.class);
@ -315,8 +319,11 @@ class ItemLifecycleSelectForm extends BaseForm {
// If the item is published, select the currently
// associated lifecycle.
final LifecycleDefinition definition = item.getLifecycle()
.getDefinition();
final LifecycleDefinition definition = controller
.getDefinitionOfLifecycle(item);
// final LifecycleDefinition definition = item
// .getLifecycle()
// .getDefinition();
cycleSelect.setValue(state, definition.getDefinitionId());
} else {
// Set the default lifecycle (if it exists).
@ -382,6 +389,8 @@ class ItemLifecycleSelectForm extends BaseForm {
final PageState state = event.getPageState();
final ContentItem item = itemRequestLocal.getContentItem(state);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ItemLifecycleAdminController controller = cdiUtil
.findBean(ItemLifecycleAdminController.class);
final Publisher publisher = new Publisher(state);
if (CMSConfig.getConfig().isThreadPublishing()) {
@ -467,8 +476,7 @@ class ItemLifecycleSelectForm extends BaseForm {
if (CMSConfig.getConfig().isThreadPublishing()) {
throw new RedirectSignal(
URL.getDispatcherPath()
+ ContentItemPage.getItemURL(item,
ContentItemPage.PUBLISHING_TAB),
+ controller.getPublishingTabUrl(item),
true);
} else {
if (CMSConfig.getConfig().isUseStreamlinedCreation()) {
@ -649,7 +657,13 @@ class ItemLifecycleSelectForm extends BaseForm {
//item = m_item.getContentItem(state);
itemUuid = itemRequestLocal.getContentItem(state).getItemUuid();
if (cycleSelect.getValue(state) instanceof BigDecimal) {
defID = ((Number) cycleSelect.getValue(state)).longValue();
} else if (cycleSelect.getValue(state) instanceof Long) {
defID = (Long) cycleSelect.getValue(state);
} else {
defID = Long.parseLong(cycleSelect.getValue(state).toString());
}
final Calendar start = Calendar.getInstance();
start.setTime((java.util.Date) startDateField.getValue(state));
@ -715,79 +729,84 @@ class ItemLifecycleSelectForm extends BaseForm {
public void publish() {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ContentItemRepository itemRepo = cdiUtil.findBean(
ContentItemRepository.class);
final ContentItemManager itemManager = cdiUtil.findBean(
ContentItemManager.class);
final PhaseRepository phaseRepo = cdiUtil.findBean(
PhaseRepository.class);
final LifecycleDefinitionRepository lifecycleDefRepo = cdiUtil
.findBean(LifecycleDefinitionRepository.class);
final LifecycleManager lifecycleManager = cdiUtil.findBean(
LifecycleManager.class);
final ItemLifecycleAdminController controller = cdiUtil
.findBean(ItemLifecycleAdminController.class);
final ContentItem item = itemRepo.findByUuid(itemUuid).get();
controller.publish(itemUuid, defID, endDate, workflowUuid, user);
// If the item is already published, remove the current lifecycle.
// Do not touch the live version.
if (itemManager.isLive(item)) {
item.setLifecycle(null);
itemRepo.save(item);
}
ContentItem pending;
final LifecycleDefinition cycleDef;
final Lifecycle lifecycle;
// Apply the new lifecycle.
cycleDef = lifecycleDefRepo.findById(defID).get();
pending = itemManager.publish(item, cycleDef);
lifecycle = pending.getLifecycle();
if (endDate != null) {
// update individual phases
final List<Phase> phases = lifecycle.getPhases();
for (final Phase phase : phases) {
final java.util.Date thisEnd = phase.getEndDateTime();
final java.util.Date thisStart = phase.getStartDateTime();
if (thisStart.compareTo(endDate) > 0) {
phase.setStartDateTime(endDate);
phaseRepo.save(phase);
}
}
}
// endOfCycle may be the original date according to lifecycle phase definitions, or endDate if that was before
// natural end of lifecycle
final java.util.Date endOfCycle = lifecycle.getEndDateTime();
if (endOfCycle != null) {
// if advance notification is requested (!= 0)
// add another phase at the start of which the user is notified
java.util.Date notificationDate;
int notificationPeriod = 0;
if (notificationDays != null) {
notificationPeriod += notificationDays * 24;
}
if (notificationHours != null) {
notificationPeriod += notificationHours;
}
}
// Force the lifecycle scheduler to run to avoid any
// scheduler delay for items that should be published
// immediately.
lifecycleManager.startLifecycle(pending.getLifecycle());
if (workflowUuid != null) {
final WorkflowRepository workflowRepo = cdiUtil.findBean(
WorkflowRepository.class);
final Workflow workflow = workflowRepo.findByUuid(workflowUuid)
.get();
finish(workflow, item, user);
}
// final ContentItemRepository itemRepo = cdiUtil.findBean(
// ContentItemRepository.class);
// final ContentItemManager itemManager = cdiUtil.findBean(
// ContentItemManager.class);
// final PhaseRepository phaseRepo = cdiUtil.findBean(
// PhaseRepository.class);
// final LifecycleDefinitionRepository lifecycleDefRepo = cdiUtil
// .findBean(LifecycleDefinitionRepository.class);
// final LifecycleManager lifecycleManager = cdiUtil.findBean(
// LifecycleManager.class);
//
// final ContentItem item = itemRepo.findByUuid(itemUuid).get();
//
// // If the item is already published, remove the current lifecycle.
// // Do not touch the live version.
// if (itemManager.isLive(item)) {
// item.setLifecycle(null);
// itemRepo.save(item);
// }
//
// ContentItem pending;
// final LifecycleDefinition cycleDef;
// final Lifecycle lifecycle;
// // Apply the new lifecycle.
// cycleDef = lifecycleDefRepo.findById(defID).get();
// pending = itemManager.publish(item, cycleDef);
// lifecycle = pending.getLifecycle();
//
// if (endDate != null) {
//
// // update individual phases
// final List<Phase> phases = lifecycle.getPhases();
//
// for (final Phase phase : phases) {
// final java.util.Date thisEnd = phase.getEndDateTime();
// final java.util.Date thisStart = phase.getStartDateTime();
// if (thisStart.compareTo(endDate) > 0) {
// phase.setStartDateTime(endDate);
// phaseRepo.save(phase);
// }
// }
// }
//
// // endOfCycle may be the original date according to lifecycle phase definitions, or endDate if that was before
// // natural end of lifecycle
// final java.util.Date endOfCycle = lifecycle.getEndDateTime();
// if (endOfCycle != null) {
//
// // if advance notification is requested (!= 0)
// // add another phase at the start of which the user is notified
// java.util.Date notificationDate;
//
// int notificationPeriod = 0;
// if (notificationDays != null) {
// notificationPeriod += notificationDays * 24;
// }
// if (notificationHours != null) {
// notificationPeriod += notificationHours;
// }
// }
//
// // Force the lifecycle scheduler to run to avoid any
// // scheduler delay for items that should be published
// // immediately.
// lifecycleManager.startLifecycle(pending.getLifecycle());
//
// if (workflowUuid != null) {
// final WorkflowRepository workflowRepo = cdiUtil.findBean(
// WorkflowRepository.class);
// final Workflow workflow = workflowRepo.findByUuid(workflowUuid)
// .get();
// finish(workflow, item, user);
// }
}
}

View File

@ -29,7 +29,6 @@ import org.librecms.workflow.CmsTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.workflow.TaskComment;
import org.libreccm.workflow.TaskManager;
import org.libreccm.workflow.TaskRepository;
@ -39,7 +38,8 @@ import org.libreccm.workflow.TaskRepository;
*/
class CommentAddForm extends BaseForm {
private static final Logger LOGGER = LogManager.getLogger(CommentAddForm.class);
private static final Logger LOGGER = LogManager.getLogger(
CommentAddForm.class);
private final TaskRequestLocal selectedTask;
private final TextArea comment;
@ -63,17 +63,23 @@ class CommentAddForm extends BaseForm {
}
private class ProcessListener implements FormProcessListener {
@Override
public final void process(final FormSectionEvent event)
throws FormProcessException {
LOGGER.debug("Processing comment add");
final PageState state = event.getPageState();
if (comment.getValue(state) != null
&& !((String) comment.getValue(state)).isEmpty()) {
final CmsTask task = selectedTask.getTask(state);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final TaskRepository taskRepo = cdiUtil.findBean(TaskRepository.class);
final TaskManager taskManager = cdiUtil.findBean(TaskManager.class);
taskManager.addComment(task, (String) comment.getValue(state));
final TaskFinishFormController controller = cdiUtil
.findBean(TaskFinishFormController.class);
controller.addComment(task, (String) comment.getValue(state));
}
}
}
}

View File

@ -50,11 +50,7 @@ import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.security.PermissionChecker;
import org.libreccm.workflow.AssignableTask;
import org.libreccm.workflow.AssignableTaskManager;
import org.libreccm.workflow.TaskManager;
import org.libreccm.workflow.TaskRepository;
import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowManager;
import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemRepository;
@ -170,13 +166,8 @@ public final class TaskFinishForm extends CommentAddForm {
permissionChecker.checkPermission(task.getTaskType().getPrivilege(),
item.get());
final TaskRepository taskRepo = cdiUtil.findBean(
TaskRepository.class);
final WorkflowManager workflowManager = cdiUtil.findBean(
WorkflowManager.class);
final TaskManager taskManager = cdiUtil.findBean(TaskManager.class);
final AssignableTaskManager assignableTaskManager = cdiUtil
.findBean(AssignableTaskManager.class);
final TaskFinishFormController controller = cdiUtil
.findBean(TaskFinishFormController.class);
final ConfigurationManager confManager = cdiUtil.findBean(
ConfigurationManager.class);
final KernelConfig kernelConfig = confManager.findConfiguration(
@ -194,7 +185,7 @@ public final class TaskFinishForm extends CommentAddForm {
if (isApproved.equals(Boolean.TRUE)) {
LOGGER.debug("The task is approved; finishing the task");
taskManager.finish(task);
controller.finish(task);
finishedTask = true;
} else {
LOGGER.debug("The task is rejected; reenabling dependent "
@ -206,17 +197,16 @@ public final class TaskFinishForm extends CommentAddForm {
dependent.getLabel().getValue(
kernelConfig.getDefaultLocale()));
taskManager.enable(dependent);
controller.enable(dependent);
}
}
} else {
LOGGER.debug("The task does not require approval; finishing it");
taskManager.disable(task);
controller.finish(task);
finishedTask = true;
}
if (finishedTask) {
final TaskFinishFormController controller = cdiUtil.findBean(
TaskFinishFormController.class);
final Workflow workflow = task.getWorkflow();
final List<AssignableTask> tasks = controller.findEnabledTasks(
workflow);
@ -231,16 +221,16 @@ public final class TaskFinishForm extends CommentAddForm {
if (permissionChecker.isPermitted(privilege,
workflow.getObject())) {
//Lock task for current user
assignableTaskManager.lockTask(currentCmsTask);
controller.lock(currentCmsTask);
if (CmsTaskType.DEPLOY == currentCmsTask.getTaskType()) {
} else {
throw new RedirectSignal(
URL.there(state.getRequest(),
ContentItemPage.getItemURL(
item.get(),
ContentItemPage.PUBLISHING_TAB)),
URL.there(
state.getRequest(),
controller
.getContentItemPublishUrl(item.get())),
true);
}

View File

@ -18,12 +18,20 @@
*/
package com.arsdigita.cms.ui.workflow;
import com.arsdigita.cms.ui.ContentItemPage;
import org.libreccm.security.Role;
import org.libreccm.security.Shiro;
import org.libreccm.security.User;
import org.libreccm.workflow.AssignableTask;
import org.libreccm.workflow.AssignableTaskManager;
import org.libreccm.workflow.Task;
import org.libreccm.workflow.TaskManager;
import org.libreccm.workflow.TaskRepository;
import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemRepository;
import org.librecms.workflow.CmsTask;
import java.util.List;
import java.util.stream.Collectors;
@ -40,7 +48,16 @@ import javax.transaction.Transactional;
public class TaskFinishFormController {
@Inject
private AssignableTaskManager taskManager;
private ContentItemRepository itemRepo;
@Inject
private TaskRepository taskRepo;
@Inject
private TaskManager taskManager;
@Inject
private AssignableTaskManager assignableTaskManager;
@Inject
private Shiro shiro;
@ -52,7 +69,71 @@ public class TaskFinishFormController {
.map(membership -> membership.getRole())
.collect(Collectors.toList());
return taskManager.findAssignedTasks(workflow, roles);
return assignableTaskManager.findAssignedTasks(workflow, roles);
}
@Transactional(Transactional.TxType.REQUIRED)
public void addComment(final CmsTask task, final String comment) {
final Task theTask = taskRepo
.findById(task.getTaskId())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No Task with ID %d in the database.",
task.getTaskId())));
taskManager.addComment(theTask, comment);
}
@Transactional
public void lock(final AssignableTask task) {
final AssignableTask theTask = (AssignableTask) taskRepo
.findById(task.getTaskId())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No Task with ID %d in the database.",
task.getTaskId())));
assignableTaskManager.unlockTask(theTask);
assignableTaskManager.lockTask(theTask);
}
@Transactional(Transactional.TxType.REQUIRED)
public void enable(final Task task) {
final Task theTask = taskRepo
.findById(task.getTaskId())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No Task with ID %d in the database.",
task.getTaskId())));
taskManager.enable(theTask);
}
@Transactional(Transactional.TxType.REQUIRED)
public void finish(final CmsTask task) {
final Task theTask = taskRepo
.findById(task.getTaskId())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No Task with ID %d in the database.",
task.getTaskId())));
taskManager.finish(theTask);
}
@Transactional(Transactional.TxType.REQUIRED)
public String getContentItemPublishUrl(final ContentItem item) {
final ContentItem contentItem = itemRepo
.findById(item.getObjectId())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No ContentItem with ID %d in the database.",
item.getObjectId())));
return ContentItemPage.getItemURL(contentItem,
ContentItemPage.PUBLISHING_TAB);
}
}

View File

@ -321,7 +321,7 @@ public class CMSConfig {
private boolean useOldStyleItemLifecycleItemPane = false;
@Setting
private boolean threadPublishing = true;
private boolean threadPublishing = false;
@Setting
private String publishingFailureSender = "";

View File

@ -880,8 +880,8 @@ public class ContentItemManager {
liveItem.setItemUuid(draftItem.getItemUuid());
liveItem.setContentType(draftItem.getContentType());
final Lifecycle lifecycle = lifecycleManager.createLifecycle(
lifecycleDefinition);
final Lifecycle lifecycle = lifecycleManager
.createLifecycle(lifecycleDefinition);
liveItem.setLifecycle(lifecycle);
liveItem.setWorkflow(draftItem.getWorkflow());

View File

@ -192,7 +192,7 @@ public class ContentItemRepository
final TypedQuery<ContentItem> query = getEntityManager()
.createNamedQuery("ContentItem.findByUuid",
ContentItem.class);
query.setParameter("objectId", uuid);
query.setParameter("uuid", uuid);
setAuthorizationParameters(query);
try {

View File

@ -127,8 +127,11 @@ public class LifecycleManager {
phaseRepo.save(phase);
});
if (lifecycle.getPhases() != null
&& !lifecycle.getPhases().isEmpty()) {
lifecycle.getPhases().get(0).setStarted(true);
phaseRepo.save(lifecycle.getPhases().get(0));
}
lifecycleRepo.save(lifecycle);
@ -201,6 +204,11 @@ public class LifecycleManager {
private void invokeLifecycleEventListener(final Lifecycle lifecycle,
final LifecycleEvent event) {
final String listenerClassName = lifecycle.getListener();
if (listenerClassName == null || listenerClassName.isEmpty()) {
return;
}
final Class<?> listenerClass;
try {
listenerClass = Class.forName(listenerClassName);
@ -208,6 +216,7 @@ public class LifecycleManager {
LOGGER.error("Failed to find LifecycleListener class \"{}\". "
+ "Listener is ignored.",
listenerClassName);
LOGGER.error(ex);
return;
}
@ -222,8 +231,8 @@ public class LifecycleManager {
final Object object;
try {
object = listenerClass.newInstance();
} catch (IllegalAccessException |
InstantiationException ex) {
} catch (IllegalAccessException
| InstantiationException ex) {
LOGGER.error("Failed to create instance of LifecycleEventListener "
+ "of class \"{}\".",
listenerClass.getName());
@ -267,8 +276,8 @@ public class LifecycleManager {
final Object object;
try {
object = listenerClass.newInstance();
} catch (IllegalAccessException |
InstantiationException ex) {
} catch (IllegalAccessException
| InstantiationException ex) {
LOGGER.error("Failed to create instance of PhaseEventListener "
+ "of class \"{}\".",
listenerClass.getName());

View File

@ -0,0 +1,84 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.sites;
import org.libreccm.categorization.Category;
import org.libreccm.categorization.CategoryManager;
import org.libreccm.categorization.CategoryRepository;
import org.libreccm.pagemodel.PageModelManager;
import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path("/{page:.+}")
public class Pages {
@Inject
private CategoryManager categoryManager;
@Inject
private CategoryRepository categoryRepo;
@Inject
private PageModelManager pageModelManager;
@Inject
private SiteRepository siteRepo;
@Path("/")
@Produces("text/html")
@Transactional(Transactional.TxType.REQUIRED)
public String getPage(@Context final UriInfo uriInfo,
@PathParam("page") final String page) {
final String siteName = uriInfo.getBaseUri().getHost();
final Site site = siteRepo.findByName(siteName);
final Category category =categoryRepo
.findByPath(site.getCategoryDomain(), page)
.orElseThrow(() -> new NotFoundException(String.format(
"No page for path \"%s\" in site \"%s\"",
page,
siteName)));
// ToDo Get PageModelBuilder
// ToDo Build page
// ToDo Get Theme Processor
// ToDo Pass page to theme processor
// ToDo Return result of ThemeProcessor
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,154 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.sites;
import org.libreccm.categorization.Domain;
import org.libreccm.web.CcmApplication;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import static org.librecms.CmsConstants.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "SITES", schema = DB_SCHEMA)
@NamedQueries({
@NamedQuery(
name = "Site.findByName",
query = "SELECT s FROM Site s WHERE s.name = :name"
)
})
public class Site extends CcmApplication implements Serializable {
private static final long serialVersionUID = -352205318143692477L;
/**
* The domain of the site.
*/
@Column(name = "NAME", unique = true)
private String name;
/**
* Should this be the default site which is used when there is no matching
* site?
*/
@Column(name = "DEFAULT_SITE")
private boolean defaultSite;
@OneToOne
@JoinColumn(name = "CATEGORY_DOMAIN_ID")
private Domain categoryDomain;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public boolean isDefaultSite() {
return defaultSite;
}
public void setDefaultSite(boolean defaultSite) {
this.defaultSite = defaultSite;
}
public Domain getCategoryDomain() {
return categoryDomain;
}
protected void setCategoryDomain(Domain categoryDomain) {
this.categoryDomain = categoryDomain;
}
@Override
public int hashCode() {
int hash = 7;
hash = 17 * hash + Objects.hashCode(name);
hash = 17 * hash + (defaultSite ? 1 : 0);
hash = 17 * hash + Objects.hashCode(categoryDomain);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Site)) {
return false;
}
final Site other = (Site) obj;
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(name, other.getName())) {
return false;
}
if (defaultSite != other.isDefaultSite()) {
return false;
}
return Objects.equals(categoryDomain, other.getCategoryDomain());
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof Site;
}
@Override
public String toString(final String data) {
return super.toString(String.format(
", name = \"%s\","
+ "defaultSite = %b%s",
name,
defaultSite,
data
));
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.sites;
import org.libreccm.core.CcmObjectRepository;
import javax.enterprise.context.RequestScoped;
import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
public class SiteRepository extends CcmObjectRepository {
@Transactional(Transactional.TxType.REQUIRED)
public Site findByName(final String name) {
final TypedQuery<Site> query = getEntityManager()
.createNamedQuery("Site.findByName", Site.class);
query.setParameter("name", name);
return query.getSingleResult();
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.sites;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
*
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@ApplicationPath("/pages")
public class Sites extends Application {
@Override
public Set<Class<?>> getClasses() {
final Set<Class<?>> classes = new HashSet<>();
classes.add(Pages.class);
return classes;
}
}

View File

@ -0,0 +1,131 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.ui;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;
import org.librecms.contentsection.ContentItem;
import org.librecms.contenttypes.AuthoringKitInfo;
import org.librecms.contenttypes.AuthoringStepInfo;
import org.librecms.contenttypes.ContentTypeInfo;
import org.librecms.contenttypes.ContentTypesManager;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.ResourceBundle;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ContentItemEditor extends Window {
private static final long serialVersionUID = 3341827053652019616L;
private List<Component> authoringsSteps;
public ContentItemEditor(final ContentSectionViewController controller,
final ContentItem item) {
super();
final ContentTypesManager typesManager = controller
.getContentTypesManager();
final ContentTypeInfo typeInfo = typesManager
.getContentTypeInfo(item.getContentType());
final AuthoringKitInfo authoringKitInfo = typeInfo.getAuthoringKit();
final List<AuthoringStepInfo> authoringsStepInfos = authoringKitInfo
.getAuthoringSteps();
final VerticalLayout sidebar = new VerticalLayout();
final VerticalLayout mainArea = new VerticalLayout();
for (final AuthoringStepInfo stepInfo : authoringsStepInfos) {
final String componentClassName;
if (stepInfo.getComponent().getName()
.startsWith("com.arsdigita.cms")) {
componentClassName = stepInfo
.getComponent()
.getName()
.replace("com.arsdigita.cms", "org.librecms");
} else if (stepInfo.getComponent().getName().startsWith(
"com.arsdigita")) {
componentClassName = stepInfo
.getComponent()
.getName()
.replace("com.arsdigita", "org.libreccm");
} else {
componentClassName = stepInfo.getComponent().getName();
}
final Component authoringStep = createAuthoringStep(
controller, item, componentClassName);
final ResourceBundle resourceBundle = ResourceBundle
.getBundle(stepInfo.getLabelBundle(),
controller
.getGlobalizationHelper()
.getNegotiatedLocale());
final Button button = new Button(resourceBundle
.getString(stepInfo.getLabelKey()));
button.addStyleName(ValoTheme.BUTTON_LINK);
button.addClickListener(event-> authoringStep.setVisible(true));
authoringStep.setVisible(false);
sidebar.addComponent(button);
mainArea.addComponent(authoringStep);
authoringsSteps.add(authoringStep);
}
authoringsSteps.get(0).setVisible(true);
}
private Component createAuthoringStep(
final ContentSectionViewController controller,
final ContentItem item,
final String componentClassName) {
try {
@SuppressWarnings("unchecked")
final Class<Component> stepClass = (Class<Component>) Class
.forName(componentClassName);
return stepClass
.getDeclaredConstructor(ContentSectionViewController.class,
ContentItem.class)
.newInstance(controller, item);
} catch (ClassNotFoundException
| NoSuchMethodException
| InstantiationException
| IllegalAccessException
| InvocationTargetException ex) {
final Label label = new Label(String
.format("AuthoringStep \"%s\" not available",
componentClassName));
label.addStyleName(ValoTheme.LABEL_FAILURE);
return new VerticalLayout(label);
}
}
}

View File

@ -21,7 +21,6 @@ package org.librecms.ui;
import com.vaadin.cdi.ViewScoped;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.PermissionChecker;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.FolderRepository;
import org.librecms.contenttypes.ContentTypesManager;

View File

@ -0,0 +1,20 @@
create table CCM_CMS.SITES (
DEFAULT_SITE boolean,
NAME varchar(255),
OBJECT_ID bigint not null,
CATEGORY_DOMAIN_ID bigint,
primary key (OBJECT_ID)
);
alter table CCM_CMS.SITES
add constraint UK_fgjx0nuuxlgnuit724a96vw81 unique (NAME);
alter table CCM_CMS.SITES
add constraint FKmiysfmv1nkcso6bm18sjhvtm8
foreign key (CATEGORY_DOMAIN_ID)
references CCM_CORE.CATEGORY_DOMAINS;
alter table CCM_CMS.SITES
add constraint FK5kmn26x72uue9t3dfnjwes45
foreign key (OBJECT_ID)
references CCM_CORE.APPLICATIONS;

View File

@ -0,0 +1,20 @@
create table CCM_CMS.SITES (
DEFAULT_SITE boolean,
NAME varchar(255),
OBJECT_ID int8 not null,
CATEGORY_DOMAIN_ID int8,
primary key (OBJECT_ID)
);
alter table CCM_CMS.SITES
add constraint UK_fgjx0nuuxlgnuit724a96vw81 unique (NAME);
alter table CCM_CMS.SITES
add constraint FKmiysfmv1nkcso6bm18sjhvtm8
foreign key (CATEGORY_DOMAIN_ID)
references CCM_CORE.CATEGORY_DOMAINS;
alter table CCM_CMS.SITES
add constraint FK5kmn26x72uue9t3dfnjwes45
foreign key (OBJECT_ID)
references CCM_CORE.APPLICATIONS;

View File

@ -447,3 +447,13 @@ cms.ui.authoring.assets.related_info_step.internal_link.target_item=Target
item_category_step.label=Assigned categories
related_info_step.description=Assign this item to categories
cms.ui.authoring.launch_date_required=Lauch date is required
cms.ui.item.lifecycle.apply=Select a lifecycle to apply
cms.ui.item.lifecycle=Lifecycle
cms.ui.item.lifecycle.start_date=Start date
cms.ui.item.lifecycle.end_date=End date
cms.ui.item.lifecycle.start_time=Start time
cms.ui.item.lifecycle.end_time\ =End time
cms.ui.item.notification_period=Notify in advance
cms.ui.item.days=days
cms.ui.item.hours=hours
cms.ui.item.lifecycle.publish=Publish content item

View File

@ -444,3 +444,13 @@ cms.ui.authoring.assets.related_info_step.internal_link.target_item=Ziel
item_category_step.label=Zugewiesene Kategorien
related_info_step.description=Dieses Dokument Kategorien zuweisen
cms.ui.authoring.launch_date_required=Lauch date is required
cms.ui.item.lifecycle.apply=Anzuwendenen Veroffentlichungszyklus ausw\u00e4hlen
cms.ui.item.lifecycle=Ver\u00f6ffentlichungszyklus
cms.ui.item.lifecycle.start_date=Beginnt am
cms.ui.item.lifecycle.end_date=Endet am
cms.ui.item.lifecycle.start_time=Beginnt um
cms.ui.item.lifecycle.end_time\ =Endet um
cms.ui.item.notification_period=Vorab Benachrichtigung
cms.ui.item.days=Tage
cms.ui.item.hours=Stunden
cms.ui.item.lifecycle.publish=Dokument ver\u00f6ffentlichen

View File

@ -403,3 +403,13 @@ cms.ui.authoring.assets.related_info_step.internal_link.target_item=Target
item_category_step.label=Assigned categories
related_info_step.description=Assign this item to categories
cms.ui.authoring.launch_date_required=Lauch date is required
cms.ui.item.lifecycle.apply=Select a lifecycle to apply
cms.ui.item.lifecycle=Lifecycle
cms.ui.item.lifecycle.start_date=Start date
cms.ui.item.lifecycle.end_date=End date
cms.ui.item.lifecycle.start_time=Start time
cms.ui.item.lifecycle.end_time\ =End time
cms.ui.item.notification_period=Notify in advance
cms.ui.item.days=days
cms.ui.item.hours=hours
cms.ui.item.lifecycle.publish=Publish content item

View File

@ -3,8 +3,8 @@ drop schema if exists CCM_CORE;
drop sequence if exists HIBERNATE_SEQUENCE;
create schema CCM_CMS;
create schema CCM_CORE;
create schema CCM_CMS;
create schema CCM_CORE;
create table CCM_CMS.ARTICLE_TEXTS (
OBJECT_ID bigint not null,
@ -814,6 +814,14 @@ create schema CCM_CORE;
primary key (OBJECT_ID, REV)
);
create table CCM_CMS.SITES (
DEFAULT_SITE boolean,
NAME varchar(255),
OBJECT_ID bigint not null,
CATEGORY_DOMAIN_ID bigint,
primary key (OBJECT_ID)
);
create table CCM_CMS.VIDEO_ASSETS (
HEIGHT bigint,
WIDTH bigint,
@ -843,6 +851,9 @@ create schema CCM_CORE;
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID);
alter table CCM_CMS.SITES
add constraint UK_fgjx0nuuxlgnuit724a96vw81 unique (NAME);
create table CCM_CORE.APPLICATIONS (
APPLICATION_TYPE varchar(1024) not null,
PRIMARY_URL varchar(1024) not null,
@ -1368,11 +1379,11 @@ create schema CCM_CORE;
SETTING_ID bigint not null,
CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null,
SETTING_VALUE_DOUBLE double,
SETTING_VALUE_LONG bigint,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_LONG bigint,
SETTING_VALUE_DOUBLE double,
primary key (SETTING_ID)
);
@ -1490,7 +1501,7 @@ create schema CCM_CORE;
create table CCM_CORE.WORKFLOWS (
WORKFLOW_ID bigint not null,
ABSTRACT_WORKFLOW boolean,
abstract_workflow boolean,
ACTIVE boolean,
WORKFLOW_STATE varchar(255),
TASKS_STATE varchar(255),
@ -2254,6 +2265,16 @@ create schema CCM_CORE;
foreign key (OBJECT_ID, REV)
references CCM_CMS.ASSETS_AUD;
alter table CCM_CMS.SITES
add constraint FKmiysfmv1nkcso6bm18sjhvtm8
foreign key (CATEGORY_DOMAIN_ID)
references CCM_CORE.CATEGORY_DOMAINS;
alter table CCM_CMS.SITES
add constraint FK5kmn26x72uue9t3dfnjwes45
foreign key (OBJECT_ID)
references CCM_CORE.APPLICATIONS;
alter table CCM_CMS.VIDEO_ASSETS
add constraint FKjuywvv7wq9pyid5b6ivyrc0yk
foreign key (LEGAL_METADATA_ID)

View File

@ -25,12 +25,30 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.web.CcmApplication;
import javax.persistence.*;
import java.io.Serializable;
import java.util.*;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* The {@code Resource} class is a base class for several other classes, for
* example the {@link CcmApplication} class.

View File

@ -20,11 +20,22 @@ package org.libreccm.pagemodel;
import org.libreccm.core.CoreConstants;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* Base class for the components model for use in a {@link PageModel}. This
* class is not designed for direct use. Instead the classes for concrete

View File

@ -28,8 +28,7 @@ import javax.enterprise.context.RequestScoped;
*
* An implementation should add all default components which have to be present
* in page. The {@link PageModel} should only specify
* <strong>additional</strong>
* components.
* <strong>additional</strong> components.
*
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
@ -39,7 +38,7 @@ public interface PageBuilder<P> {
/**
* Build a page for the view technology supported by this page builder
* without an additional components.
* without any additional components.
* {@link #buildPage(org.libreccm.pagemodel.PageModel)} should use this
* method for creating the default page.
*

View File

@ -22,13 +22,32 @@ import org.libreccm.core.CoreConstants;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.web.CcmApplication;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
* A {@link PageModel} is used by a {@link PageBuilder} implementation to build
* a page. The {@code PageModel} specifics which components are used on a page.

View File

@ -162,11 +162,4 @@ public class Group extends Party implements Serializable, Portable {
return super.hashCode();
}
@Override
public String toString(final String data) {
return super.toString(String.format(", members = { %s }%s",
Objects.toString(memberships),
data));
}
}

View File

@ -22,10 +22,10 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashSet;
@ -35,6 +35,21 @@ import java.util.Set;
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.NamedAttributeNode;
import javax.persistence.NamedEntityGraph;
import javax.persistence.NamedEntityGraphs;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
* Party is a base class for {@link User} and {@link Group} defining some common
* characteristics and associations, especially the association to
@ -178,13 +193,11 @@ public class Party implements Serializable {
public String toString(final String data) {
return String.format("%s{ "
+ "partyId = %d, "
+ "name = \"%s\", "
+ "roles = { %s }%s"
+ "name = \"%s\"%s"
+ " }",
super.toString(),
partyId,
name,
Objects.toString(roleMemberships),
data);
}

View File

@ -43,6 +43,8 @@ public class ConfirmDialog extends Window {
private Button cancelButton;
public ConfirmDialog(final Callable<Void> confirmedAction) {
super();
this.confirmedAction = confirmedAction;
this.cancelAction = () -> {
close();
@ -53,6 +55,8 @@ public class ConfirmDialog extends Window {
public ConfirmDialog(final Callable<Void> confirmedAction,
final Callable<Void> cancelAction) {
super();
this.confirmedAction = confirmedAction;
this.cancelAction = cancelAction;
addWidgets();