From 4bb0117366bfe44d7bf2a8e85713335e0e384fa7 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Wed, 16 Mar 2022 19:13:09 +0100 Subject: [PATCH] Removed deprecated package com/arsdigita/cms/ui/authoring/assets --- .../assets/AttachmentListSelectionModel.java | 106 ------------------ .../assets/AttachmentSelectionModel.java | 105 ----------------- .../assets/ItemAttachmentSelectionModel.java | 104 ----------------- 3 files changed, 315 deletions(-) delete mode 100644 ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/AttachmentListSelectionModel.java delete mode 100644 ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/AttachmentSelectionModel.java delete mode 100644 ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/ItemAttachmentSelectionModel.java diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/AttachmentListSelectionModel.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/AttachmentListSelectionModel.java deleted file mode 100644 index b47f0a79d..000000000 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/AttachmentListSelectionModel.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 com.arsdigita.cms.ui.authoring.assets; - -import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.ParameterSingleSelectionModel; -import com.arsdigita.bebop.SingleSelectionModel; -import com.arsdigita.bebop.event.ChangeListener; -import com.arsdigita.bebop.parameters.LongParameter; -import com.arsdigita.bebop.parameters.ParameterModel; - -import org.libreccm.cdi.utils.CdiUtil; -import org.librecms.contentsection.AttachmentList; -import org.librecms.contentsection.AttachmentListManager; - -/** - * - * @author Jens Pelzetter - */ -public class AttachmentListSelectionModel implements - SingleSelectionModel { - - private final SingleSelectionModel model; - - public AttachmentListSelectionModel(final LongParameter parameter) { - this.model = new ParameterSingleSelectionModel<>(parameter); - } - - public AttachmentListSelectionModel(final String parameterName) { - this(new LongParameter(parameterName)); - } - - @Override - public boolean isSelected(final PageState state) { - return model.isSelected(state); - } - - @Override - public Long getSelectedKey(final PageState state) { - - final Object key = model.getSelectedKey(state); - if (key == null) { - return null; - } else if (key instanceof Long) { - return (Long) key; - } else if (key instanceof String) { - return Long.parseLong((String) key); - } else { - return Long.parseLong(key.toString()); - } - } - - @Override - public void setSelectedKey(final PageState state, final Long key) { - model.setSelectedKey(state, key); - } - - public AttachmentList getSelectedAttachmentList(final PageState state) { - final Long key = getSelectedKey(state); - if (key == null) { - return null; - } else { - final AttachmentListManager manager = CdiUtil - .createCdiUtil() - .findBean(AttachmentListManager.class); - return manager.getAttachmentList(key).get(); - } - } - - @Override - public void clearSelection(final PageState state) { - model.clearSelection(state); - } - - @Override - public void addChangeListener(final ChangeListener changeListener) { - model.addChangeListener(changeListener); - } - - @Override - public void removeChangeListener(final ChangeListener changeListener) { - model.removeChangeListener(changeListener); - } - - @Override - public ParameterModel getStateParameter() { - return model.getStateParameter(); - } - -} diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/AttachmentSelectionModel.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/AttachmentSelectionModel.java deleted file mode 100644 index ca120633a..000000000 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/AttachmentSelectionModel.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 com.arsdigita.cms.ui.authoring.assets; - -import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.ParameterSingleSelectionModel; -import com.arsdigita.bebop.SingleSelectionModel; -import com.arsdigita.bebop.event.ChangeListener; -import com.arsdigita.bebop.parameters.LongParameter; -import com.arsdigita.bebop.parameters.ParameterModel; - -import org.libreccm.cdi.utils.CdiUtil; -import org.librecms.contentsection.ItemAttachment; -import org.librecms.contentsection.ItemAttachmentManager; - -/** - * - * @author Jens Pelzetter - */ -public class AttachmentSelectionModel implements SingleSelectionModel { - - private final SingleSelectionModel model; - - public AttachmentSelectionModel(final LongParameter parameter) { - this.model = new ParameterSingleSelectionModel<>(parameter); - } - - public AttachmentSelectionModel(final String parameterName) { - this(new LongParameter(parameterName)); - } - - @Override - public boolean isSelected(final PageState state) { - return model.isSelected(state); - } - - @Override - public Long getSelectedKey(final PageState state) { - - final Object key = model.getSelectedKey(state); - if (key == null) { - return null; - } else if (key instanceof Long) { - return (Long) key; - } else if (key instanceof String) { - return Long.parseLong((String) key); - } else { - return Long.parseLong(key.toString()); - } - } - - @Override - public void setSelectedKey(final PageState state, final Long key) { - model.setSelectedKey(state, key); - } - - public ItemAttachment getSelectedAttachment(final PageState state) { - final Long key = getSelectedKey(state); - if (key == null) { - return null; - } else { - final ItemAttachmentManager manager = CdiUtil - .createCdiUtil() - .findBean(ItemAttachmentManager.class); - return manager.findById(key).get(); - } - } - - @Override - public void clearSelection(final PageState state) { - model.clearSelection(state); - } - - @Override - public void addChangeListener(final ChangeListener changeListener) { - model.addChangeListener(changeListener); - } - - @Override - public void removeChangeListener(final ChangeListener changeListener) { - model.removeChangeListener(changeListener); - } - - @Override - public ParameterModel getStateParameter() { - return model.getStateParameter(); - } - -} diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/ItemAttachmentSelectionModel.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/ItemAttachmentSelectionModel.java deleted file mode 100644 index 4e1c0c4a1..000000000 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/ItemAttachmentSelectionModel.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 com.arsdigita.cms.ui.authoring.assets; - -import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.ParameterSingleSelectionModel; -import com.arsdigita.bebop.SingleSelectionModel; -import com.arsdigita.bebop.event.ChangeListener; -import com.arsdigita.bebop.parameters.LongParameter; -import com.arsdigita.bebop.parameters.ParameterModel; - -import org.libreccm.cdi.utils.CdiUtil; -import org.librecms.contentsection.ItemAttachment; -import org.librecms.contentsection.ItemAttachmentManager; - -/** - * - * @author Jens Pelzetter - */ -public class ItemAttachmentSelectionModel implements SingleSelectionModel { - - private final SingleSelectionModel model; - - public ItemAttachmentSelectionModel(final LongParameter parameter) { - this.model = new ParameterSingleSelectionModel<>(parameter); - } - - public ItemAttachmentSelectionModel(final String parameterName) { - this(new LongParameter(parameterName)); - } - - @Override - public boolean isSelected(final PageState state) { - return model.isSelected(state); - } - - @Override - public Long getSelectedKey(final PageState state) { - final Object key = model.getSelectedKey(state); - if (key == null) { - return null; - } else if (key instanceof Long) { - return (Long) key; - } else if (key instanceof String) { - return Long.parseLong((String) key); - } else { - return Long.parseLong(key.toString()); - } - } - - @Override - public void setSelectedKey(final PageState state, final Long key) { - model.setSelectedKey(state, key); - } - - public ItemAttachment getSelectedAttachment(final PageState state) { - final Long key = getSelectedKey(state); - if (key == null) { - return null; - } else { - final ItemAttachmentManager manager = CdiUtil - .createCdiUtil() - .findBean(ItemAttachmentManager.class); - return manager.findById(key).get(); - } - } - - @Override - public void clearSelection(final PageState state) { - model.clearSelection(state); - } - - @Override - public void addChangeListener(final ChangeListener changeListener) { - model.addChangeListener(changeListener); - } - - @Override - public void removeChangeListener(final ChangeListener changeListener) { - model.removeChangeListener(changeListener); - } - - @Override - public ParameterModel getStateParameter() { - return model.getStateParameter(); - } - -}