- Finished support for multi instance applications in the Applications tab of /ccm/admin/
- Integration of ContentSection application into /ccm/admin/


git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4205 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-07-23 18:18:37 +00:00
parent fb35554553
commit e4640cd6d7
34 changed files with 3809 additions and 137 deletions

View File

@ -48,6 +48,12 @@
<artifactId>ccm-shortcuts</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- CCM Modules end -->
</dependencies>

View File

@ -22,8 +22,10 @@
<jta-data-source>java:/comp/env/jdbc/libreccm/db</jta-data-source>
<jar-file>lib/ccm-core-7.0.0-SNAPSHOT.jar</jar-file>
<jar-file>lib/ccm-cms-7.0.0-SNAPSHOT.jar</jar-file>
<jar-file>lib/ccm-shortcuts-7.0.0-SNAPSHOT.jar</jar-file>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="validate"/>

View File

@ -5,7 +5,6 @@ package org.librecms;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.categorization.Category;
import org.libreccm.core.CoreConstants;
import org.libreccm.modules.CcmModule;
import org.libreccm.modules.InitEvent;
@ -14,24 +13,36 @@ import org.libreccm.modules.Module;
import org.libreccm.modules.RequiredModule;
import org.libreccm.modules.ShutdownEvent;
import org.libreccm.modules.UnInstallEvent;
import org.libreccm.web.ApplicationType;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionCreator;
import org.librecms.contentsection.ContentSectionSetup;
import org.librecms.contentsection.ui.admin.ApplicationInstanceForm;
import org.librecms.contentsection.ui.admin.SettingsPane;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
@Module(packageName = "org.libreccm.cms",
@Module(//packageName = "org.librecms.cms",
requiredModules = {
@RequiredModule(module = org.libreccm.core.CcmCore.class)
},
applicationTypes = {
@ApplicationType(
name = CmsConstants.CONTENT_SECTION_APP_TYPE,
applicationClass = ContentSection.class,
instanceForm = ApplicationInstanceForm.class,
settingsPane = SettingsPane.class,
descBundle = CmsConstants.CONTENT_SECTION_DESC_BUNDLE,
creator = ContentSectionCreator.class
)
}
)
public class Cms implements CcmModule {
private static final Logger LOGGER = LogManager.getLogger(Cms.class);
@Override
public void install(final InstallEvent event) {
//ToDo Create initial data for the module if neccessary
@ -43,7 +54,12 @@ public class Cms implements CcmModule {
final Properties integrationProps = new Properties();
try (final InputStream inputStream = getClass().getResourceAsStream(
CoreConstants.INTEGRATION_PROPS)) {
if (inputStream == null) {
LOGGER.warn("No integration.properties available.");
} else {
integrationProps.load(inputStream);
}
} catch (IOException ex) {
LOGGER.warn(
"Failed to load integration properties. Using default values.",
@ -67,15 +83,14 @@ public class Cms implements CcmModule {
// * Content Reader: View Published Items
}
private void createContentSection(final String contentSectionName) {
final ContentSection section = new ContentSection();
section.setLabel(contentSectionName);
final Category rootFolder = new Category();
rootFolder.setName(String.format("%s_root", contentSectionName));
}
// private void createContentSection(final String contentSectionName) {
// final ContentSection section = new ContentSection();
// section.setLabel(contentSectionName);
//
// final Category rootFolder = new Category();
// rootFolder.setName(String.format("%s_root", contentSectionName));
//
// }
@Override
public void init(final InitEvent event) {
//ToDo Add initialisation logic necessary for your module

View File

@ -28,8 +28,11 @@ public class CmsConstants {
public static final String DB_SCHEMA = "CCM_CMS";
public static final String CMS_BUNDLE = "org.librecms.CmsResources";
public static final String CONTENT_SECTION_APP_TYPE = "org.librecms.contentsection.ContentSection";
public static final String CONTENT_SECTION_SERVLET_PATH = "/templates/servlet/content-section/*";
public static final String CONTENT_SECTION_DESC_BUNDLE = "org.librecms.contentsection.ContentSectionResources";
public static final String PRIVILEGE_ADMINISTER_CATEGORIES = "administer_categories";
public static final String PRIVILEGE_ADMINISTER_CONTENT_TYPES = "administer_content_types";

View File

@ -21,6 +21,7 @@ package org.librecms.assets;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;
import javax.activation.MimeType;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
@ -30,10 +31,14 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.Table;
import org.hibernate.envers.Audited;
import org.hibernate.validator.constraints.NotEmpty;
import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.l10n.LocalizedString;
import javax.persistence.Convert;
import static org.librecms.CmsConstants.*;
/**
@ -64,6 +69,7 @@ public class BinaryAsset extends Asset implements Serializable {
private String fileName;
@Column(name = "MIME_TYPE", length = 512, nullable = false)
@Convert(converter = MimeTypeConverter.class)
@NotEmpty
private MimeType mimeType;

View File

@ -18,8 +18,6 @@
*/
package org.librecms.contentsection;
import com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm;
import com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane;
import org.libreccm.categorization.Category;
import org.libreccm.security.Role;
@ -40,6 +38,7 @@ import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.libreccm.web.ApplicationType;
import org.librecms.contentsection.ui.admin.ApplicationInstanceForm;
import java.util.ArrayList;
@ -65,12 +64,13 @@ import static org.librecms.CmsConstants.*;
+ " OR p.object = :rootDocumentsFolder) "
+ "AND p.grantee = :role")
})
@ApplicationType(
name = CONTENT_SECTION_APP_TYPE,
descBundle = "org.librecms.contentsection.ContentSectionResources",
singleton = false,
creator = ContentSectionCreator.class,
servlet = ContentSectionServlet.class)
//@ApplicationType(
// name = CONTENT_SECTION_APP_TYPE,
// descBundle = "org.librecms.contentsection.ContentSectionResources",
// singleton = false,
// creator = ContentSectionCreator.class,
// servlet = ContentSectionServlet.class,
// instanceForm = ApplicationInstanceForm.class)
public class ContentSection extends CcmApplication implements Serializable {
private static final long serialVersionUID = -671718122153931727L;

View File

@ -120,9 +120,9 @@ public class ContentSectionManager {
section.setRootDocumentFolder(rootFolder);
section.setRootAssetsFolder(rootAssetFolder);
sectionRepo.save(section);
categoryRepo.save(rootFolder);
categoryRepo.save(rootAssetFolder);
sectionRepo.save(section);
addRoleToContentSection(section,
ALERT_RECIPIENT);

View File

@ -24,6 +24,10 @@ import org.libreccm.categorization.Category;
import org.libreccm.modules.InstallEvent;
import org.libreccm.security.Role;
import org.libreccm.web.AbstractCcmApplicationSetup;
import org.librecms.CmsConstants;
import java.util.Locale;
import java.util.UUID;
import static org.librecms.CmsConstants.*;
import static org.librecms.contentsection.ContentSection.*;
@ -61,13 +65,21 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
private void createContentSection(final String sectionName) {
final ContentSection section = new ContentSection();
section.setUuid(UUID.randomUUID().toString());
section.setApplicationType(CmsConstants.CONTENT_SECTION_APP_TYPE);
section.setPrimaryUrl(sectionName);
section.setDisplayName(sectionName);
section.setLabel(sectionName);
final Category rootFolder = new Category();
rootFolder.setUuid(UUID.randomUUID().toString());
rootFolder.setUniqueId(rootFolder.getUuid());
rootFolder.setName(String.format("%s_" + ROOT, sectionName));
final Category rootAssetFolder = new Category();
rootFolder.setName(String.format("%s_" + ASSETS, sectionName));
rootAssetFolder.setName(String.format("%s_" + ASSETS, sectionName));
rootAssetFolder.setUuid(UUID.randomUUID().toString());
rootAssetFolder.setUniqueId(rootAssetFolder.getUuid());
section.setRootDocumentFolder(rootFolder);
section.setRootAssetsFolder(rootAssetFolder);

View File

@ -0,0 +1,63 @@
/*
* Copyright (C) 2016 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.contentsection.ui.admin;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.contentsection.ContentSectionManager;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ApplicationInstanceForm extends DefaultApplicationInstanceForm {
public ApplicationInstanceForm(
final String name,
final ParameterSingleSelectionModel<String> selectedAppType,
final ParameterSingleSelectionModel<String> selectedAppInstance) {
super(name, selectedAppType, selectedAppInstance);
}
@Override
protected FormProcessListener createProcessListener() {
return (FormSectionEvent e) -> {
final PageState state = e.getPageState();
if (getSaveCancelSection().getSaveButton().isSelected(state)) {
final FormData data = e.getFormData();
final String primaryUrlData = data.getString(
"new_instance_primary_url");
final ContentSectionManager manager = CdiUtil.createCdiUtil()
.findBean(ContentSectionManager.class);
manager.createContentSection(primaryUrlData);
}
};
}
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2016 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.contentsection.ui.admin;
import com.arsdigita.bebop.ActionLink;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.ui.admin.applications.AbstractAppSettingsPane;
import com.arsdigita.web.RedirectSignal;
import com.arsdigita.web.URL;
import org.librecms.CmsConstants;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class SettingsPane extends AbstractAppSettingsPane {
public SettingsPane(
final ParameterSingleSelectionModel<String> selectedAppType,
final ParameterSingleSelectionModel<String> selectedAppInstance) {
super(selectedAppType, selectedAppInstance);
}
@Override
protected void createWidgets() {
final Label label = new Label(new GlobalizedMessage(
"contentsection.ui.admin.app_note", CmsConstants.CMS_BUNDLE));
add(label);
final ActionLink link = new ActionLink(new GlobalizedMessage(
"contentsection.ui.admin.link_app", CmsConstants.CMS_BUNDLE));
link.addActionListener(e -> {
final PageState state = e.getPageState();
final String primaryUrl;
if (getSelectedAppInstance(state).get().getPrimaryUrl().startsWith(
"/")) {
primaryUrl = getSelectedAppInstance(state).get().getPrimaryUrl();
} else {
primaryUrl = String.format(
"/%s",
getSelectedAppInstance(state).get().getPrimaryUrl());
}
throw new RedirectSignal(
URL.there(state.getRequest(), primaryUrl, null),
false);
});
add(link);
}
}

View File

@ -162,7 +162,7 @@
create table CCM_CMS.BINARY_ASSETS (
ASSET_DATA blob,
FILENAME varchar(512) not null,
MIME_TYPE binary(512) not null,
MIME_TYPE varchar(512) not null,
DATA_SIZE bigint,
ASSET_ID bigint not null,
primary key (ASSET_ID)
@ -173,7 +173,7 @@
REV integer not null,
ASSET_DATA blob,
FILENAME varchar(512),
MIME_TYPE binary(512),
MIME_TYPE varchar(512),
DATA_SIZE bigint,
primary key (ASSET_ID, REV)
);
@ -278,6 +278,11 @@
primary key (OBJECT_ID, REV)
);
create table CCM_CMS.CONTENT_SECTION_ROLES (
SECTION_ID bigint not null,
ROLE_ID bigint not null
);
create table CCM_CMS.CONTENT_SECTIONS (
DEFAULT_LOCALE varchar(255),
ITEM_RESOLVER_CLASS varchar(1024),
@ -288,8 +293,6 @@
OBJECT_ID bigint not null,
ROOT_ASSETS_FOLDER_ID bigint,
ROOT_DOCUMENTS_FOLDER_ID bigint,
STAFF_ROLE_ID bigint,
VIEWERS_ROLE_ID bigint,
primary key (OBJECT_ID)
);
@ -1071,6 +1074,16 @@
foreign key (OBJECT_ID, REV)
references CCM_CORE.CCM_OBJECTS_AUD;
alter table CCM_CMS.CONTENT_SECTION_ROLES
add constraint FKkn5nygbmub9wd5lxw3402t82d
foreign key (ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CMS.CONTENT_SECTION_ROLES
add constraint FKgcn76piocmkmvl3b0omv9vkv9
foreign key (SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS;
alter table CCM_CMS.CONTENT_SECTIONS
add constraint FKajweudfxaf7g2ydr2hcgqwcib
foreign key (ROOT_ASSETS_FOLDER_ID)
@ -1081,16 +1094,6 @@
foreign key (ROOT_DOCUMENTS_FOLDER_ID)
references CCM_CORE.CATEGORIES;
alter table CCM_CMS.CONTENT_SECTIONS
add constraint FKqb579yjmmqbergn0qv68a4rqb
foreign key (STAFF_ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CMS.CONTENT_SECTIONS
add constraint FKjntqpyi3g4bx97ive5x8aipyi
foreign key (VIEWERS_ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CMS.CONTENT_SECTIONS
add constraint FK72jh0axiiru87i61mppvaiv96
foreign key (OBJECT_ID)
@ -1556,3 +1559,492 @@
foreign key (TASK_ID)
references CCM_CORE.WORKFLOW_USER_TASKS;
alter table CCM_CORE.APPLICATIONS
add constraint FKatcp9ij6mbkx0nfeig1o6n3lm
foreign key (OBJECT_ID)
references CCM_CORE.RESOURCES;
alter table CCM_CORE.ATTACHMENTS
add constraint FK8ju9hm9baceridp803nislkwb
foreign key (MESSAGE_ID)
references CCM_CORE.MESSAGES;
alter table CCM_CORE.CATEGORIES
add constraint FKrj3marx99nheur4fqanm0ylur
foreign key (PARENT_CATEGORY_ID)
references CCM_CORE.CATEGORIES;
alter table CCM_CORE.CATEGORIES
add constraint FKpm291swli2musd0204phta652
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.CATEGORIZATIONS
add constraint FKejp0ubk034nfq60v1po6srkke
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.CATEGORIZATIONS
add constraint FKoyeipswl876wa6mqwbx0uy83h
foreign key (CATEGORY_ID)
references CCM_CORE.CATEGORIES;
alter table CCM_CORE.CATEGORY_DESCRIPTIONS
add constraint FKhiwjlmh5vkbu3v3vng1la1qum
foreign key (OBJECT_ID)
references CCM_CORE.CATEGORIES;
alter table CCM_CORE.CATEGORY_DOMAINS
add constraint FKf25vi73cji01w8fgo6ow1dgg
foreign key (ROOT_CATEGORY_ID)
references CCM_CORE.CATEGORIES;
alter table CCM_CORE.CATEGORY_DOMAINS
add constraint FK58xpmnvciohkom1c16oua4xha
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.CATEGORY_TITLES
add constraint FKka9bt9f5br0kji5bcjxcmf6ch
foreign key (OBJECT_ID)
references CCM_CORE.CATEGORIES;
alter table CCM_CORE.CCM_OBJECTS_AUD
add constraint FKr00eauutiyvocno8ckx6h9nw6
foreign key (REV)
references CCM_CORE.CCM_REVISIONS;
alter table CCM_CORE.CCM_OBJECTS_AUD
add constraint FKo5s37ctcdny7tmewjwv7705h5
foreign key (REVEND)
references CCM_CORE.CCM_REVISIONS;
alter table CCM_CORE.DIGESTS
add constraint FKc53g09agnye3w1v4euy3e0gsi
foreign key (FROM_PARTY_ID)
references CCM_CORE.PARTIES;
alter table CCM_CORE.DIGESTS
add constraint FK845r9ep6xu6nbt1mvxulwybym
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.DOMAIN_DESCRIPTIONS
add constraint FKn4i2dxgn8cqysa62dds6eih6a
foreign key (OBJECT_ID)
references CCM_CORE.CATEGORY_DOMAINS;
alter table CCM_CORE.DOMAIN_OWNERSHIPS
add constraint FK47nsasr7jrdwlky5gx0u6e9py
foreign key (domain_OBJECT_ID)
references CCM_CORE.CATEGORY_DOMAINS;
alter table CCM_CORE.DOMAIN_OWNERSHIPS
add constraint FK3u4hq6yqau4m419b1xva3xpwq
foreign key (owner_OBJECT_ID)
references CCM_CORE.APPLICATIONS;
alter table CCM_CORE.DOMAIN_TITLES
add constraint FK5p526dsdwn94els6lp5w0hdn4
foreign key (OBJECT_ID)
references CCM_CORE.CATEGORY_DOMAINS;
alter table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS
add constraint FKfh0k9lj3pf4amfc9bbbss0tr1
foreign key (COMPONENT_ID)
references CCM_CORE.FORMBUILDER_COMPONENTS;
alter table CCM_CORE.FORMBUILDER_COMPONENTS
add constraint FKpcpmvyiix023b4g5n4q8nkfca
foreign key (parentComponent_OBJECT_ID)
references CCM_CORE.FORMBUILDER_COMPONENTS;
alter table CCM_CORE.FORMBUILDER_COMPONENTS
add constraint FKt0e0uv00pp1rwhyaltrytghnm
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.FORMBUILDER_CONFIRM_EMAIL_LISTENER
add constraint FK48khrbud3xhi2gvsvnlttd8tg
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
alter table CCM_CORE.FORMBUILDER_CONFIRM_REDIRECT_LISTENERS
add constraint FKbyjjt2ufendvje2obtge2l7et
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
alter table CCM_CORE.FORMBUILDER_DATA_DRIVEN_SELECTS
add constraint FK8oriyta1957u7dvbrqk717944
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_WIDGETS;
alter table CCM_CORE.FORMBUILDER_DATA_QUERIES
add constraint FKhhaxpeddbtmrnjr5o0fopju3a
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS
add constraint FKsmduu1opoiulkeo2gc8v7lsbn
foreign key (DATA_QUERY_ID)
references CCM_CORE.FORMBUILDER_DATA_QUERIES;
alter table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES
add constraint FKju1x82inrw3kguyjuxoetn6gn
foreign key (DATA_QUERY_ID)
references CCM_CORE.FORMBUILDER_DATA_QUERIES;
alter table CCM_CORE.FORMBUILDER_FORMSECTIONS
add constraint FKnfhsgxp4lvigq2pm33pn4afac
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_COMPONENTS;
alter table CCM_CORE.FORMBUILDER_LISTENERS
add constraint FK33ilyirwoux28yowafgd5xx0o
foreign key (widget_OBJECT_ID)
references CCM_CORE.FORMBUILDER_WIDGETS;
alter table CCM_CORE.FORMBUILDER_LISTENERS
add constraint FKlqm76746nq5yrt8ganm474uu0
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.FORMBUILDER_METAOBJECTS
add constraint FKf963v6u9mw8pwjmasrw51w8dx
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.FORMBUILDER_OBJECT_TYPES
add constraint FKkv337e83rsecf0h3qy8bu7l9w
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.FORMBUILDER_OPTION_LABELS
add constraint FKatlsylsvln6yse55eof6wwkj6
foreign key (OPTION_ID)
references CCM_CORE.FORMBUILDER_OPTIONS;
alter table CCM_CORE.FORMBUILDER_OPTIONS
add constraint FKhe5q71wby9g4i56sotc501h11
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_COMPONENTS;
alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS
add constraint FKcv3iu04gxjk9c0pn6tl8rqqv3
foreign key (PROCESS_LISTENER_ID)
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES
add constraint FK8rnyb1m6ij3b9hhmhr7klgd4p
foreign key (PROCESS_LISTENER_ID)
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS
add constraint FK7uiaeax8qafm82e5k729ms5ku
foreign key (formSection_OBJECT_ID)
references CCM_CORE.FORMBUILDER_FORMSECTIONS;
alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS
add constraint FKbdnloo884qk6gn36jwiqv5rlp
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.FORMBUILDER_REMOTE_SERVER_POST_LISTENER
add constraint FKpajvu9m6fj1enm67a9gcb5ii9
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
alter table CCM_CORE.FORMBUILDER_SIMPLE_EMAIL_LISTENERS
add constraint FKsn82ktlq0c9ikijyv8k2bfv4f
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
alter table CCM_CORE.FORMBUILDER_TEMPLATE_EMAIL_LISTENERS
add constraint FK8kjyu72btjsuaaqh4bvd8npns
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
alter table CCM_CORE.FORMBUILDER_WIDGET_LABELS
add constraint FKb1q9bfshcrkwlj7r8w5jb4y8l
foreign key (widget_OBJECT_ID)
references CCM_CORE.FORMBUILDER_WIDGETS;
alter table CCM_CORE.FORMBUILDER_WIDGET_LABELS
add constraint FKm1huo6ghk9l5o8buku9v8y6q7
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_COMPONENTS;
alter table CCM_CORE.FORMBUILDER_WIDGETS
add constraint FKs7qq6vxblhmq0rlf87re65jdp
foreign key (label_OBJECT_ID)
references CCM_CORE.FORMBUILDER_WIDGET_LABELS;
alter table CCM_CORE.FORMBUILDER_WIDGETS
add constraint FK1wosr4ujbfckdc50u5fgmrhrk
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_COMPONENTS;
alter table CCM_CORE.FORMBUILDER_XML_EMAIL_LISTENERS
add constraint FKjie9co03m7ow4ihig5rk7l8oj
foreign key (OBJECT_ID)
references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS;
alter table CCM_CORE.GROUP_MEMBERSHIPS
add constraint FKq4qnny8ri3eo7eqh4olxco8nk
foreign key (GROUP_ID)
references CCM_CORE.GROUPS;
alter table CCM_CORE.GROUP_MEMBERSHIPS
add constraint FKc8u86ivkhvoiw6ju8b2p365he
foreign key (MEMBER_ID)
references CCM_CORE.USERS;
alter table CCM_CORE.GROUPS
add constraint FK4f61mlqxw0ct6s7wwpi9m0735
foreign key (PARTY_ID)
references CCM_CORE.PARTIES;
alter table CCM_CORE.INITS
add constraint FK3nvvxk10nmq9nfuko8yklqdgc
foreign key (REQUIRED_BY_ID)
references CCM_CORE.INITS;
alter table CCM_CORE.LUCENE_DOCUMENTS
add constraint FK942kl4yff8rdiwr0pjk2a9g8
foreign key (CREATED_BY_PARTY_ID)
references CCM_CORE.USERS;
alter table CCM_CORE.LUCENE_DOCUMENTS
add constraint FKc5rs6afx4p9fidabfqsxr5ble
foreign key (LAST_MODIFIED_BY)
references CCM_CORE.USERS;
alter table CCM_CORE.LUCENE_INDEXES
add constraint FK6gu0yrlviqk07dtb3r02iw43f
foreign key (HOST_ID)
references CCM_CORE.HOSTS;
alter table CCM_CORE.MESSAGES
add constraint FKph10aehmg9f20pn2w4buki97q
foreign key (IN_REPLY_TO_ID)
references CCM_CORE.MESSAGES;
alter table CCM_CORE.MESSAGES
add constraint FKjufsx3c3h538fj35h8hgfnb1p
foreign key (SENDER_ID)
references CCM_CORE.USERS;
alter table CCM_CORE.MESSAGES
add constraint FK6w20ao7scwecd9mfwpun2ddqx
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.NOTIFICATIONS
add constraint FKqk70c1x1dklhty9ju5t4wukd9
foreign key (DIGEST_ID)
references CCM_CORE.DIGESTS;
alter table CCM_CORE.NOTIFICATIONS
add constraint FKtt4fjr2p75og79jxxgd8q8mr
foreign key (MESSAGE_ID)
references CCM_CORE.MESSAGES;
alter table CCM_CORE.NOTIFICATIONS
add constraint FK2vlnma0ox43j0clx8ead08n5s
foreign key (RECEIVER_ID)
references CCM_CORE.PARTIES;
alter table CCM_CORE.NOTIFICATIONS
add constraint FKf423hhiaw1bexpxeh1pnas7qt
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.ONE_TIME_AUTH_TOKENS
add constraint FKtplfuphkiorfkttaewb4wmfjc
foreign key (USER_ID)
references CCM_CORE.USERS;
alter table CCM_CORE.PERMISSIONS
add constraint FKj9di7pawxgtouxmu2k44bj5c4
foreign key (CREATION_USER_ID)
references CCM_CORE.USERS;
alter table CCM_CORE.PERMISSIONS
add constraint FKikx3x0kn9fito23g50v6xbr9f
foreign key (GRANTEE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.PERMISSIONS
add constraint FKkamckexjnffnt8lay9nqeawhm
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.PORTALS
add constraint FK5a2hdrbw03mmgr74vj5nxlpvk
foreign key (OBJECT_ID)
references CCM_CORE.RESOURCES;
alter table CCM_CORE.PORTLETS
add constraint FK9gr5xjt3rx4uhtw7vl6adruol
foreign key (PORTAL_ID)
references CCM_CORE.PORTALS;
alter table CCM_CORE.PORTLETS
add constraint FKjmx9uebt0gwxkw3xv34niy35f
foreign key (OBJECT_ID)
references CCM_CORE.RESOURCES;
alter table CCM_CORE.QUEUE_ITEMS
add constraint FKtgkwfruv9kjdybf46l02da088
foreign key (MESSAGE_ID)
references CCM_CORE.MESSAGES;
alter table CCM_CORE.QUEUE_ITEMS
add constraint FKs9aq1hyxstwmvx7fmfifp4x7r
foreign key (RECEIVER_ID)
references CCM_CORE.PARTIES;
alter table CCM_CORE.RESOURCE_DESCRIPTIONS
add constraint FKk9arvj5u21rv23ce3cav4opqx
foreign key (OBJECT_ID)
references CCM_CORE.RESOURCES;
alter table CCM_CORE.RESOURCE_TITLES
add constraint FKto4p6n2wklljyf7tmuxtmyfe0
foreign key (OBJECT_ID)
references CCM_CORE.RESOURCES;
alter table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS
add constraint FKckpihjtv23iahbg3imnpbsr2
foreign key (RESOURCE_TYPE_ID)
references CCM_CORE.RESOURCE_TYPES;
alter table CCM_CORE.RESOURCES
add constraint FKbo7ibfgodicn9flv2gfo11g5a
foreign key (parent_OBJECT_ID)
references CCM_CORE.RESOURCES;
alter table CCM_CORE.RESOURCES
add constraint FK262fbwetpjx3k4uuvw24wsiv
foreign key (resourceType_RESOURCE_TYPE_ID)
references CCM_CORE.RESOURCE_TYPES;
alter table CCM_CORE.RESOURCES
add constraint FKbjdf8pm4frth8r06ev2qjm88f
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.ROLE_MEMBERSHIPS
add constraint FK9m88ywi7rcin7b7jrgh53emrq
foreign key (MEMBER_ID)
references CCM_CORE.PARTIES;
alter table CCM_CORE.ROLE_MEMBERSHIPS
add constraint FKcsyogv5m2rgsrmtgnhgkjhfw7
foreign key (ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.SETTINGS_ENUM_VALUES
add constraint FK8mw4p92s0h3h8bmo8saowu32i
foreign key (ENUM_ID)
references CCM_CORE.SETTINGS;
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
add constraint FK5knjq7cisej0qfx5dw1y93rou
foreign key (ENTRY_ID)
references CCM_CORE.SETTINGS;
alter table CCM_CORE.SETTINGS_STRING_LIST
add constraint FKqeclqa5sf1g53vxs857tpwrus
foreign key (LIST_ID)
references CCM_CORE.SETTINGS;
alter table CCM_CORE.TASK_ASSIGNMENTS
add constraint FKe29uwmvxdmol1fjob3auej4qv
foreign key (ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.TASK_ASSIGNMENTS
add constraint FKc1vovbjg9mp5yegx2fdoutx7u
foreign key (TASK_ID)
references CCM_CORE.WORKFLOW_USER_TASKS;
alter table CCM_CORE.THREADS
add constraint FKsx08mpwvwnw97uwdgjs76q39g
foreign key (ROOT_ID)
references CCM_CORE.MESSAGES;
alter table CCM_CORE.THREADS
add constraint FKp97b1sy1kop07rtapeh5l9fb2
foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.USER_EMAIL_ADDRESSES
add constraint FKr900l79erul95seyyccf04ufc
foreign key (USER_ID)
references CCM_CORE.USERS;
alter table CCM_CORE.USERS
add constraint FKosh928q71aonu6l1kurb417r
foreign key (PARTY_ID)
references CCM_CORE.PARTIES;
alter table CCM_CORE.WORKFLOW_DESCRIPTIONS
add constraint FKgx7upkqky82dpxvbs95imfl9l
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOW_NAMES
add constraint FKkxedy9p48avfk45r0bn4uc09i
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOW_TASK_COMMENTS
add constraint FKkfqrf9jdvm7livu5if06w0r5t
foreign key (TASK_ID)
references CCM_CORE.WORKFLOW_TASKS;
alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES
add constraint FK1htp420ki24jaswtcum56iawe
foreign key (DEPENDENT_TASK_ID)
references CCM_CORE.WORKFLOW_TASKS;
alter table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES
add constraint FK8rbggnp4yjpab8quvvx800ymy
foreign key (DEPENDS_ON_TASK_ID)
references CCM_CORE.WORKFLOW_TASKS;
alter table CCM_CORE.WORKFLOW_TASK_LABELS
add constraint FKf715qud6g9xv2xeb8rrpnv4xs
foreign key (TASK_ID)
references CCM_CORE.WORKFLOW_TASKS;
alter table CCM_CORE.WORKFLOW_TASKS
add constraint FK1693cbc36e4d8gucg8q7sc57e
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS
add constraint FK2s2498d2tpojjrtghq7iyaosv
foreign key (TASK_ID)
references CCM_CORE.WORKFLOW_TASKS;
alter table CCM_CORE.WORKFLOW_TEMPLATES
add constraint FK8692vdme4yxnkj1m0k1dw74pk
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOW_USER_TASKS
add constraint FKf09depwj5rgso2dair07vnu33
foreign key (LOCKING_USER_ID)
references CCM_CORE.USERS;
alter table CCM_CORE.WORKFLOW_USER_TASKS
add constraint FK6evo9y34awhdfcyl8gv78qb7f
foreign key (NOTIFICATION_SENDER)
references CCM_CORE.USERS;
alter table CCM_CORE.WORKFLOW_USER_TASKS
add constraint FKefpdf9ojplu7loo31hfm0wl2h
foreign key (TASK_ID)
references CCM_CORE.WORKFLOW_TASKS;

View File

@ -163,7 +163,7 @@
create table CCM_CMS.BINARY_ASSETS (
ASSET_DATA oid,
FILENAME varchar(512) not null,
MIME_TYPE bytea not null,
MIME_TYPE varchar(512) not null,
DATA_SIZE int8,
ASSET_ID int8 not null,
primary key (ASSET_ID)
@ -174,7 +174,7 @@
REV int4 not null,
ASSET_DATA oid,
FILENAME varchar(512),
MIME_TYPE bytea,
MIME_TYPE varchar(512),
DATA_SIZE int8,
primary key (ASSET_ID, REV)
);
@ -279,6 +279,11 @@
primary key (OBJECT_ID, REV)
);
create table CCM_CMS.CONTENT_SECTION_ROLES (
SECTION_ID int8 not null,
ROLE_ID int8 not null
);
create table CCM_CMS.CONTENT_SECTIONS (
DEFAULT_LOCALE varchar(255),
ITEM_RESOLVER_CLASS varchar(1024),
@ -289,8 +294,6 @@
OBJECT_ID int8 not null,
ROOT_ASSETS_FOLDER_ID int8,
ROOT_DOCUMENTS_FOLDER_ID int8,
STAFF_ROLE_ID int8,
VIEWERS_ROLE_ID int8,
primary key (OBJECT_ID)
);
@ -1072,6 +1075,16 @@
foreign key (OBJECT_ID, REV)
references CCM_CORE.CCM_OBJECTS_AUD;
alter table CCM_CMS.CONTENT_SECTION_ROLES
add constraint FKkn5nygbmub9wd5lxw3402t82d
foreign key (ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CMS.CONTENT_SECTION_ROLES
add constraint FKgcn76piocmkmvl3b0omv9vkv9
foreign key (SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS;
alter table CCM_CMS.CONTENT_SECTIONS
add constraint FKajweudfxaf7g2ydr2hcgqwcib
foreign key (ROOT_ASSETS_FOLDER_ID)
@ -1082,16 +1095,6 @@
foreign key (ROOT_DOCUMENTS_FOLDER_ID)
references CCM_CORE.CATEGORIES;
alter table CCM_CMS.CONTENT_SECTIONS
add constraint FKqb579yjmmqbergn0qv68a4rqb
foreign key (STAFF_ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CMS.CONTENT_SECTIONS
add constraint FKjntqpyi3g4bx97ive5x8aipyi
foreign key (VIEWERS_ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CMS.CONTENT_SECTIONS
add constraint FK72jh0axiiru87i61mppvaiv96
foreign key (OBJECT_ID)

View File

@ -0,0 +1,3 @@
contentsection.ui.admin.app_note=The properties for a Content Section are managed a special application:
contentsection.ui.admin.link_app=Go to Content Section application

View File

@ -0,0 +1,3 @@
contentsection.ui.admin.app_note=Die Verwaltung von Content Sections erfolgt \u00fcber eine eigene Application:
contentsection.ui.admin.link_app=Zur Content Section Applikation

View File

@ -15,5 +15,5 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA
application_title=Inhaltssektion
application_title=Content Section
application_desc=A content section is used to group similar content.

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,7 @@ public interface TreeNode {
/**
* Obtain a unique ID representing the node
* @return
*/
Object getKey();

View File

@ -19,8 +19,10 @@
package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.event.FormProcessListener;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.web.ApplicationRepository;
@ -49,10 +51,14 @@ public abstract class AbstractAppInstanceForm extends Form {
this.selectedAppInstance = selectedAppInstance;
createWidgets();
addProcessListener(createProcessListener());
}
protected abstract void createWidgets();
protected abstract FormProcessListener createProcessListener();
protected ApplicationType getSelectedAppType(final PageState state) {
final org.libreccm.web.ApplicationManager appManager = CdiUtil
.createCdiUtil().findBean(org.libreccm.web.ApplicationManager.class);

View File

@ -19,17 +19,23 @@
package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.tree.TreeNode;
import com.arsdigita.kernel.KernelConfig;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.web.CcmApplication;
import java.util.Locale;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ApplicationInstanceTreeNode implements TreeNode {
protected static final String INSTANCE_NODE_KEY_PREFIX = "appinstance_";
private final CcmApplication application;
public ApplicationInstanceTreeNode(final CcmApplication application) {
@ -38,15 +44,36 @@ public class ApplicationInstanceTreeNode implements TreeNode {
@Override
public Object getKey() {
return application.getObjectId();
return String.format("%s%d",
INSTANCE_NODE_KEY_PREFIX,
application.getObjectId());
}
@Override
public Object getElement() {
final GlobalizationHelper globalizationHelper = CdiUtil.createCdiUtil()
.findBean(GlobalizationHelper.class);
return application.getTitle().getValue(globalizationHelper
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
.findBean(ConfigurationManager.class);
final KernelConfig kernelConfig = confManager.findConfiguration(
KernelConfig.class);
final Locale defaultLocale = new Locale(kernelConfig
.getDefaultLanguage());
final String title;
if (application.getTitle().hasValue(globalizationHelper
.getNegotiatedLocale())) {
title = application.getTitle().getValue(globalizationHelper
.getNegotiatedLocale());
} else if (application.getTitle().hasValue(defaultLocale)) {
title = application.getTitle().getValue(defaultLocale);
} else if (application.getTitle().hasValue(Locale.getDefault())) {
title = application.getTitle().getValue(Locale.getDefault());
} else {
title = application.getPrimaryUrl();
}
return title;
}
public CcmApplication getApplication() {

View File

@ -29,6 +29,8 @@ import org.libreccm.web.ApplicationType;
*/
public class ApplicationTypeTreeNode implements TreeNode {
protected final static String TYPE_NODE_KEY_PREFIX = "apptype_";
private final ApplicationType applicationType;
public ApplicationTypeTreeNode(final ApplicationType applicationType) {
@ -37,7 +39,7 @@ public class ApplicationTypeTreeNode implements TreeNode {
@Override
public Object getKey() {
return applicationType.name();
return String.join("", TYPE_NODE_KEY_PREFIX, applicationType.name());
}
@Override

View File

@ -33,7 +33,9 @@ import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.util.UncheckedWrapperException;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.web.ApplicationRepository;
import org.libreccm.web.ApplicationType;
import org.libreccm.web.CcmApplication;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@ -81,15 +83,37 @@ public class ApplicationsTab extends LayoutPanel {
applicationTree = new Tree(new ApplicationTreeModelBuilder());
applicationTree.addChangeListener(e -> {
final PageState state = e.getPageState();
final String key = (String) applicationTree.getSelectedKey(state);
final Object key = applicationTree.getSelectedKey(state);
if (key instanceof Long) {
if (key.startsWith(
ApplicationInstanceTreeNode.INSTANCE_NODE_KEY_PREFIX)) {
//Instance is selected
final String instanceId = key.substring(
ApplicationInstanceTreeNode.INSTANCE_NODE_KEY_PREFIX
.length());
selectedAppInstance.setSelectedKey(state, instanceId);
final ApplicationRepository appRepo = CdiUtil.createCdiUtil()
.findBean(ApplicationRepository.class);
final CcmApplication application = appRepo.findById(
Long.parseLong(instanceId));
if (application != null) {
selectedAppType.setSelectedKey(
state, application.getApplicationType());
}
showAppSettings(state);
} else if (key.startsWith(
ApplicationTypeTreeNode.TYPE_NODE_KEY_PREFIX)) {
} else if (key instanceof String) {
//ApplicationType node is selected
showManagementLinks(state);
final String appTypeKey = (String) key;
final String appTypeKey = key.substring(
ApplicationTypeTreeNode.TYPE_NODE_KEY_PREFIX.length());
selectedAppType.setSelectedKey(state, appTypeKey);
@ -196,6 +220,7 @@ public class ApplicationsTab extends LayoutPanel {
settingsPanes.put(appTypeName, settingsPane);
} else {
final AbstractAppInstanceForm instanceForm = createInstanceForm(
String.format("%s_instance_form", appTypeName),
instanceFormClass);
managementPanel.add(instanceForm);
instanceForms.put(appTypeName, instanceForm);
@ -246,11 +271,17 @@ public class ApplicationsTab extends LayoutPanel {
}
protected void showInstances(final PageState state) {
placeholderInstances.setVisible(state, true);
placeholderSingletonSettings.setVisible(state, false);
appInfo.setVisible(state, false);
hideAllInstanceForms(state);
hideAllSettingsPanes(state);
//placeholderInstances.setVisible(state, true);
final String appType = selectedAppType.getSelectedKey(state);
if (instanceForms.containsKey(appType)) {
instanceForms.get(appType).setVisible(state, true);
}
placeholderSingletonSettings.setVisible(state, false);
appInfo.setVisible(state, false);
}
protected void hideInstances(final PageState state) {
@ -273,6 +304,31 @@ public class ApplicationsTab extends LayoutPanel {
appInfo.setVisible(state, false);
}
protected void showAppSettings(final PageState state) {
hideAllInstanceForms(state);
hideAllSettingsPanes(state);
hideManagementLinks(state);
placeholderInstances.setVisible(state, false);
placeholderSingletonSettings.setVisible(state, false);
if (settingsPanes.containsKey(selectedAppType.getSelectedKey(state))) {
settingsPanes.get(selectedAppType.getSelectedKey(state)).setVisible(
state, true);
}
// final String appId = selectedAppInstance.getSelectedKey(state);
// final ApplicationRepository appRepo = CdiUtil.createCdiUtil().findBean(
// ApplicationRepository.class);
// final CcmApplication application = appRepo.findById(Long
// .parseLong(appId));
// if (application != null) {
// final String appType = application.getApplicationType();
// if (settingsPanes.containsKey(appType)) {
// settingsPanes.get(appType).setVisible(state, true);
// }
// }
}
protected void hideSingletonAppSettings(final PageState state) {
placeholderSingletonSettings.setVisible(state, false);
hideAllInstanceForms(state);
@ -306,15 +362,18 @@ public class ApplicationsTab extends LayoutPanel {
}
private AbstractAppInstanceForm createInstanceForm(
Class<? extends AbstractAppInstanceForm> instanceFormClass) {
final String name,
final Class<? extends AbstractAppInstanceForm> instanceFormClass) {
try {
final Constructor<? extends AbstractAppInstanceForm> constructor
= instanceFormClass
.getConstructor(ParameterSingleSelectionModel.class,
.getConstructor(String.class,
ParameterSingleSelectionModel.class,
ParameterSingleSelectionModel.class);
return constructor.newInstance(selectedAppType,
return constructor.newInstance(name,
selectedAppType,
selectedAppInstance);
} catch (NoSuchMethodException |
SecurityException |

View File

@ -18,15 +18,48 @@
*/
package com.arsdigita.ui.admin.applications;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.Text;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.util.LockableImpl;
import com.arsdigita.util.UncheckedWrapperException;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.web.ApplicationCreateException;
import org.libreccm.web.ApplicationRepository;
import org.libreccm.web.ApplicationType;
import org.libreccm.web.CcmApplication;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import static com.arsdigita.ui.admin.AdminUiConstants.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class DefaultApplicationInstanceForm
extends AbstractAppInstanceForm {
public class DefaultApplicationInstanceForm extends AbstractAppInstanceForm {
private static final int COL_PRIMARY_URL = 0;
private SaveCancelSection saveCancelSection;
public DefaultApplicationInstanceForm(
final String name,
@ -39,9 +72,157 @@ public class DefaultApplicationInstanceForm
@Override
protected void createWidgets() {
add(new Text("placeholder"));
addInstanceTable();
final Label newInstanceFormHeading = new Label(new GlobalizedMessage(
"ui.admin.applications.new_instance_form.title", ADMIN_BUNDLE));
newInstanceFormHeading.setClassAttr("heading");
add(newInstanceFormHeading);
final TextField primaryUrl = new TextField("new_instance_primary_url");
primaryUrl.setLabel(new GlobalizedMessage(
"ui.admin.applications.new_instance.primary_url", ADMIN_BUNDLE));
primaryUrl.addValidationListener(new NotEmptyValidationListener(
new GlobalizedMessage(
"ui.admin.applications.new_instance.primary_url.error.not_empty",
ADMIN_BUNDLE)));
add(primaryUrl);
saveCancelSection = new SaveCancelSection();
add(saveCancelSection);
//add(new Text("placeholder"));
}
protected SaveCancelSection getSaveCancelSection() {
return saveCancelSection;
}
protected void addInstanceTable() {
final Label tableHeading = new Label(new GlobalizedMessage(
"ui.admin.applications.instance_table.heading", ADMIN_BUNDLE));
tableHeading.setClassAttr("heading");
add(tableHeading);
final Table instanceTable = new Table();
final TableColumnModel colModel = instanceTable.getColumnModel();
colModel.add(new TableColumn(
COL_PRIMARY_URL,
new Label(new GlobalizedMessage(
"ui.admin.applications.instances_table.col_primary_url",
ADMIN_BUNDLE))));
instanceTable.setModelBuilder(new InstanceTableModelBuilder(this));
add(instanceTable);
}
@Override
@SuppressWarnings("unchecked")
protected FormProcessListener createProcessListener() {
return (FormSectionEvent e) -> {
final PageState state = e.getPageState();
if (saveCancelSection.getSaveButton().isSelected(state)) {
final FormData data = e.getFormData();
final String primaryUrlData = data.getString(
"new_instance_primary_url");
final org.libreccm.web.ApplicationManager appManager = CdiUtil
.createCdiUtil().findBean(
org.libreccm.web.ApplicationManager.class);
try {
appManager.createInstance(
getSelectedAppType(state),
primaryUrlData,
(Class<CcmApplication>) getSelectedAppType(state)
.applicationClass());
} catch (ApplicationCreateException ex) {
throw new UncheckedWrapperException(
"Failed to create new application instance.", ex);
}
final Class<?> clazz = getSelectedAppType(state)
.applicationClass();
if (!clazz.isAssignableFrom(CcmApplication.class)) {
throw new UncheckedWrapperException(String.format(
"Application class \"%s\" is not a sub class of "
+ "class \"%s\". Something is wrong...",
clazz.getName(), CcmApplication.class.getName()));
}
final CcmApplication application;
try {
application = (CcmApplication) clazz.newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
throw new UncheckedWrapperException(
String.format("Failed to create object of "
+ "class \"%s\".",
clazz.getName()),
ex);
}
application.setPrimaryUrl(primaryUrlData);
final ApplicationRepository appRepo = CdiUtil.createCdiUtil()
.findBean(ApplicationRepository.class);
appRepo.save(application);
}
};
}
private class InstanceTableModelBuilder extends LockableImpl
implements TableModelBuilder {
private final AbstractAppInstanceForm instanceForm;
public InstanceTableModelBuilder(
final AbstractAppInstanceForm instanceForm) {
this.instanceForm = instanceForm;
}
@Override
public TableModel makeModel(final Table table, final PageState state) {
return new InstanceTableModel(instanceForm.getSelectedAppType(state));
}
}
private class InstanceTableModel implements TableModel {
private final List<CcmApplication> instances;
private int index = -1;
public InstanceTableModel(final ApplicationType appType) {
final ApplicationRepository appRepo = CdiUtil.createCdiUtil()
.findBean(ApplicationRepository.class);
instances = appRepo.findByType(appType.name());
}
@Override
public int getColumnCount() {
return 1;
}
@Override
public boolean nextRow() {
index++;
return index < instances.size();
}
@Override
public Object getElementAt(final int columnIndex) {
switch (columnIndex) {
case COL_PRIMARY_URL:
return instances.get(index).getPrimaryUrl();
default:
throw new IllegalArgumentException("Illegal columnIndex");
}
}
@Override
public Object getKeyAt(final int columnIndex) {
return Long.toString(instances.get(index).getObjectId());
}
}
}

View File

@ -202,7 +202,8 @@ public class CcmIntegrator implements Integrator {
* @param buffer Buffer for the location string.
* @param connection The JDBC connection object.
*
* @throws SQLException If an error occurs while accessing the database.
* @throws SQLException If an error occurs while accessing the
* database.
* @throws IntegrationException If the database is not supported yet.
*/
private void appendDbLocation(final StringBuffer buffer,
@ -269,8 +270,7 @@ public class CcmIntegrator implements Integrator {
//Set schema correctly for the different databases. Necessary because
//different RDBMS handle case different.
if ("H2".equals(connection.getMetaData().getDatabaseProductName())) {
flyway
.setSchemas(getSchemaName(moduleInfo).toUpperCase(
flyway.setSchemas(getSchemaName(moduleInfo).toUpperCase(
Locale.ROOT));
} else {
flyway.setSchemas(getSchemaName(moduleInfo));

View File

@ -70,7 +70,7 @@ public class ApplicationRoleSetup {
final Permission permission = createPermission(role, privilege);
permission.setObject(ccmObject);
entityManager.persist(privilege);
entityManager.persist(permission);
entityManager.merge(role);
}

View File

@ -126,6 +126,10 @@ public class SystemUsersSetup {
final Properties properties = new Properties();
if (inputStream == null) {
LOGGER.warn("No integration properties available.");
LOGGER.warn("Using empty integration properties");
return new Properties();
} else {
LOGGER.info("Loading integration.properties...");
properties.load(inputStream);
}
return properties;

View File

@ -57,7 +57,9 @@ public abstract class AbstractCcmApplicationSetup {
try (InputStream inputStream = getClass().getResourceAsStream(
CoreConstants.INTEGRATION_PROPS)) {
final Properties properties = new Properties();
if (inputStream != null) {
properties.load(inputStream);
}
return properties;
} catch (IOException ex) {
LOGGER.warn(

View File

@ -21,6 +21,7 @@ package org.libreccm.web;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.util.Strings;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.core.CoreConstants;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.modules.CcmModule;
@ -37,7 +38,6 @@ import java.util.ResourceBundle;
import java.util.ServiceLoader;
import javax.annotation.PostConstruct;
import javax.ejb.TransactionAttribute;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
@ -92,19 +92,14 @@ public class ApplicationManager {
final ApplicationType type,
final String path,
final Class<T> applicationClass) throws ApplicationCreateException {
try {
@SuppressWarnings("unchecked")
final ApplicationCreator<T> creator = type.creator().newInstance();
final ApplicationCreator<T> creator = CdiUtil.createCdiUtil().findBean(
type.creator());
final T application = creator.createInstance(path, type);
entityManager.persist(application);
return application;
} catch (InstantiationException | IllegalAccessException ex) {
throw new ApplicationCreateException("Failed to create application.",
ex);
}
}
@AuthorizationRequired

View File

@ -18,7 +18,6 @@
*/
package org.libreccm.web;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.libreccm.core.AbstractEntityRepository;
import org.libreccm.core.CoreConstants;
import org.libreccm.security.AuthorizationRequired;
@ -57,6 +56,7 @@ public class ApplicationRepository
* @return The application mounted at {@code path} or {@code null} if there
* is no application mounted at that {@code path}.
*/
@Transactional(Transactional.TxType.REQUIRED)
public CcmApplication retrieveApplicationForPath(final String path) {
final TypedQuery<CcmApplication> query = getEntityManager()
.createNamedQuery("CcmApplication.retrieveApplicationForPath",
@ -77,6 +77,7 @@ public class ApplicationRepository
* @return A list of the installed applications of the provided
* {@code type}.
*/
@Transactional(Transactional.TxType.REQUIRED)
public List<CcmApplication> findByType(final String type) {
final TypedQuery<CcmApplication> query = getEntityManager()
.createNamedQuery("CcmApplication.Application.findByType",

View File

@ -540,3 +540,9 @@ ui.admin.applications.type.property_sheet.servlet_path=Servlet path
ui.admin.applications.info.heading=About the application type
ui.admin.applications.settings.singleton.no_setting_for=No settings for application {0} available.
ui.admin.applications.settings.instance.no_setting_for=No settings for instance of application type {0} available.
ui.admin.applications.instances.link=Instances
ui.admin.applications.instances_table.col_primary_url=Primary URL
ui.admin.applications.new_instance_form.title=Create new instance
ui.admin.applications.instance_table.heading=Instances
ui.admin.applications.new_instance.primary_url=Primary URL
ui.admin.applications.new_instance.primary_url.error.not_empty=The primary URL of an application instance can't be empty.

View File

@ -543,3 +543,10 @@ ui.admin.applications.type.property_sheet.servlet_path=Servlet-Pfad
ui.admin.applications.info.heading=\u00dcber den Applikationstyp
ui.admin.applications.settings.singleton.no_setting_for=Keine Einstellungen f\u00fcr Applikation {0} verf\u00fcbar.
ui.admin.applications.settings.instance.no_setting_for=Keine Einstellungen f\u00fcr Instanzen des Typs {0} verf\u00fcgbar.
ui.admin.applications.instances.link=Instanzen
ui.admin.applications.instances_table.col_primary_url=Prim\u00e4re URL
#Create new instance
ui.admin.applications.new_instance_form.title=Neue Instanz anlegen
ui.admin.applications.instance_table.heading=Instanzen
ui.admin.applications.new_instance.primary_url=Prim\u00e4re URL
ui.admin.applications.new_instance.primary_url.error.not_empty=Die prim\u00e4re URL einer Applikations-Instanz kann nicht leer sein.

View File

@ -536,3 +536,10 @@ ui.admin.applications.type.property_sheet.servlet_path=Servlet path
ui.admin.applications.info.heading=About the application type
ui.admin.applications.settings.singleton.no_setting_for=No settings for application {0} available.
ui.admin.applications.settings.instance.no_setting_for=No settings for instance of application type {0} available.
ui.admin.applications.instances.link=Instances
ui.admin.applications.instances_table.col_primary_url=Primary URL
#Create new instance
ui.admin.applications.new_instance_form.title=Create new instance
ui.admin.applications.instance_table.heading=Instances
ui.admin.applications.new_instance.primary_url=Primary URL
ui.admin.applications.new_instance.primary_url.error.not_empty=The primary URL of an application instance can't be empty.

View File

@ -527,3 +527,10 @@ ui.admin.applications.type.property_sheet.servlet_path=Servlet path
ui.admin.applications.info.heading=About the application type
ui.admin.applications.settings.singleton.no_setting_for=No settings for application {0} available.
ui.admin.applications.settings.instance.no_setting_for=No settings for instance of application type {0} available.
ui.admin.applications.instances.link=Instances
ui.admin.applications.instances_table.col_primary_url=Primary URL
#Create new instance
ui.admin.applications.new_instance_form.title=Create new instance
ui.admin.applications.instance_table.heading=Instances
ui.admin.applications.new_instance.primary_url=Primary URL
ui.admin.applications.new_instance.primary_url.error.not_empty=The primary URL of an application instance can't be empty.