CCM NG: Assets
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@6155 8810af33-2d31-482b-a856-94f89814c4df
Former-commit-id: 67ed864e39
pull/2/head
parent
e7601eccd6
commit
eb0a24db80
|
|
@ -150,12 +150,7 @@ public abstract class AbstractAssetForm<T extends Asset>
|
|||
|
||||
target.clearOptions();
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
@SuppressWarnings("unchecked")
|
||||
final AbstractAssetFormController<T> controller
|
||||
= cdiUtil
|
||||
.findBean(AbstractAssetFormController.class);
|
||||
final List<Locale> availableLocales = controller
|
||||
final List<Locale> availableLocales = getController()
|
||||
.availableLocales(selectedAssetId,
|
||||
getAssetClass());
|
||||
availableLocales.sort((locale1, locale2) -> {
|
||||
|
|
@ -213,13 +208,7 @@ public abstract class AbstractAssetForm<T extends Asset>
|
|||
|
||||
target.clearOptions();
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
@SuppressWarnings("unchecked")
|
||||
final AbstractAssetFormController<T> controller
|
||||
= cdiUtil
|
||||
.findBean(AbstractAssetFormController.class);
|
||||
|
||||
final List<Locale> creatableLocales = controller
|
||||
final List<Locale> creatableLocales = getController()
|
||||
.creatableLocales(selectedAssetId,
|
||||
getAssetClass());
|
||||
creatableLocales.sort((locale1, locale2) -> {
|
||||
|
|
@ -302,17 +291,15 @@ public abstract class AbstractAssetForm<T extends Asset>
|
|||
|
||||
} else {
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
@SuppressWarnings("unchecked")
|
||||
final AbstractAssetFormController<T> controller = cdiUtil
|
||||
.findBean(AbstractAssetFormController.class);
|
||||
showLocaleSelect.setValue(state,
|
||||
getSelectedLocale(state));
|
||||
|
||||
data = controller.getAssetData(selectedAssetId,
|
||||
getAssetClass(),
|
||||
getSelectedLocale(state));
|
||||
data = getController().getAssetData(selectedAssetId,
|
||||
getAssetClass(),
|
||||
getSelectedLocale(state));
|
||||
|
||||
name.setValue(state,
|
||||
data.get(AbstractAssetFormController.DISPLAY_NAME));
|
||||
title.setValue(state,
|
||||
data.get(AbstractAssetFormController.TITLE));
|
||||
}
|
||||
|
|
@ -350,7 +337,6 @@ public abstract class AbstractAssetForm<T extends Asset>
|
|||
// @SuppressWarnings("unchecked")
|
||||
// final AbstractAssetFormController<T> controller = cdiUtil
|
||||
// .findBean(AbstractAssetFormController.class);
|
||||
|
||||
title.setValue(state,
|
||||
data.get(AbstractAssetFormController.TITLE));
|
||||
showLocale(state);
|
||||
|
|
@ -385,7 +371,6 @@ public abstract class AbstractAssetForm<T extends Asset>
|
|||
|
||||
if (saveCancelSection.getSaveButton().isSelected(state)) {
|
||||
|
||||
final Long selectedAssetId = getSelectedAssetId(state);
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
data.put(AbstractAssetFormController.DISPLAY_NAME,
|
||||
name.getValue(state));
|
||||
|
|
@ -393,6 +378,20 @@ public abstract class AbstractAssetForm<T extends Asset>
|
|||
title.getValue(state));
|
||||
data.putAll(collectData(event));
|
||||
|
||||
final Long selectedAssetId;
|
||||
if (getSelectedAssetId(state) == null) {
|
||||
|
||||
selectedAssetId = getController()
|
||||
.createAsset(assetPane
|
||||
.getFolderSelectionModel()
|
||||
.getSelectedObject(state),
|
||||
getSelectedLocale(state),
|
||||
getAssetClass(),
|
||||
data);
|
||||
} else {
|
||||
selectedAssetId = getSelectedAssetId(state);
|
||||
}
|
||||
|
||||
getController().updateAsset(selectedAssetId,
|
||||
getSelectedLocale(state),
|
||||
getAssetClass(),
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ package com.arsdigita.cms.ui.assets;
|
|||
|
||||
import org.librecms.assets.AssetL10NManager;
|
||||
import org.librecms.contentsection.Asset;
|
||||
import org.librecms.contentsection.AssetManager;
|
||||
import org.librecms.contentsection.AssetRepository;
|
||||
import org.librecms.contentsection.Folder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -44,6 +46,9 @@ public abstract class AbstractAssetFormController<T extends Asset> implements
|
|||
protected static final String DISPLAY_NAME = "displayName";
|
||||
protected static final String TITLE = "title";
|
||||
|
||||
@Inject
|
||||
private AssetManager assetManager;
|
||||
|
||||
@Inject
|
||||
private AssetRepository assetRepository;
|
||||
|
||||
|
|
@ -86,6 +91,36 @@ public abstract class AbstractAssetFormController<T extends Asset> implements
|
|||
protected abstract Map<String, Object> getAssetData(
|
||||
final T asset, final Locale selectedLocale);
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
public long createAsset(final Folder infolder,
|
||||
final Locale selectedLocale,
|
||||
final Class<T> assetType,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
if (!data.containsKey(DISPLAY_NAME)) {
|
||||
throw new IllegalArgumentException(
|
||||
"data does not contain a value for displayName.");
|
||||
}
|
||||
|
||||
if (!data.containsKey(TITLE)) {
|
||||
throw new IllegalArgumentException(
|
||||
"data does not contain a value for title.");
|
||||
}
|
||||
|
||||
final String name = (String) data.get(DISPLAY_NAME);
|
||||
final String title = (String) data.get(TITLE);
|
||||
|
||||
final T asset = assetManager
|
||||
.createAsset(name,
|
||||
title,
|
||||
selectedLocale,
|
||||
infolder,
|
||||
assetType);
|
||||
|
||||
return asset.getObjectId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the provided asset with the provided data.
|
||||
*
|
||||
|
|
@ -109,18 +144,11 @@ public abstract class AbstractAssetFormController<T extends Asset> implements
|
|||
final Class<T> assetType,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
Objects.requireNonNull(assetId, "Can't update asset null.");
|
||||
Objects.requireNonNull(selectedLocale,
|
||||
"Can't get update asset for locale null.");
|
||||
Objects.requireNonNull(data, "Can't update asset without data.");
|
||||
|
||||
final T asset;
|
||||
if (assetId == null) {
|
||||
asset = createAsset();
|
||||
} else {
|
||||
asset = loadAsset(assetId, assetType);
|
||||
}
|
||||
|
||||
final T asset = loadAsset(assetId, assetType);
|
||||
if (data.containsKey(DISPLAY_NAME)) {
|
||||
asset.setDisplayName((String) data.get(DISPLAY_NAME));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
package com.arsdigita.cms.ui.assets;
|
||||
|
||||
import org.librecms.contentsection.Asset;
|
||||
import org.librecms.contentsection.Folder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
|
@ -70,7 +71,12 @@ public interface AssetFormController<T extends Asset> {
|
|||
Class<T> assetType,
|
||||
Map<String, Object> data);
|
||||
|
||||
T createAsset();
|
||||
long createAsset(Folder inFolder,
|
||||
Locale selectedLocale,
|
||||
Class<T> assetType,
|
||||
Map<String, Object> data);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Determines in which locales the provided asset is available.
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.librecms.contentsection.Asset;
|
|||
import org.librecms.contentsection.AssetRepository;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
|
|
@ -91,33 +92,20 @@ public class AssetSearchWidget extends Widget {
|
|||
final Long value = (Long) getValue(state);
|
||||
if (value != null) {
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final AssetRepository assetRepo = cdiUtil
|
||||
.findBean(AssetRepository.class);
|
||||
final AssetTypesManager typesManager = cdiUtil
|
||||
.findBean(AssetTypesManager.class);
|
||||
final GlobalizationHelper globalizationHelper = cdiUtil
|
||||
.findBean(GlobalizationHelper.class);
|
||||
final AssetSearchWidgetController controller = cdiUtil
|
||||
.findBean(AssetSearchWidgetController.class);
|
||||
|
||||
final Asset asset = assetRepo
|
||||
.findById(value)
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No Asset with ID %d in the database.", value)));
|
||||
final Map<String, String> data = controller.getData(value);
|
||||
|
||||
final Element selected = widget
|
||||
.newChildElement("cms:selected-asset", CMS.CMS_XML_NS);
|
||||
selected.addAttribute("assetId",
|
||||
Long.toString(asset.getObjectId()));
|
||||
selected.addAttribute(
|
||||
"title",
|
||||
globalizationHelper
|
||||
.getValueFromLocalizedString(asset.getTitle()));
|
||||
final AssetTypeInfo typeInfo = typesManager
|
||||
.getAssetTypeInfo(asset.getClass().getName());
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(typeInfo.getLabelBundle(),
|
||||
globalizationHelper.getNegotiatedLocale());
|
||||
final String typeLabel = bundle.getString(typeInfo.getLabelKey());
|
||||
selected.addAttribute("type", typeLabel);
|
||||
"assetId", data.get(AssetSearchWidgetController.OBJECT_ID)
|
||||
);
|
||||
selected.addAttribute("title",
|
||||
data.get(AssetSearchWidgetController.TITLE));
|
||||
selected.addAttribute("type",
|
||||
data.get(AssetSearchWidgetController.TYPE));
|
||||
|
||||
exportAttributes(widget);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import org.libreccm.l10n.GlobalizationHelper;
|
||||
import org.librecms.assets.AssetTypeInfo;
|
||||
import org.librecms.assets.AssetTypesManager;
|
||||
import org.librecms.contentsection.Asset;
|
||||
import org.librecms.contentsection.AssetRepository;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
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 AssetSearchWidgetController {
|
||||
|
||||
protected static final String OBJECT_ID = "objectId";
|
||||
protected static final String TYPE = "type";
|
||||
protected static final String TITLE = "title";
|
||||
|
||||
@Inject
|
||||
private AssetRepository assetRepository;
|
||||
|
||||
@Inject
|
||||
private AssetTypesManager typesManager;
|
||||
|
||||
@Inject
|
||||
private GlobalizationHelper globalizationHelper;
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Map<String, String> getData(final long assetId) {
|
||||
|
||||
final Asset asset = assetRepository
|
||||
.findById(assetId)
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No Asset with ID %d in the database.", assetId)));
|
||||
|
||||
final Map<String, String> data = new HashMap<>();
|
||||
|
||||
data.put(OBJECT_ID, Long.toString(asset.getObjectId()));
|
||||
|
||||
data.put(TITLE,
|
||||
globalizationHelper
|
||||
.getValueFromLocalizedString(asset.getTitle()));
|
||||
final AssetTypeInfo typeInfo = typesManager
|
||||
.getAssetTypeInfo(asset.getClass().getName());
|
||||
final ResourceBundle bundle = ResourceBundle
|
||||
.getBundle(typeInfo.getLabelBundle(),
|
||||
globalizationHelper.getNegotiatedLocale());
|
||||
final String typeLabel = bundle.getString(typeInfo.getLabelKey());
|
||||
|
||||
data.put(TYPE, typeLabel);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -97,6 +97,8 @@ public abstract class AbstractBookmarkForm<T extends Bookmark>
|
|||
protected void initForm(final PageState state,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
super.initForm(state, data);
|
||||
|
||||
if (!data.isEmpty()) {
|
||||
|
||||
description
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.assets.forms;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
|
|
@ -56,8 +55,10 @@ import org.librecms.assets.ContactEntryKey;
|
|||
import org.librecms.assets.ContactableEntity;
|
||||
import org.librecms.assets.PostalAddress;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TooManyListenersException;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
|
@ -76,8 +77,6 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
|||
|
||||
private static final int COL_CONTACT_ENTRIES_REMOVE = 2;
|
||||
|
||||
private final AssetPane assetPane;
|
||||
|
||||
private SimpleContainer contactEntriesContainer;
|
||||
|
||||
private Table contactEntriesTable;
|
||||
|
|
@ -93,8 +92,6 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
|||
public AbstractContactableEntityForm(final AssetPane assetPane) {
|
||||
|
||||
super(assetPane);
|
||||
|
||||
this.assetPane = assetPane;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -158,27 +155,46 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||
public void initForm(final PageState state,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
super.init(event);
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
super.initForm(state, data);
|
||||
|
||||
final Long selectedAssetId = getSelectedAssetId(state);
|
||||
|
||||
if (selectedAssetId != null) {
|
||||
// ToDo
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
postalAddressSearchWidget.setValue(
|
||||
state,
|
||||
data.get(AbstractContactableEntityFormController.POSTAL_ADDRESS)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> collectData(
|
||||
final FormSectionEvent event) {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
if (postalAddressSearchWidget.getValue(state) != null) {
|
||||
|
||||
data.put(AbstractContactableEntityFormController.POSTAL_ADDRESS,
|
||||
postalAddressSearchWidget.getValue(state));
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
if (addContactEntryLink.equals(event.getSource())) {
|
||||
if (addContactEntryLink.isSelected(state)) {
|
||||
|
||||
final Long selectedAssetId = getSelectedAssetId(state);
|
||||
if (selectedAssetId == null) {
|
||||
|
|
@ -197,11 +213,11 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
|||
final String value = (String) contactEntryValueField.getValue(state);
|
||||
|
||||
controller.addContactEntry(key, value, selectedAssetId);
|
||||
|
||||
contactEntryKeySelect.setValue(state, null);
|
||||
contactEntryValueField.setValue(state, null);
|
||||
} else {
|
||||
super.process(event);
|
||||
|
||||
final Object selectedPostal = postalAddressSearchWidget
|
||||
.getValue(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -384,6 +400,7 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
|||
|
||||
return new ControlLink((Component) value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ContactEntryKeySelectPrintListener implements PrintListener {
|
||||
|
|
@ -400,21 +417,15 @@ public abstract class AbstractContactableEntityForm<T extends ContactableEntity>
|
|||
CMS_BUNDLE)))
|
||||
);
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final AbstractContactableEntityFormController controller = cdiUtil
|
||||
.findBean(AbstractContactableEntityFormController.class);
|
||||
final GlobalizationHelper globalizationHelper = cdiUtil
|
||||
.findBean(GlobalizationHelper.class);
|
||||
final List<ContactEntryKey> keys = controller
|
||||
.findAvailableContactEntryKeys();
|
||||
final AbstractContactableEntityFormController<?> controller = (AbstractContactableEntityFormController<?>) getController();
|
||||
|
||||
for (final ContactEntryKey key : keys) {
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
final Text label = new Text(
|
||||
globalizationHelper
|
||||
.getValueFromLocalizedString(key.getLabel()));
|
||||
final List<String[]> keys = controller
|
||||
.findAvailableContactEntryKeys(getSelectedLocale(state));
|
||||
|
||||
target.addOption(new Option(key.getEntryKey(), label));
|
||||
for (final String[] key : keys) {
|
||||
target.addOption(new Option(key[0], new Text(key[1])));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,16 +121,12 @@ public abstract class AbstractContactableEntityFormController<T extends Contacta
|
|||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No ContactEntity with ID %d found.", contactableId)));
|
||||
|
||||
entity
|
||||
return entity
|
||||
.getContactEntries()
|
||||
.stream()
|
||||
.map(contactEntry -> toContactEntryArray(contactEntry,
|
||||
selectedLocale))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<String[]> entries = new ArrayList<>();
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
private String[] toContactEntryArray(final ContactEntry entry,
|
||||
|
|
@ -189,15 +185,26 @@ public abstract class AbstractContactableEntityFormController<T extends Contacta
|
|||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<ContactEntryKey> findAvailableContactEntryKeys() {
|
||||
|
||||
final Locale locale = globalizationHelper.getNegotiatedLocale();
|
||||
public List<String[]> findAvailableContactEntryKeys(
|
||||
final Locale selectedLocale) {
|
||||
|
||||
return keyRepository
|
||||
.findAll()
|
||||
.stream()
|
||||
.sorted(new ContactEntryKeyByLabelComparator(locale))
|
||||
.sorted(new ContactEntryKeyByLabelComparator(selectedLocale))
|
||||
.map(key -> buildContactEntryKeyArray(key,
|
||||
selectedLocale))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private String[] buildContactEntryKeyArray(
|
||||
final ContactEntryKey contactEntryKey, final Locale selectedLocale) {
|
||||
|
||||
final String key = contactEntryKey.getEntryKey();
|
||||
final String label = contactEntryKey.getLabel().getValue(selectedLocale);
|
||||
|
||||
return new String[]{key, label};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.arsdigita.cms.ui.assets.IsControllerForAssetType;
|
|||
import org.librecms.assets.AudioAsset;
|
||||
import org.librecms.assets.LegalMetadata;
|
||||
import org.librecms.contentsection.AssetRepository;
|
||||
import org.librecms.contentsection.Folder;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
|
@ -43,11 +44,6 @@ public class AudioFormController extends AbstractBinaryAssetFormController<Audio
|
|||
@Inject
|
||||
private AssetRepository assetRepository;
|
||||
|
||||
@Override
|
||||
public AudioAsset createAsset() {
|
||||
return new AudioAsset();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getAssetData(final AudioAsset asset,
|
||||
final Locale selectedLocale) {
|
||||
|
|
|
|||
|
|
@ -33,9 +33,4 @@ import javax.enterprise.context.RequestScoped;
|
|||
public class BookmarkFormController
|
||||
extends AbstractBookmarkFormController<Bookmark> {
|
||||
|
||||
@Override
|
||||
public Bookmark createAsset() {
|
||||
return new Bookmark();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,11 +44,6 @@ public class ExternalAudioAssetFormController
|
|||
@Inject
|
||||
private AssetRepository assetRepository;
|
||||
|
||||
@Override
|
||||
public ExternalAudioAsset createAsset() {
|
||||
return new ExternalAudioAsset();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getAssetData(final ExternalAudioAsset asset,
|
||||
final Locale selectedLocale) {
|
||||
|
|
|
|||
|
|
@ -45,11 +45,6 @@ public class ExternalVideoAssetFormController
|
|||
@Inject
|
||||
private AssetRepository assetRepository;
|
||||
|
||||
@Override
|
||||
public ExternalVideoAsset createAsset() {
|
||||
return new ExternalVideoAsset();
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Override
|
||||
protected Map<String, Object> getAssetData(final ExternalVideoAsset asset,
|
||||
|
|
|
|||
|
|
@ -32,10 +32,4 @@ import javax.enterprise.context.RequestScoped;
|
|||
@IsControllerForAssetType(FileAsset.class)
|
||||
public class FileAssetFormController extends AbstractBinaryAssetFormController<FileAsset> {
|
||||
|
||||
@Override
|
||||
public FileAsset createAsset() {
|
||||
|
||||
return new FileAsset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,11 +47,6 @@ public class ImageFormController
|
|||
@Inject
|
||||
private AssetRepository assetRepository;
|
||||
|
||||
@Override
|
||||
public Image createAsset() {
|
||||
return new Image();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getAssetData(final Image asset,
|
||||
final Locale selectedLocale) {
|
||||
|
|
|
|||
|
|
@ -30,12 +30,9 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
|||
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.assets.LegalMetadata;
|
||||
import org.librecms.contentsection.Asset;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -88,6 +85,8 @@ public class LegalMetadataForm extends AbstractAssetForm<LegalMetadata> {
|
|||
protected void initForm(final PageState state,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
super.initForm(state, data);
|
||||
|
||||
if (getSelectedAssetId(state) != null) {
|
||||
|
||||
rightsHolder.setValue(
|
||||
|
|
|
|||
|
|
@ -90,10 +90,4 @@ public class LegalMetadataFormController
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LegalMetadata createAsset() {
|
||||
return new LegalMetadata();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
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;
|
||||
|
|
@ -82,12 +81,11 @@ public class OrganizationForm extends AbstractContactableEntityForm<Organization
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> collectData(final FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
protected Map<String, Object> collectData(final FormSectionEvent event) {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
final Map<String, Object> data = super.collectData(event);
|
||||
data.put(OrganizationFormController.ORGANIZATION_NAME,
|
||||
organizationName.getValue(state));
|
||||
|
||||
|
|
|
|||
|
|
@ -62,9 +62,4 @@ public class OrganizationFormController
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Organization createAsset() {
|
||||
return new Organization();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,13 +36,11 @@ import com.arsdigita.util.LockableImpl;
|
|||
|
||||
import org.librecms.assets.Person;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -115,6 +113,8 @@ public class PersonForm extends AbstractContactableEntityForm<Person> {
|
|||
CMS_BUNDLE));
|
||||
add(birthdateLabel);
|
||||
birthdateField = new Date("birthdate");
|
||||
final LocalDate today = LocalDate.now(ZoneId.systemDefault());
|
||||
birthdateField.setYearRange(1930, today.getYear());
|
||||
add(birthdateField);
|
||||
}
|
||||
|
||||
|
|
@ -130,8 +130,7 @@ public class PersonForm extends AbstractContactableEntityForm<Person> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> collectData(
|
||||
final FormSectionEvent event) throws FormProcessException {
|
||||
protected Map<String, Object> collectData(final FormSectionEvent event) {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
|
|
@ -150,16 +149,10 @@ public class PersonForm extends AbstractContactableEntityForm<Person> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||
public void initForm(final PageState state,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
super.init(event);
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
final Map<String, Object> data = getController()
|
||||
.getAssetData(getSelectedAssetId(state),
|
||||
getAssetClass(),
|
||||
getSelectedLocale(state));
|
||||
super.initForm(state, data);
|
||||
|
||||
if (data.containsKey(PersonFormController.SURNAME)) {
|
||||
surnameField.setValue(state,
|
||||
|
|
@ -192,7 +185,7 @@ public class PersonForm extends AbstractContactableEntityForm<Person> {
|
|||
if (addPersonNameButton.equals(event.getSource())) {
|
||||
|
||||
final PersonFormController controller
|
||||
= (PersonFormController) getController();
|
||||
= (PersonFormController) getController();
|
||||
controller.addPersonName(getSelectedAssetId(event.getPageState()));
|
||||
|
||||
} else {
|
||||
|
|
@ -202,7 +195,13 @@ public class PersonForm extends AbstractContactableEntityForm<Person> {
|
|||
|
||||
private Table buildPersonNamesTable() {
|
||||
|
||||
final Table table = new Table();
|
||||
final Table table = new Table() {
|
||||
|
||||
@Override
|
||||
public boolean isVisible(final PageState state) {
|
||||
return getSelectedAssetId(state) != null;
|
||||
}
|
||||
};
|
||||
|
||||
final TableColumnModel columnModel = table.getColumnModel();
|
||||
columnModel.add(new TableColumn(
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -73,6 +74,7 @@ public class PersonFormController
|
|||
@Inject
|
||||
private PersonManager personManager;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
protected Map<String, Object> getAssetData(final Person asset,
|
||||
final Locale selectedLocale) {
|
||||
|
|
@ -96,7 +98,10 @@ public class PersonFormController
|
|||
|
||||
final LocalDate birthdate = asset.getBirthdate();
|
||||
if (birthdate != null) {
|
||||
final Instant instant = Instant.from(birthdate);
|
||||
final Instant instant = birthdate
|
||||
.atStartOfDay()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toInstant();
|
||||
final Date birthdateValue = Date.from(instant);
|
||||
data.put(BIRTHDATE, birthdateValue);
|
||||
}
|
||||
|
|
@ -104,6 +109,7 @@ public class PersonFormController
|
|||
return data;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
protected List<String[]> getPersonNames(final Long personId) {
|
||||
|
||||
final Person person = personRepository
|
||||
|
|
@ -154,12 +160,18 @@ public class PersonFormController
|
|||
final String prefix = (String) data.get(PREFIX);
|
||||
final String suffix = (String) data.get(SUFFIX);
|
||||
|
||||
if (asset.getPersonName() == null) {
|
||||
personManager.addPersonName(asset);
|
||||
}
|
||||
|
||||
asset.getPersonName().setSurname(surname);
|
||||
asset.getPersonName().setGivenName(givenName);
|
||||
asset.getPersonName().setPrefix(prefix);
|
||||
asset.getPersonName().setSuffix(suffix);
|
||||
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public void addPersonName(final long personId) {
|
||||
|
||||
final Person person = personRepository
|
||||
|
|
@ -170,9 +182,4 @@ public class PersonFormController
|
|||
personManager.addPersonName(person);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Person createAsset() {
|
||||
return new Person();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
|
||||
import com.arsdigita.cms.ui.assets.AssetPane;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
import org.librecms.assets.PostalAddress;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class PostalAddressForm extends AbstractAssetForm<PostalAddress> {
|
||||
|
||||
private TextArea addressArea;
|
||||
private TextField postalCodeField;
|
||||
private TextField cityField;
|
||||
private TextField stateField;
|
||||
private TextField isoCountryCodeField;
|
||||
|
||||
public PostalAddressForm(final AssetPane assetPane) {
|
||||
super(assetPane);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
|
||||
super.addWidgets();
|
||||
|
||||
addressArea = new TextArea("address");
|
||||
addressArea.setLabel(new GlobalizedMessage(
|
||||
"cms.ui.authoring.assets.postaladdress.address", CMS_BUNDLE));
|
||||
addressArea.setCols(80);
|
||||
addressArea.setRows(10);
|
||||
add(addressArea);
|
||||
|
||||
postalCodeField = new TextField("postalCode");
|
||||
postalCodeField.setLabel(new GlobalizedMessage(
|
||||
"cms.ui.authoring.assets.postaladdress.postalcode", CMS_BUNDLE));
|
||||
add(postalCodeField);
|
||||
|
||||
cityField = new TextField("city");
|
||||
cityField.setLabel(new GlobalizedMessage(
|
||||
"cms.ui.authoring.assets.postaladdress.city", CMS_BUNDLE));
|
||||
add(cityField);
|
||||
|
||||
stateField = new TextField("state");
|
||||
stateField.setLabel(new GlobalizedMessage(
|
||||
"cms.ui.authoring.assets.postaladdress.state", CMS_BUNDLE));
|
||||
add(stateField);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<PostalAddress> getAssetClass() {
|
||||
return PostalAddress.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showLocale(final PageState state) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> collectData(final FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
|
||||
final PageState state = event.getPageState();
|
||||
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put(PostalAddressFormController.ADDRESS,
|
||||
addressArea.getValue(state));
|
||||
data.put(PostalAddressFormController.CITY,
|
||||
cityField.getValue(state));
|
||||
data.put(PostalAddressFormController.POSTAL_CODE,
|
||||
postalCodeField.getValue(state));
|
||||
data.put(PostalAddressFormController.STATE,
|
||||
stateField.getValue(state));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* 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.cms.ui.assets.AbstractAssetFormController;
|
||||
import com.arsdigita.cms.ui.assets.IsControllerForAssetType;
|
||||
|
||||
import org.librecms.assets.PostalAddress;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@IsControllerForAssetType(PostalAddress.class)
|
||||
public class PostalAddressFormController
|
||||
extends AbstractAssetFormController<PostalAddress> {
|
||||
|
||||
protected static final String STATE = "state";
|
||||
protected static final String CITY = "city";
|
||||
protected static final String POSTAL_CODE = "postalCode";
|
||||
protected static final String ADDRESS = "address";
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> getAssetData(final PostalAddress asset,
|
||||
final Locale selectedLocale) {
|
||||
|
||||
final Map<String, Object> data = new HashMap<>();
|
||||
|
||||
data.put(ADDRESS, asset.getAddress());
|
||||
data.put(POSTAL_CODE, asset.getPostalCode());
|
||||
data.put(CITY, asset.getCity());
|
||||
data.put(STATE, asset.getState());
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAssetProperties(final PostalAddress asset,
|
||||
final Locale selectedLocale,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
if (data.containsKey(ADDRESS)) {
|
||||
asset.setAddress((String) data.get(ADDRESS));
|
||||
}
|
||||
|
||||
if (data.containsKey(POSTAL_CODE)) {
|
||||
asset.setPostalCode((String) data.get(POSTAL_CODE));
|
||||
}
|
||||
|
||||
if (data.containsKey(CITY)) {
|
||||
asset.setCity((String) data.get(CITY));
|
||||
}
|
||||
|
||||
if (data.containsKey(STATE)) {
|
||||
asset.setState((String) data.get(STATE));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -58,6 +58,8 @@ public class SideNoteForm extends AbstractAssetForm<SideNote> {
|
|||
protected void initForm(final PageState state,
|
||||
final Map<String, Object> data) {
|
||||
|
||||
super.initForm(state, data);
|
||||
|
||||
if (getSelectedAssetId(state) != null) {
|
||||
|
||||
text.setValue(state, data.get(SideNoteFormController.TEXT));
|
||||
|
|
|
|||
|
|
@ -64,9 +64,4 @@ public class SideNoteFormController
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SideNote createAsset() {
|
||||
return new SideNote();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (C) 2017 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
|
@ -27,12 +27,9 @@ import com.arsdigita.cms.ui.assets.AssetPane;
|
|||
import com.arsdigita.cms.ui.assets.AssetSearchWidget;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.assets.VideoAsset;
|
||||
import org.librecms.assets.LegalMetadata;
|
||||
import org.librecms.contentsection.Asset;
|
||||
import org.librecms.contentsection.AssetRepository;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
package com.arsdigita.cms.ui.assets.forms;
|
||||
|
||||
import com.arsdigita.cms.ui.assets.IsControllerForAssetType;
|
||||
import com.arsdigita.cms.ui.assets.forms.AbstractBinaryAssetFormController;
|
||||
|
||||
import org.librecms.contentsection.AssetRepository;
|
||||
|
||||
|
|
@ -96,9 +95,4 @@ public class VideoFormController
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VideoAsset createAsset() {
|
||||
return new VideoAsset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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 ContactEntryRepository
|
||||
extends AbstractEntityRepository<Long, ContactEntry> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Class<ContactEntry> getEntityClass() {
|
||||
return ContactEntry.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdAttributeName() {
|
||||
return "contactEntryId";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getIdOfEntity(final ContactEntry entity) {
|
||||
|
||||
return entity.getContactEntryId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNew(final ContactEntry entity) {
|
||||
|
||||
return entity.getContactEntryId() == 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -35,6 +35,9 @@ public class ContactableEntityManager {
|
|||
@Inject
|
||||
private AssetRepository assetRepository;
|
||||
|
||||
@Inject
|
||||
private ContactEntryRepository entryRepository;
|
||||
|
||||
public void addContactEntryToContactableEntity(
|
||||
final ContactEntry contactEntry,
|
||||
final ContactableEntity contactableEntity) {
|
||||
|
|
@ -44,28 +47,29 @@ public class ContactableEntityManager {
|
|||
.setOrder(contactableEntity.getContactEntries().size());
|
||||
}
|
||||
contactableEntity.addContactEntry(contactEntry);
|
||||
entryRepository.save(contactEntry);
|
||||
assetRepository.save(contactableEntity);
|
||||
}
|
||||
|
||||
public void removeContactEntryFromContactableEntity(
|
||||
final ContactEntry contactEntry,
|
||||
final ContactableEntity contactableEntity) {
|
||||
final ContactEntry contactEntry,
|
||||
final ContactableEntity contactableEntity) {
|
||||
|
||||
contactableEntity.removeContactEntry(contactEntry);
|
||||
assetRepository.save(contactableEntity);
|
||||
}
|
||||
|
||||
public void addPostalAddressToContactableEntity(
|
||||
final PostalAddress postalAddress,
|
||||
final ContactableEntity contactableEntity) {
|
||||
final PostalAddress postalAddress,
|
||||
final ContactableEntity contactableEntity) {
|
||||
|
||||
contactableEntity.setPostalAddress(postalAddress);
|
||||
assetRepository.save(postalAddress);
|
||||
}
|
||||
|
||||
public void removePostalAddressFromContactableEntity(
|
||||
final PostalAddress postalAddress,
|
||||
final ContactableEntity contactableEntity) {
|
||||
final PostalAddress postalAddress,
|
||||
final ContactableEntity contactableEntity) {
|
||||
|
||||
contactableEntity.setPostalAddress(null);
|
||||
assetRepository.save(postalAddress);
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ package org.librecms.assets;
|
|||
|
||||
import com.arsdigita.cms.ui.assets.forms.PersonForm;
|
||||
|
||||
import static org.libreccm.core.CoreConstants.*;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
|
@ -35,10 +33,9 @@ import javax.persistence.ElementCollection;
|
|||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
import static org.librecms.assets.AssetConstants.*;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ package org.librecms.assets;
|
|||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.ejb.TransactionAttribute;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.transaction.Transactional;
|
||||
|
|
@ -42,7 +41,11 @@ public class PersonManager {
|
|||
.requireNonNull(toPerson, "Can't add a name to Person null.")
|
||||
.getPersonName();
|
||||
|
||||
toPerson.addPersonName(current);
|
||||
if (current == null) {
|
||||
toPerson.addPersonName(new PersonName());
|
||||
} else {
|
||||
toPerson.addPersonName(current);
|
||||
}
|
||||
|
||||
personRepository.save(toPerson);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.librecms.assets;
|
||||
|
||||
import com.arsdigita.cms.ui.assets.forms.PostalAddressForm;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.librecms.contentsection.Asset;
|
||||
|
||||
|
|
@ -28,6 +30,7 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.Table;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
import static org.librecms.assets.AssetConstants.*;
|
||||
|
||||
/**
|
||||
* A reuable postal address.
|
||||
|
|
@ -37,6 +40,11 @@ import static org.librecms.CmsConstants.*;
|
|||
@Entity
|
||||
@Audited
|
||||
@Table(name = "POSTAL_ADDRESSES", schema = DB_SCHEMA)
|
||||
@AssetType(assetForm = PostalAddressForm.class,
|
||||
labelBundle = ASSETS_BUNDLE,
|
||||
labelKey = "postaladdress.label",
|
||||
descriptionBundle = ASSETS_BUNDLE,
|
||||
descriptionKey = "postaladdress.description")
|
||||
public class PostalAddress extends Asset {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
alter table contact_entries drop column entry_key;
|
||||
|
|
@ -0,0 +1 @@
|
|||
alter table contact_entries drop column entry_key;
|
||||
|
|
@ -549,3 +549,15 @@ cms.ui.authoring.assets.contactable.contactentries.none=No contact entries
|
|||
cms.ui.authoring.assets.contactable.contactentries.key=Type
|
||||
cms.ui.authoring.assets.contactable.contactentries.add=Add
|
||||
cms.ui.authoring.assets.contactable.postaladdress=Postal address
|
||||
cms.ui.authoring.assets.contactable.contactentries.remove=Remove
|
||||
cms.ui.authoring.assets.postaladdress.address=Address
|
||||
cms.ui.authoring.assets.postaladdress.postalcode=Postal code
|
||||
cms.ui.authoring.assets.postaladdress.city=City
|
||||
cms.ui.authoring.assets.postaladdress.state=State
|
||||
cms.ui.authoring.assets.person.surname=Surname
|
||||
cms.ui.authoring.assets.person.given_name=Given name
|
||||
cms.ui.authoring.assets.person.prefix=Prefix
|
||||
cms.ui.authoring.assets.person.suffix=Suffix
|
||||
cms.ui.authoring.assets.person.add_name=Add name
|
||||
cms.ui.authoring.assets.person.birthdate=Birthdate
|
||||
cms.ui.authoring.assets.person.names.none=No records
|
||||
|
|
|
|||
|
|
@ -546,3 +546,15 @@ cms.ui.authoring.assets.contactable.contactentries.none=Keine Eintr\u00e4ge
|
|||
cms.ui.authoring.assets.contactable.contactentries.key=Typ
|
||||
cms.ui.authoring.assets.contactable.contactentries.add=Hinzuf\u00fcgen
|
||||
cms.ui.authoring.assets.contactable.postaladdress=Post Adresse
|
||||
cms.ui.authoring.assets.contactable.contactentries.remove=Entfernen
|
||||
cms.ui.authoring.assets.postaladdress.address=Adresse
|
||||
cms.ui.authoring.assets.postaladdress.postalcode=Postleitzahl
|
||||
cms.ui.authoring.assets.postaladdress.city=Ort
|
||||
cms.ui.authoring.assets.postaladdress.state=Staat
|
||||
cms.ui.authoring.assets.person.surname=Familienname
|
||||
cms.ui.authoring.assets.person.given_name=Vorname
|
||||
cms.ui.authoring.assets.person.prefix=Prefix
|
||||
cms.ui.authoring.assets.person.suffix=Suffix
|
||||
cms.ui.authoring.assets.person.add_name=Name hinzuf\u00fcgen
|
||||
cms.ui.authoring.assets.person.birthdate=Geburtsdatum
|
||||
cms.ui.authoring.assets.person.names.none=Keine Eintr\u00e4ge
|
||||
|
|
|
|||
|
|
@ -508,3 +508,15 @@ cms.ui.authoring.assets.contactable.contactentries.none=No contact entries
|
|||
cms.ui.authoring.assets.contactable.contactentries.key=Type
|
||||
cms.ui.authoring.assets.contactable.contactentries.add=Add
|
||||
cms.ui.authoring.assets.contactable.postaladdress=Postal address
|
||||
cms.ui.authoring.assets.contactable.contactentries.remove=Remove
|
||||
cms.ui.authoring.assets.postaladdress.address=Address
|
||||
cms.ui.authoring.assets.postaladdress.postalcode=Postal code
|
||||
cms.ui.authoring.assets.postaladdress.city=City
|
||||
cms.ui.authoring.assets.postaladdress.state=State
|
||||
cms.ui.authoring.assets.person.surname=Surname
|
||||
cms.ui.authoring.assets.person.given_name=Given name
|
||||
cms.ui.authoring.assets.person.prefix=Prefix
|
||||
cms.ui.authoring.assets.person.suffix=Suffix
|
||||
cms.ui.authoring.assets.person.add_name=Add name
|
||||
cms.ui.authoring.assets.person.birthdate=Birthdate
|
||||
cms.ui.authoring.assets.person.names.none=No records
|
||||
|
|
|
|||
|
|
@ -21,3 +21,5 @@ organization.label=Organization
|
|||
organization.desc=Stores data about an organization
|
||||
person.label=Person
|
||||
person.desc=Data about a person
|
||||
postaladdress.label=Postal Address
|
||||
postaladdress.desc=A postal address
|
||||
|
|
|
|||
|
|
@ -21,3 +21,5 @@ organization.label=Organisation
|
|||
organization.desc=Kontakt-) Daten einer Organisation
|
||||
person.label=Person
|
||||
person.desc=Daten zu einer Person
|
||||
postaladdress.label=Post-Adresse
|
||||
postaladdress.desc=Postalische Addresse
|
||||
|
|
|
|||
|
|
@ -223,19 +223,78 @@
|
|||
|
||||
create table CCM_CMS.CONTACT_ENTRIES (
|
||||
CONTACT_ENTRY_ID bigint not null,
|
||||
ENTRY_KEY varchar(255) not null,
|
||||
ENTRY_ORDER bigint,
|
||||
ENTRY_VALUE varchar(4096),
|
||||
CONTACT_ENTRY_KEY_ID bigint,
|
||||
CONTACTABLE_ID bigint,
|
||||
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_ORDER bigint,
|
||||
ENTRY_VALUE varchar(4096),
|
||||
CONTACT_ENTRY_KEY_ID bigint,
|
||||
primary key (CONTACT_ENTRY_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEY_LABELS (
|
||||
KEY_ID bigint not null,
|
||||
LOCALIZED_VALUE varchar(2147483647),
|
||||
LOCALE varchar(255) not null,
|
||||
primary key (KEY_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD (
|
||||
REV integer not null,
|
||||
KEY_ID bigint not null,
|
||||
LOCALIZED_VALUE varchar(2147483647) not null,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
primary key (REV, KEY_ID, LOCALIZED_VALUE, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEYS (
|
||||
KEY_ID bigint not null,
|
||||
ENTRY_KEY varchar(255),
|
||||
primary key (KEY_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEYS_AUD (
|
||||
KEY_ID bigint not null,
|
||||
REV integer not null,
|
||||
REVTYPE tinyint,
|
||||
REVEND integer,
|
||||
ENTRY_KEY varchar(255),
|
||||
primary key (KEY_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACTABLE_ENTITIES (
|
||||
OBJECT_ID bigint not null,
|
||||
POSTAL_ADDRESS_ID bigint,
|
||||
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 CCM_CMS.CONTENT_ITEM_COMPONENTS (
|
||||
MODE varchar(255),
|
||||
COMPONENT_MODEL_ID bigint not null,
|
||||
|
|
@ -826,6 +885,13 @@
|
|||
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 CCM_CMS.PAGE_THEME_CONFIGURATIONS (
|
||||
PAGE_ID bigint not null,
|
||||
INDEX_PAGE_TEMPLATE varchar(255),
|
||||
|
|
@ -848,16 +914,39 @@
|
|||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PERSONS (
|
||||
BIRTHDATA date,
|
||||
create table CCM_CMS.PERSON_NAMES (
|
||||
PERSON_ID bigint not null,
|
||||
GIVEN_NAME varchar(255),
|
||||
NAME_PREFIX 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),
|
||||
NAME_PREFIX varchar(255),
|
||||
GIVEN_NAME varchar(255),
|
||||
SUFFIX varchar(255),
|
||||
primary key (REV, REVTYPE, PERSON_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PERSONS (
|
||||
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.POSTAL_ADDRESSES (
|
||||
ADDRESS varchar(2048),
|
||||
CITY varchar(512),
|
||||
|
|
@ -868,6 +957,17 @@
|
|||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.POSTAL_ADDRESSES_AUD (
|
||||
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)
|
||||
);
|
||||
|
||||
create table CCM_CMS.RELATED_LINKS (
|
||||
OBJECT_ID bigint not null,
|
||||
BOOKMARK_ID bigint,
|
||||
|
|
@ -1484,10 +1584,10 @@
|
|||
SETTING_ID bigint not null,
|
||||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_LONG bigint,
|
||||
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||
SETTING_VALUE_DOUBLE double,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
|
@ -1958,11 +2058,51 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
|||
foreign key (COMPONENT_MODEL_ID)
|
||||
references CCM_CORE.PAGE_MODEL_COMPONENT_MODELS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES
|
||||
add constraint FKirtfj8sm4y5myworl5hvs1l78
|
||||
foreign key (CONTACT_ENTRY_KEY_ID)
|
||||
references CCM_CMS.CONTACT_ENTRY_KEYS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES
|
||||
add constraint FKljrrfco44damal9eaqrnfam0m
|
||||
foreign key (CONTACTABLE_ID)
|
||||
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES_AUD
|
||||
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.CONTACT_ENTRY_KEY_LABELS
|
||||
add constraint FK243nk3buqm0pskkr5ifjqfxn5
|
||||
foreign key (KEY_ID)
|
||||
references CCM_CMS.CONTACT_ENTRY_KEYS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD
|
||||
add constraint FK6n995k5gao6v63gfcga3yaxcw
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD
|
||||
add constraint FKdr8ujdpn1ej8l6omlxq8bsxbd
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEYS_AUD
|
||||
add constraint FKcvn2b1h1d4uvvmtbf4qf81l0y
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEYS_AUD
|
||||
add constraint FKkyy4v3tax8w5htnpkmmt8aec1
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACTABLE_ENTITIES
|
||||
add constraint FKqefwowr9adclj3xvpfje9rddr
|
||||
foreign key (POSTAL_ADDRESS_ID)
|
||||
|
|
@ -1973,6 +2113,21 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
|||
foreign key (OBJECT_ID)
|
||||
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.CONTENT_ITEM_COMPONENTS
|
||||
add constraint FKp83o82kxo2ipa0xo03wxp4dcr
|
||||
foreign key (COMPONENT_MODEL_ID)
|
||||
|
|
@ -2508,6 +2663,11 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
|||
foreign key (OBJECT_ID)
|
||||
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.PAGE_THEME_CONFIGURATIONS
|
||||
add constraint FK6l6xp6ex6sh2uuxfmeekf6ckn
|
||||
foreign key (PAGE_ID)
|
||||
|
|
@ -2538,16 +2698,41 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SITE_AWARE_APPLICATIONS;
|
||||
|
||||
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;
|
||||
|
||||
alter table CCM_CMS.POSTAL_ADDRESSES
|
||||
add constraint FK4vajjjjo8ro0wns58t8f3i782
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.ASSETS;
|
||||
|
||||
alter table CCM_CMS.POSTAL_ADDRESSES_AUD
|
||||
add constraint FKcrxgaot6kcp9rbxlg8gpp4grg
|
||||
foreign key (OBJECT_ID, REV)
|
||||
references CCM_CMS.ASSETS_AUD;
|
||||
|
||||
alter table CCM_CMS.RELATED_LINKS
|
||||
add constraint FKb517dnfj56oby2s34jp1omuim
|
||||
foreign key (BOOKMARK_ID)
|
||||
|
|
|
|||
|
|
@ -223,19 +223,78 @@
|
|||
|
||||
create table CCM_CMS.CONTACT_ENTRIES (
|
||||
CONTACT_ENTRY_ID int8 not null,
|
||||
ENTRY_KEY varchar(255) not null,
|
||||
ENTRY_ORDER int8,
|
||||
ENTRY_VALUE varchar(4096),
|
||||
CONTACT_ENTRY_KEY_ID int8,
|
||||
CONTACTABLE_ID int8,
|
||||
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_ORDER int8,
|
||||
ENTRY_VALUE varchar(4096),
|
||||
CONTACT_ENTRY_KEY_ID int8,
|
||||
primary key (CONTACT_ENTRY_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEY_LABELS (
|
||||
KEY_ID int8 not null,
|
||||
LOCALIZED_VALUE text,
|
||||
LOCALE varchar(255) not null,
|
||||
primary key (KEY_ID, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD (
|
||||
REV int4 not null,
|
||||
KEY_ID int8 not null,
|
||||
LOCALIZED_VALUE text not null,
|
||||
LOCALE varchar(255) not null,
|
||||
REVTYPE int2,
|
||||
REVEND int4,
|
||||
primary key (REV, KEY_ID, LOCALIZED_VALUE, LOCALE)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEYS (
|
||||
KEY_ID int8 not null,
|
||||
ENTRY_KEY varchar(255),
|
||||
primary key (KEY_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACT_ENTRY_KEYS_AUD (
|
||||
KEY_ID int8 not null,
|
||||
REV int4 not null,
|
||||
REVTYPE int2,
|
||||
REVEND int4,
|
||||
ENTRY_KEY varchar(255),
|
||||
primary key (KEY_ID, REV)
|
||||
);
|
||||
|
||||
create table CCM_CMS.CONTACTABLE_ENTITIES (
|
||||
OBJECT_ID int8 not null,
|
||||
POSTAL_ADDRESS_ID int8,
|
||||
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.CONTENT_ITEM_COMPONENTS (
|
||||
MODE varchar(255),
|
||||
COMPONENT_MODEL_ID int8 not null,
|
||||
|
|
@ -826,6 +885,13 @@
|
|||
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.PAGE_THEME_CONFIGURATIONS (
|
||||
PAGE_ID int8 not null,
|
||||
INDEX_PAGE_TEMPLATE varchar(255),
|
||||
|
|
@ -848,16 +914,39 @@
|
|||
primary key (OBJECT_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PERSONS (
|
||||
BIRTHDATA date,
|
||||
create table CCM_CMS.PERSON_NAMES (
|
||||
PERSON_ID int8 not null,
|
||||
GIVEN_NAME varchar(255),
|
||||
NAME_PREFIX 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),
|
||||
NAME_PREFIX varchar(255),
|
||||
GIVEN_NAME varchar(255),
|
||||
SUFFIX varchar(255),
|
||||
primary key (REV, REVTYPE, PERSON_ID)
|
||||
);
|
||||
|
||||
create table CCM_CMS.PERSONS (
|
||||
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.POSTAL_ADDRESSES (
|
||||
ADDRESS varchar(2048),
|
||||
CITY varchar(512),
|
||||
|
|
@ -868,6 +957,17 @@
|
|||
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)
|
||||
);
|
||||
|
||||
create table CCM_CMS.RELATED_LINKS (
|
||||
OBJECT_ID int8 not null,
|
||||
BOOKMARK_ID int8,
|
||||
|
|
@ -1484,10 +1584,10 @@
|
|||
SETTING_ID int8 not null,
|
||||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_LONG int8,
|
||||
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
||||
SETTING_VALUE_DOUBLE float8,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
|
@ -1958,11 +2058,51 @@ create sequence hibernate_sequence start 1 increment 1;
|
|||
foreign key (COMPONENT_MODEL_ID)
|
||||
references CCM_CORE.PAGE_MODEL_COMPONENT_MODELS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES
|
||||
add constraint FKirtfj8sm4y5myworl5hvs1l78
|
||||
foreign key (CONTACT_ENTRY_KEY_ID)
|
||||
references CCM_CMS.CONTACT_ENTRY_KEYS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES
|
||||
add constraint FKljrrfco44damal9eaqrnfam0m
|
||||
foreign key (CONTACTABLE_ID)
|
||||
references CCM_CMS.CONTACTABLE_ENTITIES;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRIES_AUD
|
||||
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.CONTACT_ENTRY_KEY_LABELS
|
||||
add constraint FK243nk3buqm0pskkr5ifjqfxn5
|
||||
foreign key (KEY_ID)
|
||||
references CCM_CMS.CONTACT_ENTRY_KEYS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD
|
||||
add constraint FK6n995k5gao6v63gfcga3yaxcw
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEY_LABELS_AUD
|
||||
add constraint FKdr8ujdpn1ej8l6omlxq8bsxbd
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEYS_AUD
|
||||
add constraint FKcvn2b1h1d4uvvmtbf4qf81l0y
|
||||
foreign key (REV)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACT_ENTRY_KEYS_AUD
|
||||
add constraint FKkyy4v3tax8w5htnpkmmt8aec1
|
||||
foreign key (REVEND)
|
||||
references CCM_CORE.CCM_REVISIONS;
|
||||
|
||||
alter table CCM_CMS.CONTACTABLE_ENTITIES
|
||||
add constraint FKqefwowr9adclj3xvpfje9rddr
|
||||
foreign key (POSTAL_ADDRESS_ID)
|
||||
|
|
@ -1973,6 +2113,21 @@ create sequence hibernate_sequence start 1 increment 1;
|
|||
foreign key (OBJECT_ID)
|
||||
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.CONTENT_ITEM_COMPONENTS
|
||||
add constraint FKp83o82kxo2ipa0xo03wxp4dcr
|
||||
foreign key (COMPONENT_MODEL_ID)
|
||||
|
|
@ -2508,6 +2663,11 @@ create sequence hibernate_sequence start 1 increment 1;
|
|||
foreign key (OBJECT_ID)
|
||||
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.PAGE_THEME_CONFIGURATIONS
|
||||
add constraint FK6l6xp6ex6sh2uuxfmeekf6ckn
|
||||
foreign key (PAGE_ID)
|
||||
|
|
@ -2538,16 +2698,41 @@ create sequence hibernate_sequence start 1 increment 1;
|
|||
foreign key (OBJECT_ID)
|
||||
references CCM_CORE.SITE_AWARE_APPLICATIONS;
|
||||
|
||||
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;
|
||||
|
||||
alter table CCM_CMS.POSTAL_ADDRESSES
|
||||
add constraint FK4vajjjjo8ro0wns58t8f3i782
|
||||
foreign key (OBJECT_ID)
|
||||
references CCM_CMS.ASSETS;
|
||||
|
||||
alter table CCM_CMS.POSTAL_ADDRESSES_AUD
|
||||
add constraint FKcrxgaot6kcp9rbxlg8gpp4grg
|
||||
foreign key (OBJECT_ID, REV)
|
||||
references CCM_CMS.ASSETS_AUD;
|
||||
|
||||
alter table CCM_CMS.RELATED_LINKS
|
||||
add constraint FKb517dnfj56oby2s34jp1omuim
|
||||
foreign key (BOOKMARK_ID)
|
||||
|
|
|
|||
Loading…
Reference in New Issue