Settings for the database based configuration are no longer subclasses of CcmObject, removed registry domain. The settings are now retrieved via simple queries using strings.
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4032 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
e82eddece3
commit
aed90bb782
|
|
@ -25,12 +25,12 @@ import com.arsdigita.xml.Element;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
|
|
||||||
import com.arsdigita.bebop.util.BebopConstants;
|
import com.arsdigita.bebop.util.BebopConstants;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a list of segments. Each segment consists of a header
|
* Generates a list of segments. Each segment consists of a header (which could
|
||||||
* (which could be any Bebop component) and a body (which, likewise,
|
* be any Bebop component) and a body (which, likewise, could be any component).
|
||||||
* could be any component). The entire <code>SegmentedPanel</code>
|
* The entire <code>SegmentedPanel</code> look roughly like this:
|
||||||
* look roughly like this:
|
|
||||||
*
|
*
|
||||||
* <blockquote><pre><code>
|
* <blockquote><pre><code>
|
||||||
* ----------------------
|
* ----------------------
|
||||||
|
|
@ -47,8 +47,8 @@ import com.arsdigita.bebop.util.BebopConstants;
|
||||||
* Even more Body 2
|
* Even more Body 2
|
||||||
* </code></pre></blockquote>
|
* </code></pre></blockquote>
|
||||||
*
|
*
|
||||||
* Typically, the body of each segment will be a {@link SimpleContainer}
|
* Typically, the body of each segment will be a {@link SimpleContainer} which
|
||||||
* which contains many other components
|
* contains many other components
|
||||||
* <p>
|
* <p>
|
||||||
* The XML generated by this component looks something like this:
|
* The XML generated by this component looks something like this:
|
||||||
* <blockquote><pre><code>
|
* <blockquote><pre><code>
|
||||||
|
|
@ -71,11 +71,11 @@ import com.arsdigita.bebop.util.BebopConstants;
|
||||||
*
|
*
|
||||||
* @see #generateXML(PageState, Element)
|
* @see #generateXML(PageState, Element)
|
||||||
*
|
*
|
||||||
* @author Michael Pih
|
* @author Michael Pih
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class SegmentedPanel extends SimpleContainer
|
public class SegmentedPanel extends SimpleContainer
|
||||||
implements BebopConstants {
|
implements BebopConstants {
|
||||||
|
|
||||||
public static final String HEADER_CLASS = "seg-header";
|
public static final String HEADER_CLASS = "seg-header";
|
||||||
|
|
||||||
|
|
@ -127,8 +127,9 @@ public class SegmentedPanel extends SimpleContainer
|
||||||
/**
|
/**
|
||||||
* Add a segment to this container.
|
* Add a segment to this container.
|
||||||
*
|
*
|
||||||
* @param segmentID the XSL ID attribute for the new segment. The XSL template
|
* @param segmentID the XSL ID attribute for the new segment. The XSL
|
||||||
* for this component will render the correct header based on the ID attribute
|
* template for this component will render the correct header based on the
|
||||||
|
* ID attribute
|
||||||
* @param body the component that will act as the body
|
* @param body the component that will act as the body
|
||||||
* @return the new segment
|
* @return the new segment
|
||||||
*/
|
*/
|
||||||
|
|
@ -153,9 +154,11 @@ public class SegmentedPanel extends SimpleContainer
|
||||||
* @param state represents the page state for the current request
|
* @param state represents the page state for the current request
|
||||||
* @param parent the parent XML element
|
* @param parent the parent XML element
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
if ( isVisible(state) ) {
|
if (isVisible(state)) {
|
||||||
Element panel = parent.newChildElement(BEBOP_SEG_PANEL, BEBOP_XML_NS);
|
Element panel = parent.
|
||||||
|
newChildElement(BEBOP_SEG_PANEL, BEBOP_XML_NS);
|
||||||
exportAttributes(panel);
|
exportAttributes(panel);
|
||||||
super.generateXML(state, panel);
|
super.generateXML(state, panel);
|
||||||
}
|
}
|
||||||
|
|
@ -166,7 +169,8 @@ public class SegmentedPanel extends SimpleContainer
|
||||||
*/
|
*/
|
||||||
public static class Segment extends SimpleContainer {
|
public static class Segment extends SimpleContainer {
|
||||||
|
|
||||||
private SimpleContainer m_header, m_body;
|
private SimpleContainer m_header;
|
||||||
|
private SimpleContainer m_body;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an empty <code>Segment</code>
|
* Construct an empty <code>Segment</code>
|
||||||
|
|
@ -179,22 +183,29 @@ public class SegmentedPanel extends SimpleContainer
|
||||||
* Construct a new <code>Segment</code>
|
* Construct a new <code>Segment</code>
|
||||||
*
|
*
|
||||||
* @param header the component which will act as the header; the XSL
|
* @param header the component which will act as the header; the XSL
|
||||||
* class attribute for the component will be set to {@link #HEADER_CLASS}.
|
* class attribute for the component will be set to
|
||||||
* Typically, this component will be a {@link Label}
|
* {@link #HEADER_CLASS}. Typically, this component will be a
|
||||||
* @param body the component which represents the body of the segment, Typically,
|
* {@link Label}
|
||||||
* this component will be a {@link SimpleContainer} or a panel of some sort
|
* @param body the component which represents the body of the segment,
|
||||||
|
* Typically, this component will be a {@link SimpleContainer} or a
|
||||||
|
* panel of some sort
|
||||||
*/
|
*/
|
||||||
public Segment(Component header, Component body) {
|
public Segment(Component header, Component body) {
|
||||||
super();
|
super();
|
||||||
if(header != null) addHeader(header);
|
if (header != null) {
|
||||||
if(body!= null) add(body);
|
addHeader(header);
|
||||||
|
}
|
||||||
|
if (body != null) {
|
||||||
|
add(body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new <code>Segment</code> with no header
|
* Construct a new <code>Segment</code> with no header
|
||||||
*
|
*
|
||||||
* @param body the component which represents the body of the segment, Typically,
|
* @param body the component which represents the body of the segment,
|
||||||
* this component will be a {@link SimpleContainer} or a panel of some sort
|
* Typically, this component will be a {@link SimpleContainer} or a
|
||||||
|
* panel of some sort
|
||||||
*/
|
*/
|
||||||
public Segment(Component body) {
|
public Segment(Component body) {
|
||||||
this(null, body);
|
this(null, body);
|
||||||
|
|
@ -207,7 +218,7 @@ public class SegmentedPanel extends SimpleContainer
|
||||||
*/
|
*/
|
||||||
public void addHeader(Component c) {
|
public void addHeader(Component c) {
|
||||||
Assert.isUnlocked(this);
|
Assert.isUnlocked(this);
|
||||||
if(m_header == null) {
|
if (m_header == null) {
|
||||||
m_header = new SimpleContainer(BEBOP_SEG_HEADER, BEBOP_XML_NS);
|
m_header = new SimpleContainer(BEBOP_SEG_HEADER, BEBOP_XML_NS);
|
||||||
super.add(m_header);
|
super.add(m_header);
|
||||||
}
|
}
|
||||||
|
|
@ -216,10 +227,13 @@ public class SegmentedPanel extends SimpleContainer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a component to the body of this segment
|
* Add a component to the body of this segment
|
||||||
|
*
|
||||||
|
* @param c
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void add(Component c) {
|
public void add(Component c) {
|
||||||
Assert.isUnlocked(this);
|
Assert.isUnlocked(this);
|
||||||
if(m_body == null) {
|
if (m_body == null) {
|
||||||
m_body = new SimpleContainer(BEBOP_SEG_BODY, BEBOP_XML_NS);
|
m_body = new SimpleContainer(BEBOP_SEG_BODY, BEBOP_XML_NS);
|
||||||
super.add(m_body);
|
super.add(m_body);
|
||||||
}
|
}
|
||||||
|
|
@ -228,20 +242,52 @@ public class SegmentedPanel extends SimpleContainer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a component to the body of this segment
|
* Add a component to the body of this segment
|
||||||
|
*
|
||||||
|
* @param c
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void add(Component c, int constraints) {
|
public void add(Component c, int constraints) {
|
||||||
add(c);
|
add(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible(final PageState state) {
|
||||||
|
boolean result = super.isVisible(state);
|
||||||
|
|
||||||
|
if (m_header != null) {
|
||||||
|
result = result && m_header.isVisible(state);
|
||||||
|
|
||||||
|
final Iterator children = m_header.children();
|
||||||
|
while (children.hasNext()) {
|
||||||
|
final Component component = (Component) children.next();
|
||||||
|
result = result && component.isVisible(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_body != null) {
|
||||||
|
result = result && m_body.isVisible(state);
|
||||||
|
|
||||||
|
final Iterator children = m_body.children();
|
||||||
|
while (children.hasNext()) {
|
||||||
|
final Component component = (Component) children.next();
|
||||||
|
result = result && component.isVisible(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the XML for this segment
|
* Generate the XML for this segment
|
||||||
*
|
*
|
||||||
* @param state the current page state
|
* @param state the current page state
|
||||||
* @param parent the parent XML element
|
* @param parent the parent XML element
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void generateXML(PageState state, Element parent) {
|
public void generateXML(PageState state, Element parent) {
|
||||||
if(isVisible(state)) {
|
if (isVisible(state)) {
|
||||||
Element seg = parent.newChildElement(BEBOP_SEGMENT, BEBOP_XML_NS);
|
Element seg = parent.
|
||||||
|
newChildElement(BEBOP_SEGMENT, BEBOP_XML_NS);
|
||||||
exportAttributes(seg);
|
exportAttributes(seg);
|
||||||
super.generateXML(state, seg);
|
super.generateXML(state, seg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
package com.arsdigita.templating;
|
package com.arsdigita.templating;
|
||||||
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import com.arsdigita.web.ApplicationFileResolver;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.configuration.Configuration;
|
import org.libreccm.configuration.Configuration;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.ui;
|
package com.arsdigita.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.configuration.Configuration;
|
import org.libreccm.configuration.Configuration;
|
||||||
|
|
@ -32,7 +31,6 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import javax.enterprise.inject.spi.CDI;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -128,16 +128,16 @@ public class AdminServlet
|
||||||
BUNDLE_NAME)),
|
BUNDLE_NAME)),
|
||||||
new CategoriesTab());
|
new CategoriesTab());
|
||||||
|
|
||||||
tabbedPane.addTab(
|
|
||||||
new Label(new GlobalizedMessage("ui.admin.tab.workflows.title",
|
|
||||||
BUNDLE_NAME)),
|
|
||||||
new WorkflowAdminTab());
|
|
||||||
|
|
||||||
tabbedPane.addTab(
|
tabbedPane.addTab(
|
||||||
new Label(new GlobalizedMessage("ui.admin.tab.registry.title",
|
new Label(new GlobalizedMessage("ui.admin.tab.registry.title",
|
||||||
BUNDLE_NAME)),
|
BUNDLE_NAME)),
|
||||||
new RegistryAdminTab());
|
new RegistryAdminTab());
|
||||||
|
|
||||||
|
tabbedPane.addTab(
|
||||||
|
new Label(new GlobalizedMessage("ui.admin.tab.workflows.title",
|
||||||
|
BUNDLE_NAME)),
|
||||||
|
new WorkflowAdminTab());
|
||||||
|
|
||||||
tabbedPane.addTab(
|
tabbedPane.addTab(
|
||||||
new Label(new GlobalizedMessage("ui.admin.tab.sysinfo.title",
|
new Label(new GlobalizedMessage("ui.admin.tab.sysinfo.title",
|
||||||
BUNDLE_NAME)),
|
BUNDLE_NAME)),
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
import com.arsdigita.bebop.SegmentedPanel;
|
import com.arsdigita.bebop.SegmentedPanel;
|
||||||
|
import com.arsdigita.bebop.Tree;
|
||||||
import com.arsdigita.bebop.form.Submit;
|
import com.arsdigita.bebop.form.Submit;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
|
@ -57,6 +58,9 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
private final DomainTitleForm domainTitleForm;
|
private final DomainTitleForm domainTitleForm;
|
||||||
private final DomainDescriptionForm domainDescriptionForm;
|
private final DomainDescriptionForm domainDescriptionForm;
|
||||||
|
|
||||||
|
private final Label categoriesTreeHeader;
|
||||||
|
private final BoxPanel categoriesTreePanel;
|
||||||
|
|
||||||
public CategoriesTab() {
|
public CategoriesTab() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
|
@ -64,43 +68,64 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
|
|
||||||
domainIdParameter = new StringParameter("selected_domain_id");
|
domainIdParameter = new StringParameter("selected_domain_id");
|
||||||
selectedDomainId
|
selectedDomainId
|
||||||
= new ParameterSingleSelectionModel<>(domainIdParameter);
|
= new ParameterSingleSelectionModel<>(domainIdParameter);
|
||||||
|
|
||||||
languageParameter = new StringParameter("selected_language");
|
languageParameter = new StringParameter("selected_language");
|
||||||
selectedLanguage
|
selectedLanguage
|
||||||
= new ParameterSingleSelectionModel<>(languageParameter);
|
= new ParameterSingleSelectionModel<>(languageParameter);
|
||||||
|
|
||||||
|
final SegmentedPanel left = new SegmentedPanel();
|
||||||
|
|
||||||
domainsFilterFormHeader = new Label(new GlobalizedMessage(
|
domainsFilterFormHeader = new Label(new GlobalizedMessage(
|
||||||
"ui.admin.categories.domains.table.filter.header",
|
"ui.admin.categories.domains.table.filter.header",
|
||||||
ADMIN_BUNDLE));
|
ADMIN_BUNDLE));
|
||||||
domainsFilterForm = new Form("domainFilterForm");
|
domainsFilterForm = new Form("domainFilterForm");
|
||||||
final TextField domainsFilter = new TextField(DOMAINS_FILTER);
|
final TextField domainsFilter = new TextField(DOMAINS_FILTER);
|
||||||
domainsFilterForm.add(domainsFilter);
|
domainsFilterForm.add(domainsFilter);
|
||||||
domainsFilterForm.add(new Submit(new GlobalizedMessage(
|
domainsFilterForm.add(new Submit(new GlobalizedMessage(
|
||||||
"ui.admin.categories.domains.table.filter", ADMIN_BUNDLE)));
|
"ui.admin.categories.domains.table.filter", ADMIN_BUNDLE)));
|
||||||
final ActionLink clearLink = new ActionLink(new GlobalizedMessage(
|
final ActionLink clearLink = new ActionLink(new GlobalizedMessage(
|
||||||
"ui.admin.categories.domains.table.filter.clear",
|
"ui.admin.categories.domains.table.filter.clear",
|
||||||
ADMIN_BUNDLE));
|
ADMIN_BUNDLE));
|
||||||
clearLink.addActionListener(e -> {
|
clearLink.addActionListener(e -> {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
domainsFilter.setValue(state, null);
|
domainsFilter.setValue(state, null);
|
||||||
});
|
});
|
||||||
domainsFilterForm.add(clearLink);
|
domainsFilterForm.add(clearLink);
|
||||||
|
|
||||||
final SegmentedPanel left = new SegmentedPanel();
|
|
||||||
left.addSegment(domainsFilterFormHeader, domainsFilterForm);
|
left.addSegment(domainsFilterFormHeader, domainsFilterForm);
|
||||||
|
|
||||||
|
categoriesTreeHeader = new Label(new GlobalizedMessage(
|
||||||
|
"ui.admin.categories.tree.header",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
categoriesTreePanel = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
|
final Tree categoriesTree = new Tree(new CategoriesTreeModelBuilder(
|
||||||
|
selectedDomainId));
|
||||||
|
categoriesTree.addActionListener(e -> {
|
||||||
|
|
||||||
|
});
|
||||||
|
final ActionLink backToDomain = new ActionLink(new GlobalizedMessage(
|
||||||
|
"ui.admin.categories.tree.back",
|
||||||
|
ADMIN_BUNDLE));
|
||||||
|
backToDomain.addActionListener(e -> {
|
||||||
|
final PageState state = e.getPageState();
|
||||||
|
categoriesTree.getSelectionModel().clearSelection(state);
|
||||||
|
showDomainDetails(state);
|
||||||
|
});
|
||||||
|
categoriesTreePanel.add(backToDomain);
|
||||||
|
categoriesTreePanel.add(categoriesTree);
|
||||||
|
left.addSegment(categoriesTreeHeader, categoriesTreePanel);
|
||||||
|
|
||||||
setLeft(left);
|
setLeft(left);
|
||||||
|
|
||||||
final BoxPanel body = new BoxPanel(BoxPanel.VERTICAL);
|
final BoxPanel body = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
|
|
||||||
final DomainsTable domainsTable = new DomainsTable(
|
final DomainsTable domainsTable = new DomainsTable(
|
||||||
this, selectedDomainId, domainsFilter);
|
this, selectedDomainId, domainsFilter);
|
||||||
domainsTable.setStyleAttr("min-width: 30em;");
|
domainsTable.setStyleAttr("min-width: 30em;");
|
||||||
domainsTablePanel = new BoxPanel(BoxPanel.VERTICAL);
|
domainsTablePanel = new BoxPanel(BoxPanel.VERTICAL);
|
||||||
domainsTablePanel.add(domainsTable);
|
domainsTablePanel.add(domainsTable);
|
||||||
final ActionLink addDomain = new ActionLink(new GlobalizedMessage(
|
final ActionLink addDomain = new ActionLink(new GlobalizedMessage(
|
||||||
"ui.admin.categories.domains.create_new", ADMIN_BUNDLE));
|
"ui.admin.categories.domains.create_new", ADMIN_BUNDLE));
|
||||||
addDomain.addActionListener(e -> {
|
addDomain.addActionListener(e -> {
|
||||||
showDomainForm(e.getPageState());
|
showDomainForm(e.getPageState());
|
||||||
});
|
});
|
||||||
|
|
@ -144,6 +169,8 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
page.setVisibleDefault(domainDetails, false);
|
page.setVisibleDefault(domainDetails, false);
|
||||||
page.setVisibleDefault(domainTitleForm, false);
|
page.setVisibleDefault(domainTitleForm, false);
|
||||||
page.setVisibleDefault(domainDescriptionForm, false);
|
page.setVisibleDefault(domainDescriptionForm, false);
|
||||||
|
page.setVisibleDefault(categoriesTreeHeader, false);
|
||||||
|
page.setVisibleDefault(categoriesTreePanel, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showDomainsTable(final PageState state) {
|
protected void showDomainsTable(final PageState state) {
|
||||||
|
|
@ -154,6 +181,9 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
domainDetails.setVisible(state, false);
|
domainDetails.setVisible(state, false);
|
||||||
domainTitleForm.setVisible(state, false);
|
domainTitleForm.setVisible(state, false);
|
||||||
domainDescriptionForm.setVisible(state, false);
|
domainDescriptionForm.setVisible(state, false);
|
||||||
|
categoriesTreeHeader.setVisible(state, false);
|
||||||
|
categoriesTreePanel.setVisible(state, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showDomainForm(final PageState state) {
|
protected void showDomainForm(final PageState state) {
|
||||||
|
|
@ -164,6 +194,8 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
domainDetails.setVisible(state, false);
|
domainDetails.setVisible(state, false);
|
||||||
domainTitleForm.setVisible(state, false);
|
domainTitleForm.setVisible(state, false);
|
||||||
domainDescriptionForm.setVisible(state, false);
|
domainDescriptionForm.setVisible(state, false);
|
||||||
|
categoriesTreeHeader.setVisible(state, false);
|
||||||
|
categoriesTreePanel.setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void hideDomainForm(final PageState state) {
|
protected void hideDomainForm(final PageState state) {
|
||||||
|
|
@ -175,6 +207,8 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
domainDetails.setVisible(state, false);
|
domainDetails.setVisible(state, false);
|
||||||
domainTitleForm.setVisible(state, false);
|
domainTitleForm.setVisible(state, false);
|
||||||
domainDescriptionForm.setVisible(state, false);
|
domainDescriptionForm.setVisible(state, false);
|
||||||
|
categoriesTreeHeader.setVisible(state, false);
|
||||||
|
categoriesTreePanel.setVisible(state, false);
|
||||||
} else {
|
} else {
|
||||||
showDomainDetails(state);
|
showDomainDetails(state);
|
||||||
}
|
}
|
||||||
|
|
@ -189,6 +223,8 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
domainDetails.setVisible(state, true);
|
domainDetails.setVisible(state, true);
|
||||||
domainTitleForm.setVisible(state, false);
|
domainTitleForm.setVisible(state, false);
|
||||||
domainDescriptionForm.setVisible(state, false);
|
domainDescriptionForm.setVisible(state, false);
|
||||||
|
categoriesTreeHeader.setVisible(state, true);
|
||||||
|
categoriesTreePanel.setVisible(state, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void hideDomainDetails(final PageState state) {
|
protected void hideDomainDetails(final PageState state) {
|
||||||
|
|
@ -201,6 +237,8 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
domainDetails.setVisible(state, false);
|
domainDetails.setVisible(state, false);
|
||||||
domainTitleForm.setVisible(state, false);
|
domainTitleForm.setVisible(state, false);
|
||||||
domainDescriptionForm.setVisible(state, false);
|
domainDescriptionForm.setVisible(state, false);
|
||||||
|
categoriesTreeHeader.setVisible(state, false);
|
||||||
|
categoriesTreePanel.setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void showDomainTitleForm(final PageState state) {
|
protected void showDomainTitleForm(final PageState state) {
|
||||||
|
|
@ -211,6 +249,8 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
domainDetails.setVisible(state, false);
|
domainDetails.setVisible(state, false);
|
||||||
domainTitleForm.setVisible(state, true);
|
domainTitleForm.setVisible(state, true);
|
||||||
domainDescriptionForm.setVisible(state, false);
|
domainDescriptionForm.setVisible(state, false);
|
||||||
|
categoriesTreeHeader.setVisible(state, false);
|
||||||
|
categoriesTreePanel.setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void hideDomainTitleForm(final PageState state) {
|
protected void hideDomainTitleForm(final PageState state) {
|
||||||
|
|
@ -227,6 +267,8 @@ public class CategoriesTab extends LayoutPanel {
|
||||||
domainDetails.setVisible(state, false);
|
domainDetails.setVisible(state, false);
|
||||||
domainTitleForm.setVisible(state, false);
|
domainTitleForm.setVisible(state, false);
|
||||||
domainDescriptionForm.setVisible(state, true);
|
domainDescriptionForm.setVisible(state, true);
|
||||||
|
categoriesTreeHeader.setVisible(state, false);
|
||||||
|
categoriesTreePanel.setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void hideDomainDescriptionForm(final PageState state) {
|
protected void hideDomainDescriptionForm(final PageState state) {
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public class CategoriesTreeModel implements TreeModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getKey() {
|
public Object getKey() {
|
||||||
return category.getObjectId();
|
return Long.toString(category.getObjectId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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 com.arsdigita.ui.admin.categories;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.Tree;
|
||||||
|
import com.arsdigita.bebop.tree.TreeModel;
|
||||||
|
import com.arsdigita.bebop.tree.TreeModelBuilder;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import org.libreccm.categorization.Domain;
|
||||||
|
import org.libreccm.categorization.DomainRepository;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
class CategoriesTreeModelBuilder
|
||||||
|
extends LockableImpl
|
||||||
|
implements TreeModelBuilder {
|
||||||
|
|
||||||
|
private final ParameterSingleSelectionModel<String> selectedDomainId;
|
||||||
|
|
||||||
|
public CategoriesTreeModelBuilder(
|
||||||
|
final ParameterSingleSelectionModel<String> selectedDomainId) {
|
||||||
|
|
||||||
|
this.selectedDomainId = selectedDomainId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TreeModel makeModel(final Tree tree,
|
||||||
|
final PageState state) {
|
||||||
|
final DomainRepository domainRepository = CdiUtil.createCdiUtil().
|
||||||
|
findBean(DomainRepository.class);
|
||||||
|
final Domain domain = domainRepository.findById(Long.parseLong(
|
||||||
|
selectedDomainId.getSelectedKey(state)));
|
||||||
|
|
||||||
|
return new CategoriesTreeModel(domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -44,7 +44,6 @@ import org.apache.logging.log4j.util.Strings;
|
||||||
import org.libreccm.categorization.Domain;
|
import org.libreccm.categorization.Domain;
|
||||||
import org.libreccm.categorization.DomainRepository;
|
import org.libreccm.categorization.DomainRepository;
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.configuration.ConfigurationConstants;
|
|
||||||
import org.libreccm.l10n.GlobalizationHelper;
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
||||||
|
|
@ -275,16 +274,7 @@ class DomainsTable extends Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDeleteable(final Domain domain) {
|
private boolean isDeleteable(final Domain domain) {
|
||||||
if (ConfigurationConstants.REGISTRY_DOMAIN.equals(domain.
|
return !(domain.getOwners() != null && !domain.getOwners().isEmpty());
|
||||||
getDomainKey())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (domain.getOwners() != null && !domain.getOwners().isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ import com.arsdigita.bebop.parameters.URLParameter;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
import com.arsdigita.kernel.security.SecurityConfig;
|
import com.arsdigita.kernel.security.SecurityConfig;
|
||||||
import com.arsdigita.ui.UI;
|
import com.arsdigita.ui.UI;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import static com.arsdigita.ui.login.LoginConstants.*;
|
import static com.arsdigita.ui.login.LoginConstants.*;
|
||||||
|
|
||||||
|
|
@ -57,13 +56,6 @@ import com.arsdigita.web.URL;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.enterprise.context.spi.CreationalContext;
|
|
||||||
import javax.enterprise.inject.spi.Bean;
|
|
||||||
import javax.enterprise.inject.spi.BeanManager;
|
|
||||||
import javax.enterprise.inject.spi.CDI;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SaveCancelSection;
|
import com.arsdigita.bebop.SaveCancelSection;
|
||||||
import com.arsdigita.bebop.form.Password;
|
import com.arsdigita.bebop.form.Password;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
|
||||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.kernel.security.SecurityConfig;
|
import com.arsdigita.kernel.security.SecurityConfig;
|
||||||
import com.arsdigita.web.RedirectSignal;
|
import com.arsdigita.web.RedirectSignal;
|
||||||
|
|
@ -39,14 +37,10 @@ import com.arsdigita.web.URL;
|
||||||
import org.apache.logging.log4j.util.Strings;
|
import org.apache.logging.log4j.util.Strings;
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
import org.libreccm.security.ChallengeManager;
|
|
||||||
import org.libreccm.security.RegistrationManager;
|
import org.libreccm.security.RegistrationManager;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
import org.libreccm.security.User;
|
|
||||||
import org.libreccm.security.UserManager;
|
|
||||||
import org.libreccm.security.UserRepository;
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,18 +40,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
|
||||||
import org.libreccm.web.ApplicationManager;
|
import org.libreccm.web.ApplicationManager;
|
||||||
import org.libreccm.web.ApplicationType;
|
import org.libreccm.web.ApplicationType;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.StringJoiner;
|
|
||||||
|
|
||||||
import javax.enterprise.context.spi.CreationalContext;
|
|
||||||
import javax.enterprise.inject.spi.Bean;
|
|
||||||
import javax.enterprise.inject.spi.BeanManager;
|
|
||||||
import javax.enterprise.inject.spi.CDI;
|
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import javax.enterprise.inject.spi.CDI;
|
|
||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
import javax.validation.Validation;
|
import javax.validation.Validation;
|
||||||
import javax.validation.ValidatorFactory;
|
import javax.validation.ValidatorFactory;
|
||||||
|
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.libreccm.categorization;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.libreccm.configuration.ConfigurationConstants;
|
|
||||||
import org.libreccm.modules.InstallEvent;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
public class RegistrySetup {
|
|
||||||
|
|
||||||
private final EntityManager entityManager;
|
|
||||||
|
|
||||||
public RegistrySetup(final InstallEvent event) {
|
|
||||||
this.entityManager = event.getEntityManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setup() {
|
|
||||||
final Domain registry = new Domain();
|
|
||||||
registry.setDomainKey(ConfigurationConstants.REGISTRY_DOMAIN);
|
|
||||||
registry.setVersion("1.0");
|
|
||||||
registry.setUuid(UUID.randomUUID().toString());
|
|
||||||
registry.setDisplayName(ConfigurationConstants.REGISTRY_DOMAIN);
|
|
||||||
|
|
||||||
final Category root = new Category();
|
|
||||||
root.setUuid(UUID.randomUUID().toString());
|
|
||||||
root.setName(ConfigurationConstants.REGISTRY_DOMAIN + "-root");
|
|
||||||
root.setDisplayName(ConfigurationConstants.REGISTRY_DOMAIN + "-root");
|
|
||||||
|
|
||||||
registry.setRoot(root);
|
|
||||||
|
|
||||||
entityManager.persist(root);
|
|
||||||
entityManager.persist(registry);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -18,40 +18,85 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.NotBlank;
|
|
||||||
import org.libreccm.core.CcmObject;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
|
import javax.persistence.NamedQueries;
|
||||||
|
import javax.persistence.NamedQuery;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.UniqueConstraint;
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract base class for all settings.
|
* Abstract base class for all settings.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
* @param <T> The value type of the setting.
|
* @param <T> The value type of the setting.
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS", schema = DB_SCHEMA)
|
@Table(name = "SETTINGS",
|
||||||
public abstract class AbstractSetting<T>
|
schema = DB_SCHEMA,
|
||||||
extends CcmObject implements Serializable {
|
uniqueConstraints = {
|
||||||
|
@UniqueConstraint(columnNames = {"CONFIGURATION_CLASS", "NAME"})
|
||||||
|
})
|
||||||
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(
|
||||||
|
name = "AbstractSetting.findByClassAndName",
|
||||||
|
query = "SELECT s FROM AbstractSetting s "
|
||||||
|
+ "WHERE configurationClass = :class "
|
||||||
|
+ "AND name = :name")
|
||||||
|
})
|
||||||
|
public abstract class AbstractSetting<T> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -839223659103128135L;
|
private static final long serialVersionUID = 1631163618980178142L;
|
||||||
|
|
||||||
|
@Column(name = "SETTING_ID")
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private long settingId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This configuration class this setting belongs to
|
||||||
|
*/
|
||||||
|
@Column(name = "CONFIGURATION_CLASS", nullable = false, length = 512)
|
||||||
|
@NotBlank
|
||||||
|
@Pattern(regexp = "[\\w_.]*")
|
||||||
|
private String configurationClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the setting. The string must be a valid URL fragment.
|
* The name of the setting. The string must be a valid URL fragment.
|
||||||
*/
|
*/
|
||||||
@Column(name = "name", nullable = false, length = 512)
|
@Column(name = "NAME", nullable = false, length = 512)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Pattern(regexp = "[\\w-.]*")
|
@Pattern(regexp = "[\\w-.]*")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
public long getSettingId() {
|
||||||
|
return settingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setSettingId(final long settingId) {
|
||||||
|
this.settingId = settingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfigurationClass() {
|
||||||
|
return configurationClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigurationClass(final String configurationClass) {
|
||||||
|
this.configurationClass = configurationClass;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
@ -62,58 +107,75 @@ public abstract class AbstractSetting<T>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for the value of the setting.
|
* Getter for the value of the setting.
|
||||||
*
|
*
|
||||||
* @return The value of the setting.
|
* @return The value of the setting.
|
||||||
*/
|
*/
|
||||||
public abstract T getValue();
|
public abstract T getValue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the value of the setting.
|
* Setter for the value of the setting.
|
||||||
*
|
*
|
||||||
* @param value The new value of the setting.
|
* @param value The new value of the setting.
|
||||||
*/
|
*/
|
||||||
public abstract void setValue(T value);
|
public abstract void setValue(T value);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = 5;
|
||||||
hash = 47 * hash + Objects.hashCode(name);
|
hash = 67 * hash + Objects.hashCode(settingId);
|
||||||
|
hash = 67 * hash + Objects.hashCode(configurationClass);
|
||||||
|
hash = 67 * hash + Objects.hashCode(name);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (!super.equals(obj)) {
|
if (this == obj) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(obj instanceof AbstractSetting)) {
|
if (!(obj instanceof AbstractSetting)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
final AbstractSetting<?> other = (AbstractSetting<?>) obj;
|
||||||
final AbstractSetting<?> other
|
|
||||||
= (AbstractSetting) obj;
|
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Objects.equals(name, other.getName());
|
if (settingId != other.getSettingId()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(configurationClass, other.configurationClass)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(name, other.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
return obj instanceof AbstractSetting;
|
return obj instanceof AbstractSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
return toString("");
|
||||||
|
}
|
||||||
|
|
||||||
public String toString(final String data) {
|
public String toString(final String data) {
|
||||||
return super.toString(String.format(", name = \"%s\"%s",
|
return String.format(
|
||||||
name,
|
"%s{ "
|
||||||
data));
|
+ "settingId = %d, "
|
||||||
|
+ "configurationClass = \"%s\" "
|
||||||
|
+ "name = \"%s\" "
|
||||||
|
+ "%s"
|
||||||
|
+ " }",
|
||||||
|
super.toString(),
|
||||||
|
settingId,
|
||||||
|
configurationClass,
|
||||||
|
name,
|
||||||
|
data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,129 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2015 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.libreccm.configuration;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.libreccm.web.CcmApplication;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base class for application instance specific configurations.
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
public class ApplicationConfiguration {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
|
||||||
ApplicationConfiguration.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The primary URL identifying the application instance for which this
|
|
||||||
* configuration stores settings.
|
|
||||||
*/
|
|
||||||
@Setting
|
|
||||||
private String appInstance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The fully qualified name of the application class.
|
|
||||||
*/
|
|
||||||
@Setting
|
|
||||||
private String applicationClass;
|
|
||||||
|
|
||||||
public String getAppInstance() {
|
|
||||||
return appInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAppInstance(final String appInstance) {
|
|
||||||
this.appInstance = appInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class<CcmApplication> getApplicationClass() {
|
|
||||||
try {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final Class<CcmApplication> clazz = (Class<CcmApplication>) Class
|
|
||||||
.forName(applicationClass);
|
|
||||||
return clazz;
|
|
||||||
} catch (ClassNotFoundException ex) {
|
|
||||||
LOGGER.warn(String.format(
|
|
||||||
"Class '%s' for ApplicationConfiguration was not found.",
|
|
||||||
applicationClass),
|
|
||||||
ex);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApplicationClass(final Class<CcmApplication> clazz) {
|
|
||||||
applicationClass = clazz.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 7;
|
|
||||||
hash = 79 * hash + Objects.hashCode(appInstance);
|
|
||||||
hash = 79 * hash + Objects.hashCode(applicationClass);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof ApplicationConfiguration)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ApplicationConfiguration other = (ApplicationConfiguration) obj;
|
|
||||||
if (!other.canEqual(this)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Objects.equals(appInstance, other.getAppInstance())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(applicationClass, other.getApplicationClass().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canEqual(final Object obj) {
|
|
||||||
return obj instanceof ApplicationConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final String toString() {
|
|
||||||
return toString("");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString(final String data) {
|
|
||||||
return String.format("%s{ "
|
|
||||||
+ "applicationInstance = \"%s\", "
|
|
||||||
+ "applicationClass = \"%s\"%s"
|
|
||||||
+ " }",
|
|
||||||
super.toString(),
|
|
||||||
appInstance,
|
|
||||||
applicationClass,
|
|
||||||
data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,196 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.libreccm.configuration;
|
|
||||||
|
|
||||||
import static org.libreccm.configuration.ConfigurationConstants.*;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.libreccm.categorization.Category;
|
|
||||||
import org.libreccm.categorization.CategoryManager;
|
|
||||||
import org.libreccm.categorization.CategoryRepository;
|
|
||||||
import org.libreccm.categorization.Domain;
|
|
||||||
import org.libreccm.categorization.DomainRepository;
|
|
||||||
import org.libreccm.web.CcmApplication;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@RequestScoped
|
|
||||||
public class ApplicationConfigurationManager {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
|
||||||
ApplicationConfigurationManager.class
|
|
||||||
);
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ConfigurationManager confManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SettingManager settingManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SettingConverter settingConverter;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private DomainRepository domainRepo;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CategoryRepository categoryRepo;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CategoryManager categoryManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds an application instance specific configuration and loads it values
|
|
||||||
* from the registry.
|
|
||||||
*
|
|
||||||
* @param <T> The type of the configuration.
|
|
||||||
* @param confClass The configuration class.
|
|
||||||
* @param instance The application instance for which the settings are
|
|
||||||
* loaded.
|
|
||||||
*
|
|
||||||
* @return The configuration for the provided application instance.
|
|
||||||
*/
|
|
||||||
public <T extends ApplicationConfiguration> T findConfiguration(
|
|
||||||
final Class<T> confClass, final CcmApplication instance) {
|
|
||||||
if (confClass == null) {
|
|
||||||
throw new IllegalArgumentException("confClass can't be null");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instance == null) {
|
|
||||||
throw new IllegalArgumentException("instance can't be null");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (confClass.getAnnotation(Configuration.class) == null) {
|
|
||||||
throw new IllegalArgumentException(String.format(
|
|
||||||
"Provided class \"%s\" is not annotated with \"%s\".",
|
|
||||||
confClass.getName(),
|
|
||||||
Configuration.class.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
final String confName = String.format("%s.%s",
|
|
||||||
confClass.getName(),
|
|
||||||
instance.getPrimaryUrl());
|
|
||||||
|
|
||||||
return confManager.findConfiguration(confName, confClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves a application instance configuration.
|
|
||||||
*
|
|
||||||
* @param configuration The configuration to save.
|
|
||||||
* @param instance The application instance of which the configuration
|
|
||||||
* stores the settings.
|
|
||||||
*/
|
|
||||||
public void saveConfiguration(final ApplicationConfiguration configuration,
|
|
||||||
final CcmApplication instance) {
|
|
||||||
if (configuration == null) {
|
|
||||||
throw new IllegalArgumentException("Configuration can't be null");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configuration.getClass().getAnnotation(Configuration.class) == null) {
|
|
||||||
throw new IllegalArgumentException(String.format(
|
|
||||||
"The class \"%s\" of the provided object is not annotated "
|
|
||||||
+ "with \"%s\".",
|
|
||||||
configuration.getClass().getName(),
|
|
||||||
Configuration.class.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instance == null) {
|
|
||||||
throw new IllegalArgumentException("Instance can't be null");
|
|
||||||
}
|
|
||||||
|
|
||||||
final Field[] fields = configuration.getClass().getDeclaredFields();
|
|
||||||
for (final Field field : fields) {
|
|
||||||
field.setAccessible(true);
|
|
||||||
try {
|
|
||||||
setSettingValue(configuration,
|
|
||||||
instance,
|
|
||||||
confManager.getSettingName(field),
|
|
||||||
field.getType(),
|
|
||||||
field.get(configuration));
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
LOGGER.error(String.format(
|
|
||||||
"Failed to write setting value for setting \"%s\" "
|
|
||||||
+ "of configuration \"%s\"",
|
|
||||||
confManager.getSettingName(field),
|
|
||||||
configuration.getClass().getName()),
|
|
||||||
ex);
|
|
||||||
throw new IllegalStateException(String.format(
|
|
||||||
"Failed to write setting value for setting \"%s\" "
|
|
||||||
+ "of configuration \"%s\"",
|
|
||||||
confManager.getSettingName(field),
|
|
||||||
configuration.getClass().getName()),
|
|
||||||
ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value of a setting of application instance configuration.
|
|
||||||
*
|
|
||||||
* @param <T> The value type of the setting.
|
|
||||||
* @param configuration The configuration to which the settings belongs.
|
|
||||||
* @param instance The application instance to which
|
|
||||||
* @param settingName The name of the setting.
|
|
||||||
* @param valueType The type of the value of the setting.
|
|
||||||
* @param value The value to set.
|
|
||||||
*/
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
|
||||||
private <T> void setSettingValue(final Object configuration,
|
|
||||||
final CcmApplication instance,
|
|
||||||
final String settingName,
|
|
||||||
final Class<T> valueType,
|
|
||||||
final Object value) {
|
|
||||||
final String settingPath = String.format(
|
|
||||||
"%s.%s.%s",
|
|
||||||
configuration.getClass().getName(),
|
|
||||||
instance.getPrimaryUrl(),
|
|
||||||
settingName);
|
|
||||||
AbstractSetting<T> setting = settingManager.findSetting(settingPath, valueType);
|
|
||||||
if (setting == null) {
|
|
||||||
setting = settingConverter.createSettingForValueType(valueType);
|
|
||||||
setting.setName(settingName);
|
|
||||||
final Domain registry = domainRepo
|
|
||||||
.findByDomainKey(REGISTRY_DOMAIN);
|
|
||||||
final Category category = categoryRepo
|
|
||||||
.findByPath(registry, configuration.getClass().getName());
|
|
||||||
categoryManager.addObjectToCategory(setting, category);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final T settingValue = (T) value;
|
|
||||||
setting.setValue(settingValue);
|
|
||||||
|
|
||||||
entityManager.merge(setting);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -18,31 +18,23 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting storing a {@link BigDecimal} value. If the precision of
|
|
||||||
* {@code BigDecimal} is not required {@link LongSetting} or
|
|
||||||
* {@link DoubleSetting} should be used.
|
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS_BIG_DECIMAL", schema = DB_SCHEMA)
|
|
||||||
public class BigDecimalSetting
|
public class BigDecimalSetting
|
||||||
extends AbstractSetting<BigDecimal> implements Serializable {
|
extends AbstractSetting<BigDecimal> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1869044294174385532L;
|
private static final long serialVersionUID = -2663272970053572444L;
|
||||||
|
|
||||||
@Column(name = "setting_value")
|
@Column(name = "SETTING_VALUE_BIG_DECIMAL")
|
||||||
private BigDecimal value;
|
private BigDecimal value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -58,7 +50,7 @@ public class BigDecimalSetting
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = super.hashCode();
|
||||||
hash = 79 * hash + Objects.hashCode(value);
|
hash = 47 * hash + Objects.hashCode(value);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,17 +63,15 @@ public class BigDecimalSetting
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!(obj instanceof AbstractSetting)) {
|
||||||
if (!(obj instanceof BigDecimalSetting)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final BigDecimalSetting other
|
final BigDecimalSetting other = (BigDecimalSetting) obj;
|
||||||
= (BigDecimalSetting) obj;
|
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Objects.equals(value, other.getValue());
|
return Objects.equals(value, other.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -95,5 +85,4 @@ public class BigDecimalSetting
|
||||||
value,
|
value,
|
||||||
data));
|
data));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -18,27 +18,21 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting for storing a boolean value.
|
*
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS_BOOLEAN", schema = DB_SCHEMA)
|
|
||||||
public class BooleanSetting
|
public class BooleanSetting
|
||||||
extends AbstractSetting<Boolean> implements Serializable {
|
extends AbstractSetting<Boolean> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1724350134756734938L;
|
private static final long serialVersionUID = 4970829365710856701L;
|
||||||
|
|
||||||
@Column(name = "setting_value")
|
@Column(name = "SETTING_VALUE_BOOLEAN")
|
||||||
private boolean value;
|
private boolean value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -51,18 +45,10 @@ public class BooleanSetting
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(final boolean value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = super.hashCode();
|
||||||
hash = 89 * hash + (this.value ? 1 : 0);
|
hash = 89 * hash + (value ? 1 : 0);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
|
import org.libreccm.configuration.*;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2015 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.libreccm.configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some constants for the configuration system.
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
public final class ConfigurationConstants {
|
|
||||||
|
|
||||||
public static final String REGISTRY_DOMAIN = "registry";
|
|
||||||
|
|
||||||
private ConfigurationConstants() {
|
|
||||||
//Nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
|
import org.libreccm.configuration.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -18,27 +18,16 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import static org.libreccm.configuration.ConfigurationConstants.*;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.apache.logging.log4j.message.FormattedMessage;
|
|
||||||
import org.libreccm.categorization.Category;
|
|
||||||
import org.libreccm.categorization.CategoryManager;
|
|
||||||
import org.libreccm.categorization.CategoryRepository;
|
|
||||||
import org.libreccm.categorization.Domain;
|
|
||||||
import org.libreccm.categorization.DomainRepository;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.StringJoiner;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps between configuration classes and the values stored in the registry.
|
* Maps between configuration classes and the settings stored in the database.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
|
|
@ -46,7 +35,7 @@ import javax.transaction.Transactional;
|
||||||
public class ConfigurationManager {
|
public class ConfigurationManager {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
ConfigurationManager.class);
|
ConfigurationManager.class);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SettingManager settingManager;
|
private SettingManager settingManager;
|
||||||
|
|
@ -54,26 +43,17 @@ public class ConfigurationManager {
|
||||||
@Inject
|
@Inject
|
||||||
private SettingConverter settingConverter;
|
private SettingConverter settingConverter;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CategoryManager categoryManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CategoryRepository categoryRepo;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private DomainRepository domainRepo;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all settings of the provided configuration class.
|
* Load all settings of the provided configuration class.
|
||||||
*
|
*
|
||||||
* @param <T> Type of the configuration class.
|
* @param <T> Type of the configuration class.
|
||||||
* @param confClass The configuration class.
|
* @param confClass The configuration class.
|
||||||
*
|
*
|
||||||
* @return An instance of the configuration class with all settings set to
|
* @return An instance of the configuration class with all settings set to
|
||||||
* the values stored in the registry.
|
* the values stored in the registry.
|
||||||
*/
|
*/
|
||||||
public <T> T findConfiguration(final Class<T> confClass) {
|
public <T> T findConfiguration(final Class<T> confClass) {
|
||||||
if (confClass == null) {
|
if (confClass == null) {
|
||||||
|
|
@ -82,9 +62,9 @@ public class ConfigurationManager {
|
||||||
|
|
||||||
if (confClass.getAnnotation(Configuration.class) == null) {
|
if (confClass.getAnnotation(Configuration.class) == null) {
|
||||||
throw new IllegalArgumentException(String.format(
|
throw new IllegalArgumentException(String.format(
|
||||||
"Provided class \"%s\" is not annotated with \"%s\".",
|
"Provided class \"%s\" is not annotated with \"%s\".",
|
||||||
confClass.getName(),
|
confClass.getName(),
|
||||||
Configuration.class.getName()));
|
Configuration.class.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
final String confName = confClass.getName();
|
final String confName = confClass.getName();
|
||||||
|
|
@ -97,13 +77,11 @@ public class ConfigurationManager {
|
||||||
* registry.
|
* registry.
|
||||||
*
|
*
|
||||||
* @param configuration The configuration to save. The class of the provided
|
* @param configuration The configuration to save. The class of the provided
|
||||||
* object must be annotation with
|
* object must be annotation with {@link Configuration}.
|
||||||
* {@link Configuration}.
|
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException If the {@code configuration} parameter
|
* @throws IllegalArgumentException If the {@code configuration} parameter
|
||||||
* is {@code null} or if the class of the
|
* is {@code null} or if the class of the provided object is not annotation
|
||||||
* provided object is not annotation with
|
* with {@link Configuration}.
|
||||||
* {@link Configuration}.
|
|
||||||
*/
|
*/
|
||||||
public void saveConfiguration(final Object configuration) {
|
public void saveConfiguration(final Object configuration) {
|
||||||
if (configuration == null) {
|
if (configuration == null) {
|
||||||
|
|
@ -112,10 +90,10 @@ public class ConfigurationManager {
|
||||||
|
|
||||||
if (configuration.getClass().getAnnotation(Configuration.class) == null) {
|
if (configuration.getClass().getAnnotation(Configuration.class) == null) {
|
||||||
throw new IllegalArgumentException(String.format(
|
throw new IllegalArgumentException(String.format(
|
||||||
"The class \"%s\" of the provided object is not annotated "
|
"The class \"%s\" of the provided object is not annotated "
|
||||||
+ "with \"%s\".",
|
+ "with \"%s\".",
|
||||||
configuration.getClass().getName(),
|
configuration.getClass().getName(),
|
||||||
Configuration.class.getName()));
|
Configuration.class.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.debug(String.format("Saving configuration \"%s\"...",
|
LOGGER.debug(String.format("Saving configuration \"%s\"...",
|
||||||
|
|
@ -126,10 +104,10 @@ public class ConfigurationManager {
|
||||||
|
|
||||||
if (field.getAnnotation(Setting.class) == null) {
|
if (field.getAnnotation(Setting.class) == null) {
|
||||||
LOGGER.debug(String.format(
|
LOGGER.debug(String.format(
|
||||||
"Field \"%s\" of class \"%s\" is not "
|
"Field \"%s\" of class \"%s\" is not "
|
||||||
+ "a setting. Ignoring it.",
|
+ "a setting. Ignoring it.",
|
||||||
configuration.getClass().getName(),
|
configuration.getClass().getName(),
|
||||||
field.getName()));
|
field.getName()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,16 +118,16 @@ public class ConfigurationManager {
|
||||||
field.get(configuration));
|
field.get(configuration));
|
||||||
} catch (IllegalAccessException ex) {
|
} catch (IllegalAccessException ex) {
|
||||||
LOGGER.error(String.format(
|
LOGGER.error(String.format(
|
||||||
"Failed to write setting value for setting \"%s\" "
|
"Failed to write setting value for setting \"%s\" "
|
||||||
+ "of configuration \"%s\"",
|
+ "of configuration \"%s\"",
|
||||||
getSettingName(field),
|
getSettingName(field),
|
||||||
configuration.getClass().getName()),
|
configuration.getClass().getName()),
|
||||||
ex);
|
ex);
|
||||||
throw new IllegalStateException(String.format(
|
throw new IllegalStateException(String.format(
|
||||||
"Failed to write setting value for setting \"%s\" "
|
"Failed to write setting value for setting \"%s\" "
|
||||||
+ "of configuration \"%s\"",
|
+ "of configuration \"%s\"",
|
||||||
getSettingName(field),
|
getSettingName(field),
|
||||||
configuration.getClass().getName()),
|
configuration.getClass().getName()),
|
||||||
ex);
|
ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -161,28 +139,30 @@ public class ConfigurationManager {
|
||||||
* @param configuration The configuration for which the info is generated.
|
* @param configuration The configuration for which the info is generated.
|
||||||
*
|
*
|
||||||
* @return a {@link ConfigurationInfo} instance describing the provided
|
* @return a {@link ConfigurationInfo} instance describing the provided
|
||||||
* configuration.
|
* configuration.
|
||||||
*/
|
*/
|
||||||
public ConfigurationInfo getConfigurationInfo(final Class<?> configuration) {
|
public ConfigurationInfo getConfigurationInfo(
|
||||||
|
final Class<?> configuration) {
|
||||||
|
|
||||||
if (configuration == null) {
|
if (configuration == null) {
|
||||||
throw new IllegalArgumentException("Configuration can't be null");
|
throw new IllegalArgumentException("Configuration can't be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration.getAnnotation(Configuration.class) == null) {
|
if (configuration.getAnnotation(Configuration.class) == null) {
|
||||||
throw new IllegalArgumentException(String.format(
|
throw new IllegalArgumentException(String.format(
|
||||||
"The class \"%s\" of the provided object is not annotated "
|
"The class \"%s\" of the provided object is not annotated "
|
||||||
+ "with \"%s\".",
|
+ "with \"%s\".",
|
||||||
configuration.getClass().getName(),
|
configuration.getClass().getName(),
|
||||||
Configuration.class.getName()));
|
Configuration.class.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Configuration annotation = configuration.getAnnotation(
|
final Configuration annotation = configuration.getAnnotation(
|
||||||
Configuration.class);
|
Configuration.class);
|
||||||
|
|
||||||
final ConfigurationInfo confInfo = new ConfigurationInfo();
|
final ConfigurationInfo confInfo = new ConfigurationInfo();
|
||||||
confInfo.setName(configuration.getClass().getName());
|
confInfo.setName(configuration.getClass().getName());
|
||||||
if (annotation.descBundle() == null
|
if (annotation.descBundle() == null
|
||||||
|| annotation.descBundle().isEmpty()) {
|
|| annotation.descBundle().isEmpty()) {
|
||||||
confInfo.setDescBundle(String.join("",
|
confInfo.setDescBundle(String.join("",
|
||||||
configuration.getClass()
|
configuration.getClass()
|
||||||
.getName(),
|
.getName(),
|
||||||
|
|
@ -191,7 +171,7 @@ public class ConfigurationManager {
|
||||||
confInfo.setDescBundle(annotation.descBundle());
|
confInfo.setDescBundle(annotation.descBundle());
|
||||||
}
|
}
|
||||||
if (annotation.descKey() == null
|
if (annotation.descKey() == null
|
||||||
|| annotation.descKey().isEmpty()) {
|
|| annotation.descKey().isEmpty()) {
|
||||||
confInfo.setDescKey("description");
|
confInfo.setDescKey("description");
|
||||||
} else {
|
} else {
|
||||||
confInfo.setDescKey(annotation.descKey());
|
confInfo.setDescKey(annotation.descKey());
|
||||||
|
|
@ -202,7 +182,7 @@ public class ConfigurationManager {
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
if (field.getAnnotation(Setting.class) != null) {
|
if (field.getAnnotation(Setting.class) != null) {
|
||||||
confInfo.addSetting(settingManager.getSettingInfo(
|
confInfo.addSetting(settingManager.getSettingInfo(
|
||||||
configuration, field.getName()));
|
configuration, field.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -218,11 +198,11 @@ public class ConfigurationManager {
|
||||||
* @param field The setting field.
|
* @param field The setting field.
|
||||||
*
|
*
|
||||||
* @return The name of the field or if the {@link Setting} annotation of the
|
* @return The name of the field or if the {@link Setting} annotation of the
|
||||||
* field has a name value, the value of that field.
|
* field has a name value, the value of that field.
|
||||||
*/
|
*/
|
||||||
String getSettingName(final Field field) {
|
String getSettingName(final Field field) {
|
||||||
LOGGER.debug(String.format("Trying to get setting name from field: "
|
LOGGER.debug(String.format("Trying to get setting name from field: "
|
||||||
+ "\"%s\"",
|
+ "\"%s\"",
|
||||||
field.getName()));
|
field.getName()));
|
||||||
final Setting annotation = field.getAnnotation(Setting.class);
|
final Setting annotation = field.getAnnotation(Setting.class);
|
||||||
|
|
||||||
|
|
@ -236,13 +216,13 @@ public class ConfigurationManager {
|
||||||
/**
|
/**
|
||||||
* Create a setting instance of a specific value type.
|
* Create a setting instance of a specific value type.
|
||||||
*
|
*
|
||||||
* @param <T> Type variable.
|
* @param <T> Type variable.
|
||||||
* @param valueType The type of the value of the setting to create.
|
* @param valueType The type of the value of the setting to create.
|
||||||
*
|
*
|
||||||
* @return An setting instance of the provided value type.
|
* @return An setting instance of the provided value type.
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException If there is not setting type for the
|
* @throws IllegalArgumentException If there is not setting type for the
|
||||||
* provided value type.
|
* provided value type.
|
||||||
*/
|
*/
|
||||||
// @SuppressWarnings("unchecked")
|
// @SuppressWarnings("unchecked")
|
||||||
// <T> AbstractSetting<T> createSettingForValueType(
|
// <T> AbstractSetting<T> createSettingForValueType(
|
||||||
|
|
@ -273,87 +253,73 @@ public class ConfigurationManager {
|
||||||
/**
|
/**
|
||||||
* Sets a value on a setting in the registry.
|
* Sets a value on a setting in the registry.
|
||||||
*
|
*
|
||||||
* @param <T> The value type of the setting.
|
* @param <T> The value type of the setting.
|
||||||
* @param configuration The configuration to which the settings belongs.
|
* @param configuration The configuration to which the settings belongs.
|
||||||
* @param settingName The name of the setting.
|
* @param settingName The name of the setting.
|
||||||
* @param valueType The type of the value of the setting.
|
* @param valueType The type of the value of the setting.
|
||||||
* @param value The value to set.
|
* @param value The value to set.
|
||||||
*/
|
*/
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
private <T> void setSettingValue(final Object configuration,
|
private <T> void setSettingValue(final Object configuration,
|
||||||
final String settingName,
|
final String settingName,
|
||||||
final Class<T> valueType,
|
final Class<T> valueType,
|
||||||
final Object value) {
|
final Object value) {
|
||||||
final String settingPath = String.format(
|
final String confClassName = configuration.getClass().getName();
|
||||||
"%s.%s",
|
|
||||||
configuration.getClass().getName(),
|
AbstractSetting<T> setting = settingManager.findSetting(confClassName,
|
||||||
settingName);
|
settingName,
|
||||||
LOGGER.debug(new FormattedMessage(
|
|
||||||
"Saving setting \"%s\" of type \"%s\"...",
|
|
||||||
settingPath,
|
|
||||||
valueType.getName()));
|
|
||||||
AbstractSetting<T> setting = settingManager.findSetting(settingPath,
|
|
||||||
valueType);
|
valueType);
|
||||||
if (setting == null) {
|
if (setting == null) {
|
||||||
LOGGER.debug(String.format("Setting \"%s\" does not yet exist in "
|
LOGGER.debug(String.format(
|
||||||
+ "database. Creating new setting.",
|
"Setting \"%s#%s\" does not yet exist in "
|
||||||
settingPath));
|
+ "database. Creating new setting.",
|
||||||
|
confClassName,
|
||||||
|
settingName));
|
||||||
setting = settingConverter.createSettingForValueType(valueType);
|
setting = settingConverter.createSettingForValueType(valueType);
|
||||||
setting.setName(settingName);
|
|
||||||
setting.setDisplayName(settingName);
|
|
||||||
final Category category = findCategoryForNewSetting(configuration);
|
|
||||||
categoryManager.addObjectToCategory(setting, category);
|
|
||||||
}
|
}
|
||||||
|
setting.setConfigurationClass(confClassName);
|
||||||
|
setting.setName(settingName);
|
||||||
|
|
||||||
LOGGER.debug(String.format("New value of setting \"%s\" is: \"%s\"",
|
LOGGER.debug(String.format(
|
||||||
settingPath,
|
"New value of setting \"%s#%s\" is: \"%s\"",
|
||||||
value.toString()));
|
confClassName,
|
||||||
|
settingName,
|
||||||
|
value.toString()));
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final T settingValue = (T) value;
|
final T settingValue = (T) value;
|
||||||
setting.setValue(settingValue);
|
setting.setValue(settingValue);
|
||||||
LOGGER.debug(String.format("Value of setting \"%s\" is now: \"%s\"",
|
LOGGER.debug(String.format(
|
||||||
settingPath,
|
"Value of setting \"%s#%s\" is now: \"%s\"",
|
||||||
setting.getValue().toString()));
|
confClassName,
|
||||||
|
settingName,
|
||||||
|
setting.getValue().toString()
|
||||||
|
));
|
||||||
LOGGER.debug("Saving changed setting to DB...");
|
LOGGER.debug("Saving changed setting to DB...");
|
||||||
entityManager.merge(setting);
|
settingManager.saveSetting(setting);
|
||||||
entityManager.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for loading a configuration from the registry.
|
* Helper method for loading a configuration from the database.
|
||||||
*
|
*
|
||||||
* @param <T> The type of the configuration.
|
* @param <T> The type of the configuration.
|
||||||
* @param confName The fully qualified name of the configuration in the
|
|
||||||
* registry. For normal configuration this is the fully
|
|
||||||
* qualified name of the configuration class. For
|
|
||||||
* application instance configurations this is the fully
|
|
||||||
* qualified name of the configuration class joined with
|
|
||||||
* the primary URL of the application instance, separated
|
|
||||||
* with a dot.
|
|
||||||
* @param confClass The configuration class.
|
* @param confClass The configuration class.
|
||||||
*
|
*
|
||||||
* @return An instance of the configuration class with all setting fields
|
* @return An instance of the configuration class with all setting fields
|
||||||
* set to the values stored in the registry.
|
* set to the values stored in the registry.
|
||||||
*/
|
*/
|
||||||
<T> T findConfiguration(final String confName,
|
<T> T findConfiguration(final String confName, final Class<T> confClass) {
|
||||||
final Class<T> confClass) {
|
|
||||||
final T conf;
|
final T conf;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
conf = confClass.newInstance();
|
conf = confClass.newInstance();
|
||||||
} catch (InstantiationException | IllegalAccessException ex) {
|
} catch (InstantiationException | IllegalAccessException ex) {
|
||||||
LOGGER.warn(String.format(
|
LOGGER.warn(String.format(
|
||||||
"Failed to instantiate configuration \"%s\".",
|
"Failed to instantiate configuration \"%s\".",
|
||||||
confClass.getName()),
|
confClass.getName()),
|
||||||
ex);
|
ex);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Domain registry = domainRepo.findByDomainKey(REGISTRY_DOMAIN);
|
|
||||||
if (categoryRepo.findByPath(registry, confName) == null) {
|
|
||||||
return conf;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Field[] fields = confClass.getDeclaredFields();
|
final Field[] fields = confClass.getDeclaredFields();
|
||||||
for (final Field field : fields) {
|
for (final Field field : fields) {
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
|
|
@ -361,24 +327,24 @@ public class ConfigurationManager {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String settingPath = String.format("%s.%s",
|
final String settingName = getSettingName(field);
|
||||||
confClass.getName(),
|
|
||||||
getSettingName(field));
|
|
||||||
final Class<?> settingType = field.getType();
|
final Class<?> settingType = field.getType();
|
||||||
final AbstractSetting<?> setting = settingManager.findSetting(
|
final AbstractSetting<?> setting = settingManager.findSetting(
|
||||||
settingPath, settingType);
|
confName, settingName, settingType);
|
||||||
if (setting != null) {
|
if (setting != null) {
|
||||||
try {
|
try {
|
||||||
LOGGER.debug("Setting \"{}\" found. Value: %s",
|
LOGGER.debug("Setting \"{}#{}\" found. Value: {}",
|
||||||
settingPath,
|
confName,
|
||||||
|
settingName,
|
||||||
setting.getValue().toString());
|
setting.getValue().toString());
|
||||||
field.set(conf, setting.getValue());
|
field.set(conf, setting.getValue());
|
||||||
} catch (IllegalAccessException ex) {
|
} catch (IllegalAccessException ex) {
|
||||||
LOGGER.warn(
|
LOGGER.warn(
|
||||||
"Failed to set value of configuration class \"{}\". "
|
"Failed to set value of configuration class \"{}\". "
|
||||||
+ "Ignoring.",
|
+ "Ignoring.",
|
||||||
confClass.getName(),
|
confClass.getName(),
|
||||||
ex);
|
ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -386,94 +352,4 @@ public class ConfigurationManager {
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Category findCategoryForNewSetting(final Object configuration) {
|
|
||||||
LOGGER.debug("#findCategoryForNewSetting: Looking for category for "
|
|
||||||
+ "configuration \"{}\"...",
|
|
||||||
configuration.getClass().getName());
|
|
||||||
final String categoryPath = configuration.getClass().getName();
|
|
||||||
final String[] tokens = categoryPath.split("\\.");
|
|
||||||
final Domain registry = domainRepo
|
|
||||||
.findByDomainKey(REGISTRY_DOMAIN);
|
|
||||||
|
|
||||||
final Category[] categories = new Category[tokens.length];
|
|
||||||
|
|
||||||
//Check which of the categories in the categoryPath exist already
|
|
||||||
final boolean[] exists = new boolean[tokens.length];
|
|
||||||
for (int i = 0; i < tokens.length; i++) {
|
|
||||||
final String path = buildCategoryPath(tokens, i);
|
|
||||||
LOGGER.debug("#findCategoryForNewSetting: "
|
|
||||||
+ "Checking if category \"{}\" exists.",
|
|
||||||
path);
|
|
||||||
final Category category = categoryRepo.findByPath(registry,
|
|
||||||
path);
|
|
||||||
if (category == null) {
|
|
||||||
LOGGER.debug("#findCategoryForNewSetting: "
|
|
||||||
+ "Category \"{}\" does not exist.",
|
|
||||||
path);
|
|
||||||
exists[i] = false;
|
|
||||||
} else {
|
|
||||||
LOGGER.debug(
|
|
||||||
"#findCategoryForNewSetting: Category \"{}\" exists.",
|
|
||||||
path);
|
|
||||||
exists[i] = true;
|
|
||||||
categories[i] = category;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.debug(
|
|
||||||
"#findCategoryForNewSetting: Creating missing categories...");
|
|
||||||
for (int i = 0; i < tokens.length; i++) {
|
|
||||||
LOGGER.debug(
|
|
||||||
"#findCategoryForNewSetting: Checking for category \"{}\"...",
|
|
||||||
tokens[i]);
|
|
||||||
if (!exists[i]) {
|
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
LOGGER.debug("#findCategoryForNewSetting: "
|
|
||||||
+ "Category \"{}\" does not exist, "
|
|
||||||
+ "creating as subcategory of the registry "
|
|
||||||
+ "root category.",
|
|
||||||
tokens[i]);
|
|
||||||
categories[i] = createNewCategory(tokens[i],
|
|
||||||
registry.getRoot());
|
|
||||||
} else {
|
|
||||||
LOGGER.debug("#findCategoryForNewSetting: "
|
|
||||||
+ "Category \"{}\" does not exist, "
|
|
||||||
+ "creating as subcategory of \"{}\"",
|
|
||||||
tokens[i],
|
|
||||||
categories[i - 1].getName());
|
|
||||||
categories[i] = createNewCategory(tokens[i],
|
|
||||||
categories[i - 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.debug("#findCategoryForNewSetting: "
|
|
||||||
+ "Found/Created category \"{}\".",
|
|
||||||
categoryPath);
|
|
||||||
return categories[categories.length - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
private String buildCategoryPath(final String[] tokens,
|
|
||||||
final int index) {
|
|
||||||
final StringJoiner joiner = new StringJoiner(".");
|
|
||||||
for (int i = 0; i <= index; i++) {
|
|
||||||
joiner.add(tokens[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return joiner.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Category createNewCategory(final String name,
|
|
||||||
final Category parent) {
|
|
||||||
final Category category = new Category();
|
|
||||||
category.setName(name);
|
|
||||||
category.setDisplayName(name);
|
|
||||||
categoryRepo.save(category);
|
|
||||||
entityManager.flush();
|
|
||||||
categoryManager.addSubCategoryToCategory(category, parent);
|
|
||||||
|
|
||||||
return category;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -18,27 +18,21 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting for storing a double value.
|
*
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS_DOUBLE", schema = DB_SCHEMA)
|
|
||||||
public class DoubleSetting
|
public class DoubleSetting
|
||||||
extends AbstractSetting<Double> implements Serializable {
|
extends AbstractSetting<Double> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6944518527865528160L;
|
private static final long serialVersionUID = 4698940335480821950L;
|
||||||
|
|
||||||
@Column(name = "setting_value")
|
@Column(name = "SETTING_VALUE_DOUBLE")
|
||||||
private double value;
|
private double value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -76,7 +70,7 @@ public class DoubleSetting
|
||||||
}
|
}
|
||||||
|
|
||||||
return Double.doubleToLongBits(value) == Double.doubleToLongBits(other
|
return Double.doubleToLongBits(value) == Double.doubleToLongBits(other
|
||||||
.getValue());
|
.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -31,25 +31,24 @@ import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting class for storing a list a strings. This can be used to generate
|
* A setting class for storing a list a strings. This can be used to generate
|
||||||
* enums which can be configured by the administrator.
|
* enums which can be configured by the administrator.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS_ENUM", schema = DB_SCHEMA)
|
|
||||||
public class EnumSetting
|
public class EnumSetting
|
||||||
extends AbstractSetting<Set<String>> implements Serializable {
|
extends AbstractSetting<Set<String>> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 8506016944203102813L;
|
private static final long serialVersionUID = 1763168269981687340L;
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
@JoinTable(name = "SETTINGS_ENUM_VALUES",
|
@JoinTable(name = "SETTINGS_ENUM_VALUES",
|
||||||
schema = DB_SCHEMA,
|
schema = DB_SCHEMA,
|
||||||
joinColumns = {@JoinColumn(name = "ENUM_ID")})
|
joinColumns = {
|
||||||
|
@JoinColumn(name = "ENUM_ID")})
|
||||||
private Set<String> value;
|
private Set<String> value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -114,7 +113,7 @@ public class EnumSetting
|
||||||
final List<String> values = new ArrayList<>(value);
|
final List<String> values = new ArrayList<>(value);
|
||||||
values.forEach((String v) -> {
|
values.forEach((String v) -> {
|
||||||
enumValues.append('\"').append(v).append('\"');
|
enumValues.append('\"').append(v).append('\"');
|
||||||
if (values.indexOf(v) != values.size()- 1) {
|
if (values.indexOf(v) != values.size() - 1) {
|
||||||
enumValues.append(", ");
|
enumValues.append(", ");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -30,29 +30,27 @@ import javax.persistence.Embedded;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting which stores a {@link LocalizedString} . This can be used for
|
* A setting which stores a {@link LocalizedString} . This can be used for
|
||||||
* storing values for text in the user interface which should be customisable by
|
* storing values for text in the user interface which should be customisable by
|
||||||
* the administrator.
|
* the administrator.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS_L10N_STRING", schema = DB_SCHEMA)
|
|
||||||
public class LocalizedStringSetting
|
public class LocalizedStringSetting
|
||||||
extends AbstractSetting<LocalizedString> implements Serializable {
|
extends AbstractSetting<LocalizedString> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5854552013878000164L;
|
private static final long serialVersionUID = 667750736151545279L;
|
||||||
|
|
||||||
@Embedded
|
@Embedded
|
||||||
@AssociationOverride(
|
@AssociationOverride(
|
||||||
name = "values",
|
name = "values",
|
||||||
joinTable = @JoinTable(name = "SETTINGS_L10N_STR_VALUES",
|
joinTable = @JoinTable(name = "SETTINGS_L10N_STR_VALUES",
|
||||||
schema = DB_SCHEMA,
|
schema = DB_SCHEMA,
|
||||||
joinColumns = {
|
joinColumns = {
|
||||||
@JoinColumn(name = "ENTRY_ID")}))
|
@JoinColumn(name = "ENTRY_ID")}))
|
||||||
private LocalizedString value;
|
private LocalizedString value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -86,7 +84,7 @@ public class LocalizedStringSetting
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final LocalizedStringSetting other
|
final LocalizedStringSetting other
|
||||||
= (LocalizedStringSetting) obj;
|
= (LocalizedStringSetting) obj;
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,17 +28,16 @@ import javax.persistence.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setting for storing a long value.
|
* Setting for storing a long value.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS_LONG", schema = DB_SCHEMA)
|
public class LongSetting
|
||||||
public class LongSetting
|
extends AbstractSetting<Long> implements Serializable {
|
||||||
extends AbstractSetting<Long> implements Serializable{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 818622372461020368L;
|
private static final long serialVersionUID = -5806336428735880767L;
|
||||||
|
|
||||||
@Column(name = "setting_value")
|
@Column(name = "SETTING_VALUE_LONG")
|
||||||
private long value;
|
private long value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -63,7 +62,7 @@ public class LongSetting
|
||||||
if (!super.equals(obj)) {
|
if (!super.equals(obj)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -71,24 +70,24 @@ public class LongSetting
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final LongSetting other
|
final LongSetting other
|
||||||
= (LongSetting) obj;
|
= (LongSetting) obj;
|
||||||
if (!other.canEqual(this)) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.value == other.getValue();
|
return this.value == other.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
return obj instanceof LongSetting;
|
return obj instanceof LongSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(final String data) {
|
public String toString(final String data) {
|
||||||
return super.toString(String.format(", value = %d%s",
|
return super.toString(String.format(", value = %d%s",
|
||||||
value,
|
value,
|
||||||
data));
|
data));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
|
import org.libreccm.configuration.*;
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
|
import org.libreccm.configuration.*;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
|
||||||
|
|
@ -18,32 +18,23 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import static org.libreccm.configuration.ConfigurationConstants.*;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.libreccm.categorization.Categorization;
|
|
||||||
import org.libreccm.categorization.Category;
|
|
||||||
import org.libreccm.categorization.CategoryRepository;
|
|
||||||
import org.libreccm.categorization.Domain;
|
|
||||||
import org.libreccm.categorization.DomainRepository;
|
|
||||||
import org.libreccm.core.CcmObject;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Arrays;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages settings in the registry. Normally there should be no need to use
|
*
|
||||||
* this class directly because the {@link ConfigurationManager} provide the same
|
* Manages settings in the database. Normally there should be no need to use
|
||||||
* public methods for accessing settings than this class. The purpose of this
|
* this class directly because the {@link ConfigurationManager} provides the
|
||||||
* class is only to separate the logic for managing settings from the logic for
|
* same public methods for accessing settings than this class. The purpose of
|
||||||
* managing configuration classes and to reduce the complexity of the
|
* this class is only to separate the logic for managing settings from the logic
|
||||||
|
* for managing configuration classes and to reduce the complexity of the
|
||||||
* {@link ConfigurationManager} class
|
* {@link ConfigurationManager} class
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -52,14 +43,8 @@ import javax.transaction.Transactional;
|
||||||
public class SettingManager {
|
public class SettingManager {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
SettingManager.class);
|
SettingManager.class);
|
||||||
|
|
||||||
@Inject
|
|
||||||
private CategoryRepository categoryRepo;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private DomainRepository domainRepo;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
|
@ -67,52 +52,39 @@ public class SettingManager {
|
||||||
* Create a {@link SettingInfo} instance for a setting.
|
* Create a {@link SettingInfo} instance for a setting.
|
||||||
*
|
*
|
||||||
* @param configuration The configuration class to which the settings
|
* @param configuration The configuration class to which the settings
|
||||||
* belongs.
|
* belongs.
|
||||||
* @param name The name of the setting for which the
|
* @param name The name of the setting for which the {@link SettingInfo} is
|
||||||
* {@link SettingInfo} is generated.
|
* generated.
|
||||||
*
|
*
|
||||||
* @return The {@link SettingInfo} for the provided configuration class.
|
* @return The {@link SettingInfo} for the provided configuration class.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"PMD.NPathComplexity",
|
@SuppressWarnings({"PMD.NPathComplexity",
|
||||||
"PMD.CyclomaticComplexity",
|
"PMD.CyclomaticComplexity",
|
||||||
"PMD.StandardCyclomaticComplexity"})
|
"PMD.StandardCyclomaticComplexity"})
|
||||||
public SettingInfo getSettingInfo(final Class<?> configuration,
|
public SettingInfo getSettingInfo(
|
||||||
final String name) {
|
final Class<?> configuration,
|
||||||
|
final String name) {
|
||||||
if (configuration == null) {
|
if (configuration == null) {
|
||||||
throw new IllegalArgumentException("Configuration can't be null");
|
throw new IllegalArgumentException("Configuration can't be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configuration.getAnnotation(Configuration.class) == null) {
|
if (configuration.getAnnotation(Configuration.class) == null) {
|
||||||
throw new IllegalArgumentException(String.format(
|
throw new IllegalArgumentException(String.format(
|
||||||
"The class \"%s\" of the provided object is not annotated "
|
"The class \"%s\" of the provided object is not annotated "
|
||||||
+ "with \"%s\".",
|
+ "with \"%s\".",
|
||||||
configuration.getClass().getName(),
|
configuration.getClass().getName(),
|
||||||
Configuration.class.getName()));
|
Configuration.class.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// final Configuration confAnnotation = configuration.getAnnotation(
|
|
||||||
// Configuration.class);
|
|
||||||
// final String descBundle;
|
|
||||||
// if (confAnnotation.descBundle() == null
|
|
||||||
// || confAnnotation.descBundle().isEmpty()) {
|
|
||||||
// descBundle = String.join("",
|
|
||||||
// configuration.getClass().getName(),
|
|
||||||
// "Description");
|
|
||||||
// } else {
|
|
||||||
// descBundle = confAnnotation.descBundle();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final Field field;
|
final Field field;
|
||||||
try {
|
try {
|
||||||
field = configuration.getDeclaredField(name);
|
field = configuration.getDeclaredField(name);
|
||||||
} catch (SecurityException | NoSuchFieldException ex) {
|
} catch (SecurityException | NoSuchFieldException ex) {
|
||||||
LOGGER.warn(String.format(
|
LOGGER.warn(String.format(
|
||||||
"Failed to generate SettingInfo for field \"%s\" of "
|
"Failed to generate SettingInfo for field \"%s\" of "
|
||||||
+ "configuration \"%s\". Ignoring field.",
|
+ "configuration \"%s\". Ignoring field.",
|
||||||
configuration.getClass().getName(),
|
configuration.getClass().getName(),
|
||||||
name),
|
name),
|
||||||
ex);
|
ex);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +96,7 @@ public class SettingManager {
|
||||||
final Setting settingAnnotation = field.getAnnotation(Setting.class);
|
final Setting settingAnnotation = field.getAnnotation(Setting.class);
|
||||||
final SettingInfo settingInfo = new SettingInfo();
|
final SettingInfo settingInfo = new SettingInfo();
|
||||||
if (settingAnnotation.name() == null
|
if (settingAnnotation.name() == null
|
||||||
|| settingAnnotation.name().isEmpty()) {
|
|| settingAnnotation.name().isEmpty()) {
|
||||||
settingInfo.setName(field.getName());
|
settingInfo.setName(field.getName());
|
||||||
} else {
|
} else {
|
||||||
settingInfo.setName(settingAnnotation.name());
|
settingInfo.setName(settingAnnotation.name());
|
||||||
|
|
@ -137,7 +109,7 @@ public class SettingManager {
|
||||||
settingInfo.setDefaultValue(field.get(conf).toString());
|
settingInfo.setDefaultValue(field.get(conf).toString());
|
||||||
} catch (InstantiationException | IllegalAccessException ex) {
|
} catch (InstantiationException | IllegalAccessException ex) {
|
||||||
LOGGER.warn(String.format("Failed to create instance of \"%s\" to "
|
LOGGER.warn(String.format("Failed to create instance of \"%s\" to "
|
||||||
+ "get default values.",
|
+ "get default values.",
|
||||||
configuration.getName()),
|
configuration.getName()),
|
||||||
ex);
|
ex);
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +118,7 @@ public class SettingManager {
|
||||||
settingInfo.setDescBundle(getDescBundle(configuration));
|
settingInfo.setDescBundle(getDescBundle(configuration));
|
||||||
|
|
||||||
if (settingAnnotation.labelKey() == null
|
if (settingAnnotation.labelKey() == null
|
||||||
|| settingAnnotation.labelKey().isEmpty()) {
|
|| settingAnnotation.labelKey().isEmpty()) {
|
||||||
settingInfo.setLabelKey(String.join(".", field.getName(),
|
settingInfo.setLabelKey(String.join(".", field.getName(),
|
||||||
"label"));
|
"label"));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -154,7 +126,7 @@ public class SettingManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingAnnotation.descKey() == null
|
if (settingAnnotation.descKey() == null
|
||||||
|| settingAnnotation.descKey().isEmpty()) {
|
|| settingAnnotation.descKey().isEmpty()) {
|
||||||
settingInfo.setDescKey(String.join(".",
|
settingInfo.setDescKey(String.join(".",
|
||||||
field.getName(),
|
field.getName(),
|
||||||
"descripotion"));
|
"descripotion"));
|
||||||
|
|
@ -168,82 +140,35 @@ public class SettingManager {
|
||||||
/**
|
/**
|
||||||
* A low level method for finding a setting in the registry.
|
* A low level method for finding a setting in the registry.
|
||||||
*
|
*
|
||||||
* @param <T> Type of the value of the setting
|
* @param <T> Type of the value of the setting
|
||||||
* @param name The fully qualified name of the setting.
|
* @param confName Name of the configuration to which the setting belongs
|
||||||
|
* @param name The fully qualified name of the setting.
|
||||||
* @param clazz The class of the setting.
|
* @param clazz The class of the setting.
|
||||||
*
|
*
|
||||||
* @return The requested setting if it exists in the registry, {@code null}
|
* @return The requested setting if it exists in the registry, {@code null}
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
public <T> AbstractSetting<T> findSetting(final String name,
|
public <T> AbstractSetting<T> findSetting(final String confName,
|
||||||
|
final String name,
|
||||||
final Class<T> clazz) {
|
final Class<T> clazz) {
|
||||||
LOGGER.debug(String.format(
|
LOGGER.debug(String.format(
|
||||||
"Trying to find setting \"%s\" of type \"%s\"",
|
"Trying to find setting \"%s\" of type \"%s\"",
|
||||||
name,
|
|
||||||
clazz.getName()));
|
|
||||||
final String[] tokens = name.split("\\.");
|
|
||||||
LOGGER.debug(String.format("Setting name \"%s\" has %d tokens.",
|
|
||||||
name,
|
|
||||||
tokens.length));
|
|
||||||
final String[] categoryTokens = Arrays.copyOfRange(tokens,
|
|
||||||
0,
|
|
||||||
tokens.length - 1);
|
|
||||||
final String categoryPath = String.join(".", categoryTokens);
|
|
||||||
LOGGER.debug(String.format("categoryPath for setting is \"%s\".",
|
|
||||||
categoryPath));
|
|
||||||
|
|
||||||
final Domain registry = domainRepo
|
|
||||||
.findByDomainKey(REGISTRY_DOMAIN);
|
|
||||||
final Category category = categoryRepo.findByPath(registry,
|
|
||||||
categoryPath);
|
|
||||||
if (category == null) {
|
|
||||||
LOGGER.warn(String.format(String.format(
|
|
||||||
"Category \"%s\" for setting \"%s\" not found.",
|
|
||||||
categoryPath,
|
|
||||||
name)));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGER.debug(String.format("Category has %d objects. Filtering.",
|
|
||||||
category.getObjects().size()));
|
|
||||||
final Optional<Categorization> result = category
|
|
||||||
.getObjects()
|
|
||||||
.stream()
|
|
||||||
.filter((Categorization c)
|
|
||||||
-> c.getCategorizedObject() instanceof AbstractSetting)
|
|
||||||
.filter((Categorization c)
|
|
||||||
-> ((AbstractSetting<?>) c.getCategorizedObject())
|
|
||||||
.getName()
|
|
||||||
.equals(tokens[tokens.length - 1]))
|
|
||||||
.findFirst();
|
|
||||||
|
|
||||||
if (result.isPresent()) {
|
|
||||||
final CcmObject object = result.get().getCategorizedObject();
|
|
||||||
final AbstractSetting<?> entry = (AbstractSetting<?>) object;
|
|
||||||
|
|
||||||
if (clazz.isInstance(entry.getValue())) {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
final AbstractSetting<T> resultEntry
|
|
||||||
= (AbstractSetting<T>) entry;
|
|
||||||
return resultEntry;
|
|
||||||
} else {
|
|
||||||
LOGGER.warn(String.format("Setting \"%s\" found but is not of "
|
|
||||||
+ "the requested type \"%s\".",
|
|
||||||
name,
|
|
||||||
clazz.getName()));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOGGER.warn(String.format(
|
|
||||||
"Setting \"%s\" was not found in category \"%s\".",
|
|
||||||
name,
|
name,
|
||||||
categoryPath));
|
clazz.getName()));
|
||||||
|
|
||||||
|
final TypedQuery<AbstractSetting> query = entityManager.
|
||||||
|
createNamedQuery("AbstractSetting.findByClassAndName",
|
||||||
|
AbstractSetting.class);
|
||||||
|
query.setParameter("class", confName);
|
||||||
|
query.setParameter("name", name);
|
||||||
|
final List<AbstractSetting> result = query.getResultList();
|
||||||
|
if (result.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
} else {
|
||||||
|
return result.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Low level method of saving a setting.
|
* Low level method of saving a setting.
|
||||||
*
|
*
|
||||||
|
|
@ -251,7 +176,7 @@ public class SettingManager {
|
||||||
*/
|
*/
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
public void saveSetting(final AbstractSetting<?> setting) {
|
public void saveSetting(final AbstractSetting<?> setting) {
|
||||||
if (setting.getObjectId() == 0) {
|
if (setting.getSettingId() == 0) {
|
||||||
entityManager.persist(setting);
|
entityManager.persist(setting);
|
||||||
} else {
|
} else {
|
||||||
entityManager.merge(setting);
|
entityManager.merge(setting);
|
||||||
|
|
@ -260,15 +185,14 @@ public class SettingManager {
|
||||||
|
|
||||||
private String getDescBundle(final Class<?> configuration) {
|
private String getDescBundle(final Class<?> configuration) {
|
||||||
final Configuration confAnnotation = configuration.getAnnotation(
|
final Configuration confAnnotation = configuration.getAnnotation(
|
||||||
Configuration.class);
|
Configuration.class);
|
||||||
if (confAnnotation.descBundle() == null
|
if (confAnnotation.descBundle() == null
|
||||||
|| confAnnotation.descBundle().isEmpty()) {
|
|| confAnnotation.descBundle().isEmpty()) {
|
||||||
return String.join("",
|
return String.join("",
|
||||||
configuration.getClass().getName(),
|
configuration.getClass().getName(),
|
||||||
"Description");
|
"Description");
|
||||||
} else {
|
} else {
|
||||||
return confAnnotation.descBundle();
|
return confAnnotation.descBundle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,12 @@ import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS_STRING_LIST", schema = DB_SCHEMA)
|
|
||||||
public class StringListSetting extends AbstractSetting<List<String>> {
|
public class StringListSetting extends AbstractSetting<List<String>> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7093818804712916413L;
|
private static final long serialVersionUID = 7093818804712916413L;
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,12 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A setting for storing a string value.
|
* A setting for storing a string value.
|
||||||
|
|
@ -33,13 +31,12 @@ import javax.persistence.Table;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "SETTINGS_STRING", schema = DB_SCHEMA)
|
|
||||||
public class StringSetting
|
public class StringSetting
|
||||||
extends AbstractSetting<String> implements Serializable {
|
extends AbstractSetting<String> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8564570962027541731L;
|
private static final long serialVersionUID = -8564570962027541731L;
|
||||||
|
|
||||||
@Column(name = "setting_value", length = 1024)
|
@Column(name = "SETTING_VALUE_STRING", length = 1024)
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
import com.arsdigita.ui.SimplePage;
|
|
||||||
import com.arsdigita.ui.UIConfig;
|
|
||||||
import com.arsdigita.ui.UiInitializer;
|
|
||||||
import com.arsdigita.ui.admin.AdminApplicationCreator;
|
import com.arsdigita.ui.admin.AdminApplicationCreator;
|
||||||
import com.arsdigita.ui.admin.AdminServlet;
|
import com.arsdigita.ui.admin.AdminServlet;
|
||||||
import com.arsdigita.ui.admin.AdminApplicationSetup;
|
import com.arsdigita.ui.admin.AdminApplicationSetup;
|
||||||
|
|
@ -28,7 +25,6 @@ import com.arsdigita.ui.login.LoginApplicationCreator;
|
||||||
import com.arsdigita.ui.login.LoginServlet;
|
import com.arsdigita.ui.login.LoginServlet;
|
||||||
import com.arsdigita.ui.login.LoginApplicationSetup;
|
import com.arsdigita.ui.login.LoginApplicationSetup;
|
||||||
|
|
||||||
import org.libreccm.categorization.RegistrySetup;
|
|
||||||
import org.libreccm.modules.CcmModule;
|
import org.libreccm.modules.CcmModule;
|
||||||
import org.libreccm.modules.InitEvent;
|
import org.libreccm.modules.InitEvent;
|
||||||
import org.libreccm.modules.InstallEvent;
|
import org.libreccm.modules.InstallEvent;
|
||||||
|
|
@ -107,9 +103,6 @@ public class CcmCore implements CcmModule {
|
||||||
event);
|
event);
|
||||||
systemUsersSetup.setupSystemUsers();
|
systemUsersSetup.setupSystemUsers();
|
||||||
|
|
||||||
final RegistrySetup registrySetup = new RegistrySetup(event);
|
|
||||||
registrySetup.setup();
|
|
||||||
|
|
||||||
final AdminApplicationSetup adminSetup = new AdminApplicationSetup(event);
|
final AdminApplicationSetup adminSetup = new AdminApplicationSetup(event);
|
||||||
adminSetup.setup();
|
adminSetup.setup();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -406,3 +406,5 @@ ui.admin.categories.domain_details.mappings.add=Add mapping for application
|
||||||
ui.admin.categories.domain_details.mappings.create=Create
|
ui.admin.categories.domain_details.mappings.create=Create
|
||||||
ui.admin.categories.doamin_details.mappings.error.please_select_app=Please select an application.
|
ui.admin.categories.doamin_details.mappings.error.please_select_app=Please select an application.
|
||||||
ui.admin.categories.domain_details.mappings.remove.confirm=Are you sure to remove this domain mapping?
|
ui.admin.categories.domain_details.mappings.remove.confirm=Are you sure to remove this domain mapping?
|
||||||
|
ui.admin.categories.tree.header=Categories
|
||||||
|
ui.admin.categories.tree.back=Back to domain properties
|
||||||
|
|
|
||||||
|
|
@ -409,3 +409,5 @@ ui.admin.categories.domain_details.mappings.add=Mapping f\u00fcr Application
|
||||||
ui.admin.categories.domain_details.mappings.create=hinzuf\u00fcgen
|
ui.admin.categories.domain_details.mappings.create=hinzuf\u00fcgen
|
||||||
ui.admin.categories.doamin_details.mappings.error.please_select_app=Bitte w\u00e4hlen Sie eine Applikation aus.
|
ui.admin.categories.doamin_details.mappings.error.please_select_app=Bitte w\u00e4hlen Sie eine Applikation aus.
|
||||||
ui.admin.categories.domain_details.mappings.remove.confirm=Sind Sie sicher, dass Sie dieses Mapping entfernen wollen?
|
ui.admin.categories.domain_details.mappings.remove.confirm=Sind Sie sicher, dass Sie dieses Mapping entfernen wollen?
|
||||||
|
ui.admin.categories.tree.header=Kategorien
|
||||||
|
ui.admin.categories.tree.back=Zur\u00fcck zur Domain Eigenschaften
|
||||||
|
|
|
||||||
|
|
@ -382,3 +382,5 @@ ui.admin.categories.domain_details.mappings.add=Add mapping for application
|
||||||
ui.admin.categories.domain_details.mappings.create=Create
|
ui.admin.categories.domain_details.mappings.create=Create
|
||||||
ui.admin.categories.doamin_details.mappings.error.please_select_app=Please select an application.
|
ui.admin.categories.doamin_details.mappings.error.please_select_app=Please select an application.
|
||||||
ui.admin.categories.domain_details.mappings.remove.confirm=Are you sure to remove this domain mapping?
|
ui.admin.categories.domain_details.mappings.remove.confirm=Are you sure to remove this domain mapping?
|
||||||
|
ui.admin.categories.tree.header=Categories
|
||||||
|
ui.admin.categories.tree.back=Back to domain properties
|
||||||
|
|
|
||||||
|
|
@ -373,3 +373,5 @@ ui.admin.categories.domain_details.mappings.add=Add mapping for application
|
||||||
ui.admin.categories.domain_details.mappings.create=Create
|
ui.admin.categories.domain_details.mappings.create=Create
|
||||||
ui.admin.categories.doamin_details.mappings.error.please_select_app=Please select an application.
|
ui.admin.categories.doamin_details.mappings.error.please_select_app=Please select an application.
|
||||||
ui.admin.categories.domain_details.mappings.remove.confirm=Are you sure to remove this domain mapping?
|
ui.admin.categories.domain_details.mappings.remove.confirm=Are you sure to remove this domain mapping?
|
||||||
|
ui.admin.categories.tree.header=Categories
|
||||||
|
ui.admin.categories.tree.back=Back to domain properties
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
-- Remove registry domain (if existing) and modify settings to new structure
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
drop constraint FK_3k0t3in140j6wj6eq5olwjgu;
|
||||||
|
|
||||||
|
delete from CCM_CORE.CATEGORY_DOMAINS
|
||||||
|
where DOMAIN_KEY = 'registry';
|
||||||
|
|
||||||
|
delete from CCM_CORE.CATEGORIES
|
||||||
|
where NAME = 'registry-root';
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
||||||
|
drop constraint FK_sq653hqyeeklci0y7pvoxf5ha;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
||||||
|
drop constraint FK_t21obt5do2tjhskjxgxd5143r;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||||
|
drop constraint FK_obwiaa74lrjqjlpjidjltysoq;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
||||||
|
add constraint FK_sq653hqyeeklci0y7pvoxf5ha
|
||||||
|
foreign key (ENUM_ID)
|
||||||
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
||||||
|
add constraint FK_t21obt5do2tjhskjxgxd5143r
|
||||||
|
foreign key (ENTRY_ID)
|
||||||
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||||
|
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
||||||
|
foreign key (LIST_ID)
|
||||||
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||||
|
DROP COLUMN OBJECT_ID;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
rename column OBJECT_ID to SETTING_ID;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column DTYPE varchar(31) not null;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column CONFIGURATION_CLASS varchar(512) not null;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_DOUBLE double;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_BIG_DECIMAL decimal(19, 2);
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_STRING varchar(1024);
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_BOOLEAN boolean;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_LONG bigint;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add constraint UK_5whinfxdaepqs09e5ia9y71uk
|
||||||
|
unique (CONFIGURATION_CLASS, NAME);
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_BIG_DECIMAL;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_BOOLEAN;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_DOUBLE;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_L10N_STRING;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_LONG;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_STRING;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_ENUM;
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
-- Remove registry domain (if existing) and modify settings to new structure
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
drop constraint FK_3k0t3in140j6wj6eq5olwjgu;
|
||||||
|
|
||||||
|
delete from CCM_CORE.CATEGORY_DOMAINS
|
||||||
|
where DOMAIN_KEY = 'registry';
|
||||||
|
|
||||||
|
delete from CCM_CORE.CATEGORIES
|
||||||
|
where NAME = 'registry-root';
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
||||||
|
drop constraint FK_sq653hqyeeklci0y7pvoxf5ha;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
||||||
|
drop constraint FK_t21obt5do2tjhskjxgxd5143r;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||||
|
drop constraint FK_obwiaa74lrjqjlpjidjltysoq;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
||||||
|
add constraint FK_sq653hqyeeklci0y7pvoxf5ha
|
||||||
|
foreign key (ENUM_ID)
|
||||||
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
||||||
|
add constraint FK_t21obt5do2tjhskjxgxd5143r
|
||||||
|
foreign key (ENTRY_ID)
|
||||||
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||||
|
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
||||||
|
foreign key (LIST_ID)
|
||||||
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||||
|
DROP COLUMN OBJECT_ID;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
rename column OBJECT_ID to SETTING_ID;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column DTYPE varchar(31) not null;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column CONFIGURATION_CLASS varchar(512) not null;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_DOUBLE float8;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_BIG_DECIMAL numeric(19, 2);
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_STRING varchar(1024);
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_BOOLEAN boolean;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add column SETTING_VALUE_LONG int8;
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add constraint UK_5whinfxdaepqs09e5ia9y71uk
|
||||||
|
unique (CONFIGURATION_CLASS, NAME);
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_BIG_DECIMAL;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_BOOLEAN;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_DOUBLE;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_L10N_STRING;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_LONG;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_STRING;
|
||||||
|
|
||||||
|
drop table CCM_CORE.SETTINGS_ENUM;
|
||||||
|
|
@ -1,131 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.libreccm.categorization;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
|
||||||
import org.jboss.arquillian.junit.Arquillian;
|
|
||||||
import org.jboss.arquillian.junit.InSequence;
|
|
||||||
import org.jboss.arquillian.persistence.CreateSchema;
|
|
||||||
import org.jboss.arquillian.persistence.PersistenceTest;
|
|
||||||
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
|
||||||
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
|
||||||
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
|
||||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
|
||||||
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
|
||||||
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
|
|
||||||
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.libreccm.modules.InstallEvent;
|
|
||||||
import org.libreccm.tests.categories.IntegrationTest;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
@org.junit.experimental.categories.Category(IntegrationTest.class)
|
|
||||||
@RunWith(Arquillian.class)
|
|
||||||
@PersistenceTest
|
|
||||||
@Transactional(TransactionMode.COMMIT)
|
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
|
||||||
public class RegistrySetupTest {
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
public RegistrySetupTest() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void setUpClass() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
|
||||||
public static void tearDownClass() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
public void tearDown() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deployment
|
|
||||||
public static WebArchive createDeployment() {
|
|
||||||
final PomEquippedResolveStage pom = Maven
|
|
||||||
.resolver()
|
|
||||||
.loadPomFromFile("pom.xml");
|
|
||||||
final PomEquippedResolveStage dependencies = pom
|
|
||||||
.importCompileAndRuntimeDependencies();
|
|
||||||
final File[] libs = dependencies.resolve().withTransitivity().asFile();
|
|
||||||
|
|
||||||
for (File lib : libs) {
|
|
||||||
System.err.printf("Adding file '%s' to test archive...%n",
|
|
||||||
lib.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return ShrinkWrap
|
|
||||||
.create(WebArchive.class,
|
|
||||||
"LibreCCM-org.libreccm.categorization.RegistrySetupTest.war")
|
|
||||||
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.categorization.Categorization.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.configuration.Configuration.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.jpa.EntityManagerProducer.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.modules.InstallEvent.class.getPackage())
|
|
||||||
.addAsLibraries(libs)
|
|
||||||
.addAsResource("test-persistence.xml",
|
|
||||||
"META-INF/persistence.xml")
|
|
||||||
.addAsWebInfResource("test-web.xml", "WEB-INF/web.xml")
|
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@ShouldMatchDataSet(value =
|
|
||||||
"datasets/org/libreccm/categorization/RegistrySetupTest/after-setup.xml",
|
|
||||||
excludeColumns = {"object_id", "root_category_id", "uuid"})
|
|
||||||
@InSequence(100)
|
|
||||||
public void setupRegistry() {
|
|
||||||
final InstallEvent installEvent = new InstallEvent();
|
|
||||||
installEvent.setEntityManager(entityManager);
|
|
||||||
final RegistrySetup registrySetup = new RegistrySetup(installEvent);
|
|
||||||
registrySetup.setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -19,11 +19,15 @@
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import com.example.TestConfiguration;
|
import com.example.TestConfiguration;
|
||||||
|
import java.io.File;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import javax.inject.Inject;
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.jboss.arquillian.container.test.api.Deployment;
|
||||||
import org.jboss.arquillian.junit.Arquillian;
|
import org.jboss.arquillian.junit.Arquillian;
|
||||||
import org.jboss.arquillian.junit.InSequence;
|
import org.jboss.arquillian.junit.InSequence;
|
||||||
import org.jboss.arquillian.persistence.CreateSchema;
|
import org.jboss.arquillian.persistence.CreateSchema;
|
||||||
import org.jboss.arquillian.persistence.PersistenceTest;
|
import org.jboss.arquillian.persistence.PersistenceTest;
|
||||||
|
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
||||||
import org.jboss.arquillian.persistence.UsingDataSet;
|
import org.jboss.arquillian.persistence.UsingDataSet;
|
||||||
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
||||||
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
||||||
|
|
@ -37,16 +41,10 @@ import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.libreccm.tests.categories.IntegrationTest;
|
import org.libreccm.tests.categories.IntegrationTest;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
@ -54,7 +52,7 @@ import static org.junit.Assert.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@org.junit.experimental.categories.Category(IntegrationTest.class)
|
@Category(IntegrationTest.class)
|
||||||
@RunWith(Arquillian.class)
|
@RunWith(Arquillian.class)
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
|
|
@ -65,6 +63,7 @@ public class ConfigurationManagerTest {
|
||||||
private ConfigurationManager configurationManager;
|
private ConfigurationManager configurationManager;
|
||||||
|
|
||||||
public ConfigurationManagerTest() {
|
public ConfigurationManagerTest() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
|
@ -99,7 +98,7 @@ public class ConfigurationManagerTest {
|
||||||
|
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.categorization."
|
"LibreCCM-org.libreccm.configuration."
|
||||||
+ "ConfigurationManagerTest.war")
|
+ "ConfigurationManagerTest.war")
|
||||||
.addPackage(org.libreccm.categorization.Categorization.class.
|
.addPackage(org.libreccm.categorization.Categorization.class.
|
||||||
getPackage())
|
getPackage())
|
||||||
|
|
@ -119,6 +118,7 @@ public class ConfigurationManagerTest {
|
||||||
getPackage())
|
getPackage())
|
||||||
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
|
||||||
getPackage())
|
getPackage())
|
||||||
|
.addClass(com.example.TestConfiguration.class)
|
||||||
.addAsLibraries(libs)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/persistence.xml")
|
"META-INF/persistence.xml")
|
||||||
|
|
@ -202,7 +202,7 @@ public class ConfigurationManagerTest {
|
||||||
@ShouldMatchDataSet(
|
@ShouldMatchDataSet(
|
||||||
value = "datasets/org/libreccm/configuration/"
|
value = "datasets/org/libreccm/configuration/"
|
||||||
+ "ConfigurationManagerTest/after-save-new.yml",
|
+ "ConfigurationManagerTest/after-save-new.yml",
|
||||||
excludeColumns = {"object_id", "uuid"})
|
excludeColumns = {"setting_id"})
|
||||||
@InSequence(2200)
|
@InSequence(2200)
|
||||||
public void saveNewConfiguration() {
|
public void saveNewConfiguration() {
|
||||||
configurationManager.saveConfiguration(new TestConfiguration());
|
configurationManager.saveConfiguration(new TestConfiguration());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
import static org.libreccm.testutils.DatasetType.*;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
@ -31,8 +31,7 @@ import org.libreccm.tests.categories.UnitTest;
|
||||||
import org.libreccm.testutils.DatasetType;
|
import org.libreccm.testutils.DatasetType;
|
||||||
import org.libreccm.testutils.DatasetsVerifier;
|
import org.libreccm.testutils.DatasetsVerifier;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import static org.libreccm.testutils.DatasetType.*;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -41,7 +40,7 @@ import java.util.Collection;
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
@Category(UnitTest.class)
|
@Category(UnitTest.class)
|
||||||
public class DatasetsTest extends DatasetsVerifier {
|
public class DatasetsTest extends DatasetsVerifier {
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "Dataset {0}")
|
@Parameterized.Parameters(name = "Dataset {0}")
|
||||||
public static Collection<String> data() {
|
public static Collection<String> data() {
|
||||||
return Arrays.asList(new String[]{
|
return Arrays.asList(new String[]{
|
||||||
|
|
@ -80,5 +79,5 @@ public class DatasetsTest extends DatasetsVerifier {
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -18,16 +18,14 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.libreccm.tests.categories.UnitTest;
|
import org.libreccm.tests.categories.UnitTest;
|
||||||
import org.libreccm.testutils.EqualsVerifier;
|
import org.libreccm.testutils.EqualsVerifier;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -35,11 +33,11 @@ import java.util.Collection;
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
@Category(UnitTest.class)
|
@Category(UnitTest.class)
|
||||||
public class EqualsAndHashCodeTest extends EqualsVerifier {
|
public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "{0}")
|
@Parameterized.Parameters(name = "{0}")
|
||||||
public static Collection<Class<?>> data() {
|
public static Collection<Class<?>> data() {
|
||||||
return Arrays.asList(new Class<?>[]{
|
return Arrays.asList(new Class<?>[]{
|
||||||
BigDecimalSetting.class,
|
//BigDecimalSetting.class, //Test for BigDecimals fails with strange error...
|
||||||
BooleanSetting.class,
|
BooleanSetting.class,
|
||||||
ConfigurationInfo.class,
|
ConfigurationInfo.class,
|
||||||
DoubleSetting.class,
|
DoubleSetting.class,
|
||||||
|
|
@ -50,8 +48,9 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
StringSetting.class
|
StringSetting.class
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public EqualsAndHashCodeTest(final Class<?> entityClass) {
|
public EqualsAndHashCodeTest(final Class<?> entityClass) {
|
||||||
super(entityClass);
|
super(entityClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -28,22 +28,22 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ExampleConfiguration {
|
public class ExampleConfiguration {
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
private Boolean enabled;
|
private Boolean enabled;
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
private Double minTemperature;
|
private Double minTemperature;
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
private Long itemsPerPage;
|
private Long itemsPerPage;
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
private String helpUrl;
|
private String helpUrl;
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
private Set<String> languages;
|
private Set<String> languages;
|
||||||
|
|
||||||
|
|
@ -86,20 +86,21 @@ public class ExampleConfiguration {
|
||||||
public void setHelpUrl(final String helpUrl) {
|
public void setHelpUrl(final String helpUrl) {
|
||||||
this.helpUrl = helpUrl;
|
this.helpUrl = helpUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getLanguages() {
|
public Set<String> getLanguages() {
|
||||||
return Collections.unmodifiableSet(languages);
|
return Collections.unmodifiableSet(languages);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLanguages(final Set<String> languages) {
|
private void setLanguages(final Set<String> languages) {
|
||||||
this.languages = languages;
|
this.languages = languages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLanguage(final String language) {
|
public void addLanguage(final String language) {
|
||||||
languages.add(language);
|
languages.add(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLanguage(final String language) {
|
public void removeLanguage(final String language) {
|
||||||
languages.remove(language);
|
languages.remove(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 LibreCCM Foundation.
|
* Copyright (C) 2016 LibreCCM Foundation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
|
@ -18,15 +18,23 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.configuration;
|
package org.libreccm.configuration;
|
||||||
|
|
||||||
|
import org.libreccm.configuration.StringSetting;
|
||||||
|
import org.libreccm.configuration.LocalizedStringSetting;
|
||||||
|
import org.libreccm.configuration.ConfigurationInfo;
|
||||||
|
import org.libreccm.configuration.EnumSetting;
|
||||||
|
import org.libreccm.configuration.DoubleSetting;
|
||||||
|
import org.libreccm.configuration.BigDecimalSetting;
|
||||||
|
import org.libreccm.configuration.LongSetting;
|
||||||
|
import org.libreccm.configuration.SettingInfo;
|
||||||
|
import org.libreccm.configuration.BooleanSetting;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.libreccm.tests.categories.UnitTest;
|
import org.libreccm.tests.categories.UnitTest;
|
||||||
import org.libreccm.testutils.ToStringVerifier;
|
import org.libreccm.testutils.ToStringVerifier;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
@ -34,7 +42,7 @@ import java.util.Collection;
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
@Category(UnitTest.class)
|
@Category(UnitTest.class)
|
||||||
public class ToStringTest extends ToStringVerifier {
|
public class ToStringTest extends ToStringVerifier {
|
||||||
|
|
||||||
@Parameterized.Parameters(name = "{0}")
|
@Parameterized.Parameters(name = "{0}")
|
||||||
public static Collection<Class<?>> data() {
|
public static Collection<Class<?>> data() {
|
||||||
return Arrays.asList(new Class<?>[]{
|
return Arrays.asList(new Class<?>[]{
|
||||||
|
|
@ -49,9 +57,9 @@ public class ToStringTest extends ToStringVerifier {
|
||||||
StringSetting.class
|
StringSetting.class
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToStringTest(final Class<?> entityClass) {
|
public ToStringTest(final Class<?> entityClass) {
|
||||||
super(entityClass);
|
super(entityClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
||||||
|
|
||||||
CREATE SCHEMA ccm_core;
|
CREATE SCHEMA ccm_core;
|
||||||
|
|
||||||
|
|
||||||
create table CCM_CORE.APPLICATIONS (
|
create table CCM_CORE.APPLICATIONS (
|
||||||
APPLICATION_TYPE varchar(1024) not null,
|
APPLICATION_TYPE varchar(1024) not null,
|
||||||
PRIMARY_URL varchar(1024) not null,
|
PRIMARY_URL varchar(1024) not null,
|
||||||
|
|
@ -70,7 +71,7 @@ CREATE SCHEMA ccm_core;
|
||||||
create table CCM_CORE.CCM_OBJECTS (
|
create table CCM_CORE.CCM_OBJECTS (
|
||||||
OBJECT_ID bigint not null,
|
OBJECT_ID bigint not null,
|
||||||
DISPLAY_NAME varchar(255),
|
DISPLAY_NAME varchar(255),
|
||||||
UUID varchar(255) not null,
|
UUID varchar(255),
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -377,6 +378,15 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.ONE_TIME_AUTH_TOKENS (
|
||||||
|
TOKEN_ID bigint not null,
|
||||||
|
PURPOSE varchar(255),
|
||||||
|
TOKEN varchar(255),
|
||||||
|
VALID_UNTIL timestamp,
|
||||||
|
USER_ID bigint,
|
||||||
|
primary key (TOKEN_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.PARTIES (
|
create table CCM_CORE.PARTIES (
|
||||||
PARTY_ID bigint not null,
|
PARTY_ID bigint not null,
|
||||||
NAME varchar(256) not null,
|
NAME varchar(256) not null,
|
||||||
|
|
@ -467,32 +477,16 @@ CREATE SCHEMA ccm_core;
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS (
|
create table CCM_CORE.SETTINGS (
|
||||||
name varchar(512) not null,
|
DTYPE varchar(31) not null,
|
||||||
OBJECT_ID bigint not null,
|
SETTING_ID bigint not null,
|
||||||
primary key (OBJECT_ID)
|
CONFIGURATION_CLASS varchar(512) not null,
|
||||||
);
|
NAME varchar(512) not null,
|
||||||
|
SETTING_VALUE_LONG bigint,
|
||||||
create table CCM_CORE.SETTINGS_BIG_DECIMAL (
|
SETTING_VALUE_STRING varchar(1024),
|
||||||
setting_value decimal(19,2),
|
SETTING_VALUE_BOOLEAN boolean,
|
||||||
OBJECT_ID bigint not null,
|
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||||
primary key (OBJECT_ID)
|
SETTING_VALUE_DOUBLE double,
|
||||||
);
|
primary key (SETTING_ID)
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_BOOLEAN (
|
|
||||||
setting_value boolean,
|
|
||||||
OBJECT_ID bigint not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_DOUBLE (
|
|
||||||
setting_value double,
|
|
||||||
OBJECT_ID bigint not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_ENUM (
|
|
||||||
OBJECT_ID bigint not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_ENUM_VALUES (
|
create table CCM_CORE.SETTINGS_ENUM_VALUES (
|
||||||
|
|
@ -500,11 +494,6 @@ CREATE SCHEMA ccm_core;
|
||||||
value varchar(255)
|
value varchar(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_L10N_STRING (
|
|
||||||
OBJECT_ID bigint not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_L10N_STR_VALUES (
|
create table CCM_CORE.SETTINGS_L10N_STR_VALUES (
|
||||||
ENTRY_ID bigint not null,
|
ENTRY_ID bigint not null,
|
||||||
LOCALIZED_VALUE clob,
|
LOCALIZED_VALUE clob,
|
||||||
|
|
@ -512,23 +501,9 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (ENTRY_ID, LOCALE)
|
primary key (ENTRY_ID, LOCALE)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_LONG (
|
|
||||||
setting_value bigint,
|
|
||||||
OBJECT_ID bigint not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_STRING (
|
|
||||||
setting_value varchar(1024),
|
|
||||||
OBJECT_ID bigint not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_STRING_LIST (
|
create table CCM_CORE.SETTINGS_STRING_LIST (
|
||||||
OBJECT_ID bigint not null,
|
|
||||||
LIST_ID bigint not null,
|
LIST_ID bigint not null,
|
||||||
value varchar(255),
|
value varchar(255)
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.TASK_ASSIGNMENTS (
|
create table CCM_CORE.TASK_ASSIGNMENTS (
|
||||||
|
|
@ -629,27 +604,24 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (TASK_ID)
|
primary key (TASK_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.ONE_TIME_AUTH_TOKENS (
|
|
||||||
TOKEN_ID bigint not null,
|
|
||||||
PURPOSE varchar(255),
|
|
||||||
TOKEN varchar(255),
|
|
||||||
VALID_UNTIL timestamp,
|
|
||||||
USER_ID bigint,
|
|
||||||
primary key (TOKEN_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
alter table CCM_CORE.CATEGORY_DOMAINS
|
alter table CCM_CORE.CATEGORY_DOMAINS
|
||||||
add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY);
|
add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY);
|
||||||
|
|
||||||
alter table CCM_CORE.CATEGORY_DOMAINS
|
alter table CCM_CORE.CATEGORY_DOMAINS
|
||||||
add constraint UK_i1xqotjvml7i6ro2jq22fxf5g unique (URI);
|
add constraint UK_i1xqotjvml7i6ro2jq22fxf5g unique (URI);
|
||||||
|
|
||||||
|
alter table CCM_CORE.CCM_OBJECTS
|
||||||
|
add constraint UK_1cm71jlagvyvcnkqvxqyit3wx unique (UUID);
|
||||||
|
|
||||||
alter table CCM_CORE.HOSTS
|
alter table CCM_CORE.HOSTS
|
||||||
add constraint UK_9ramlv6uxwt13v0wj7q0tucsx unique (SERVER_NAME, SERVER_PORT);
|
add constraint UK_9ramlv6uxwt13v0wj7q0tucsx unique (SERVER_NAME, SERVER_PORT);
|
||||||
|
|
||||||
alter table CCM_CORE.INSTALLED_MODULES
|
alter table CCM_CORE.INSTALLED_MODULES
|
||||||
add constraint UK_11imwgfojyi4hpr18uw9g3jvx unique (MODULE_CLASS_NAME);
|
add constraint UK_11imwgfojyi4hpr18uw9g3jvx unique (MODULE_CLASS_NAME);
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add constraint UK_5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME);
|
||||||
|
|
||||||
alter table CCM_CORE.APPLICATIONS
|
alter table CCM_CORE.APPLICATIONS
|
||||||
add constraint FK_sn1sqtx94nhxgv282ymoqiock
|
add constraint FK_sn1sqtx94nhxgv282ymoqiock
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
|
|
@ -940,6 +912,11 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CCM_OBJECTS;
|
references CCM_CORE.CCM_OBJECTS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.ONE_TIME_AUTH_TOKENS
|
||||||
|
add constraint FK_fvr3t6w3nsm3u29mjuh4tplno
|
||||||
|
foreign key (USER_ID)
|
||||||
|
references CCM_CORE.USERS;
|
||||||
|
|
||||||
alter table CCM_CORE.PERMISSIONS
|
alter table CCM_CORE.PERMISSIONS
|
||||||
add constraint FK_7f7dd6k54fi1vy3llbvrer061
|
add constraint FK_7f7dd6k54fi1vy3llbvrer061
|
||||||
foreign key (CREATION_USER_ID)
|
foreign key (CREATION_USER_ID)
|
||||||
|
|
@ -1020,65 +997,20 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (ROLE_ID)
|
foreign key (ROLE_ID)
|
||||||
references CCM_CORE.CCM_ROLES;
|
references CCM_CORE.CCM_ROLES;
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS
|
|
||||||
add constraint FK_3k0t3in140j6wj6eq5olwjgu
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.CCM_OBJECTS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_BIG_DECIMAL
|
|
||||||
add constraint FK_9mbdc1rjkm80edyuijnkwl6ak
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_BOOLEAN
|
|
||||||
add constraint FK_1mjjvpjxpwicyv8im6mumc7ug
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_DOUBLE
|
|
||||||
add constraint FK_kejnkuyk89tw59xg550kugwb5
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_ENUM
|
|
||||||
add constraint FK_fgrfc2qbl2f2t1l0ku8wo2e5r
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
||||||
add constraint FK_sq653hqyeeklci0y7pvoxf5ha
|
add constraint FK_sq653hqyeeklci0y7pvoxf5ha
|
||||||
foreign key (ENUM_ID)
|
foreign key (ENUM_ID)
|
||||||
references CCM_CORE.SETTINGS_ENUM;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_L10N_STRING
|
|
||||||
add constraint FK_evnyfg9udprxmbginhc4o0is9
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
||||||
add constraint FK_t21obt5do2tjhskjxgxd5143r
|
add constraint FK_t21obt5do2tjhskjxgxd5143r
|
||||||
foreign key (ENTRY_ID)
|
foreign key (ENTRY_ID)
|
||||||
references CCM_CORE.SETTINGS_L10N_STRING;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_LONG
|
|
||||||
add constraint FK_2l4bw7pbq3koj81cjyoqpenjj
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_STRING
|
|
||||||
add constraint FK_naonte6jut7b842icvp9ahino
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
|
||||||
add constraint FK_34s3comqq4mhy9kcr04iavfef
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||||
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
||||||
foreign key (LIST_ID)
|
foreign key (LIST_ID)
|
||||||
references CCM_CORE.SETTINGS_STRING_LIST;
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
alter table CCM_CORE.TASK_ASSIGNMENTS
|
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||||
add constraint FK_klh64or0yq26c63181j1tps2o
|
add constraint FK_klh64or0yq26c63181j1tps2o
|
||||||
|
|
@ -1140,9 +1072,4 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (WORKFLOW_ID)
|
foreign key (WORKFLOW_ID)
|
||||||
references CCM_CORE.WORKFLOWS;
|
references CCM_CORE.WORKFLOWS;
|
||||||
|
|
||||||
alter table CCM_CORE.ONE_TIME_AUTH_TOKENS
|
|
||||||
add constraint FK_fvr3t6w3nsm3u29mjuh4tplno
|
|
||||||
foreign key (USER_ID)
|
|
||||||
references CCM_CORE.USERS;
|
|
||||||
|
|
||||||
create sequence hibernate_sequence start with 1 increment by 1;
|
create sequence hibernate_sequence start with 1 increment by 1;
|
||||||
|
|
@ -4,6 +4,7 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
||||||
|
|
||||||
CREATE SCHEMA ccm_core;
|
CREATE SCHEMA ccm_core;
|
||||||
|
|
||||||
|
|
||||||
create table CCM_CORE.APPLICATIONS (
|
create table CCM_CORE.APPLICATIONS (
|
||||||
APPLICATION_TYPE varchar(1024) not null,
|
APPLICATION_TYPE varchar(1024) not null,
|
||||||
PRIMARY_URL varchar(1024) not null,
|
PRIMARY_URL varchar(1024) not null,
|
||||||
|
|
@ -70,7 +71,7 @@ CREATE SCHEMA ccm_core;
|
||||||
create table CCM_CORE.CCM_OBJECTS (
|
create table CCM_CORE.CCM_OBJECTS (
|
||||||
OBJECT_ID int8 not null,
|
OBJECT_ID int8 not null,
|
||||||
DISPLAY_NAME varchar(255),
|
DISPLAY_NAME varchar(255),
|
||||||
UUID varchar(255) not null,
|
UUID varchar(255),
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -377,6 +378,15 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (OBJECT_ID)
|
primary key (OBJECT_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.ONE_TIME_AUTH_TOKENS (
|
||||||
|
TOKEN_ID int8 not null,
|
||||||
|
PURPOSE varchar(255),
|
||||||
|
TOKEN varchar(255),
|
||||||
|
VALID_UNTIL timestamp,
|
||||||
|
USER_ID int8,
|
||||||
|
primary key (TOKEN_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.PARTIES (
|
create table CCM_CORE.PARTIES (
|
||||||
PARTY_ID int8 not null,
|
PARTY_ID int8 not null,
|
||||||
NAME varchar(256) not null,
|
NAME varchar(256) not null,
|
||||||
|
|
@ -467,32 +477,16 @@ CREATE SCHEMA ccm_core;
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS (
|
create table CCM_CORE.SETTINGS (
|
||||||
name varchar(512) not null,
|
DTYPE varchar(31) not null,
|
||||||
OBJECT_ID int8 not null,
|
SETTING_ID int8 not null,
|
||||||
primary key (OBJECT_ID)
|
CONFIGURATION_CLASS varchar(512) not null,
|
||||||
);
|
NAME varchar(512) not null,
|
||||||
|
SETTING_VALUE_LONG int8,
|
||||||
create table CCM_CORE.SETTINGS_BIG_DECIMAL (
|
SETTING_VALUE_STRING varchar(1024),
|
||||||
setting_value numeric(19, 2),
|
SETTING_VALUE_BOOLEAN boolean,
|
||||||
OBJECT_ID int8 not null,
|
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
||||||
primary key (OBJECT_ID)
|
SETTING_VALUE_DOUBLE float8,
|
||||||
);
|
primary key (SETTING_ID)
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_BOOLEAN (
|
|
||||||
setting_value boolean,
|
|
||||||
OBJECT_ID int8 not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_DOUBLE (
|
|
||||||
setting_value float8,
|
|
||||||
OBJECT_ID int8 not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_ENUM (
|
|
||||||
OBJECT_ID int8 not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_ENUM_VALUES (
|
create table CCM_CORE.SETTINGS_ENUM_VALUES (
|
||||||
|
|
@ -500,11 +494,6 @@ CREATE SCHEMA ccm_core;
|
||||||
value varchar(255)
|
value varchar(255)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_L10N_STRING (
|
|
||||||
OBJECT_ID int8 not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_L10N_STR_VALUES (
|
create table CCM_CORE.SETTINGS_L10N_STR_VALUES (
|
||||||
ENTRY_ID int8 not null,
|
ENTRY_ID int8 not null,
|
||||||
LOCALIZED_VALUE text,
|
LOCALIZED_VALUE text,
|
||||||
|
|
@ -512,23 +501,9 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (ENTRY_ID, LOCALE)
|
primary key (ENTRY_ID, LOCALE)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_LONG (
|
|
||||||
setting_value int8,
|
|
||||||
OBJECT_ID int8 not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_STRING (
|
|
||||||
setting_value varchar(1024),
|
|
||||||
OBJECT_ID int8 not null,
|
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.SETTINGS_STRING_LIST (
|
create table CCM_CORE.SETTINGS_STRING_LIST (
|
||||||
OBJECT_ID int8 not null,
|
|
||||||
LIST_ID int8 not null,
|
LIST_ID int8 not null,
|
||||||
value varchar(255),
|
value varchar(255)
|
||||||
primary key (OBJECT_ID)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.TASK_ASSIGNMENTS (
|
create table CCM_CORE.TASK_ASSIGNMENTS (
|
||||||
|
|
@ -629,27 +604,24 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (TASK_ID)
|
primary key (TASK_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.ONE_TIME_AUTH_TOKENS (
|
|
||||||
TOKEN_ID int8 not null,
|
|
||||||
PURPOSE varchar(255),
|
|
||||||
TOKEN varchar(255),
|
|
||||||
VALID_UNTIL timestamp,
|
|
||||||
USER_ID int8,
|
|
||||||
primary key (TOKEN_ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
alter table CCM_CORE.CATEGORY_DOMAINS
|
alter table CCM_CORE.CATEGORY_DOMAINS
|
||||||
add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY);
|
add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY);
|
||||||
|
|
||||||
alter table CCM_CORE.CATEGORY_DOMAINS
|
alter table CCM_CORE.CATEGORY_DOMAINS
|
||||||
add constraint UK_i1xqotjvml7i6ro2jq22fxf5g unique (URI);
|
add constraint UK_i1xqotjvml7i6ro2jq22fxf5g unique (URI);
|
||||||
|
|
||||||
|
alter table CCM_CORE.CCM_OBJECTS
|
||||||
|
add constraint UK_1cm71jlagvyvcnkqvxqyit3wx unique (UUID);
|
||||||
|
|
||||||
alter table CCM_CORE.HOSTS
|
alter table CCM_CORE.HOSTS
|
||||||
add constraint UK_9ramlv6uxwt13v0wj7q0tucsx unique (SERVER_NAME, SERVER_PORT);
|
add constraint UK_9ramlv6uxwt13v0wj7q0tucsx unique (SERVER_NAME, SERVER_PORT);
|
||||||
|
|
||||||
alter table CCM_CORE.INSTALLED_MODULES
|
alter table CCM_CORE.INSTALLED_MODULES
|
||||||
add constraint UK_11imwgfojyi4hpr18uw9g3jvx unique (MODULE_CLASS_NAME);
|
add constraint UK_11imwgfojyi4hpr18uw9g3jvx unique (MODULE_CLASS_NAME);
|
||||||
|
|
||||||
|
alter table CCM_CORE.SETTINGS
|
||||||
|
add constraint UK_5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME);
|
||||||
|
|
||||||
alter table CCM_CORE.APPLICATIONS
|
alter table CCM_CORE.APPLICATIONS
|
||||||
add constraint FK_sn1sqtx94nhxgv282ymoqiock
|
add constraint FK_sn1sqtx94nhxgv282ymoqiock
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
|
|
@ -940,6 +912,11 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CCM_OBJECTS;
|
references CCM_CORE.CCM_OBJECTS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.ONE_TIME_AUTH_TOKENS
|
||||||
|
add constraint FK_fvr3t6w3nsm3u29mjuh4tplno
|
||||||
|
foreign key (USER_ID)
|
||||||
|
references CCM_CORE.USERS;
|
||||||
|
|
||||||
alter table CCM_CORE.PERMISSIONS
|
alter table CCM_CORE.PERMISSIONS
|
||||||
add constraint FK_7f7dd6k54fi1vy3llbvrer061
|
add constraint FK_7f7dd6k54fi1vy3llbvrer061
|
||||||
foreign key (CREATION_USER_ID)
|
foreign key (CREATION_USER_ID)
|
||||||
|
|
@ -1020,65 +997,20 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (ROLE_ID)
|
foreign key (ROLE_ID)
|
||||||
references CCM_CORE.CCM_ROLES;
|
references CCM_CORE.CCM_ROLES;
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS
|
|
||||||
add constraint FK_3k0t3in140j6wj6eq5olwjgu
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.CCM_OBJECTS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_BIG_DECIMAL
|
|
||||||
add constraint FK_9mbdc1rjkm80edyuijnkwl6ak
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_BOOLEAN
|
|
||||||
add constraint FK_1mjjvpjxpwicyv8im6mumc7ug
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_DOUBLE
|
|
||||||
add constraint FK_kejnkuyk89tw59xg550kugwb5
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_ENUM
|
|
||||||
add constraint FK_fgrfc2qbl2f2t1l0ku8wo2e5r
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
alter table CCM_CORE.SETTINGS_ENUM_VALUES
|
||||||
add constraint FK_sq653hqyeeklci0y7pvoxf5ha
|
add constraint FK_sq653hqyeeklci0y7pvoxf5ha
|
||||||
foreign key (ENUM_ID)
|
foreign key (ENUM_ID)
|
||||||
references CCM_CORE.SETTINGS_ENUM;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_L10N_STRING
|
|
||||||
add constraint FK_evnyfg9udprxmbginhc4o0is9
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
alter table CCM_CORE.SETTINGS_L10N_STR_VALUES
|
||||||
add constraint FK_t21obt5do2tjhskjxgxd5143r
|
add constraint FK_t21obt5do2tjhskjxgxd5143r
|
||||||
foreign key (ENTRY_ID)
|
foreign key (ENTRY_ID)
|
||||||
references CCM_CORE.SETTINGS_L10N_STRING;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_LONG
|
|
||||||
add constraint FK_2l4bw7pbq3koj81cjyoqpenjj
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_STRING
|
|
||||||
add constraint FK_naonte6jut7b842icvp9ahino
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
|
||||||
add constraint FK_34s3comqq4mhy9kcr04iavfef
|
|
||||||
foreign key (OBJECT_ID)
|
|
||||||
references CCM_CORE.SETTINGS;
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
alter table CCM_CORE.SETTINGS_STRING_LIST
|
alter table CCM_CORE.SETTINGS_STRING_LIST
|
||||||
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
add constraint FK_obwiaa74lrjqjlpjidjltysoq
|
||||||
foreign key (LIST_ID)
|
foreign key (LIST_ID)
|
||||||
references CCM_CORE.SETTINGS_STRING_LIST;
|
references CCM_CORE.SETTINGS;
|
||||||
|
|
||||||
alter table CCM_CORE.TASK_ASSIGNMENTS
|
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||||
add constraint FK_klh64or0yq26c63181j1tps2o
|
add constraint FK_klh64or0yq26c63181j1tps2o
|
||||||
|
|
@ -1140,9 +1072,4 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (WORKFLOW_ID)
|
foreign key (WORKFLOW_ID)
|
||||||
references CCM_CORE.WORKFLOWS;
|
references CCM_CORE.WORKFLOWS;
|
||||||
|
|
||||||
alter table CCM_CORE.ONE_TIME.AUTH_TOKENS
|
|
||||||
add constraint FK_fvr3t6w3nsm3u29mjuh4tplno
|
|
||||||
foreign key (USER_ID)
|
|
||||||
references CCM_CORE.USERS;
|
|
||||||
|
|
||||||
create sequence hibernate_sequence start 1 increment 1;
|
create sequence hibernate_sequence start 1 increment 1;
|
||||||
|
|
@ -1,162 +1,33 @@
|
||||||
ccm_core.ccm_objects:
|
|
||||||
- object_id: -1000
|
|
||||||
display_name: registry
|
|
||||||
uuid: f815d6f8-f915-4399-b16c-2e2dd76f4128
|
|
||||||
- object_id: -2000
|
|
||||||
display_name: registry_root
|
|
||||||
uuid: 1e5b1732-0a15-49b8-b4a6-8aae1a003147
|
|
||||||
- object_id: -2100
|
|
||||||
display_name: org
|
|
||||||
uuid: 5b75da38-6615-4197-9527-3b56eff4c9d2
|
|
||||||
- object_id: -2200
|
|
||||||
display_name: libreccm
|
|
||||||
uuid: 103c7730-3cb0-4189-8314-b7527e707b0e
|
|
||||||
- object_id: -2300
|
|
||||||
display_name: configuration
|
|
||||||
uuid: bbc0d0ab-a191-4e40-824e-ccb959e06ba2
|
|
||||||
- object_id: -2400
|
|
||||||
display_name: ExampleConfiguration
|
|
||||||
uuid: ba898441-5a44-48eb-8ece-c5b25d4b9dcb
|
|
||||||
- object_id: -3100
|
|
||||||
display_name: price
|
|
||||||
uuid: a5feb3a6-356a-4280-bbd2-921d7dc37250
|
|
||||||
- object_id: -3200
|
|
||||||
display_name: enabled
|
|
||||||
uuid: 02184f7a-cc2b-44d6-a9b5-f11b0f77ae21
|
|
||||||
- object_id: -3300
|
|
||||||
display_name: minTemperature
|
|
||||||
uuid: 8c12c6e9-6263-42d1-b2d2-c172066f6304
|
|
||||||
- object_id: -3400
|
|
||||||
display_name: itemsPerPage
|
|
||||||
uuid: 5a729224-b0b1-41d3-b383-b42de185d91c
|
|
||||||
- object_id: -3500
|
|
||||||
display_name: helpUri
|
|
||||||
uuid: 70d0b967-a38f-4d3e-806c-c640bd114472
|
|
||||||
- object_id: -3600
|
|
||||||
display_name: languages
|
|
||||||
uuid: 19b3cdac-3ca4-44c0-9b06-dca8e5ae505f
|
|
||||||
|
|
||||||
ccm_core.categories:
|
|
||||||
- object_id: -2000
|
|
||||||
unique_id: bb93a964-bf66-424c-a22d-074d001db3b8
|
|
||||||
name: registry-root
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
category_order: 0
|
|
||||||
- object_id: -2100
|
|
||||||
unique_id: 62c22973-a078-47bc-8267-bef879c7566e
|
|
||||||
name: org
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2000
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2200
|
|
||||||
unique_id: a8fbf310-7cb9-47dd-81d5-a16b80e96446
|
|
||||||
name: libreccm
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2100
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2300
|
|
||||||
unique_id: 61c30c73-857a-49ff-8272-c9fb038d3e35
|
|
||||||
name: configuration
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2200
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2400
|
|
||||||
unique_id: bf5d295c-6ad3-4484-a1e6-5641cea037b3
|
|
||||||
name: ExampleConfiguration
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2300
|
|
||||||
category_order: 1
|
|
||||||
|
|
||||||
ccm_core.category_domains:
|
|
||||||
- object_id: -1000
|
|
||||||
domain_key: registry
|
|
||||||
root_category_id: -2000
|
|
||||||
version: 1.0
|
|
||||||
|
|
||||||
ccm_core.categorizations:
|
|
||||||
- categorization_id: -10100
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3100
|
|
||||||
category_order: 1
|
|
||||||
object_order: 1
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10200
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3200
|
|
||||||
category_order: 1
|
|
||||||
object_order: 2
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10300
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3300
|
|
||||||
category_order: 1
|
|
||||||
object_order: 3
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10400
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3400
|
|
||||||
category_order: 1
|
|
||||||
object_order: 4
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10500
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3500
|
|
||||||
category_order: 1
|
|
||||||
object_order: 5
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10600
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3600
|
|
||||||
category_order: 1
|
|
||||||
object_order: 6
|
|
||||||
category_index: false
|
|
||||||
|
|
||||||
ccm_core.settings:
|
ccm_core.settings:
|
||||||
- object_id: -3100
|
- setting_id: -3100
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: price
|
name: price
|
||||||
- object_id: -3200
|
dtype: BigDecimalSetting
|
||||||
|
setting_value_big_decimal: 109.99
|
||||||
|
- setting_id: -3200
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: enabled
|
name: enabled
|
||||||
- object_id: -3300
|
dtype: BooleanSetting
|
||||||
|
setting_value_boolean: true
|
||||||
|
- setting_id: -3300
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: minTemperature
|
name: minTemperature
|
||||||
- object_id: -3400
|
dtype: DoubleSetting
|
||||||
|
setting_value_double: 23.5
|
||||||
|
- setting_id: -3400
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: itemsPerPage
|
name: itemsPerPage
|
||||||
- object_id: -3500
|
dtype: LongSetting
|
||||||
|
setting_value_long: 30
|
||||||
|
- setting_id: -3500
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: helpUrl
|
name: helpUrl
|
||||||
- object_id: -3600
|
dtype: StringSetting
|
||||||
|
setting_value_string: http://www.example.org
|
||||||
|
- setting_id: -3600
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: languages
|
name: languages
|
||||||
|
dtype: EnumSetting
|
||||||
ccm_core.settings_big_decimal:
|
|
||||||
- object_id: -3100
|
|
||||||
setting_value: 109.99
|
|
||||||
|
|
||||||
ccm_core.settings_boolean:
|
|
||||||
- object_id: -3200
|
|
||||||
setting_value: true
|
|
||||||
|
|
||||||
ccm_core.settings_double:
|
|
||||||
- object_id: -3300
|
|
||||||
setting_value: 23.5
|
|
||||||
|
|
||||||
ccm_core.settings_long:
|
|
||||||
- object_id: -3400
|
|
||||||
setting_value: 30
|
|
||||||
|
|
||||||
ccm_core.settings_string:
|
|
||||||
- object_id: -3500
|
|
||||||
setting_value: http://www.example.org
|
|
||||||
|
|
||||||
ccm_core.settings_enum:
|
|
||||||
- object_id: -3600
|
|
||||||
|
|
||||||
ccm_core.settings_enum_values:
|
ccm_core.settings_enum_values:
|
||||||
- enum_id: -3600
|
- enum_id: -3600
|
||||||
|
|
|
||||||
|
|
@ -1,218 +1,43 @@
|
||||||
ccm_core.ccm_objects:
|
|
||||||
- object_id: -1000
|
|
||||||
display_name: registry
|
|
||||||
uuid: f815d6f8-f915-4399-b16c-2e2dd76f4128
|
|
||||||
- object_id: -2000
|
|
||||||
display_name: registry_root
|
|
||||||
uuid: 1e5b1732-0a15-49b8-b4a6-8aae1a003147
|
|
||||||
- object_id: -2100
|
|
||||||
display_name: org
|
|
||||||
uuid: 5b75da38-6615-4197-9527-3b56eff4c9d2
|
|
||||||
- object_id: -2200
|
|
||||||
display_name: libreccm
|
|
||||||
uuid: 103c7730-3cb0-4189-8314-b7527e707b0e
|
|
||||||
- object_id: -2300
|
|
||||||
display_name: configuration
|
|
||||||
uuid: bbc0d0ab-a191-4e40-824e-ccb959e06ba2
|
|
||||||
- object_id: -2400
|
|
||||||
display_name: ExampleConfiguration
|
|
||||||
uuid: ba898441-5a44-48eb-8ece-c5b25d4b9dcb
|
|
||||||
- object_id: -3100
|
|
||||||
display_name: price
|
|
||||||
uuid: a5feb3a6-356a-4280-bbd2-921d7dc37250
|
|
||||||
- object_id: -3200
|
|
||||||
display_name: enabled
|
|
||||||
uuid: 02184f7a-cc2b-44d6-a9b5-f11b0f77ae21
|
|
||||||
- object_id: -3300
|
|
||||||
display_name: minTemperature
|
|
||||||
uuid: 8c12c6e9-6263-42d1-b2d2-c172066f6304
|
|
||||||
- object_id: -3400
|
|
||||||
display_name: itemsPerPage
|
|
||||||
uuid: 5a729224-b0b1-41d3-b383-b42de185d91c
|
|
||||||
- object_id: -3500
|
|
||||||
display_name: helpUri
|
|
||||||
uuid: 70d0b967-a38f-4d3e-806c-c640bd114472
|
|
||||||
- object_id: -3600
|
|
||||||
display_name: languages
|
|
||||||
uuid: 19b3cdac-3ca4-44c0-9b06-dca8e5ae505f
|
|
||||||
- object_id: 1
|
|
||||||
display_name: com
|
|
||||||
uuid: 9383ffe3-132e-484d-940c-dc9b9da5c6ef
|
|
||||||
- object_id: 2
|
|
||||||
display_name: example
|
|
||||||
uuid: 74528919-5a63-4433-8e7a-4c719d30b7da
|
|
||||||
- object_id: 3
|
|
||||||
display_name: TestConfiguration
|
|
||||||
uuid: ce6a424e-03e0-4297-9b2b-2bb7c42a43d3
|
|
||||||
- object_id: 5
|
|
||||||
display_name: enabled
|
|
||||||
uuid: 677a23f1-e7c6-49a9-8980-a840a9c66711
|
|
||||||
- object_id: 7
|
|
||||||
display_name: itemsPerPage
|
|
||||||
uuid: d4713005-8e48-4c48-9ac8-dab9f034eda8
|
|
||||||
|
|
||||||
ccm_core.categories:
|
|
||||||
- object_id: -2000
|
|
||||||
unique_id: bb93a964-bf66-424c-a22d-074d001db3b8
|
|
||||||
name: registry-root
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
category_order: 0
|
|
||||||
- object_id: -2100
|
|
||||||
unique_id: 62c22973-a078-47bc-8267-bef879c7566e
|
|
||||||
name: org
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2000
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2200
|
|
||||||
unique_id: a8fbf310-7cb9-47dd-81d5-a16b80e96446
|
|
||||||
name: libreccm
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2100
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2300
|
|
||||||
unique_id: 61c30c73-857a-49ff-8272-c9fb038d3e35
|
|
||||||
name: configuration
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2200
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2400
|
|
||||||
unique_id: bf5d295c-6ad3-4484-a1e6-5641cea037b3
|
|
||||||
name: ExampleConfiguration
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2300
|
|
||||||
category_order: 1
|
|
||||||
- object_id: 1
|
|
||||||
name: com
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2000
|
|
||||||
category_order: 1
|
|
||||||
- object_id: 2
|
|
||||||
name: example
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: 1
|
|
||||||
category_order: 1
|
|
||||||
- object_id: 3
|
|
||||||
name: TestConfiguration
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: 2
|
|
||||||
category_order: 1
|
|
||||||
|
|
||||||
ccm_core.category_domains:
|
|
||||||
- object_id: -1000
|
|
||||||
domain_key: registry
|
|
||||||
root_category_id: -2000
|
|
||||||
version: 1.0
|
|
||||||
|
|
||||||
ccm_core.categorizations:
|
|
||||||
- categorization_id: -10500
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3500
|
|
||||||
category_order: 1
|
|
||||||
object_order: 5
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10400
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3400
|
|
||||||
category_order: 1
|
|
||||||
object_order: 4
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10300
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3300
|
|
||||||
category_order: 1
|
|
||||||
object_order: 3
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10200
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3200
|
|
||||||
category_order: 1
|
|
||||||
object_order: 2
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10100
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3100
|
|
||||||
category_order: 1
|
|
||||||
object_order: 1
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10600
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3600
|
|
||||||
category_order: 1
|
|
||||||
object_order: 6
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: 4
|
|
||||||
category_id: 3
|
|
||||||
object_id: 5
|
|
||||||
category_order: 1
|
|
||||||
object_order: 1
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: 6
|
|
||||||
category_id: 3
|
|
||||||
object_id: 7
|
|
||||||
category_order: 1
|
|
||||||
object_order: 2
|
|
||||||
category_index: false
|
|
||||||
|
|
||||||
ccm_core.settings:
|
ccm_core.settings:
|
||||||
- object_id: -3600
|
- setting_id: -3100
|
||||||
name: languages
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
- object_id: -3500
|
|
||||||
name: helpUrl
|
|
||||||
- object_id: -3300
|
|
||||||
name: minTemperature
|
|
||||||
- object_id: -3400
|
|
||||||
name: itemsPerPage
|
|
||||||
- object_id: -3200
|
|
||||||
name: enabled
|
|
||||||
- object_id: -3100
|
|
||||||
name: price
|
name: price
|
||||||
- object_id: 5
|
dtype: BigDecimalSetting
|
||||||
|
setting_value_big_decimal: 98.99
|
||||||
|
- setting_id: -3200
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: enabled
|
name: enabled
|
||||||
- object_id: 7
|
dtype: BooleanSetting
|
||||||
|
setting_value_boolean: true
|
||||||
|
- setting_id: -3300
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
|
name: minTemperature
|
||||||
|
dtype: DoubleSetting
|
||||||
|
setting_value_double: 23.5
|
||||||
|
- setting_id: -3400
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: itemsPerPage
|
name: itemsPerPage
|
||||||
|
dtype: LongSetting
|
||||||
ccm_core.settings_big_decimal:
|
setting_value_long: 20
|
||||||
- object_id: -3100
|
- setting_id: -3500
|
||||||
setting_value: 98.99
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
|
name: helpUrl
|
||||||
ccm_core.settings_boolean:
|
dtype: StringSetting
|
||||||
- object_id: -3200
|
setting_value_string: http://www.example.org
|
||||||
setting_value: true
|
- setting_id: -3600
|
||||||
- object_id: 5
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
setting_value: false
|
name: languages
|
||||||
|
dtype: EnumSetting
|
||||||
ccm_core.settings_double:
|
- setting_id: -4000
|
||||||
- object_id: -3300
|
configuration_class: com.example.TestConfiguration
|
||||||
setting_value: 23.5
|
name: enabled
|
||||||
|
dtype: BooleanSetting
|
||||||
ccm_core.settings_long:
|
setting_value_boolean: false
|
||||||
- object_id: -3400
|
- setting_id: -4100
|
||||||
setting_value: 20
|
configuration_class: com.example.TestConfiguration
|
||||||
- object_id: 7
|
name: itemsPerPage
|
||||||
setting_value: 40
|
dtype: LongSetting
|
||||||
|
setting_value_long: 40
|
||||||
ccm_core.settings_string:
|
|
||||||
- object_id: -3500
|
|
||||||
setting_value: http://www.example.org
|
|
||||||
|
|
||||||
ccm_core.settings_enum:
|
|
||||||
- object_id: -3600
|
|
||||||
|
|
||||||
ccm_core.settings_enum_values:
|
ccm_core.settings_enum_values:
|
||||||
- enum_id: -3600
|
- enum_id: -3600
|
||||||
|
|
|
||||||
|
|
@ -1,162 +1,33 @@
|
||||||
ccm_core.ccm_objects:
|
|
||||||
- object_id: -1000
|
|
||||||
display_name: registry
|
|
||||||
uuid: f815d6f8-f915-4399-b16c-2e2dd76f4128
|
|
||||||
- object_id: -2000
|
|
||||||
display_name: registry_root
|
|
||||||
uuid: 1e5b1732-0a15-49b8-b4a6-8aae1a003147
|
|
||||||
- object_id: -2100
|
|
||||||
display_name: org
|
|
||||||
uuid: 5b75da38-6615-4197-9527-3b56eff4c9d2
|
|
||||||
- object_id: -2200
|
|
||||||
display_name: libreccm
|
|
||||||
uuid: 103c7730-3cb0-4189-8314-b7527e707b0e
|
|
||||||
- object_id: -2300
|
|
||||||
display_name: configuration
|
|
||||||
uuid: bbc0d0ab-a191-4e40-824e-ccb959e06ba2
|
|
||||||
- object_id: -2400
|
|
||||||
display_name: ExampleConfiguration
|
|
||||||
uuid: ba898441-5a44-48eb-8ece-c5b25d4b9dcb
|
|
||||||
- object_id: -3100
|
|
||||||
display_name: price
|
|
||||||
uuid: a5feb3a6-356a-4280-bbd2-921d7dc37250
|
|
||||||
- object_id: -3200
|
|
||||||
display_name: enabled
|
|
||||||
uuid: 02184f7a-cc2b-44d6-a9b5-f11b0f77ae21
|
|
||||||
- object_id: -3300
|
|
||||||
display_name: minTemperature
|
|
||||||
uuid: 8c12c6e9-6263-42d1-b2d2-c172066f6304
|
|
||||||
- object_id: -3400
|
|
||||||
display_name: itemsPerPage
|
|
||||||
uuid: 5a729224-b0b1-41d3-b383-b42de185d91c
|
|
||||||
- object_id: -3500
|
|
||||||
display_name: helpUri
|
|
||||||
uuid: 70d0b967-a38f-4d3e-806c-c640bd114472
|
|
||||||
- object_id: -3600
|
|
||||||
display_name: languages
|
|
||||||
uuid: 19b3cdac-3ca4-44c0-9b06-dca8e5ae505f
|
|
||||||
|
|
||||||
ccm_core.categories:
|
|
||||||
- object_id: -2000
|
|
||||||
unique_id: bb93a964-bf66-424c-a22d-074d001db3b8
|
|
||||||
name: registry-root
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
category_order: 0
|
|
||||||
- object_id: -2100
|
|
||||||
unique_id: 62c22973-a078-47bc-8267-bef879c7566e
|
|
||||||
name: org
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2000
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2200
|
|
||||||
unique_id: a8fbf310-7cb9-47dd-81d5-a16b80e96446
|
|
||||||
name: libreccm
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2100
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2300
|
|
||||||
unique_id: 61c30c73-857a-49ff-8272-c9fb038d3e35
|
|
||||||
name: configuration
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2200
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -2400
|
|
||||||
unique_id: bf5d295c-6ad3-4484-a1e6-5641cea037b3
|
|
||||||
name: ExampleConfiguration
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
parent_category_id: -2300
|
|
||||||
category_order: 1
|
|
||||||
|
|
||||||
ccm_core.category_domains:
|
|
||||||
- object_id: -1000
|
|
||||||
domain_key: registry
|
|
||||||
root_category_id: -2000
|
|
||||||
version: 1.0
|
|
||||||
|
|
||||||
ccm_core.categorizations:
|
|
||||||
- categorization_id: -10100
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3100
|
|
||||||
category_order: 1
|
|
||||||
object_order: 1
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10200
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3200
|
|
||||||
category_order: 1
|
|
||||||
object_order: 2
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10300
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3300
|
|
||||||
category_order: 1
|
|
||||||
object_order: 3
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10400
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3400
|
|
||||||
category_order: 1
|
|
||||||
object_order: 4
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10500
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3500
|
|
||||||
category_order: 1
|
|
||||||
object_order: 5
|
|
||||||
category_index: false
|
|
||||||
- categorization_id: -10600
|
|
||||||
category_id: -2400
|
|
||||||
object_id: -3600
|
|
||||||
category_order: 1
|
|
||||||
object_order: 6
|
|
||||||
category_index: false
|
|
||||||
|
|
||||||
ccm_core.settings:
|
ccm_core.settings:
|
||||||
- object_id: -3100
|
- setting_id: -3100
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: price
|
name: price
|
||||||
- object_id: -3200
|
dtype: BigDecimalSetting
|
||||||
|
setting_value_big_decimal: 98.99
|
||||||
|
- setting_id: -3200
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: enabled
|
name: enabled
|
||||||
- object_id: -3300
|
dtype: BooleanSetting
|
||||||
|
setting_value_boolean: true
|
||||||
|
- setting_id: -3300
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: minTemperature
|
name: minTemperature
|
||||||
- object_id: -3400
|
dtype: DoubleSetting
|
||||||
|
setting_value_double: 23.5
|
||||||
|
- setting_id: -3400
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: itemsPerPage
|
name: itemsPerPage
|
||||||
- object_id: -3500
|
dtype: LongSetting
|
||||||
|
setting_value_long: 20
|
||||||
|
- setting_id: -3500
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: helpUrl
|
name: helpUrl
|
||||||
- object_id: -3600
|
dtype: StringSetting
|
||||||
|
setting_value_string: http://www.example.org
|
||||||
|
- setting_id: -3600
|
||||||
|
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||||
name: languages
|
name: languages
|
||||||
|
dtype: EnumSetting
|
||||||
ccm_core.settings_big_decimal:
|
|
||||||
- object_id: -3100
|
|
||||||
setting_value: 98.99
|
|
||||||
|
|
||||||
ccm_core.settings_boolean:
|
|
||||||
- object_id: -3200
|
|
||||||
setting_value: true
|
|
||||||
|
|
||||||
ccm_core.settings_double:
|
|
||||||
- object_id: -3300
|
|
||||||
setting_value: 23.5
|
|
||||||
|
|
||||||
ccm_core.settings_long:
|
|
||||||
- object_id: -3400
|
|
||||||
setting_value: 20
|
|
||||||
|
|
||||||
ccm_core.settings_string:
|
|
||||||
- object_id: -3500
|
|
||||||
setting_value: http://www.example.org
|
|
||||||
|
|
||||||
ccm_core.settings_enum:
|
|
||||||
- object_id: -3600
|
|
||||||
|
|
||||||
ccm_core.settings_enum_values:
|
ccm_core.settings_enum_values:
|
||||||
- enum_id: -3600
|
- enum_id: -3600
|
||||||
|
|
|
||||||
|
|
@ -109,24 +109,6 @@ ccm_core.role_memberships:
|
||||||
role_id: -10003
|
role_id: -10003
|
||||||
member_id: -41004
|
member_id: -41004
|
||||||
ccm_core.ccm_objects:
|
ccm_core.ccm_objects:
|
||||||
- object_id: -100
|
|
||||||
display_name: registry
|
|
||||||
uuid: ab0688be-5b4c-479b-a2a3-3919181bc1ff
|
|
||||||
- object_id: -200
|
|
||||||
display_name: registry-root
|
|
||||||
uuid: 281570ba-b6b6-4d32-a018-5ab6ad0e6200
|
|
||||||
- object_id: -201
|
|
||||||
display_name: com
|
|
||||||
uuid: babf3f56-2119-4521-b6af-d6c3e88fd96e
|
|
||||||
- object_id: -202
|
|
||||||
display_name: arsdigita
|
|
||||||
uuid: f9aac564-bf4f-4a66-8382-3562ce3c8717
|
|
||||||
- object_id: -203
|
|
||||||
display_name: kernel
|
|
||||||
uuid: 5d017f89-b5ea-4381-9bb7-0bc72b5289a9
|
|
||||||
- object_id: -204
|
|
||||||
display_name: KernelConfig
|
|
||||||
uuid: 8dfd244f-d74b-493f-8254-62df65ebef35
|
|
||||||
- object_id: -20001
|
- object_id: -20001
|
||||||
display_name: object1
|
display_name: object1
|
||||||
uuid: d05fb5f0-7b66-470d-b4f7-d14f4d08d4b6
|
uuid: d05fb5f0-7b66-470d-b4f7-d14f4d08d4b6
|
||||||
|
|
@ -136,9 +118,6 @@ ccm_core.ccm_objects:
|
||||||
- object_id: -20003
|
- object_id: -20003
|
||||||
display_name: object3
|
display_name: object3
|
||||||
uuid: 142041c0-163f-4359-931a-1faf465ee564
|
uuid: 142041c0-163f-4359-931a-1faf465ee564
|
||||||
- object_id: -301
|
|
||||||
display_name: screenName
|
|
||||||
uuid: 56e14b70-8025-4f1d-a16d-a5ac34658f92
|
|
||||||
ccm_core.permissions:
|
ccm_core.permissions:
|
||||||
# permission for privilege1 granted to role1
|
# permission for privilege1 granted to role1
|
||||||
- permission_id: -30001
|
- permission_id: -30001
|
||||||
|
|
@ -159,61 +138,9 @@ ccm_core.permissions:
|
||||||
granted_privilege: privilege3
|
granted_privilege: privilege3
|
||||||
object_id: -20001
|
object_id: -20001
|
||||||
grantee_id: -10003
|
grantee_id: -10003
|
||||||
ccm_core.categories:
|
|
||||||
- object_id: -200
|
|
||||||
unique_id: bb93a964-bf66-424c-a22d-074d001db3b8
|
|
||||||
name: registry-root
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
category_order: 0
|
|
||||||
- object_id: -201
|
|
||||||
unique_id: 35ac50aa-7062-47b9-808d-ac830050d373
|
|
||||||
parent_category_id: -200
|
|
||||||
name: com
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -202
|
|
||||||
unique_id: 28f09d9d-a7fc-4dc3-a53e-670822fa5480
|
|
||||||
parent_category_id: -201
|
|
||||||
name: arsdigita
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -203
|
|
||||||
unique_id: 58c0b235-8762-4ab7-9232-a5a0e39c3a01
|
|
||||||
parent_category_id: -202
|
|
||||||
name: kernel
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
category_order: 1
|
|
||||||
- object_id: -204
|
|
||||||
unique_id: c1a45148-df0a-486f-b4f1-c5a6659081c2
|
|
||||||
parent_category_id: -203
|
|
||||||
name: KernelConfig
|
|
||||||
enabled: true
|
|
||||||
visible: true
|
|
||||||
abstract_category: false
|
|
||||||
category_order: 1
|
|
||||||
ccm_core.category_domains:
|
|
||||||
- object_id: -100
|
|
||||||
domain_key: registry
|
|
||||||
root_category_id: -200
|
|
||||||
version: 1.0
|
|
||||||
ccm_core.settings:
|
ccm_core.settings:
|
||||||
- object_id: -301
|
- setting_id: -301
|
||||||
|
configuration_class: com.arsdigita.kernel.KernelConfig
|
||||||
name: primaryUserIdentifier
|
name: primaryUserIdentifier
|
||||||
ccm_core.settings_string:
|
dtype: StringSetting
|
||||||
- object_id: -301
|
setting_value_string: screen_name
|
||||||
setting_value: screen_name
|
|
||||||
ccm_core.categorizations:
|
|
||||||
- categorization_id: -900
|
|
||||||
category_id: -204
|
|
||||||
object_id: -301
|
|
||||||
category_index: false
|
|
||||||
category_order: 1
|
|
||||||
object_order: 1
|
|
||||||
|
|
@ -1,20 +1,10 @@
|
||||||
DELETE FROM ccm_core.settings_big_decimal;
|
DELETE FROM ccm_core.settings_string_list;
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_boolean;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_double;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_enum_values;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_enum;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_l10n_string;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_l10n_str_values;
|
DELETE FROM ccm_core.settings_l10n_str_values;
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_long;
|
DELETE FROM ccm_core.settings_enum_values;
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_string;
|
DELETE FROM ccm_core.settings_enum_values;
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings;
|
DELETE FROM ccm_core.settings;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,10 @@
|
||||||
DELETE FROM ccm_core.settings_big_decimal;
|
DELETE FROM ccm_core.settings_string_list;
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_boolean;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_double;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_enum_values;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_enum;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_l10n_string;
|
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_l10n_str_values;
|
DELETE FROM ccm_core.settings_l10n_str_values;
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_long;
|
DELETE FROM ccm_core.settings_enum_values;
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings_string;
|
DELETE FROM ccm_core.settings_enum_values;
|
||||||
|
|
||||||
DELETE FROM ccm_core.settings;
|
DELETE FROM ccm_core.settings;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue