Several bugfixes, migrations for Person and Organization assets etc
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@6148 8810af33-2d31-482b-a856-94f89814c4df
parent
7fdcb962ab
commit
6b7bd96e60
|
|
@ -66,7 +66,7 @@
|
||||||
<param-value>true</param-value>
|
<param-value>true</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
|
||||||
<servlet>
|
<!-- <servlet>
|
||||||
<servlet-name>vaadin-servlet</servlet-name>
|
<servlet-name>vaadin-servlet</servlet-name>
|
||||||
<servlet-class>com.vaadin.cdi.server.VaadinCDIServlet</servlet-class>
|
<servlet-class>com.vaadin.cdi.server.VaadinCDIServlet</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
@ -78,6 +78,6 @@
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>vaadin-servlet</servlet-name>
|
<servlet-name>vaadin-servlet</servlet-name>
|
||||||
<url-pattern>/VAADIN/*</url-pattern>
|
<url-pattern>/VAADIN/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>-->
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,21 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.assets.forms;
|
package com.arsdigita.cms.ui.assets.forms;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.ActionLink;
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.bebop.ControlLink;
|
import com.arsdigita.bebop.ControlLink;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.Table;
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
import com.arsdigita.bebop.event.TableActionEvent;
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
import com.arsdigita.bebop.event.TableActionListener;
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.bebop.form.SingleSelect;
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.bebop.table.TableCellRenderer;
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
import com.arsdigita.bebop.table.TableColumn;
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
import com.arsdigita.bebop.table.TableColumnModel;
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
|
@ -40,6 +45,7 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
import org.librecms.CmsConstants;
|
import org.librecms.CmsConstants;
|
||||||
import org.librecms.assets.ContactEntry;
|
import org.librecms.assets.ContactEntry;
|
||||||
import org.librecms.assets.ContactableEntity;
|
import org.librecms.assets.ContactableEntity;
|
||||||
|
|
@ -48,6 +54,8 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.librecms.CmsConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -62,28 +70,51 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
||||||
|
|
||||||
private static final int COL_CONTACT_ENTRIES_REMOVE = 2;
|
private static final int COL_CONTACT_ENTRIES_REMOVE = 2;
|
||||||
|
|
||||||
|
private final AssetPane assetPane;
|
||||||
|
|
||||||
private Table contactEntriesTable;
|
private Table contactEntriesTable;
|
||||||
|
|
||||||
private SingleSelect contactEntryKeySelect;
|
private SingleSelect contactEntryKeySelect;
|
||||||
|
|
||||||
private TextField contactEntryValueField;
|
private TextField contactEntryValueField;
|
||||||
|
|
||||||
|
private ActionLink addContactEntryLink;
|
||||||
|
|
||||||
private AssetSearchWidget postalAddressSearchWidget;
|
private AssetSearchWidget postalAddressSearchWidget;
|
||||||
|
|
||||||
public AbstractContactableEntityForm(final AssetPane assetPane) {
|
public AbstractContactableEntityForm(final AssetPane assetPane) {
|
||||||
|
|
||||||
super(assetPane);
|
super(assetPane);
|
||||||
|
|
||||||
|
this.assetPane = assetPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
|
|
||||||
contactEntriesTable = buildContactEntriesTable();
|
addPropertyWidgets();
|
||||||
|
|
||||||
|
contactEntriesTable = buildContactEntriesTable();
|
||||||
|
add(contactEntriesTable);
|
||||||
|
|
||||||
|
contactEntryKeySelect = new SingleSelect(new StringParameter(
|
||||||
|
"contactentry-key"));
|
||||||
|
add(contactEntryKeySelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract void addPropertyWidgets();
|
||||||
|
|
||||||
private Table buildContactEntriesTable() {
|
private Table buildContactEntriesTable() {
|
||||||
|
|
||||||
final Table table = new Table();
|
final Table table = new Table() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible(final PageState state) {
|
||||||
|
return getSelectedAsset(state).isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
final TableColumnModel columnModel = table.getColumnModel();
|
final TableColumnModel columnModel = table.getColumnModel();
|
||||||
columnModel.add(new TableColumn(
|
columnModel.add(new TableColumn(
|
||||||
COL_CONTACT_ENTRIES_KEY,
|
COL_CONTACT_ENTRIES_KEY,
|
||||||
|
|
@ -160,19 +191,15 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
||||||
private class ContactEntriesTableModelBuilder
|
private class ContactEntriesTableModelBuilder
|
||||||
extends LockableImpl implements TableModelBuilder {
|
extends LockableImpl implements TableModelBuilder {
|
||||||
|
|
||||||
private final ContactableEntity contactableEntity;
|
|
||||||
|
|
||||||
public ContactEntriesTableModelBuilder(
|
|
||||||
final ContactableEntity contactableEntity) {
|
|
||||||
|
|
||||||
this.contactableEntity = contactableEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableModel makeModel(final Table table,
|
public TableModel makeModel(final Table table,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
|
||||||
final List<ContactEntry> contactEntries = contactableEntity
|
final ContactableEntity selected = getSelectedAsset(state)
|
||||||
|
.orElseThrow(
|
||||||
|
() -> new IllegalStateException("No asset selected")
|
||||||
|
);
|
||||||
|
final List<ContactEntry> contactEntries = selected
|
||||||
.getContactEntries();
|
.getContactEntries();
|
||||||
return new ContactEntriesTableModel(contactEntries);
|
return new ContactEntriesTableModel(contactEntries);
|
||||||
}
|
}
|
||||||
|
|
@ -253,4 +280,26 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ContactEntryKeySelectPrintListener implements PrintListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prepare(final PrintEvent event) {
|
||||||
|
|
||||||
|
final SingleSelect target = (SingleSelect) event.getTarget();
|
||||||
|
target.clearOptions();
|
||||||
|
|
||||||
|
target.addOption(
|
||||||
|
new Option("",
|
||||||
|
new Label(new GlobalizedMessage("cms.ui.select_one"),
|
||||||
|
CMS_BUNDLE))
|
||||||
|
);
|
||||||
|
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
|
||||||
|
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.assets.forms;
|
package com.arsdigita.cms.ui.assets.forms;
|
||||||
|
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
|
||||||
import com.arsdigita.bebop.form.TextField;
|
|
||||||
import com.arsdigita.cms.ui.assets.AssetPane;
|
import com.arsdigita.cms.ui.assets.AssetPane;
|
||||||
|
|
||||||
import org.librecms.assets.Bookmark;
|
import org.librecms.assets.Bookmark;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.assets.forms;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.cms.ui.assets.AssetPane;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
import org.librecms.CmsConstants;
|
||||||
|
import org.librecms.assets.Organization;
|
||||||
|
import org.librecms.contentsection.Asset;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class OrganizationForm extends AbstractContactableEntityForm<Organization> {
|
||||||
|
|
||||||
|
private TextField organizationName;
|
||||||
|
|
||||||
|
public OrganizationForm(final AssetPane assetPane) {
|
||||||
|
|
||||||
|
super(assetPane);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addPropertyWidgets() {
|
||||||
|
|
||||||
|
add(new Label(
|
||||||
|
new GlobalizedMessage("cms.ui.assets.organization.name",
|
||||||
|
CmsConstants.CMS_BUNDLE)));
|
||||||
|
organizationName = new TextField("organization-name");
|
||||||
|
add(organizationName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<Organization> getAssetClass() {
|
||||||
|
|
||||||
|
return Organization.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void showLocale(final PageState state) {
|
||||||
|
|
||||||
|
// Organization has no localizable fields.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateAsset(final Asset asset,
|
||||||
|
final FormSectionEvent event)
|
||||||
|
throws FormProcessException {
|
||||||
|
|
||||||
|
Objects.requireNonNull(asset);
|
||||||
|
Objects.requireNonNull(event);
|
||||||
|
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
if (!(asset instanceof Organization)) {
|
||||||
|
throw new IllegalArgumentException(String.format(
|
||||||
|
"The provided asset is not an instance of \"%s\" "
|
||||||
|
+ "or a subclass,but of %s.",
|
||||||
|
Organization.class.getName(),
|
||||||
|
asset.getClass().getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
final Organization organization = (Organization) asset;
|
||||||
|
|
||||||
|
organization.setName((String) organizationName.getValue(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -38,19 +38,24 @@ import java.util.Locale;
|
||||||
class FolderPathListModel implements ListModel {
|
class FolderPathListModel implements ListModel {
|
||||||
|
|
||||||
private final Locale defaultLocale;
|
private final Locale defaultLocale;
|
||||||
|
|
||||||
private final Iterator<Folder> pathFolders;
|
private final Iterator<Folder> pathFolders;
|
||||||
|
|
||||||
private Folder currentFolder;
|
private Folder currentFolder;
|
||||||
|
|
||||||
public FolderPathListModel(final Folder folder) {
|
public FolderPathListModel(final Folder folder) {
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final FolderManager folderManager = cdiUtil.findBean(FolderManager.class);
|
final FolderManager folderManager = cdiUtil
|
||||||
final List<Folder> parentFolders = folderManager.getParentFolders(folder);
|
.findBean(FolderManager.class);
|
||||||
|
final List<Folder> parentFolders = folderManager
|
||||||
|
.getParentFolders(folder);
|
||||||
final List<Folder> path = new ArrayList<>();
|
final List<Folder> path = new ArrayList<>();
|
||||||
path.addAll(parentFolders);
|
path.addAll(parentFolders);
|
||||||
path.add(folder);
|
path.add(folder);
|
||||||
pathFolders = path.iterator();
|
pathFolders = path.iterator();
|
||||||
|
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(ConfigurationManager.class);
|
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||||
|
ConfigurationManager.class);
|
||||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||||
KernelConfig.class);
|
KernelConfig.class);
|
||||||
defaultLocale = kernelConfig.getDefaultLocale();
|
defaultLocale = kernelConfig.getDefaultLocale();
|
||||||
|
|
@ -68,7 +73,12 @@ class FolderPathListModel implements ListModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getElement() {
|
public Object getElement() {
|
||||||
return currentFolder.getTitle().getValue(defaultLocale);
|
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final FolderPathListModelController controller = cdiUtil
|
||||||
|
.findBean(FolderPathListModelController.class);
|
||||||
|
|
||||||
|
return controller.getElement(currentFolder, defaultLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.folder;
|
||||||
|
|
||||||
|
import org.librecms.contentsection.Folder;
|
||||||
|
import org.librecms.contentsection.FolderRepository;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class FolderPathListModelController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private FolderRepository folderRepository;
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getElement(final Folder folder, final Locale locale) {
|
||||||
|
|
||||||
|
final Folder result = folderRepository
|
||||||
|
.findById(folder.getObjectId())
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||||
|
"No folder wit ID %d found.", folder.getObjectId())));
|
||||||
|
|
||||||
|
return result.getTitle().getValue(locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -138,7 +138,6 @@ public abstract class FolderTreeModelBuilder
|
||||||
// final ContentSection section = CMS.getContext().getContentSection();
|
// final ContentSection section = CMS.getContext().getContentSection();
|
||||||
// return section.getRootDocumentsFolder();
|
// return section.getRootDocumentsFolder();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the root folder for the tree model in the current request.
|
* Return the root folder for the tree model in the current request.
|
||||||
*
|
*
|
||||||
|
|
@ -167,16 +166,19 @@ public abstract class FolderTreeModelBuilder
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
final GlobalizationHelper globalizationHelper = cdiUtil.findBean(
|
final GlobalizationHelper globalizationHelper = cdiUtil.findBean(
|
||||||
GlobalizationHelper.class);
|
GlobalizationHelper.class);
|
||||||
|
final FolderTreeModelController controller = cdiUtil
|
||||||
|
.findBean(FolderTreeModelController.class);
|
||||||
final Locale locale = globalizationHelper.getNegotiatedLocale();
|
final Locale locale = globalizationHelper.getNegotiatedLocale();
|
||||||
if (folder.getTitle().hasValue(locale)) {
|
if (controller.hasTitleValue(folder, locale)) {
|
||||||
return folder.getTitle().getValue(locale);
|
return controller.getTitleValue(folder, locale);
|
||||||
} else {
|
} else {
|
||||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||||
ConfigurationManager.class);
|
ConfigurationManager.class);
|
||||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||||
KernelConfig.class);
|
KernelConfig.class);
|
||||||
final String value = folder.getTitle().getValue(kernelConfig.
|
final String value = controller
|
||||||
getDefaultLocale());
|
.getTitleValue(folder,
|
||||||
|
kernelConfig.getDefaultLocale());
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return folder.getName();
|
return folder.getName();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import org.librecms.contentsection.FolderRepository;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
@ -63,6 +64,32 @@ public class FolderTreeModelController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public boolean hasTitleValue(final Folder ofFolder,
|
||||||
|
final Locale forLocale) {
|
||||||
|
|
||||||
|
final Folder folder = folderRepo
|
||||||
|
.findById(ofFolder.getObjectId())
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||||
|
"No folder with Id %d found.",
|
||||||
|
ofFolder.getObjectId())));
|
||||||
|
|
||||||
|
return folder.getTitle().hasValue(forLocale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
public String getTitleValue(final Folder ofFolder,
|
||||||
|
final Locale forLocale) {
|
||||||
|
|
||||||
|
final Folder folder = folderRepo
|
||||||
|
.findById(ofFolder.getObjectId())
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||||
|
"No folder with Id %d found.",
|
||||||
|
ofFolder.getObjectId())));
|
||||||
|
|
||||||
|
return folder.getTitle().getValue(forLocale);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public boolean hasChildren(final TreeNode node) {
|
public boolean hasChildren(final TreeNode node) {
|
||||||
return !getCurrentFolder(node).getSubCategories().isEmpty();
|
return !getCurrentFolder(node).getSubCategories().isEmpty();
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.assets;
|
package org.librecms.assets;
|
||||||
|
|
||||||
|
import org.hibernate.envers.Audited;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -36,6 +38,7 @@ import static org.librecms.CmsConstants.*;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
|
@Audited
|
||||||
@Table(name = "CONTACT_ENTRIES", schema = DB_SCHEMA)
|
@Table(name = "CONTACT_ENTRIES", schema = DB_SCHEMA)
|
||||||
public class ContactEntry implements Serializable {
|
public class ContactEntry implements Serializable {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.assets;
|
||||||
|
|
||||||
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.persistence.AssociationOverride;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embedded;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import static org.librecms.CmsConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "CONTACT_ENTRY_KEYS")
|
||||||
|
public class ContactEntryKey implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "KEY_ID")
|
||||||
|
private long keyId;
|
||||||
|
|
||||||
|
@Column(name = "ENTRY_KEY", length = 255)
|
||||||
|
private String entryKey;
|
||||||
|
|
||||||
|
@Embedded
|
||||||
|
@AssociationOverride(
|
||||||
|
name = "values",
|
||||||
|
joinTable = @JoinTable(name = "CONTACT_ENTRY_KEY_LABELS",
|
||||||
|
schema = DB_SCHEMA,
|
||||||
|
joinColumns = {
|
||||||
|
@JoinColumn(name = "KEY_ID")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
private LocalizedString label;
|
||||||
|
|
||||||
|
public ContactEntryKey() {
|
||||||
|
|
||||||
|
super();
|
||||||
|
label = new LocalizedString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getKeyId() {
|
||||||
|
return keyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKeyId(final long keyId) {
|
||||||
|
this.keyId = keyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEntryKey() {
|
||||||
|
return entryKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntryKey(final String entryKey) {
|
||||||
|
this.entryKey = Objects.requireNonNull(entryKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalizedString getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(final LocalizedString label) {
|
||||||
|
|
||||||
|
this.label = Objects.requireNonNull(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 73 * hash + (int) (keyId ^ (keyId >>> 32));
|
||||||
|
hash = 73 * hash + Objects.hashCode(entryKey);
|
||||||
|
hash = 73 * hash + Objects.hashCode(label);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof ContactEntryKey)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final ContactEntryKey other = (ContactEntryKey) obj;
|
||||||
|
if (keyId != other.getKeyId()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(entryKey, other.getEntryKey())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(label, other.getLabel())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
||||||
|
return obj instanceof ContactEntryKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(final String data) {
|
||||||
|
|
||||||
|
return String.format("%s{ "
|
||||||
|
+ "keyId = %d, "
|
||||||
|
+ "entryKey = \"%s\", "
|
||||||
|
+ "label = %s%s }",
|
||||||
|
super.toString(),
|
||||||
|
keyId,
|
||||||
|
entryKey,
|
||||||
|
Objects.toString(label),
|
||||||
|
data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
|
||||||
|
return toString("");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.assets;
|
||||||
|
|
||||||
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class ContactEntryKeyRepository
|
||||||
|
extends AbstractEntityRepository<Long, ContactEntryKey>{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<ContactEntryKey> getEntityClass() {
|
||||||
|
|
||||||
|
return ContactEntryKey.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdAttributeName() {
|
||||||
|
|
||||||
|
return "keyId";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getIdOfEntity(final ContactEntryKey entity) {
|
||||||
|
|
||||||
|
return entity.getKeyId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isNew(final ContactEntryKey entity) {
|
||||||
|
|
||||||
|
return entity.getKeyId() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,7 @@ package org.librecms.assets;
|
||||||
|
|
||||||
import org.hibernate.annotations.Cascade;
|
import org.hibernate.annotations.Cascade;
|
||||||
import org.hibernate.annotations.CascadeType;
|
import org.hibernate.annotations.CascadeType;
|
||||||
|
import org.hibernate.envers.Audited;
|
||||||
import org.librecms.contentsection.Asset;
|
import org.librecms.contentsection.Asset;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -37,11 +38,13 @@ import javax.persistence.Table;
|
||||||
import static org.librecms.CmsConstants.*;
|
import static org.librecms.CmsConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for contactable entities. Not for public use
|
* Base class for contactable entities. Not for public use, but needs to be
|
||||||
|
* public to give UI classes in the {@code com.arsdigita} packages access.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
|
@Audited
|
||||||
@Table(name = "CONTACTABLE_ENTITIES", schema = DB_SCHEMA)
|
@Table(name = "CONTACTABLE_ENTITIES", schema = DB_SCHEMA)
|
||||||
public class ContactableEntity extends Asset {
|
public class ContactableEntity extends Asset {
|
||||||
|
|
||||||
|
|
@ -99,8 +102,8 @@ public class ContactableEntity extends Asset {
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = super.hashCode();
|
||||||
hash = 59 * hash + Objects.hashCode(this.contactEntries);
|
hash = 59 * hash + Objects.hashCode(contactEntries);
|
||||||
hash = 59 * hash + Objects.hashCode(this.postalAddress);
|
hash = 59 * hash + Objects.hashCode(postalAddress);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,10 +127,10 @@ public class ContactableEntity extends Asset {
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(this.contactEntries, other.getContactEntries())) {
|
if (!Objects.equals(contactEntries, other.getContactEntries())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Objects.equals(this.postalAddress, other.getPostalAddress());
|
return Objects.equals(postalAddress, other.getPostalAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.assets;
|
package org.librecms.assets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ui.assets.forms.OrganizationForm;
|
||||||
|
|
||||||
|
import org.hibernate.envers.Audited;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
|
@ -25,13 +29,20 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import static org.librecms.CmsConstants.*;
|
import static org.librecms.CmsConstants.*;
|
||||||
|
import static org.librecms.assets.AssetConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reusable piece of information about an organization.
|
* A reusable piece of information about an organization.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
@AssetType(assetForm = OrganizationForm.class,
|
||||||
|
labelBundle = ASSETS_BUNDLE,
|
||||||
|
labelKey = "organization.label",
|
||||||
|
descriptionBundle = ASSETS_BUNDLE,
|
||||||
|
descriptionKey = "organization.description")
|
||||||
@Entity
|
@Entity
|
||||||
|
@Audited
|
||||||
@Table(name = "ORGANIZATIONS", schema = DB_SCHEMA)
|
@Table(name = "ORGANIZATIONS", schema = DB_SCHEMA)
|
||||||
public class Organization extends ContactableEntity {
|
public class Organization extends ContactableEntity {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,20 @@ package org.librecms.assets;
|
||||||
import org.hibernate.envers.Audited;
|
import org.hibernate.envers.Audited;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.persistence.AssociationOverride;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import static org.librecms.CmsConstants.*;
|
import static org.librecms.CmsConstants.*;
|
||||||
import static org.librecms.assets.AssetConstants.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An asset representing a person.
|
* An asset representing a person.
|
||||||
|
|
@ -47,68 +53,117 @@ public class Person extends ContactableEntity {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
@ElementCollection
|
||||||
* The surname/familyname of the person
|
@JoinTable(
|
||||||
*/
|
joinColumns = {
|
||||||
@Column(name = "SURNAME")
|
@JoinColumn(name = "PERSON_ID")
|
||||||
private String surname;
|
},
|
||||||
|
name = "PERSON_NAMES",
|
||||||
/**
|
schema = DB_SCHEMA
|
||||||
* The given name of the person.
|
)
|
||||||
*/
|
private List<PersonName> personNames;
|
||||||
@Column(name = "GIVEN_NAME")
|
|
||||||
private String givenName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Any prefixes to the name of the person. Examples are Prof. or Dr.
|
|
||||||
*/
|
|
||||||
@Column(name = "NAME_PREFIX")
|
|
||||||
private String prefix;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Any suffixes to the name of the person. Examples for suffixes are
|
|
||||||
* PhD, or especially for Great Britain the membership in various orders,
|
|
||||||
* for example KBE or CBE.
|
|
||||||
*/
|
|
||||||
@Column(name = "SUFFIX")
|
|
||||||
private String suffix;
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * The surname/familyname of the person
|
||||||
|
// */
|
||||||
|
// @Column(name = "SURNAME")
|
||||||
|
// private String surname;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * The given name of the person.
|
||||||
|
// */
|
||||||
|
// @Column(name = "GIVEN_NAME")
|
||||||
|
// private String givenName;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Any prefixes to the name of the person. Examples are Prof. or Dr.
|
||||||
|
// */
|
||||||
|
// @Column(name = "NAME_PREFIX")
|
||||||
|
// private String prefix;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Any suffixes to the name of the person. Examples for suffixes are
|
||||||
|
// * PhD, or especially for Great Britain the membership in various orders,
|
||||||
|
// * for example KBE or CBE.
|
||||||
|
// */
|
||||||
|
// @Column(name = "SUFFIX")
|
||||||
|
// private String suffix;
|
||||||
/**
|
/**
|
||||||
* The birthdate of the person.
|
* The birthdate of the person.
|
||||||
*/
|
*/
|
||||||
@Column(name = "BIRTHDATA")
|
@Column(name = "BIRTHDATE")
|
||||||
private LocalDate birthdate;
|
private LocalDate birthdate;
|
||||||
|
|
||||||
public String getSurname() {
|
public Person() {
|
||||||
return surname;
|
|
||||||
|
super();
|
||||||
|
|
||||||
|
personNames = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSurname(final String surname) {
|
// public String getSurname() {
|
||||||
this.surname = surname;
|
// return surname;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setSurname(final String surname) {
|
||||||
|
// this.surname = surname;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getGivenName() {
|
||||||
|
// return givenName;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setGivenName(final String givenName) {
|
||||||
|
// this.givenName = givenName;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getPrefix() {
|
||||||
|
// return prefix;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setPrefix(final String prefix) {
|
||||||
|
// this.prefix = prefix;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public String getSuffix() {
|
||||||
|
// return suffix;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setSuffix(final String suffix) {
|
||||||
|
// this.suffix = suffix;
|
||||||
|
// }
|
||||||
|
public List<PersonName> getPersonNames() {
|
||||||
|
|
||||||
|
return Collections.unmodifiableList(personNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGivenName() {
|
/**
|
||||||
return givenName;
|
* The current name of the person, the last entry in the list.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PersonName getPersonName() {
|
||||||
|
|
||||||
|
if (personNames.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return personNames.get(personNames.size() - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGivenName(final String givenName) {
|
protected void addPersonName(final PersonName personName) {
|
||||||
this.givenName = givenName;
|
|
||||||
|
personNames.add(personName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrefix() {
|
protected void removePersonName(final PersonName personName) {
|
||||||
return prefix;
|
|
||||||
|
personNames.remove(personName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrefix(final String prefix) {
|
protected void setPersonNames(final List<PersonName> personNames) {
|
||||||
this.prefix = prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuffix() {
|
this.personNames = new ArrayList<>(personNames);
|
||||||
return suffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuffix(final String suffix) {
|
|
||||||
this.suffix = suffix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDate getBirthdate() {
|
public LocalDate getBirthdate() {
|
||||||
|
|
@ -122,10 +177,11 @@ public class Person extends ContactableEntity {
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = super.hashCode();
|
||||||
hash = 37 * hash + Objects.hashCode(surname);
|
// hash = 37 * hash + Objects.hashCode(surname);
|
||||||
hash = 37 * hash + Objects.hashCode(givenName);
|
// hash = 37 * hash + Objects.hashCode(givenName);
|
||||||
hash = 37 * hash + Objects.hashCode(prefix);
|
// hash = 37 * hash + Objects.hashCode(prefix);
|
||||||
hash = 37 * hash + Objects.hashCode(suffix);
|
// hash = 37 * hash + Objects.hashCode(suffix);
|
||||||
|
hash = 37 * hash + Objects.hashCode(personNames);
|
||||||
hash = 37 * hash + Objects.hashCode(birthdate);
|
hash = 37 * hash + Objects.hashCode(birthdate);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
@ -150,16 +206,19 @@ public class Person extends ContactableEntity {
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(surname, other.getSurname())) {
|
// if (!Objects.equals(surname, other.getSurname())) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
if (!Objects.equals(givenName, other.getGivenName())) {
|
// if (!Objects.equals(givenName, other.getGivenName())) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
if (!Objects.equals(prefix, other.getPrefix())) {
|
// if (!Objects.equals(prefix, other.getPrefix())) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
if (!Objects.equals(suffix, other.getSuffix())) {
|
// if (!Objects.equals(suffix, other.getSuffix())) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
if (!Objects.equals(personNames, other.getPersonNames())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Objects.equals(birthdate, other.getBirthdate());
|
return Objects.equals(birthdate, other.getBirthdate());
|
||||||
|
|
@ -176,14 +235,16 @@ public class Person extends ContactableEntity {
|
||||||
|
|
||||||
return super.toString(String.format(
|
return super.toString(String.format(
|
||||||
"surname = \"%s\", "
|
"surname = \"%s\", "
|
||||||
+ "givenName = \"%s\", "
|
+ "personNames = \"%s\", "
|
||||||
+ "prefix = \"%s\", "
|
// + "givenName = \"%s\", "
|
||||||
+ "suffix = \"%s\", "
|
// + "prefix = \"%s\", "
|
||||||
|
// + "suffix = \"%s\", "
|
||||||
+ "birthdate = %s%s",
|
+ "birthdate = %s%s",
|
||||||
surname,
|
Objects.toString(personNames),
|
||||||
givenName,
|
// surname,
|
||||||
prefix,
|
// givenName,
|
||||||
suffix,
|
// prefix,
|
||||||
|
// suffix,
|
||||||
Objects.toString(birthdate),
|
Objects.toString(birthdate),
|
||||||
data));
|
data));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.assets;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Embeddable
|
||||||
|
public class PersonName implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The surname/familyname of the person
|
||||||
|
*/
|
||||||
|
@Column(name = "SURNAME")
|
||||||
|
private String surname;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The given name of the person.
|
||||||
|
*/
|
||||||
|
@Column(name = "GIVEN_NAME")
|
||||||
|
private String givenName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Any prefixes to the name of the person. Examples are Prof. or Dr.
|
||||||
|
*/
|
||||||
|
@Column(name = "NAME_PREFIX")
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Any suffixes to the name of the person. Examples for suffixes are PhD, or
|
||||||
|
* especially for Great Britain the membership in various orders, for
|
||||||
|
* example KBE or CBE.
|
||||||
|
*/
|
||||||
|
@Column(name = "SUFFIX")
|
||||||
|
private String suffix;
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(final String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGivenName() {
|
||||||
|
return givenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGivenName(final String givenName) {
|
||||||
|
this.givenName = givenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrefix() {
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrefix(final String prefix) {
|
||||||
|
this.prefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSuffix() {
|
||||||
|
return suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuffix(final String suffix) {
|
||||||
|
this.suffix = suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 5;
|
||||||
|
hash = 79 * hash + Objects.hashCode(surname);
|
||||||
|
hash = 79 * hash + Objects.hashCode(givenName);
|
||||||
|
hash = 79 * hash + Objects.hashCode(prefix);
|
||||||
|
hash = 79 * hash + Objects.hashCode(suffix);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof PersonName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PersonName other = (PersonName) obj;
|
||||||
|
if (!other.canEqual(this)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(surname, other.getSurname())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(givenName, other.getGivenName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(prefix, other.getPrefix())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(suffix, other.getSuffix());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
||||||
|
return obj instanceof PersonName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(final String data) {
|
||||||
|
|
||||||
|
return String.format("%s{ "
|
||||||
|
+ "surname = \"%s\", "
|
||||||
|
+ "givenName = \"%s\", "
|
||||||
|
+ "prefix = \"%s\", "
|
||||||
|
+ "suffix = \"%s\"%s"
|
||||||
|
+ " }",
|
||||||
|
super.toString(),
|
||||||
|
surname,
|
||||||
|
givenName,
|
||||||
|
prefix,
|
||||||
|
suffix);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.assets;
|
package org.librecms.assets;
|
||||||
|
|
||||||
|
import org.hibernate.envers.Audited;
|
||||||
import org.librecms.contentsection.Asset;
|
import org.librecms.contentsection.Asset;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -34,6 +35,7 @@ import static org.librecms.CmsConstants.*;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
|
@Audited
|
||||||
@Table(name = "POSTAL_ADDRESSES", schema = DB_SCHEMA)
|
@Table(name = "POSTAL_ADDRESSES", schema = DB_SCHEMA)
|
||||||
public class PostalAddress extends Asset {
|
public class PostalAddress extends Asset {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,8 +151,7 @@ public class MultilingualItemResolver implements ItemResolver {
|
||||||
// nothing to do, if root folder is null
|
// nothing to do, if root folder is null
|
||||||
LOGGER.debug("The root folder is null; returning no item");
|
LOGGER.debug("The root folder is null; returning no item");
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug("Using root folder {}...",
|
LOGGER.debug("Using root folder {}...", rootFolder.getName());
|
||||||
Objects.toString(rootFolder));
|
|
||||||
|
|
||||||
if (ContentItemVersion.LIVE.toString().equals(context)) {
|
if (ContentItemVersion.LIVE.toString().equals(context)) {
|
||||||
LOGGER.debug("The use context is 'live'");
|
LOGGER.debug("The use context is 'live'");
|
||||||
|
|
|
||||||
|
|
@ -7,26 +7,83 @@ create table CONTACT_ENTRIES (
|
||||||
primary key (CONTACT_ENTRY_ID)
|
primary key (CONTACT_ENTRY_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.CONTACT_ENTRIES_AUD (
|
||||||
|
CONTACT_ENTRY_ID bigint not null,
|
||||||
|
REV integer not null,
|
||||||
|
REVTYPE tinyint,
|
||||||
|
REVEND integer,
|
||||||
|
ENTRY_KEY varchar(255),
|
||||||
|
ENTRY_ORDER bigint,
|
||||||
|
ENTRY_VALUE varchar(4096),
|
||||||
|
primary key (CONTACT_ENTRY_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
create table CONTACTABLE_ENTITIES (
|
create table CONTACTABLE_ENTITIES (
|
||||||
OBJECT_ID bigint not null,
|
OBJECT_ID bigint not null,
|
||||||
POSTAL_ADDRESS_ID bigint,
|
POSTAL_ADDRESS_ID bigint,
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.CONTACTABLE_ENTITIES_AUD (
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
REV integer not null,
|
||||||
|
POSTAL_ADDRESS_ID bigint,
|
||||||
|
primary key (OBJECT_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.ContactableEntity_ContactEntry_AUD (
|
||||||
|
REV integer not null,
|
||||||
|
CONTACTABLE_ID bigint not null,
|
||||||
|
CONTACT_ENTRY_ID bigint not null,
|
||||||
|
REVTYPE tinyint,
|
||||||
|
REVEND integer,
|
||||||
|
primary key (REV, CONTACTABLE_ID, CONTACT_ENTRY_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table ORGANIZATIONS (
|
create table ORGANIZATIONS (
|
||||||
NAME varchar(1024),
|
NAME varchar(1024),
|
||||||
OBJECT_ID bigint not null,
|
OBJECT_ID bigint not null,
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.ORGANIZATIONS_AUD (
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
REV integer not null,
|
||||||
|
NAME varchar(1024),
|
||||||
|
primary key (OBJECT_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
create table PERSONS (
|
create table PERSONS (
|
||||||
BIRTHDATA date,
|
BIRTHDATE date,
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.PERSONS_AUD (
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
REV integer not null,
|
||||||
|
BIRTHDATE date,
|
||||||
|
primary key (OBJECT_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.PERSON_NAMES (
|
||||||
|
PERSON_ID bigint not null,
|
||||||
GIVEN_NAME varchar(255),
|
GIVEN_NAME varchar(255),
|
||||||
NAME_PREFIX varchar(255),
|
NAME_PREFIX varchar(255),
|
||||||
SUFFIX varchar(255),
|
SUFFIX varchar(255),
|
||||||
|
SURNAME varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.PERSON_NAMES_AUD (
|
||||||
|
REV integer not null,
|
||||||
|
REVTYPE tinyint not null,
|
||||||
|
PERSON_ID bigint not null,
|
||||||
|
REVEND integer,
|
||||||
SURNAME varchar(255),
|
SURNAME varchar(255),
|
||||||
OBJECT_ID bigint not null,
|
NAME_PREFIX varchar(255),
|
||||||
primary key (OBJECT_ID)
|
GIVEN_NAME varchar(255),
|
||||||
|
SUFFIX varchar(255),
|
||||||
|
primary key (REV, REVTYPE, PERSON_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table POSTAL_ADDRESSES (
|
create table POSTAL_ADDRESSES (
|
||||||
|
|
@ -39,32 +96,88 @@ create table POSTAL_ADDRESSES (
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
alter table CONTACT_ENTRIES
|
create table CCM_CMS.POSTAL_ADDRESSES_AUD (
|
||||||
add constraint FKfm16ni25r5iscfcyqhlyo4y24
|
OBJECT_ID bigint not null,
|
||||||
|
REV integer not null,
|
||||||
|
ADDRESS varchar(2048),
|
||||||
|
CITY varchar(512),
|
||||||
|
ISO_COUNTRY_CODE varchar(10),
|
||||||
|
POSTAL_CODE varchar(255),
|
||||||
|
ADDRESS_STATE varchar(255),
|
||||||
|
primary key (OBJECT_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table CCM_CMS.CONTACT_ENTRIES
|
||||||
|
add constraint FKljrrfco44damal9eaqrnfam0m
|
||||||
foreign key (CONTACTABLE_ID)
|
foreign key (CONTACTABLE_ID)
|
||||||
references CONTACTABLE_ENTITY;
|
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||||
|
|
||||||
alter table CONTACTABLE_ENTITY
|
alter table CCM_CMS.CONTACT_ENTRIES_AUD
|
||||||
add constraint FKn7nb0chctw8ih05kguf2s4jh0
|
add constraint FKib8xp3ab8kdkc0six36f99e2g
|
||||||
|
foreign key (REV)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.CONTACT_ENTRIES_AUD
|
||||||
|
add constraint FKrse7ibjqsfnny5t1b2tqqs3pt
|
||||||
|
foreign key (REVEND)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.CONTACTABLE_ENTITIES
|
||||||
|
add constraint FKqefwowr9adclj3xvpfje9rddr
|
||||||
foreign key (POSTAL_ADDRESS_ID)
|
foreign key (POSTAL_ADDRESS_ID)
|
||||||
references POSTAL_ADDRESSES;
|
references CCM_CMS.POSTAL_ADDRESSES;
|
||||||
|
|
||||||
alter table CONTACTABLE_ENTITY
|
alter table CCM_CMS.CONTACTABLE_ENTITIES
|
||||||
add constraint FK37gvl3x07envs4u4lwustuyge
|
add constraint FKhdwlhf3jp8wf5wxjkoynrcspj
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CMS.ASSETS;
|
references CCM_CMS.ASSETS;
|
||||||
|
|
||||||
alter table ORGANIZATIONS
|
alter table CCM_CMS.CONTACTABLE_ENTITIES_AUD
|
||||||
add constraint FKjjcnjs0eecrla6eqq8fes8o86
|
add constraint FKjx8trfvt96fkdn6bafnh839id
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID, REV)
|
||||||
references CONTACTABLE_ENTITY;
|
references CCM_CMS.ASSETS_AUD;
|
||||||
|
|
||||||
alter table PERSONS
|
alter table CCM_CMS.ContactableEntity_ContactEntry_AUD
|
||||||
add constraint FK3i2r1w7qc1ofdn4jlbak7vkpu
|
add constraint FKs5tfdp1auj9ocgvfa9ivec517
|
||||||
foreign key (OBJECT_ID)
|
foreign key (REV)
|
||||||
references CONTACTABLE_ENTITY;
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
alter table POSTAL_ADDRESSES
|
alter table CCM_CMS.ContactableEntity_ContactEntry_AUD
|
||||||
add constraint FK4vajjjjo8ro0wns58t8f3i782
|
add constraint FKskn2ovg24tnnnwd2o8y0biyje
|
||||||
|
foreign key (REVEND)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.ORGANIZATIONS
|
||||||
|
add constraint FK77ig0to48xrlfx8qsc0vlfsp6
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CMS.ASSETS;
|
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||||
|
|
||||||
|
alter table CCM_CMS.ORGANIZATIONS_AUD
|
||||||
|
add constraint FKp0k3bf008pih96sguio80siql
|
||||||
|
foreign key (OBJECT_ID, REV)
|
||||||
|
references CCM_CMS.CONTACTABLE_ENTITIES_AUD;
|
||||||
|
|
||||||
|
alter table CCM_CMS.PERSON_NAMES
|
||||||
|
add constraint FK2yluyhmpuhwxafcbna6u8txrt
|
||||||
|
foreign key (PERSON_ID)
|
||||||
|
references CCM_CMS.PERSONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.PERSON_NAMES_AUD
|
||||||
|
add constraint FKtqtlwx8pa9ydh009sudtpfxie
|
||||||
|
foreign key (REV)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.PERSON_NAMES_AUD
|
||||||
|
add constraint FKs6m8tgbp8agrd5q3klwbtcujg
|
||||||
|
foreign key (REVEND)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.PERSONS
|
||||||
|
add constraint FKiv4ydysjekfx64pkb5v4vd9yj
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||||
|
|
||||||
|
alter table CCM_CMS.PERSONS_AUD
|
||||||
|
add constraint FKpup1q3295qkuovaptq8aj5lxp
|
||||||
|
foreign key (OBJECT_ID, REV)
|
||||||
|
references CCM_CMS.CONTACTABLE_ENTITIES_AUD;
|
||||||
|
|
@ -7,26 +7,83 @@ create table CCM_CMS.CONTACT_ENTRIES (
|
||||||
primary key (CONTACT_ENTRY_ID)
|
primary key (CONTACT_ENTRY_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.CONTACT_ENTRIES_AUD (
|
||||||
|
CONTACT_ENTRY_ID int8 not null,
|
||||||
|
REV int4 not null,
|
||||||
|
REVTYPE int2,
|
||||||
|
REVEND int4,
|
||||||
|
ENTRY_KEY varchar(255),
|
||||||
|
ENTRY_ORDER int8,
|
||||||
|
ENTRY_VALUE varchar(4096),
|
||||||
|
primary key (CONTACT_ENTRY_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CMS.CONTACTABLE_ENTITIES (
|
create table CCM_CMS.CONTACTABLE_ENTITIES (
|
||||||
OBJECT_ID int8 not null,
|
OBJECT_ID int8 not null,
|
||||||
POSTAL_ADDRESS_ID int8,
|
POSTAL_ADDRESS_ID int8,
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.CONTACTABLE_ENTITIES_AUD (
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
REV int4 not null,
|
||||||
|
POSTAL_ADDRESS_ID int8,
|
||||||
|
primary key (OBJECT_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.ContactableEntity_ContactEntry_AUD (
|
||||||
|
REV int4 not null,
|
||||||
|
CONTACTABLE_ID int8 not null,
|
||||||
|
CONTACT_ENTRY_ID int8 not null,
|
||||||
|
REVTYPE int2,
|
||||||
|
REVEND int4,
|
||||||
|
primary key (REV, CONTACTABLE_ID, CONTACT_ENTRY_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CMS.ORGANIZATIONS (
|
create table CCM_CMS.ORGANIZATIONS (
|
||||||
NAME varchar(1024),
|
NAME varchar(1024),
|
||||||
OBJECT_ID int8 not null,
|
OBJECT_ID int8 not null,
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.ORGANIZATIONS_AUD (
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
REV int4 not null,
|
||||||
|
NAME varchar(1024),
|
||||||
|
primary key (OBJECT_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CMS.PERSONS (
|
create table CCM_CMS.PERSONS (
|
||||||
BIRTHDATA date,
|
BIRTHDATE date,
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.PERSONS_AUD (
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
REV int4 not null,
|
||||||
|
BIRTHDATE date,
|
||||||
|
primary key (OBJECT_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
|
Create table CCM_CMS.PERSON_NAMES (
|
||||||
|
PERSON_ID int8 not null,
|
||||||
GIVEN_NAME varchar(255),
|
GIVEN_NAME varchar(255),
|
||||||
NAME_PREFIX varchar(255),
|
NAME_PREFIX varchar(255),
|
||||||
SUFFIX varchar(255),
|
SUFFIX varchar(255),
|
||||||
|
SURNAME varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.PERSON_NAMES_AUD (
|
||||||
|
REV int4 not null,
|
||||||
|
REVTYPE int2 not null,
|
||||||
|
PERSON_ID int8 not null,
|
||||||
|
REVEND int4,
|
||||||
SURNAME varchar(255),
|
SURNAME varchar(255),
|
||||||
OBJECT_ID int8 not null,
|
NAME_PREFIX varchar(255),
|
||||||
primary key (OBJECT_ID)
|
GIVEN_NAME varchar(255),
|
||||||
|
SUFFIX varchar(255),
|
||||||
|
primary key (REV, REVTYPE, PERSON_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CMS.POSTAL_ADDRESSES (
|
create table CCM_CMS.POSTAL_ADDRESSES (
|
||||||
|
|
@ -39,32 +96,88 @@ create table CCM_CMS.POSTAL_ADDRESSES (
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CMS.POSTAL_ADDRESSES_AUD (
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
REV int4 not null,
|
||||||
|
ADDRESS varchar(2048),
|
||||||
|
CITY varchar(512),
|
||||||
|
ISO_COUNTRY_CODE varchar(10),
|
||||||
|
POSTAL_CODE varchar(255),
|
||||||
|
ADDRESS_STATE varchar(255),
|
||||||
|
primary key (OBJECT_ID, REV)
|
||||||
|
);
|
||||||
|
|
||||||
alter table CCM_CMS.CONTACT_ENTRIES
|
alter table CCM_CMS.CONTACT_ENTRIES
|
||||||
add constraint FKfm16ni25r5iscfcyqhlyo4y24
|
add constraint FKljrrfco44damal9eaqrnfam0m
|
||||||
foreign key (CONTACTABLE_ID)
|
foreign key (CONTACTABLE_ID)
|
||||||
references CONTACTABLE_ENTITY;
|
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||||
|
|
||||||
alter table CCM_CMS.CONTACTABLE_ENTITY
|
alter table CCM_CMS.CONTACT_ENTRIES_AUD
|
||||||
add constraint FKn7nb0chctw8ih05kguf2s4jh0
|
add constraint FKib8xp3ab8kdkc0six36f99e2g
|
||||||
|
foreign key (REV)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.CONTACT_ENTRIES_AUD
|
||||||
|
add constraint FKrse7ibjqsfnny5t1b2tqqs3pt
|
||||||
|
foreign key (REVEND)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.CONTACTABLE_ENTITIES
|
||||||
|
add constraint FKqefwowr9adclj3xvpfje9rddr
|
||||||
foreign key (POSTAL_ADDRESS_ID)
|
foreign key (POSTAL_ADDRESS_ID)
|
||||||
references POSTAL_ADDRESSES;
|
references CCM_CMS.POSTAL_ADDRESSES;
|
||||||
|
|
||||||
alter table CCM_CMS.CONTACTABLE_ENTITY
|
alter table CCM_CMS.CONTACTABLE_ENTITIES
|
||||||
add constraint FK37gvl3x07envs4u4lwustuyge
|
add constraint FKhdwlhf3jp8wf5wxjkoynrcspj
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CMS.ASSETS;
|
references CCM_CMS.ASSETS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.CONTACTABLE_ENTITIES_AUD
|
||||||
|
add constraint FKjx8trfvt96fkdn6bafnh839id
|
||||||
|
foreign key (OBJECT_ID, REV)
|
||||||
|
references CCM_CMS.ASSETS_AUD;
|
||||||
|
|
||||||
|
alter table CCM_CMS.ContactableEntity_ContactEntry_AUD
|
||||||
|
add constraint FKs5tfdp1auj9ocgvfa9ivec517
|
||||||
|
foreign key (REV)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.ContactableEntity_ContactEntry_AUD
|
||||||
|
add constraint FKskn2ovg24tnnnwd2o8y0biyje
|
||||||
|
foreign key (REVEND)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
alter table CCM_CMS.ORGANIZATIONS
|
alter table CCM_CMS.ORGANIZATIONS
|
||||||
add constraint FKjjcnjs0eecrla6eqq8fes8o86
|
add constraint FK77ig0to48xrlfx8qsc0vlfsp6
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CONTACTABLE_ENTITY;
|
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||||
|
|
||||||
|
alter table CCM_CMS.ORGANIZATIONS_AUD
|
||||||
|
add constraint FKp0k3bf008pih96sguio80siql
|
||||||
|
foreign key (OBJECT_ID, REV)
|
||||||
|
references CCM_CMS.CONTACTABLE_ENTITIES_AUD;
|
||||||
|
|
||||||
|
alter table CCM_CMS.PERSON_NAMES
|
||||||
|
add constraint FK2yluyhmpuhwxafcbna6u8txrt
|
||||||
|
foreign key (PERSON_ID)
|
||||||
|
references CCM_CMS.PERSONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.PERSON_NAMES_AUD
|
||||||
|
add constraint FKtqtlwx8pa9ydh009sudtpfxie
|
||||||
|
foreign key (REV)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
|
alter table CCM_CMS.PERSON_NAMES_AUD
|
||||||
|
add constraint FKs6m8tgbp8agrd5q3klwbtcujg
|
||||||
|
foreign key (REVEND)
|
||||||
|
references CCM_CORE.CCM_REVISIONS;
|
||||||
|
|
||||||
alter table CCM_CMS.PERSONS
|
alter table CCM_CMS.PERSONS
|
||||||
add constraint FK3i2r1w7qc1ofdn4jlbak7vkpu
|
add constraint FKiv4ydysjekfx64pkb5v4vd9yj
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CONTACTABLE_ENTITY;
|
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||||
|
|
||||||
alter table CCM_CMS.POSTAL_ADDRESSES
|
alter table CCM_CMS.PERSONS_AUD
|
||||||
add constraint FK4vajjjjo8ro0wns58t8f3i782
|
add constraint FKpup1q3295qkuovaptq8aj5lxp
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID, REV)
|
||||||
references CCM_CMS.ASSETS;
|
references CCM_CMS.CONTACTABLE_ENTITIES_AUD;
|
||||||
|
|
@ -540,3 +540,4 @@ cms.ui.pages.index_page_model=PageModel for index page
|
||||||
cms.ui.pages.item_page_model=Page Model for item page
|
cms.ui.pages.item_page_model=Page Model for item page
|
||||||
cms.ui.pages.tab.pages=Pages
|
cms.ui.pages.tab.pages=Pages
|
||||||
cms.ui.pages.tab.page_models=Page Models
|
cms.ui.pages.tab.page_models=Page Models
|
||||||
|
cms.ui.assets.organization.name=Name of the organization
|
||||||
|
|
|
||||||
|
|
@ -537,3 +537,4 @@ cms.ui.pages.index_page_model=PageModel f\u00fcr Index Seite
|
||||||
cms.ui.pages.item_page_model=Page Model f\u00fcr Item Seite
|
cms.ui.pages.item_page_model=Page Model f\u00fcr Item Seite
|
||||||
cms.ui.pages.tab.pages=Seiten
|
cms.ui.pages.tab.pages=Seiten
|
||||||
cms.ui.pages.tab.page_models=Page Models
|
cms.ui.pages.tab.page_models=Page Models
|
||||||
|
cms.ui.assets.organization.name=Name der Organization
|
||||||
|
|
|
||||||
|
|
@ -499,3 +499,4 @@ cms.ui.pages.index_page_model=PageModel for index page
|
||||||
cms.ui.pages.item_page_model=Page Model for item page
|
cms.ui.pages.item_page_model=Page Model for item page
|
||||||
cms.ui.pages.tab.pages=Pages
|
cms.ui.pages.tab.pages=Pages
|
||||||
cms.ui.pages.tab.page_models=Page Models
|
cms.ui.pages.tab.page_models=Page Models
|
||||||
|
cms.ui.assets.organization.name=Name of the organization
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,7 @@ video_asset.label=Video
|
||||||
video_asset.description=A video
|
video_asset.description=A video
|
||||||
image.label=Image
|
image.label=Image
|
||||||
image.description=An image file in a web compatible format (PNG, JPEG, GIF, SVG)
|
image.description=An image file in a web compatible format (PNG, JPEG, GIF, SVG)
|
||||||
|
organization.label=Organization
|
||||||
|
organization.desc=Stores data about an organization
|
||||||
|
person.label=Person
|
||||||
|
person.desc=Data about a person
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,7 @@ video_asset.label=Video
|
||||||
video_asset.description=A video
|
video_asset.description=A video
|
||||||
image.label=Bild
|
image.label=Bild
|
||||||
image.description=An Bild-Datei in einem web-kompatiblen Format (PNG, JPEG, GIF, SVG)
|
image.description=An Bild-Datei in einem web-kompatiblen Format (PNG, JPEG, GIF, SVG)
|
||||||
|
organization.label=Organisation
|
||||||
|
organization.desc=Kontakt-) Daten einer Organisation
|
||||||
|
person.label=Person
|
||||||
|
person.desc=Daten zu einer Person
|
||||||
|
|
|
||||||
|
|
@ -402,8 +402,8 @@ public class Category extends CcmObject implements Serializable, Exportable {
|
||||||
int hash = super.hashCode();
|
int hash = super.hashCode();
|
||||||
hash = 23 * hash + Objects.hashCode(uniqueId);
|
hash = 23 * hash + Objects.hashCode(uniqueId);
|
||||||
hash = 23 * hash + Objects.hashCode(name);
|
hash = 23 * hash + Objects.hashCode(name);
|
||||||
hash = 23 * hash + Objects.hashCode(title);
|
// hash = 23 * hash + Objects.hashCode(title);
|
||||||
hash = 23 * hash + Objects.hashCode(description);
|
// hash = 23 * hash + Objects.hashCode(description);
|
||||||
hash = 23 * hash + (enabled ? 1 : 0);
|
hash = 23 * hash + (enabled ? 1 : 0);
|
||||||
hash = 23 * hash + (visible ? 1 : 0);
|
hash = 23 * hash + (visible ? 1 : 0);
|
||||||
hash = 23 * hash + (abstractCategory ? 1 : 0);
|
hash = 23 * hash + (abstractCategory ? 1 : 0);
|
||||||
|
|
@ -439,12 +439,12 @@ public class Category extends CcmObject implements Serializable, Exportable {
|
||||||
if (!Objects.equals(name, other.getName())) {
|
if (!Objects.equals(name, other.getName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(title, other.getTitle())) {
|
// if (!Objects.equals(title, other.getTitle())) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
if (!Objects.equals(description, other.getDescription())) {
|
// if (!Objects.equals(description, other.getDescription())) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
if (enabled != other.isEnabled()) {
|
if (enabled != other.isEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -469,14 +469,14 @@ public class Category extends CcmObject implements Serializable, Exportable {
|
||||||
public String toString(final String data) {
|
public String toString(final String data) {
|
||||||
return super.toString(String.format(", uniqueId = %s, "
|
return super.toString(String.format(", uniqueId = %s, "
|
||||||
+ "name = \"%s\", "
|
+ "name = \"%s\", "
|
||||||
+ "title = %s, "
|
// + "title = %s, "
|
||||||
+ "enabled = %b, "
|
+ "enabled = %b, "
|
||||||
+ "visible = %b, "
|
+ "visible = %b, "
|
||||||
+ "abstractCategory = %s, "
|
+ "abstractCategory = %s, "
|
||||||
+ "categoryOrder = %d%s",
|
+ "categoryOrder = %d%s",
|
||||||
uniqueId,
|
uniqueId,
|
||||||
name,
|
name,
|
||||||
Objects.toString(title),
|
// Objects.toString(title),
|
||||||
enabled,
|
enabled,
|
||||||
visible,
|
visible,
|
||||||
abstractCategory,
|
abstractCategory,
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,17 @@ package org.libreccm.configuration;
|
||||||
|
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
||||||
|
import javax.persistence.AssociationOverride;
|
||||||
|
import javax.persistence.Embedded;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting which stores a {@link LocalizedString} . This can be used for
|
* A setting which stores a {@link LocalizedString} . This can be used for
|
||||||
* storing values for text in the user interface which should be customisable by
|
* storing values for text in the user interface which should be customisable by
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,19 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting for a list of strings. In contrast to the {@link EnumSetting} which
|
* Setting for a list of strings. In contrast to the {@link EnumSetting} which
|
||||||
* uses a {@link java.util.Set} a list maintains the order of its elements.
|
* uses a {@link java.util.Set} a list maintains the order of its elements.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue