CCM NG: First part of sites/pages application

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5035 8810af33-2d31-482b-a856-94f89814c4df
ccm-docs
jensp 2017-10-10 17:27:02 +00:00
parent ffcbfa2a2a
commit 99b3e513aa
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, public static String getItemURL(final ContentItem item,
final int tab) { final int tab) {
final ContentSection section = item.getContentType().getContentSection(); final ContentSection section = item.getContentType().getContentSection();
if (section == null) { if (section == null) {

View File

@ -65,7 +65,10 @@ import org.apache.logging.log4j.LogManager;
import org.arsdigita.cms.CMSConfig; import org.arsdigita.cms.CMSConfig;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.configuration.ConfigurationManager; import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.workflow.Task;
import org.libreccm.workflow.TaskRepository;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.contenttypes.AuthoringKit; import org.librecms.contenttypes.AuthoringKit;
@ -576,7 +579,17 @@ public class AuthoringKitWizard extends LayoutPanel implements Resettable {
.getSelectedKey(state) .getSelectedKey(state)
.toString(); .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; 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.Categorization;
import org.libreccm.categorization.Category; 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.ContentItem;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentItemRepository; import org.librecms.contentsection.ContentItemRepository;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository; import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.lifecycle.Lifecycle;
import org.librecms.lifecycle.LifecycleDefinition; 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.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
@ -41,12 +62,39 @@ import javax.transaction.Transactional;
@RequestScoped @RequestScoped
public class ItemLifecycleAdminController { public class ItemLifecycleAdminController {
private static final Logger LOGGER = LogManager
.getLogger(ItemLifecycleAdminController.class);
@Inject
private ConfigurationManager confManager;
@Inject @Inject
private ContentItemRepository itemRepo; private ContentItemRepository itemRepo;
@Inject
private ContentItemManager itemManager;
@Inject
private LifecycleDefinitionRepository lifecycleDefRepo;
@Inject
private LifecycleManager lifecycleManager;
@Inject
private PhaseRepository phaseRepo;
@Inject @Inject
private ContentSectionRepository sectionRepo; private ContentSectionRepository sectionRepo;
@Inject
private TaskManager taskManager;
@Inject
private WorkflowManager workflowManager;
@Inject
private WorkflowRepository workflowRepo;
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public boolean isAssignedToAbstractCategory(final ContentItem item) { public boolean isAssignedToAbstractCategory(final ContentItem item) {
@ -91,7 +139,135 @@ public class ItemLifecycleAdminController {
.format("No ContentItem with ID %d in the database.", .format("No ContentItem with ID %d in the database.",
item.getObjectId()))); 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.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer; import java.io.Writer;
import java.math.BigDecimal;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -284,14 +285,16 @@ class ItemLifecycleSelectForm extends BaseForm {
final Locale locale = globalizationHelper.getNegotiatedLocale(); final Locale locale = globalizationHelper.getNegotiatedLocale();
for (final LifecycleDefinition definition : definitions) { for (final LifecycleDefinition definition : definitions) {
final List<PhaseDefinition> phaseDefinitions = definition // final List<PhaseDefinition> phaseDefinitions = definition
.getPhaseDefinitions(); // .getPhaseDefinitions();
//
if (!phaseDefinitions.isEmpty()) { // if (!phaseDefinitions.isEmpty()) {
target.addOption(new Option( target.addOption(
new Option(
Long.toString(definition.getDefinitionId()), 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 @Override
public final void init(final FormSectionEvent event) { public final void init(final FormSectionEvent event) {
final PageState state = event.getPageState(); final PageState state = event.getPageState();
final ContentItem item = itemRequestLocal.getContentItem(state); final ContentItem item = itemRequestLocal.getContentItem(state);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ContentItemManager itemManager = cdiUtil.findBean( final ContentItemManager itemManager = cdiUtil
ContentItemManager.class); .findBean(ContentItemManager.class);
final ItemLifecycleAdminController controller = cdiUtil final ItemLifecycleAdminController controller = cdiUtil
.findBean(ItemLifecycleAdminController.class); .findBean(ItemLifecycleAdminController.class);
@ -315,8 +319,11 @@ class ItemLifecycleSelectForm extends BaseForm {
// If the item is published, select the currently // If the item is published, select the currently
// associated lifecycle. // associated lifecycle.
final LifecycleDefinition definition = item.getLifecycle() final LifecycleDefinition definition = controller
.getDefinition(); .getDefinitionOfLifecycle(item);
// final LifecycleDefinition definition = item
// .getLifecycle()
// .getDefinition();
cycleSelect.setValue(state, definition.getDefinitionId()); cycleSelect.setValue(state, definition.getDefinitionId());
} else { } else {
// Set the default lifecycle (if it exists). // Set the default lifecycle (if it exists).
@ -382,6 +389,8 @@ class ItemLifecycleSelectForm extends BaseForm {
final PageState state = event.getPageState(); final PageState state = event.getPageState();
final ContentItem item = itemRequestLocal.getContentItem(state); final ContentItem item = itemRequestLocal.getContentItem(state);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ItemLifecycleAdminController controller = cdiUtil
.findBean(ItemLifecycleAdminController.class);
final Publisher publisher = new Publisher(state); final Publisher publisher = new Publisher(state);
if (CMSConfig.getConfig().isThreadPublishing()) { if (CMSConfig.getConfig().isThreadPublishing()) {
@ -467,8 +476,7 @@ class ItemLifecycleSelectForm extends BaseForm {
if (CMSConfig.getConfig().isThreadPublishing()) { if (CMSConfig.getConfig().isThreadPublishing()) {
throw new RedirectSignal( throw new RedirectSignal(
URL.getDispatcherPath() URL.getDispatcherPath()
+ ContentItemPage.getItemURL(item, + controller.getPublishingTabUrl(item),
ContentItemPage.PUBLISHING_TAB),
true); true);
} else { } else {
if (CMSConfig.getConfig().isUseStreamlinedCreation()) { if (CMSConfig.getConfig().isUseStreamlinedCreation()) {
@ -649,7 +657,13 @@ class ItemLifecycleSelectForm extends BaseForm {
//item = m_item.getContentItem(state); //item = m_item.getContentItem(state);
itemUuid = itemRequestLocal.getContentItem(state).getItemUuid(); 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); defID = (Long) cycleSelect.getValue(state);
} else {
defID = Long.parseLong(cycleSelect.getValue(state).toString());
}
final Calendar start = Calendar.getInstance(); final Calendar start = Calendar.getInstance();
start.setTime((java.util.Date) startDateField.getValue(state)); start.setTime((java.util.Date) startDateField.getValue(state));
@ -715,79 +729,84 @@ class ItemLifecycleSelectForm extends BaseForm {
public void publish() { public void publish() {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ContentItemRepository itemRepo = cdiUtil.findBean( final ItemLifecycleAdminController controller = cdiUtil
ContentItemRepository.class); .findBean(ItemLifecycleAdminController.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(); controller.publish(itemUuid, defID, endDate, workflowUuid, user);
// If the item is already published, remove the current lifecycle. // final ContentItemRepository itemRepo = cdiUtil.findBean(
// Do not touch the live version. // ContentItemRepository.class);
if (itemManager.isLive(item)) { // final ContentItemManager itemManager = cdiUtil.findBean(
item.setLifecycle(null); // ContentItemManager.class);
itemRepo.save(item); // final PhaseRepository phaseRepo = cdiUtil.findBean(
} // PhaseRepository.class);
// final LifecycleDefinitionRepository lifecycleDefRepo = cdiUtil
ContentItem pending; // .findBean(LifecycleDefinitionRepository.class);
final LifecycleDefinition cycleDef; // final LifecycleManager lifecycleManager = cdiUtil.findBean(
final Lifecycle lifecycle; // LifecycleManager.class);
// Apply the new lifecycle. //
cycleDef = lifecycleDefRepo.findById(defID).get(); // final ContentItem item = itemRepo.findByUuid(itemUuid).get();
pending = itemManager.publish(item, cycleDef); //
lifecycle = pending.getLifecycle(); // // If the item is already published, remove the current lifecycle.
// // Do not touch the live version.
if (endDate != null) { // if (itemManager.isLive(item)) {
// item.setLifecycle(null);
// update individual phases // itemRepo.save(item);
final List<Phase> phases = lifecycle.getPhases(); // }
//
for (final Phase phase : phases) { // ContentItem pending;
final java.util.Date thisEnd = phase.getEndDateTime(); // final LifecycleDefinition cycleDef;
final java.util.Date thisStart = phase.getStartDateTime(); // final Lifecycle lifecycle;
if (thisStart.compareTo(endDate) > 0) { // // Apply the new lifecycle.
phase.setStartDateTime(endDate); // cycleDef = lifecycleDefRepo.findById(defID).get();
phaseRepo.save(phase); // pending = itemManager.publish(item, cycleDef);
} // lifecycle = pending.getLifecycle();
} //
} // if (endDate != null) {
//
// endOfCycle may be the original date according to lifecycle phase definitions, or endDate if that was before // // update individual phases
// natural end of lifecycle // final List<Phase> phases = lifecycle.getPhases();
final java.util.Date endOfCycle = lifecycle.getEndDateTime(); //
if (endOfCycle != null) { // for (final Phase phase : phases) {
// final java.util.Date thisEnd = phase.getEndDateTime();
// if advance notification is requested (!= 0) // final java.util.Date thisStart = phase.getStartDateTime();
// add another phase at the start of which the user is notified // if (thisStart.compareTo(endDate) > 0) {
java.util.Date notificationDate; // phase.setStartDateTime(endDate);
// phaseRepo.save(phase);
int notificationPeriod = 0; // }
if (notificationDays != null) { // }
notificationPeriod += notificationDays * 24; // }
} //
if (notificationHours != null) { // // endOfCycle may be the original date according to lifecycle phase definitions, or endDate if that was before
notificationPeriod += notificationHours; // // natural end of lifecycle
} // final java.util.Date endOfCycle = lifecycle.getEndDateTime();
} // if (endOfCycle != null) {
//
// Force the lifecycle scheduler to run to avoid any // // if advance notification is requested (!= 0)
// scheduler delay for items that should be published // // add another phase at the start of which the user is notified
// immediately. // java.util.Date notificationDate;
lifecycleManager.startLifecycle(pending.getLifecycle()); //
// int notificationPeriod = 0;
if (workflowUuid != null) { // if (notificationDays != null) {
final WorkflowRepository workflowRepo = cdiUtil.findBean( // notificationPeriod += notificationDays * 24;
WorkflowRepository.class); // }
final Workflow workflow = workflowRepo.findByUuid(workflowUuid) // if (notificationHours != null) {
.get(); // notificationPeriod += notificationHours;
finish(workflow, item, user); // }
} // }
//
// // 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.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.workflow.TaskComment;
import org.libreccm.workflow.TaskManager; import org.libreccm.workflow.TaskManager;
import org.libreccm.workflow.TaskRepository; import org.libreccm.workflow.TaskRepository;
@ -39,7 +38,8 @@ import org.libreccm.workflow.TaskRepository;
*/ */
class CommentAddForm extends BaseForm { 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 TaskRequestLocal selectedTask;
private final TextArea comment; private final TextArea comment;
@ -63,17 +63,23 @@ class CommentAddForm extends BaseForm {
} }
private class ProcessListener implements FormProcessListener { private class ProcessListener implements FormProcessListener {
@Override @Override
public final void process(final FormSectionEvent event) public final void process(final FormSectionEvent event)
throws FormProcessException { throws FormProcessException {
LOGGER.debug("Processing comment add"); LOGGER.debug("Processing comment add");
final PageState state = event.getPageState(); final PageState state = event.getPageState();
if (comment.getValue(state) != null
&& !((String) comment.getValue(state)).isEmpty()) {
final CmsTask task = selectedTask.getTask(state); final CmsTask task = selectedTask.getTask(state);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final TaskRepository taskRepo = cdiUtil.findBean(TaskRepository.class); final TaskFinishFormController controller = cdiUtil
final TaskManager taskManager = cdiUtil.findBean(TaskManager.class); .findBean(TaskFinishFormController.class);
taskManager.addComment(task, (String) comment.getValue(state)); 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.configuration.ConfigurationManager;
import org.libreccm.security.PermissionChecker; import org.libreccm.security.PermissionChecker;
import org.libreccm.workflow.AssignableTask; 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.Workflow;
import org.libreccm.workflow.WorkflowManager;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemRepository; import org.librecms.contentsection.ContentItemRepository;
@ -170,13 +166,8 @@ public final class TaskFinishForm extends CommentAddForm {
permissionChecker.checkPermission(task.getTaskType().getPrivilege(), permissionChecker.checkPermission(task.getTaskType().getPrivilege(),
item.get()); item.get());
final TaskRepository taskRepo = cdiUtil.findBean( final TaskFinishFormController controller = cdiUtil
TaskRepository.class); .findBean(TaskFinishFormController.class);
final WorkflowManager workflowManager = cdiUtil.findBean(
WorkflowManager.class);
final TaskManager taskManager = cdiUtil.findBean(TaskManager.class);
final AssignableTaskManager assignableTaskManager = cdiUtil
.findBean(AssignableTaskManager.class);
final ConfigurationManager confManager = cdiUtil.findBean( final ConfigurationManager confManager = cdiUtil.findBean(
ConfigurationManager.class); ConfigurationManager.class);
final KernelConfig kernelConfig = confManager.findConfiguration( final KernelConfig kernelConfig = confManager.findConfiguration(
@ -194,7 +185,7 @@ public final class TaskFinishForm extends CommentAddForm {
if (isApproved.equals(Boolean.TRUE)) { if (isApproved.equals(Boolean.TRUE)) {
LOGGER.debug("The task is approved; finishing the task"); LOGGER.debug("The task is approved; finishing the task");
taskManager.finish(task); controller.finish(task);
finishedTask = true; finishedTask = true;
} else { } else {
LOGGER.debug("The task is rejected; reenabling dependent " LOGGER.debug("The task is rejected; reenabling dependent "
@ -206,17 +197,16 @@ public final class TaskFinishForm extends CommentAddForm {
dependent.getLabel().getValue( dependent.getLabel().getValue(
kernelConfig.getDefaultLocale())); kernelConfig.getDefaultLocale()));
taskManager.enable(dependent); controller.enable(dependent);
} }
} }
} else { } else {
LOGGER.debug("The task does not require approval; finishing it"); LOGGER.debug("The task does not require approval; finishing it");
taskManager.disable(task); controller.finish(task);
finishedTask = true;
} }
if (finishedTask) { if (finishedTask) {
final TaskFinishFormController controller = cdiUtil.findBean(
TaskFinishFormController.class);
final Workflow workflow = task.getWorkflow(); final Workflow workflow = task.getWorkflow();
final List<AssignableTask> tasks = controller.findEnabledTasks( final List<AssignableTask> tasks = controller.findEnabledTasks(
workflow); workflow);
@ -231,16 +221,16 @@ public final class TaskFinishForm extends CommentAddForm {
if (permissionChecker.isPermitted(privilege, if (permissionChecker.isPermitted(privilege,
workflow.getObject())) { workflow.getObject())) {
//Lock task for current user //Lock task for current user
assignableTaskManager.lockTask(currentCmsTask); controller.lock(currentCmsTask);
if (CmsTaskType.DEPLOY == currentCmsTask.getTaskType()) { if (CmsTaskType.DEPLOY == currentCmsTask.getTaskType()) {
} else { } else {
throw new RedirectSignal( throw new RedirectSignal(
URL.there(state.getRequest(), URL.there(
ContentItemPage.getItemURL( state.getRequest(),
item.get(), controller
ContentItemPage.PUBLISHING_TAB)), .getContentItemPublishUrl(item.get())),
true); true);
} }

View File

@ -18,12 +18,20 @@
*/ */
package com.arsdigita.cms.ui.workflow; package com.arsdigita.cms.ui.workflow;
import com.arsdigita.cms.ui.ContentItemPage;
import org.libreccm.security.Role; import org.libreccm.security.Role;
import org.libreccm.security.Shiro; import org.libreccm.security.Shiro;
import org.libreccm.security.User; import org.libreccm.security.User;
import org.libreccm.workflow.AssignableTask; import org.libreccm.workflow.AssignableTask;
import org.libreccm.workflow.AssignableTaskManager; 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.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.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -40,7 +48,16 @@ import javax.transaction.Transactional;
public class TaskFinishFormController { public class TaskFinishFormController {
@Inject @Inject
private AssignableTaskManager taskManager; private ContentItemRepository itemRepo;
@Inject
private TaskRepository taskRepo;
@Inject
private TaskManager taskManager;
@Inject
private AssignableTaskManager assignableTaskManager;
@Inject @Inject
private Shiro shiro; private Shiro shiro;
@ -52,7 +69,71 @@ public class TaskFinishFormController {
.map(membership -> membership.getRole()) .map(membership -> membership.getRole())
.collect(Collectors.toList()); .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; private boolean useOldStyleItemLifecycleItemPane = false;
@Setting @Setting
private boolean threadPublishing = true; private boolean threadPublishing = false;
@Setting @Setting
private String publishingFailureSender = ""; private String publishingFailureSender = "";

View File

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

View File

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

View File

@ -127,8 +127,11 @@ public class LifecycleManager {
phaseRepo.save(phase); phaseRepo.save(phase);
}); });
if (lifecycle.getPhases() != null
&& !lifecycle.getPhases().isEmpty()) {
lifecycle.getPhases().get(0).setStarted(true); lifecycle.getPhases().get(0).setStarted(true);
phaseRepo.save(lifecycle.getPhases().get(0)); phaseRepo.save(lifecycle.getPhases().get(0));
}
lifecycleRepo.save(lifecycle); lifecycleRepo.save(lifecycle);
@ -201,6 +204,11 @@ public class LifecycleManager {
private void invokeLifecycleEventListener(final Lifecycle lifecycle, private void invokeLifecycleEventListener(final Lifecycle lifecycle,
final LifecycleEvent event) { final LifecycleEvent event) {
final String listenerClassName = lifecycle.getListener(); final String listenerClassName = lifecycle.getListener();
if (listenerClassName == null || listenerClassName.isEmpty()) {
return;
}
final Class<?> listenerClass; final Class<?> listenerClass;
try { try {
listenerClass = Class.forName(listenerClassName); listenerClass = Class.forName(listenerClassName);
@ -208,6 +216,7 @@ public class LifecycleManager {
LOGGER.error("Failed to find LifecycleListener class \"{}\". " LOGGER.error("Failed to find LifecycleListener class \"{}\". "
+ "Listener is ignored.", + "Listener is ignored.",
listenerClassName); listenerClassName);
LOGGER.error(ex);
return; return;
} }
@ -222,8 +231,8 @@ public class LifecycleManager {
final Object object; final Object object;
try { try {
object = listenerClass.newInstance(); object = listenerClass.newInstance();
} catch (IllegalAccessException | } catch (IllegalAccessException
InstantiationException ex) { | InstantiationException ex) {
LOGGER.error("Failed to create instance of LifecycleEventListener " LOGGER.error("Failed to create instance of LifecycleEventListener "
+ "of class \"{}\".", + "of class \"{}\".",
listenerClass.getName()); listenerClass.getName());
@ -267,8 +276,8 @@ public class LifecycleManager {
final Object object; final Object object;
try { try {
object = listenerClass.newInstance(); object = listenerClass.newInstance();
} catch (IllegalAccessException | } catch (IllegalAccessException
InstantiationException ex) { | InstantiationException ex) {
LOGGER.error("Failed to create instance of PhaseEventListener " LOGGER.error("Failed to create instance of PhaseEventListener "
+ "of class \"{}\".", + "of class \"{}\".",
listenerClass.getName()); 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 com.vaadin.cdi.ViewScoped;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.security.PermissionChecker; import org.libreccm.security.PermissionChecker;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository; import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.FolderRepository; import org.librecms.contentsection.FolderRepository;
import org.librecms.contenttypes.ContentTypesManager; 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 item_category_step.label=Assigned categories
related_info_step.description=Assign this item to categories related_info_step.description=Assign this item to categories
cms.ui.authoring.launch_date_required=Lauch date is required 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 item_category_step.label=Zugewiesene Kategorien
related_info_step.description=Dieses Dokument Kategorien zuweisen related_info_step.description=Dieses Dokument Kategorien zuweisen
cms.ui.authoring.launch_date_required=Lauch date is required 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 item_category_step.label=Assigned categories
related_info_step.description=Assign this item to categories related_info_step.description=Assign this item to categories
cms.ui.authoring.launch_date_required=Lauch date is required 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; drop sequence if exists HIBERNATE_SEQUENCE;
create schema CCM_CMS; create schema CCM_CMS;
create schema CCM_CORE; create schema CCM_CORE;
create table CCM_CMS.ARTICLE_TEXTS ( create table CCM_CMS.ARTICLE_TEXTS (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
@ -814,6 +814,14 @@ create schema CCM_CORE;
primary key (OBJECT_ID, REV) 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 ( create table CCM_CMS.VIDEO_ASSETS (
HEIGHT bigint, HEIGHT bigint,
WIDTH bigint, WIDTH bigint,
@ -843,6 +851,9 @@ create schema CCM_CORE;
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID); add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID);
alter table CCM_CMS.SITES
add constraint UK_fgjx0nuuxlgnuit724a96vw81 unique (NAME);
create table CCM_CORE.APPLICATIONS ( create table CCM_CORE.APPLICATIONS (
APPLICATION_TYPE varchar(1024) not null, APPLICATION_TYPE varchar(1024) not null,
PRIMARY_URL varchar(1024) not null, PRIMARY_URL varchar(1024) not null,
@ -1368,11 +1379,11 @@ create schema CCM_CORE;
SETTING_ID bigint not null, SETTING_ID bigint not null,
CONFIGURATION_CLASS varchar(512) not null, CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null, NAME varchar(512) not null,
SETTING_VALUE_DOUBLE double,
SETTING_VALUE_LONG bigint,
SETTING_VALUE_BOOLEAN boolean, SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_STRING varchar(1024), SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_LONG bigint,
SETTING_VALUE_DOUBLE double,
primary key (SETTING_ID) primary key (SETTING_ID)
); );
@ -1490,7 +1501,7 @@ create schema CCM_CORE;
create table CCM_CORE.WORKFLOWS ( create table CCM_CORE.WORKFLOWS (
WORKFLOW_ID bigint not null, WORKFLOW_ID bigint not null,
ABSTRACT_WORKFLOW boolean, abstract_workflow boolean,
ACTIVE boolean, ACTIVE boolean,
WORKFLOW_STATE varchar(255), WORKFLOW_STATE varchar(255),
TASKS_STATE varchar(255), TASKS_STATE varchar(255),
@ -2254,6 +2265,16 @@ create schema CCM_CORE;
foreign key (OBJECT_ID, REV) foreign key (OBJECT_ID, REV)
references CCM_CMS.ASSETS_AUD; 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 alter table CCM_CMS.VIDEO_ASSETS
add constraint FKjuywvv7wq9pyid5b6ivyrc0yk add constraint FKjuywvv7wq9pyid5b6ivyrc0yk
foreign key (LEGAL_METADATA_ID) 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.l10n.LocalizedString;
import org.libreccm.web.CcmApplication; import org.libreccm.web.CcmApplication;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.*;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; 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 * The {@code Resource} class is a base class for several other classes, for
* example the {@link CcmApplication} class. * example the {@link CcmApplication} class.

View File

@ -20,11 +20,22 @@ package org.libreccm.pagemodel;
import org.libreccm.core.CoreConstants; import org.libreccm.core.CoreConstants;
import javax.persistence.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; 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 * 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 * 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 * An implementation should add all default components which have to be present
* in page. The {@link PageModel} should only specify * in page. The {@link PageModel} should only specify
* <strong>additional</strong> * <strong>additional</strong> components.
* components.
* *
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @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 * 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 * {@link #buildPage(org.libreccm.pagemodel.PageModel)} should use this
* method for creating the default page. * 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.l10n.LocalizedString;
import org.libreccm.web.CcmApplication; import org.libreccm.web.CcmApplication;
import javax.persistence.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; 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 {@link PageModel} is used by a {@link PageBuilder} implementation to build
* a page. The {@code PageModel} specifics which components are used on a page. * 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(); 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.JsonIgnore;
import com.fasterxml.jackson.annotation.ObjectIdGenerators; import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import javax.persistence.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlElementWrapper;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; 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.CORE_XML_NS;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; 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 * Party is a base class for {@link User} and {@link Group} defining some common
* characteristics and associations, especially the association to * characteristics and associations, especially the association to
@ -178,13 +193,11 @@ public class Party implements Serializable {
public String toString(final String data) { public String toString(final String data) {
return String.format("%s{ " return String.format("%s{ "
+ "partyId = %d, " + "partyId = %d, "
+ "name = \"%s\", " + "name = \"%s\"%s"
+ "roles = { %s }%s"
+ " }", + " }",
super.toString(), super.toString(),
partyId, partyId,
name, name,
Objects.toString(roleMemberships),
data); data);
} }

View File

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