CCM NG/ccm-cms: FolderBrowser now shows up, buts needs more testing
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4561 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
82d0ceffbd
commit
0a51a89ca9
|
|
@ -186,8 +186,10 @@ public abstract class NewItemForm extends Form {
|
|||
if (isVisible(state)) {
|
||||
final ContentSection section = getContentSection(state);
|
||||
|
||||
final List<ContentType> types = section.getContentTypes();
|
||||
boolean isEmpty = types.isEmpty();
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final NewItemFormController controller = cdiUtil.findBean(
|
||||
NewItemFormController.class);
|
||||
boolean isEmpty = !controller.hasContentTypes(section);
|
||||
|
||||
createLabel.setVisible(state, !isEmpty);
|
||||
typeSelect.setVisible(state, !isEmpty);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -22,6 +22,7 @@ import com.arsdigita.kernel.KernelConfig;
|
|||
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.libreccm.core.CcmObject;
|
||||
import org.libreccm.core.CcmObjectRepository;
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
|
|
@ -32,6 +33,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
|
@ -51,6 +53,9 @@ public class FolderBrowserController {
|
|||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Inject
|
||||
private CcmObjectRepository objectRepo;
|
||||
|
||||
@Inject
|
||||
private ConfigurationManager confManager;
|
||||
|
||||
|
|
@ -164,7 +169,7 @@ public class FolderBrowserController {
|
|||
final TypedQuery<CcmObject> query = entityManager.createNamedQuery(
|
||||
"Folder.findObjects", CcmObject.class);
|
||||
query.setParameter("folder", folder);
|
||||
query.setParameter(filterTerm, filterTerm);
|
||||
query.setParameter("term", filterTerm);
|
||||
|
||||
if (first > 0 && maxResults > 0) {
|
||||
query.setFirstResult(first);
|
||||
|
|
@ -174,40 +179,22 @@ public class FolderBrowserController {
|
|||
return query.getResultList();
|
||||
}
|
||||
|
||||
public int countObjects(final Folder folder) {
|
||||
return countObjects(folder, -1, -1);
|
||||
public long countObjects(final Folder folder) {
|
||||
return countObjects(folder, "%");
|
||||
}
|
||||
|
||||
public int countObjects(final Folder folder,
|
||||
final int frist,
|
||||
final int maxResults) {
|
||||
return countObjects(folder, "%", frist, maxResults);
|
||||
}
|
||||
|
||||
public int countObjects(final Folder folder,
|
||||
final String filterTerm) {
|
||||
return countObjects(folder, filterTerm, -1, -1);
|
||||
}
|
||||
|
||||
public int countObjects(final Folder folder,
|
||||
final String filterTerm,
|
||||
final int first,
|
||||
final int maxResults) {
|
||||
final TypedQuery<Integer> query = entityManager.createNamedQuery(
|
||||
"Folder.countObjects", Integer.class);
|
||||
public long countObjects(final Folder folder,
|
||||
final String filterTerm) {
|
||||
final TypedQuery<Long> query = entityManager.createNamedQuery(
|
||||
"Folder.countObjects", Long.class);
|
||||
query.setParameter("folder", folder);
|
||||
query.setParameter(filterTerm, filterTerm);
|
||||
|
||||
if (first > 0 && maxResults > 0) {
|
||||
query.setFirstResult(first);
|
||||
query.setMaxResults(maxResults);
|
||||
}
|
||||
query.setParameter("term", filterTerm);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected List<FolderBrowserTableRow> getObjectRows(final Folder folder) {
|
||||
List<FolderBrowserTableRow> getObjectRows(final Folder folder) {
|
||||
final List<CcmObject> objects = findObjects(folder);
|
||||
|
||||
return objects.stream()
|
||||
|
|
@ -216,8 +203,8 @@ public class FolderBrowserController {
|
|||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||
final String filterTerm) {
|
||||
List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||
final String filterTerm) {
|
||||
final List<CcmObject> objects = findObjects(folder,
|
||||
filterTerm);
|
||||
|
||||
|
|
@ -227,9 +214,9 @@ public class FolderBrowserController {
|
|||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||
final int first,
|
||||
final int maxResults) {
|
||||
List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||
final int first,
|
||||
final int maxResults) {
|
||||
final List<CcmObject> objects = findObjects(folder, first, maxResults);
|
||||
|
||||
return objects.stream()
|
||||
|
|
@ -238,10 +225,10 @@ public class FolderBrowserController {
|
|||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||
final String filterTerm,
|
||||
final int first,
|
||||
final int maxResults) {
|
||||
List<FolderBrowserTableRow> getObjectRows(final Folder folder,
|
||||
final String filterTerm,
|
||||
final int first,
|
||||
final int maxResults) {
|
||||
final List<CcmObject> objects = findObjects(folder,
|
||||
filterTerm,
|
||||
first,
|
||||
|
|
@ -297,4 +284,13 @@ public class FolderBrowserController {
|
|||
return row;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected void deleteObject(final long objectId) {
|
||||
final Optional<CcmObject> object = objectRepo.findById(objectId);
|
||||
|
||||
if (object.isPresent()) {
|
||||
objectRepo.delete(object.get());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package com.arsdigita.cms.ui.folder;
|
|||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.PaginationModelBuilder;
|
||||
import com.arsdigita.bebop.Paginator;
|
||||
import com.arsdigita.bebop.Table;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.librecms.contentsection.Folder;
|
||||
|
|
@ -66,9 +65,10 @@ class FolderBrowserPaginationModelBuilder implements PaginationModelBuilder {
|
|||
}
|
||||
|
||||
if (filterTerm == null) {
|
||||
return controller.countObjects(folder, first, pageSize);
|
||||
return (int) controller.countObjects(folder);
|
||||
} else {
|
||||
return controller.countObjects(folder, filter, first, pageSize);
|
||||
return (int) controller.countObjects(folder,
|
||||
filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,11 +26,9 @@ import com.arsdigita.bebop.table.TableModelBuilder;
|
|||
import com.arsdigita.util.LockableImpl;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
import org.librecms.contentsection.Folder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -102,19 +102,19 @@ import org.librecms.contentsection.privileges.ItemPrivileges;
|
|||
*/
|
||||
@SuppressWarnings("PMD.BeanMembersShouldSerialize")
|
||||
public class FolderManipulator extends SimpleContainer implements
|
||||
//FormProcessListener,
|
||||
//FormValidationListener,
|
||||
//FormSubmissionListener,
|
||||
Resettable {
|
||||
//FormProcessListener,
|
||||
//FormValidationListener,
|
||||
//FormSubmissionListener,
|
||||
Resettable {
|
||||
|
||||
//public static final String RESOURCE_BUNDLE = "com.arsdigita.cms.ui.folder.CMSFolderResources";
|
||||
private static final Logger LOGGER = LogManager.getLogger(
|
||||
FolderManipulator.class);
|
||||
FolderManipulator.class);
|
||||
|
||||
private static final String ATOZ_FILTER_PARAM = "aToZfilter";
|
||||
private static final String ACTION_PARAM = "act";
|
||||
private static final String FILTER_PARAM = "filter";
|
||||
|
||||
|
||||
private static final String SOURCES_PARAM = "srcs";
|
||||
private static final String MOVE = "Move";
|
||||
private static final String COPY = "Copy";
|
||||
|
|
@ -122,8 +122,9 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
//private static final String UNPUBLISH = "UnPublish";
|
||||
|
||||
private final ArrayParameter sourcesParam = new ArrayParameter(
|
||||
new BigDecimalParameter(SOURCES_PARAM));
|
||||
private final StringParameter actionParam = new StringParameter(ACTION_PARAM);
|
||||
new BigDecimalParameter(SOURCES_PARAM));
|
||||
private final StringParameter actionParam
|
||||
= new StringParameter(ACTION_PARAM);
|
||||
;
|
||||
/**
|
||||
* The folder in which the source items live.
|
||||
|
|
@ -135,32 +136,33 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
|
||||
private FilterForm filterForm;
|
||||
private final StringParameter atozFilterParam = new StringParameter(
|
||||
ATOZ_FILTER_PARAM);
|
||||
private final StringParameter filterParam = new StringParameter(FILTER_PARAM);
|
||||
|
||||
ATOZ_FILTER_PARAM);
|
||||
private final StringParameter filterParam
|
||||
= new StringParameter(FILTER_PARAM);
|
||||
|
||||
public FolderManipulator(final FolderSelectionModel folderModel) {
|
||||
|
||||
|
||||
super();
|
||||
|
||||
|
||||
sourceFolderModel = folderModel;
|
||||
itemView = new ItemView();
|
||||
itemView.addProcessListener(new ItemViewProcessListener());
|
||||
itemView.addValidationListener(new ItemViewValidationListener());
|
||||
add(itemView);
|
||||
|
||||
|
||||
targetSelector.addProcessListener(new TargetSelectorProcessListener());
|
||||
targetSelector.addValidationListener(
|
||||
new TargetSelectorValidationListener());
|
||||
new TargetSelectorValidationListener());
|
||||
targetSelector.addSubmissionListener(
|
||||
new TargetSelectorSubmissionListener());
|
||||
new TargetSelectorSubmissionListener());
|
||||
add(targetSelector);
|
||||
|
||||
//publishDialog.addProcessListener(new PublishDialogProcessListener());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void register(final Page page) {
|
||||
|
||||
|
||||
super.register(page);
|
||||
page.setVisibleDefault(targetSelector, false);
|
||||
page.setVisibleDefault(filterForm, true);
|
||||
|
|
@ -168,11 +170,11 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
page.addComponentStateParam(this, actionParam);
|
||||
page.addComponentStateParam(this, atozFilterParam);
|
||||
page.addComponentStateParam(this, filterParam);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public final Long[] getSources(final PageState state) {
|
||||
|
||||
|
||||
final Long[] result = (Long[]) state.getValue(sourcesParam);
|
||||
|
||||
//Return empty array instead of null.
|
||||
|
|
@ -182,19 +184,19 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public final FolderSelectionModel getSourceFolderModel() {
|
||||
return sourceFolderModel;
|
||||
}
|
||||
|
||||
|
||||
public final Category getTarget(final PageState state) {
|
||||
return targetSelector.getTarget(state);
|
||||
}
|
||||
|
||||
|
||||
protected final boolean isMove(final PageState state) {
|
||||
return MOVE.equals(getAction(state));
|
||||
}
|
||||
|
||||
|
||||
protected final boolean isCopy(final PageState state) {
|
||||
return COPY.equals(getAction(state));
|
||||
}
|
||||
|
|
@ -209,18 +211,18 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
private String getAction(final PageState state) {
|
||||
return (String) state.getValue(actionParam);
|
||||
}
|
||||
|
||||
|
||||
protected void moveItems(final Category target,
|
||||
final Long[] itemIds) {
|
||||
|
||||
|
||||
for (Long itemId : itemIds) {
|
||||
|
||||
|
||||
changeItemParent(itemId, target);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void changeItemParent(final Long itemId, final Category newParent) {
|
||||
|
||||
//ToDo
|
||||
|
|
@ -239,7 +241,7 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
// item.setParent(newParent);
|
||||
// item.save();
|
||||
}
|
||||
|
||||
|
||||
protected void copyItems(final Category target,
|
||||
final Long[] itemIds) {
|
||||
|
||||
|
|
@ -421,53 +423,53 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
public final FolderBrowser getBrowser() {
|
||||
return itemView.getBrowser();
|
||||
}
|
||||
|
||||
|
||||
private class ItemViewProcessListener implements FormProcessListener {
|
||||
|
||||
|
||||
public ItemViewProcessListener() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
FormProcessException {
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
|
||||
itemView.setVisible(state, false);
|
||||
targetSelector.setVisible(state, true);
|
||||
targetSelector.expose(state);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class TargetSelectorProcessListener implements FormProcessListener {
|
||||
|
||||
|
||||
public TargetSelectorProcessListener() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
|
||||
FormProcessException {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
|
||||
itemView.setVisible(state, true);
|
||||
targetSelector.setVisible(state, false);
|
||||
|
||||
|
||||
final Category folder = targetSelector.getTarget(state);
|
||||
final Long[] itemIds = getSources(state);
|
||||
|
||||
|
||||
if (isCopy(state)) {
|
||||
copyItems(folder, itemIds);
|
||||
} else if (isMove(state)) {
|
||||
moveItems(folder, itemIds);
|
||||
}
|
||||
|
||||
|
||||
reset(state);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// private class PublishDialogProcessListener implements FormProcessListener {
|
||||
|
|
@ -497,113 +499,113 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
//
|
||||
// }
|
||||
private class ItemViewValidationListener implements FormValidationListener {
|
||||
|
||||
|
||||
public ItemViewValidationListener() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validate(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
|
||||
FormProcessException {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
final FormData data = event.getFormData();
|
||||
|
||||
|
||||
if (getSources(state).length <= 0) {
|
||||
data.addError("cms.ui.folder.must_select_item",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class TargetSelectorValidationListener implements
|
||||
FormValidationListener {
|
||||
|
||||
FormValidationListener {
|
||||
|
||||
public TargetSelectorValidationListener() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validate(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
|
||||
FormProcessException {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
|
||||
if (getSources(state).length <= 0) {
|
||||
throw new IllegalStateException("No source items specified");
|
||||
}
|
||||
|
||||
|
||||
final Category target = targetSelector.getTarget(state);
|
||||
final FormData data = event.getFormData();
|
||||
if (target == null) {
|
||||
data.addError(new GlobalizedMessage(
|
||||
"cms.ui.folder.need_select_target_folder",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
"cms.ui.folder.need_select_target_folder",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
//If the target is null, we can skip the rest of the checks
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (target.equals(sourceFolderModel.getSelectedObject(state))) {
|
||||
data.addError(new GlobalizedMessage(
|
||||
"cms.ui.folder.not_within_same_folder",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
"cms.ui.folder.not_within_same_folder",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
}
|
||||
|
||||
// check create item permission
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||
PermissionChecker.class);
|
||||
PermissionChecker.class);
|
||||
if (!permissionChecker.isPermitted(
|
||||
ItemPrivileges.CREATE_NEW, target)) {
|
||||
ItemPrivileges.CREATE_NEW, target)) {
|
||||
data.addError("cms.ui.folder.no_permission_for_item",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE);
|
||||
}
|
||||
|
||||
|
||||
for (Long source : getSources(state)) {
|
||||
|
||||
|
||||
validateItem(source, target, state, data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void validateItem(final Long itemId,
|
||||
final Category target,
|
||||
final PageState state,
|
||||
final FormData data) {
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ContentItemRepository itemRepo = cdiUtil.findBean(
|
||||
ContentItemRepository.class);
|
||||
ContentItemRepository.class);
|
||||
final ContentItemManager itemManager = cdiUtil.findBean(
|
||||
ContentItemManager.class);
|
||||
ContentItemManager.class);
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||
PermissionChecker.class);
|
||||
|
||||
PermissionChecker.class);
|
||||
|
||||
final ContentItem item = itemRepo.findById(itemId).get();
|
||||
final String name = item.getDisplayName();
|
||||
|
||||
|
||||
final long count = itemRepo.countByNameInFolder(target, name);
|
||||
if (count > 0) {
|
||||
// there is an item in the target folder that already has this name
|
||||
addErrorMessage(data, "cms.ui.folder.item_already_exists", name);
|
||||
}
|
||||
|
||||
|
||||
if (itemManager.isLive(item) && isMove(state)) {
|
||||
addErrorMessage(data, "cms.ui.folder.item_is_live", name);
|
||||
}
|
||||
|
||||
|
||||
if (!(permissionChecker.isPermitted(
|
||||
ItemPrivileges.DELETE, item))
|
||||
&& isMove(state)) {
|
||||
&& isMove(state)) {
|
||||
addErrorMessage(data, "cms.ui.folder.no_permission_for_item",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void addErrorMessage(final FormData data,
|
||||
final String message,
|
||||
final String itemName) {
|
||||
|
|
@ -624,32 +626,32 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
// }
|
||||
// }
|
||||
private class TargetSelectorSubmissionListener implements
|
||||
FormSubmissionListener {
|
||||
|
||||
FormSubmissionListener {
|
||||
|
||||
public TargetSelectorSubmissionListener() {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void submitted(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
|
||||
FormProcessException {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
|
||||
if (targetSelector.isCancelled(state)) {
|
||||
reset(state);
|
||||
throw new FormProcessException(new GlobalizedMessage(
|
||||
"cms.ui.folder.cancelled",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
"cms.ui.folder.cancelled",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reset(final PageState state) {
|
||||
|
||||
|
||||
itemView.setVisible(state, true);
|
||||
itemView.reset(state);
|
||||
targetSelector.setVisible(state, false);
|
||||
|
|
@ -659,55 +661,55 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
state.setValue(sourcesParam, null);
|
||||
//s.setValue(m_aToZfilter, null);
|
||||
state.setValue(filterParam, null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// The form containing the tree to select the target folder from
|
||||
private class TargetSelector extends Form implements Resettable {
|
||||
|
||||
|
||||
private final FolderSelectionModel targetModel;
|
||||
private final FolderTree folderTree;
|
||||
private final Submit cancelButton;
|
||||
|
||||
|
||||
public TargetSelector() {
|
||||
super("targetSel", new BoxPanel());
|
||||
setMethod(GET);
|
||||
targetModel = new FolderSelectionModel("target");
|
||||
folderTree = new FolderTree(targetModel);
|
||||
folderTree.setCellRenderer(new FolderTreeCellRenderer());
|
||||
|
||||
|
||||
final Label label = new Label(new PrintListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void prepare(final PrintEvent event) {
|
||||
final PageState state = event.getPageState();
|
||||
final Label label = (Label) event.getTarget();
|
||||
final int numberOfItems = getSources(state).length;
|
||||
final Category folder = (Category) sourceFolderModel.
|
||||
getSelectedObject(state);
|
||||
getSelectedObject(state);
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final CategoryManager categoryManager = cdiUtil.
|
||||
findBean(CategoryManager.class);
|
||||
|
||||
findBean(CategoryManager.class);
|
||||
|
||||
if (isMove(state)) {
|
||||
|
||||
|
||||
label.setLabel(new GlobalizedMessage(
|
||||
"cms.ui.folder.move",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE,
|
||||
new Object[]{numberOfItems,
|
||||
categoryManager.getCategoryPath(
|
||||
folder)}));
|
||||
"cms.ui.folder.move",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE,
|
||||
new Object[]{numberOfItems,
|
||||
categoryManager.getCategoryPath(
|
||||
folder)}));
|
||||
} else if (isCopy(state)) {
|
||||
label.setLabel(new GlobalizedMessage(
|
||||
"cms.ui.folder.copy",
|
||||
new Object[]{numberOfItems,
|
||||
categoryManager.getCategoryPath(
|
||||
folder)}));
|
||||
"cms.ui.folder.copy",
|
||||
new Object[]{numberOfItems,
|
||||
categoryManager.getCategoryPath(
|
||||
folder)}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
label.setOutputEscaping(false);
|
||||
add(label);
|
||||
add(folderTree);
|
||||
|
|
@ -716,7 +718,7 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
cancelButton = saveCancelSection.getCancelButton();
|
||||
add(saveCancelSection);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void register(final Page page) {
|
||||
super.register(page);
|
||||
|
|
@ -726,13 +728,13 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
// Set things up the first time the selector gets visible
|
||||
public void expose(final PageState state) {
|
||||
final Category folder = (Category) sourceFolderModel.
|
||||
getSelectedObject(
|
||||
state);
|
||||
getSelectedObject(
|
||||
state);
|
||||
targetModel.clearSelection(state);
|
||||
if (folder != null) {
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ContentItemManager itemManager = cdiUtil.findBean(
|
||||
ContentItemManager.class);
|
||||
ContentItemManager.class);
|
||||
|
||||
//ToDo
|
||||
// final ItemCollection items = folder.getPathInfo(true);
|
||||
|
|
@ -742,7 +744,7 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
// items.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reset(final PageState state) {
|
||||
folderTree.clearSelection(state);
|
||||
|
|
@ -751,15 +753,15 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
state.setValue(folderTree.getSelectionModel().getStateParameter(),
|
||||
null);
|
||||
}
|
||||
|
||||
|
||||
public Category getTarget(final PageState state) {
|
||||
return (Category) targetModel.getSelectedObject(state);
|
||||
}
|
||||
|
||||
|
||||
public boolean isCancelled(final PageState state) {
|
||||
return cancelButton.isSelected(state);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//The form which is show for the publish and unpublish action
|
||||
|
|
@ -803,63 +805,65 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
// The form containing the browser and the drop down for selecting an
|
||||
// action
|
||||
private class ItemView extends Form implements Resettable {
|
||||
|
||||
|
||||
private static final String ITEM_VIEW = "itemView";
|
||||
|
||||
|
||||
private final FolderBrowser folderBrowser;
|
||||
private final Paginator paginator;
|
||||
private final OptionGroup checkboxGroup;
|
||||
private final SingleSelect actionSelect;
|
||||
private final Submit submit;
|
||||
|
||||
|
||||
public ItemView() {
|
||||
|
||||
|
||||
super(ITEM_VIEW, new SimpleContainer());
|
||||
setMethod(GET);
|
||||
|
||||
|
||||
final ActionGroup group = new ActionGroup();
|
||||
add(group);
|
||||
|
||||
|
||||
final GridPanel panel = new GridPanel(1);
|
||||
group.setSubject(panel);
|
||||
|
||||
|
||||
folderBrowser = new FolderBrowser(sourceFolderModel);
|
||||
folderBrowser.setAtoZfilterParameter(atozFilterParam);
|
||||
folderBrowser.setFilterParameter(filterParam);
|
||||
folderBrowser.setFilterForm(filterForm);
|
||||
// folderBrowser.setFilterForm(filterForm);
|
||||
folderBrowser.setFolderManipulator(FolderManipulator.this);
|
||||
paginator = new Paginator(
|
||||
(PaginationModelBuilder) folderBrowser.getModelBuilder(),
|
||||
CMSConfig.getConfig().getFolderBrowseListSize());
|
||||
new FolderBrowserPaginationModelBuilder(folderBrowser),
|
||||
CMSConfig.getConfig().getFolderBrowseListSize());
|
||||
folderBrowser.setPaginator(paginator);
|
||||
panel.add(paginator);
|
||||
panel.add(folderBrowser);
|
||||
|
||||
|
||||
LOGGER.debug("Adding filter form...");
|
||||
filterForm = new FilterForm((FilterFormModelBuilder) folderBrowser.
|
||||
getModelBuilder());
|
||||
filterForm = new FilterForm(new FolderBrowserFilterFormModelBuilder(
|
||||
folderBrowser));
|
||||
FolderManipulator.this.add(filterForm);
|
||||
|
||||
|
||||
checkboxGroup = new CheckboxGroup(sourcesParam);
|
||||
panel.add(checkboxGroup);
|
||||
|
||||
|
||||
panel.add(new FormErrorDisplay(this));
|
||||
|
||||
|
||||
final Container container = new SimpleContainer();
|
||||
group.addAction(container);
|
||||
|
||||
|
||||
container.add(new Label(new GlobalizedMessage(
|
||||
"cms.ui.folder.edit_selection",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||
"cms.ui.folder.edit_selection",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||
actionSelect = new SingleSelect(actionParam);
|
||||
actionSelect.addOption(
|
||||
new Option(COPY,
|
||||
new Label(new GlobalizedMessage(
|
||||
"cms.ui.folder.copy.action",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE))));
|
||||
new Option(COPY,
|
||||
new Label(new GlobalizedMessage(
|
||||
"cms.ui.folder.copy.action",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE))));
|
||||
actionSelect.addOption(
|
||||
new Option(MOVE,
|
||||
new Label(new GlobalizedMessage(
|
||||
"cms.ui.folder.move.action",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE))));
|
||||
new Option(MOVE,
|
||||
new Label(new GlobalizedMessage(
|
||||
"cms.ui.folder.move.action",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE))));
|
||||
//Publishing in the folder browser only works if threaded publishing is active
|
||||
// if (CMSConfig.getInstanceOf().getThreadedPublishing()) {
|
||||
// actionSelect.addOption(new Option(PUBLISH,
|
||||
|
|
@ -872,8 +876,8 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
container.add(actionSelect);
|
||||
submit = new Submit("Go",
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.folder.go",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
"cms.ui.folder.go",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
container.add(submit);
|
||||
|
||||
// Add a new first column to the table
|
||||
|
|
@ -881,14 +885,18 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
column.setCellRenderer(new CheckboxRenderer());
|
||||
folderBrowser.getColumnModel().add(0, column);
|
||||
}
|
||||
|
||||
|
||||
public final FolderBrowser getBrowser() {
|
||||
return folderBrowser;
|
||||
}
|
||||
|
||||
|
||||
public Paginator getPaginator() {
|
||||
return paginator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(final PageState state) {
|
||||
|
||||
|
||||
checkboxGroup.setValue(state, null);
|
||||
actionSelect.setValue(state, null);
|
||||
paginator.reset(state);
|
||||
|
|
@ -899,11 +907,11 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
|
||||
// The renderer for the first column in the itemView table
|
||||
private class CheckboxRenderer implements TableCellRenderer {
|
||||
|
||||
|
||||
public CheckboxRenderer() {
|
||||
//Nothing to do
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Component getComponent(final Table table,
|
||||
final PageState state,
|
||||
|
|
@ -918,44 +926,44 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
result.setGroup(checkboxGroup);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected class FilterForm extends Form implements FormProcessListener,
|
||||
FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
|
||||
private final SimpleContainer panel;
|
||||
private boolean visible;
|
||||
private final FilterFormModelBuilder modelBuilder;
|
||||
private final TextField filterField;
|
||||
|
||||
|
||||
public FilterForm(final FilterFormModelBuilder modelBuilder) {
|
||||
super("folderFilterForm");
|
||||
|
||||
|
||||
LOGGER.debug("Creating filter form...");
|
||||
|
||||
|
||||
this.modelBuilder = modelBuilder;
|
||||
|
||||
|
||||
addProcessListener(this);
|
||||
addInitListener(this);
|
||||
addSubmissionListener(this);
|
||||
|
||||
|
||||
panel = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||
|
||||
|
||||
final ActionLink allLink = new ActionLink(
|
||||
new GlobalizedMessage("cms.ui.folder.filter.all",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
new GlobalizedMessage("cms.ui.folder.filter.all",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE));
|
||||
allLink.addActionListener(new ActionListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
//event.getPageState().setValue(m_aToZfilter, "");
|
||||
event.getPageState().setValue(filterParam, "");
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
panel.add(allLink);
|
||||
|
||||
|
|
@ -973,59 +981,59 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
// panel.add(link);
|
||||
// }
|
||||
panel.add(new Label(new GlobalizedMessage(
|
||||
"cms.ui.folder.filter",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||
"cms.ui.folder.filter",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||
filterField = new TextField(filterParam);
|
||||
panel.add(filterField);
|
||||
panel.add(new Submit("filterFolderSubmit",
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.folder.filter_do",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||
|
||||
"cms.ui.folder.filter_do",
|
||||
CmsConstants.CMS_FOLDER_BUNDLE)));
|
||||
|
||||
add(panel);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public TextField getFilterField() {
|
||||
return filterField;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
FormProcessException {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
FormProcessException {
|
||||
//fse.getPageState().setValue(FolderManipulator.this.m_filter, null);
|
||||
//filterField.setValue(fse.getPageState(), null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void submitted(final FormSectionEvent event) throws
|
||||
FormProcessException {
|
||||
FormProcessException {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isVisible(PageState state) {
|
||||
if (super.isVisible(state)
|
||||
&& (modelBuilder.getFolderSize(state)
|
||||
>= CMSConfig.getConfig().
|
||||
getFolderAtoZShowLimit())) {
|
||||
&& (modelBuilder.getFolderSize(state)
|
||||
>= CMSConfig.getConfig().
|
||||
getFolderAtoZShowLimit())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected interface FilterFormModelBuilder {
|
||||
|
||||
|
||||
public long getFolderSize(PageState state);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1043,7 +1051,7 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
// return new GlobalizedMessage(key, RESOURCE_BUNDLE, args);
|
||||
// }
|
||||
private class FolderTreeCellRenderer implements TreeCellRenderer {
|
||||
|
||||
|
||||
private RequestLocal m_invalidFolders = new RequestLocal();
|
||||
|
||||
/**
|
||||
|
|
@ -1110,9 +1118,8 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
// // Save the invalid folder list
|
||||
// m_invalidFolders.set(state, invalidFolders);
|
||||
// }
|
||||
|
||||
final Label label = new Label(value.toString());
|
||||
|
||||
|
||||
if (invalidFolders.contains(key.toString())) {
|
||||
return label;
|
||||
}
|
||||
|
|
@ -1122,10 +1129,10 @@ public class FolderManipulator extends SimpleContainer implements
|
|||
label.setFontWeight(Label.BOLD);
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
return new ControlLink(label);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,16 +56,30 @@ import static org.librecms.CmsConstants.*;
|
|||
@Entity
|
||||
@Table(name = "CONTENT_SECTIONS", schema = DB_SCHEMA)
|
||||
@NamedQueries({
|
||||
@NamedQuery(
|
||||
name = "ContentSection.findById",
|
||||
query = "SELECT S FROM ContentSection s WHERE s.objectId = :objectId")
|
||||
,
|
||||
@NamedQuery(
|
||||
name = "ContentSection.findByLabel",
|
||||
query = "SELECT s FROM ContentSection s WHERE s.label = :label")
|
||||
,
|
||||
@NamedQuery(
|
||||
name = "ContentSection.findContentTypes",
|
||||
query = "SELECT t FROM ContentType t WHERE t.contentSection = :section")
|
||||
,
|
||||
@NamedQuery(
|
||||
name = "ContentSection.countContentTypes",
|
||||
query
|
||||
= "SELECT COUNT(t) FROM ContentType t WHERE t.contentSection = :section"
|
||||
)
|
||||
,
|
||||
@NamedQuery(
|
||||
name = "ContentSection.findPermissions",
|
||||
query = "SELECT p FROM Permission p "
|
||||
+ "WHERE (p.object = :section "
|
||||
+ " OR p.object = :rootDocumentsFolder"
|
||||
+ " OR p.object = :rootAssetsFolder) "
|
||||
+ " OR p.object = :rootAssetsFolder) "
|
||||
+ "AND p.grantee = :role")
|
||||
})
|
||||
//@ApplicationType(
|
||||
|
|
|
|||
|
|
@ -23,9 +23,11 @@ import org.libreccm.core.CoreConstants;
|
|||
import org.libreccm.security.AuthorizationRequired;
|
||||
import org.libreccm.security.RequiresPrivilege;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
|
|
@ -42,12 +44,12 @@ public class ContentSectionRepository
|
|||
throw new IllegalArgumentException(
|
||||
"The label of a ContentSection can't be empty.");
|
||||
}
|
||||
|
||||
|
||||
final TypedQuery<ContentSection> query = getEntityManager()
|
||||
.createNamedQuery("ContentSection.findByLabel",
|
||||
.createNamedQuery("ContentSection.findByLabel",
|
||||
ContentSection.class);
|
||||
query.setParameter("label", label);
|
||||
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
|
|
@ -66,11 +68,11 @@ public class ContentSectionRepository
|
|||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public void save(final ContentSection section) {
|
||||
if(isNew(section)) {
|
||||
if (isNew(section)) {
|
||||
section.setUuid(UUID.randomUUID().toString());
|
||||
section.setApplicationType(ContentSection.class.getName());
|
||||
}
|
||||
|
||||
|
||||
super.save(section);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.librecms.contentsection;
|
|||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.libreccm.core.UnexpectedErrorException;
|
||||
import org.libreccm.modules.InstallEvent;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.web.AbstractCcmApplicationSetup;
|
||||
|
|
@ -32,8 +33,15 @@ import static org.librecms.contentsection.ContentSection.*;
|
|||
import org.librecms.contentsection.privileges.AdminPrivileges;
|
||||
import org.librecms.contentsection.privileges.AssetPrivileges;
|
||||
import org.librecms.contentsection.privileges.ItemPrivileges;
|
||||
import org.librecms.contenttypes.Article;
|
||||
import org.librecms.contenttypes.Event;
|
||||
import org.librecms.contenttypes.MultiPartArticle;
|
||||
import org.librecms.contenttypes.News;
|
||||
import org.librecms.dispatcher.MultilingualItemResolver;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
|
|
@ -47,6 +55,11 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
|||
= "org.librecms.initial_content_sections";
|
||||
private static final String DEFAULT_ITEM_RESOLVER
|
||||
= "org.librecms.default_item_resolver";
|
||||
private static final String[] DEFAULT_TYPES = new String[]{
|
||||
Article.class.getName(),
|
||||
Event.class.getName(),
|
||||
MultiPartArticle.class.getName(),
|
||||
News.class.getName()};
|
||||
|
||||
public ContentSectionSetup(final InstallEvent event) {
|
||||
super(event);
|
||||
|
|
@ -241,22 +254,61 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
|||
section.addRole(publisher);
|
||||
section.addRole(contentReader);
|
||||
|
||||
|
||||
|
||||
final String itemResolverClassName;
|
||||
if (getIntegrationProps().containsKey(String.format("%s.item_resolver",
|
||||
sectionName))) {
|
||||
itemResolverClassName = getIntegrationProps().getProperty(
|
||||
String.format("%s.item_resolver",
|
||||
sectionName));
|
||||
} else if(getIntegrationProps().containsKey("default_item_resolver")) {
|
||||
itemResolverClassName = getIntegrationProps().getProperty("default_item_resolver_name");
|
||||
} else if (getIntegrationProps().containsKey("default_item_resolver")) {
|
||||
itemResolverClassName = getIntegrationProps().getProperty(
|
||||
"default_item_resolver_name");
|
||||
} else {
|
||||
itemResolverClassName = MultilingualItemResolver.class.getName();
|
||||
}
|
||||
section.setItemResolverClass(itemResolverClassName);
|
||||
|
||||
|
||||
final String[] types;
|
||||
if (getIntegrationProps().containsKey(String.format("%s.content_types",
|
||||
sectionName))) {
|
||||
final String typesStr = getIntegrationProps().getProperty(String
|
||||
.format("%s.content_types", sectionName));
|
||||
types = typesStr.split(",");
|
||||
} else if (getIntegrationProps().containsKey("default_content_types")) {
|
||||
final String typesStr = getIntegrationProps().getProperty(
|
||||
"default_content_types");
|
||||
types = typesStr.split(",");
|
||||
} else {
|
||||
types = DEFAULT_TYPES;
|
||||
}
|
||||
Arrays.stream(types).forEach(type -> addContentTypeToSection(section,
|
||||
type));
|
||||
|
||||
getEntityManager().merge(section);
|
||||
}
|
||||
|
||||
private void addContentTypeToSection(final ContentSection section,
|
||||
final String contentType) {
|
||||
final String typeClassName = contentType.trim();
|
||||
final Class<?> clazz;
|
||||
try {
|
||||
clazz = Class.forName(typeClassName);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
throw new UnexpectedErrorException(String.format(
|
||||
"No class for content type '%s'.", typeClassName));
|
||||
}
|
||||
|
||||
if (ContentItem.class.isAssignableFrom(clazz)) {
|
||||
final ContentType type = new ContentType();
|
||||
type.setContentSection(section);
|
||||
type.setContentItemClass(clazz.getName());
|
||||
section.addContentType(type);
|
||||
} else {
|
||||
throw new UnexpectedErrorException(String.format(
|
||||
"The class '%s' is not a sub class of '%s'.",
|
||||
clazz.getName(),
|
||||
ContentItem.class.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,71 +68,97 @@ import static org.librecms.CmsConstants.*;
|
|||
+ "ORDER BY f.name"
|
||||
)
|
||||
,
|
||||
@NamedQuery(
|
||||
name = "Folder.countSubFolders",
|
||||
query
|
||||
= "SELECT COUNT(f) FROM Folder f WHERE f.parentCategory = :parent "
|
||||
+ "AND LOWER(f.name) LIKE :term"
|
||||
)
|
||||
,
|
||||
@NamedQuery(
|
||||
name = "Folder.findItems",
|
||||
query = "SELECT c.categorizedObject "
|
||||
+ "FROM Categorization c "
|
||||
+ "WHERE c.category = :folder "
|
||||
+ "AND TYPE(c.categorizedObject) IN ContentItem "
|
||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||
+ "AND c.version = "
|
||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||
+ "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||
+ "OR LOWER(c.categorizedObject.name.value) LIKE :term) "
|
||||
+ "ORDER BY c.categorizedObject.name")
|
||||
,
|
||||
@NamedQuery(
|
||||
name = "Folder.countItems",
|
||||
query = "SELECT COUNT(c).categorizedObject "
|
||||
+ "FROM Categorization c "
|
||||
+ "WHERE c.category = :folder "
|
||||
+ "AND Type(c.categorizedObject) IN ContentItem "
|
||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||
+ "AND c.version = "
|
||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||
+ "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||
+ "OR LOWER(c.categorizedObject.name.value) LIKE :term)")
|
||||
,
|
||||
// @NamedQuery(
|
||||
// name = "Folder.countSubFolders",
|
||||
// query
|
||||
// = "SELECT COUNT(f) FROM Folder f WHERE f.parentCategory = :parent "
|
||||
// + "AND LOWER(f.name) LIKE :term"
|
||||
// )
|
||||
// ,
|
||||
// @NamedQuery(
|
||||
// name = "Folder.findItems",
|
||||
// query = "SELECT c.categorizedObject "
|
||||
// + "FROM Categorization c "
|
||||
// + "WHERE c.category = :folder "
|
||||
// + "AND TYPE(c.categorizedObject) IN ContentItem "
|
||||
// + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||
// + "AND c.version = "
|
||||
// + "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||
// + "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||
// + "OR LOWER(c.categorizedObject.name.value) LIKE :term) "
|
||||
// + "ORDER BY c.categorizedObject.name")
|
||||
// ,
|
||||
// @NamedQuery(
|
||||
// name = "Folder.countItems",
|
||||
// query = "SELECT COUNT(c).categorizedObject "
|
||||
// + "FROM Categorization c "
|
||||
// + "WHERE c.category = :folder "
|
||||
// + "AND Type(c.categorizedObject) IN ContentItem "
|
||||
// + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||
// + "AND c.version = "
|
||||
// + "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||
// + "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||
// + "OR LOWER(c.categorizedObject.name.value) LIKE :term)")
|
||||
// ,
|
||||
@NamedQuery(
|
||||
name = "Folder.findObjects",
|
||||
query = "SELECT o FROM CcmObject o "
|
||||
+ "WHERE o IN (SELECT f FROM Folder f "
|
||||
+ "WHERE f.parentCategory = :parent "
|
||||
+ "AND lower(f.name) LIKE :term) "
|
||||
+ "OR o IN (SELECT c.categorizedObject "
|
||||
+ "FROM Categorization c "
|
||||
+ "WHERE c.category = :folder "
|
||||
+ "AND TYPE(c.categorizedObject) IN ContentItem "
|
||||
+ "WHERE f.parentCategory = :folder "
|
||||
+ "AND LOWER(f.name) LIKE :term) "
|
||||
+ "OR o IN (SELECT i FROM ContentItem i JOIN i.categories c "
|
||||
+ "WHERE c.category = :folder "
|
||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||
+ "AND c.version = "
|
||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||
+ "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||
+ "OR LOWER(c.categorizedObject.name.value) LIKE :term)) "
|
||||
+ "ORDER BY o.displayName")
|
||||
+ "AND i.version = "
|
||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT "
|
||||
+ "AND (LOWER(i.displayName) LIKE LOWER(:term) "
|
||||
// + "OR LOWER(i.name.values) LIKE LOWER(:term)"
|
||||
+ ")) "
|
||||
+ "ORDER BY o.displayName"
|
||||
// query = "SELECT o FROM CcmObject o "
|
||||
// + "WHERE o IN (SELECT f FROM Folder f "
|
||||
// + "WHERE f.parentCategory = :parent "
|
||||
// + "AND lower(f.name) LIKE :term) "
|
||||
// + "OR o IN (SELECT c.categorizedObject "
|
||||
// + "FROM Categorization c "
|
||||
// + "WHERE c.category = :folder "
|
||||
// + "AND TYPE(c.categorizedObject) IN ContentItem "
|
||||
// + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||
// + "AND c.version = "
|
||||
// + "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||
// + "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||
// + "OR LOWER(c.categorizedObject.name.value) LIKE :term)) "
|
||||
// + "ORDER BY o.displayName"
|
||||
)
|
||||
,
|
||||
@NamedQuery(
|
||||
name = "Folder.countObjects",
|
||||
query = "SELECT COUNT(o) FROM CcmObject o "
|
||||
+ "WHERE o IN (SELECT f FROM Folder f "
|
||||
+ "WHERE f.parentCategory = :parent "
|
||||
+ "AND lower(f.name) LIKE :term) "
|
||||
+ "OR o IN (SELECT c.categorizedObject "
|
||||
+ "FROM Categorization c "
|
||||
+ "WHERE c.category = :folder "
|
||||
+ "AND TYPE(c.categorizedObject) IN ContentItem "
|
||||
+ "WHERE f.parentCategory = :folder "
|
||||
+ "AND LOWER(f.name) LIKE :term) "
|
||||
+ "OR o IN (SELECT i FROM ContentItem i JOIN i.categories c "
|
||||
+ "WHERE c.category = :folder "
|
||||
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||
+ "AND c.version = "
|
||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT"
|
||||
+ "AND (LOWER(c.categorizedObject.displayName) LIKE :term "
|
||||
+ "OR LOWER(c.categorizedObject.name.value) LIKE :term)) "
|
||||
+ "ORDER BY o.displayName")
|
||||
+ "AND i.version = "
|
||||
+ "org.librecms.contentsection.ContentItemVersion.DRAFT "
|
||||
+ "AND (LOWER(i.displayName) LIKE LOWER(:term) "
|
||||
// + "OR LOWER(i.name.values) LIKE LOWER(:term)"
|
||||
+ "))"
|
||||
// query = "SELECT COUNT(o) FROM CcmObject o "
|
||||
// + "WHERE o IN (SELECT f FROM Folder f "
|
||||
// + "WHERE f.parentCategory = :parent "
|
||||
// + "AND lower(f.name) LIKE :term) "
|
||||
// + "OR o IN (SELECT c.categorizedObject AS co "
|
||||
// + "FROM Categorization c "
|
||||
// + "WHERE c.category = :folder "
|
||||
// // + "AND TYPE(co) IN ContentItem "
|
||||
// + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
|
||||
// + "AND co.version = "
|
||||
// + "org.librecms.contentsection.ContentItemVersion.DRAFT "
|
||||
// + "AND ((LOWER(co.displayName) LIKE :term "
|
||||
// + "OR LOWER(co.name.value) LIKE :term)))"
|
||||
)
|
||||
})
|
||||
public class Folder extends Category implements Serializable {
|
||||
|
||||
|
|
|
|||
|
|
@ -44,4 +44,8 @@ cms.ui.permissions.table.remove_all.header=Remove all
|
|||
|
||||
cms.ui.category.select_index_item=Select index item for category
|
||||
cms.ui.category.non_option=None
|
||||
cms.ui.category.inherit_parent=Inherit Index from Parent Category
|
||||
cms.ui.category.inherit_parent=Inherit Index from Parent Category
|
||||
cms.ui.authoring.no_types_registered=No types registered
|
||||
cms.ui.contents_of=Contents of
|
||||
cms.ui.new_folder=Create new folder
|
||||
cms.ui.edit_folder=Rename the current folder
|
||||
|
|
|
|||
|
|
@ -43,4 +43,8 @@ cms.ui.permissions.table.actions.remove_all.confirm=Sind Sie sicher, dass Sie al
|
|||
cms.ui.permissions.table.remove_all.header=Alle entfernen
|
||||
|
||||
cms.ui.category.select_index_item=Index Element f\u00fcr diese Kategorie ausw\u00e4hlen
|
||||
cms.ui.category.inherit_parent=Inherit Index from Parent Category
|
||||
cms.ui.category.inherit_parent=Inherit Index from Parent Category
|
||||
cms.ui.authoring.no_types_registered=Keine Typen registiert
|
||||
cms.ui.contents_of=Inhalt von
|
||||
cms.ui.new_folder=Neuen Ordner erstellen
|
||||
cms.ui.edit_folder=Aktuellen Ordner umbenennen
|
||||
|
|
|
|||
|
|
@ -44,3 +44,7 @@ cms.ui.folder_browser=Folders
|
|||
cms.ui.permissions.table.actions.remove_all=Remove all permissions
|
||||
cms.ui.permissions.table.actions.remove_all.confirm=Are you sure to remove all permissions for this role from the current object?
|
||||
cms.ui.permissions.table.remove_all.header=Remove all
|
||||
cms.ui.authoring.no_types_registered=No types registered
|
||||
cms.ui.contents_of=Contents of
|
||||
cms.ui.new_folder=Create new folder
|
||||
cms.ui.edit_folder=Rename the current folder
|
||||
|
|
|
|||
Loading…
Reference in New Issue