CCM NG: Several changes:
- Replaced CdiLookupException with IllegalStateException. IllegalStateException is a RuntimeException, therefore it is not necessary to catch the exception. An error in the findBean method usually is not recoverable, therefore it is not necessary to use a checked exception. - Removed several uses of UncheckedWrapperException - CategoryRepository and CategoryManager are now implemented (not completetly yet) and have tests. - Changed value field of EnumConfigurationEntry from List to Set to avoid duplicate entries. git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3770 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
e743e052ff
commit
3f27e09a84
|
|
@ -25,13 +25,11 @@ import com.arsdigita.dispatcher.AccessDeniedException;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.templating.Templating;
|
import com.arsdigita.templating.Templating;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.web.BaseApplicationServlet;
|
import com.arsdigita.web.BaseApplicationServlet;
|
||||||
import com.arsdigita.web.LoginSignal;
|
import com.arsdigita.web.LoginSignal;
|
||||||
import com.arsdigita.xml.Document;
|
import com.arsdigita.xml.Document;
|
||||||
|
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.PermissionChecker;
|
import org.libreccm.security.PermissionChecker;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
|
|
@ -108,14 +106,8 @@ public class AdminServlet extends BaseApplicationServlet implements
|
||||||
// /////// Some preparational steps ///////////////
|
// /////// Some preparational steps ///////////////
|
||||||
/* Determine access privilege: only logged in users may access */
|
/* Determine access privilege: only logged in users may access */
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final Subject subject;
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
final PermissionChecker permissionChecker;
|
final PermissionChecker permissionChecker = cdiUtil.findBean(PermissionChecker.class);
|
||||||
try {
|
|
||||||
subject = cdiUtil.findBean(Subject.class);
|
|
||||||
permissionChecker = cdiUtil.findBean(PermissionChecker.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!subject.isAuthenticated()) {
|
if (!subject.isAuthenticated()) {
|
||||||
throw new LoginSignal(sreq);
|
throw new LoginSignal(sreq);
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,11 @@ import com.arsdigita.ui.admin.applications.BaseApplicationPane;
|
||||||
import com.arsdigita.ui.admin.applications.MultiInstanceApplicationPane;
|
import com.arsdigita.ui.admin.applications.MultiInstanceApplicationPane;
|
||||||
import com.arsdigita.ui.admin.applications.SingletonApplicationPane;
|
import com.arsdigita.ui.admin.applications.SingletonApplicationPane;
|
||||||
import com.arsdigita.ui.admin.applications.tree.ApplicationTreeModelBuilder;
|
import com.arsdigita.ui.admin.applications.tree.ApplicationTreeModelBuilder;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.web.ApplicationRepository;
|
import org.libreccm.web.ApplicationRepository;
|
||||||
import org.libreccm.web.ApplicationType;
|
import org.libreccm.web.ApplicationType;
|
||||||
|
|
@ -52,13 +52,13 @@ import org.libreccm.web.CcmApplication;
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
*/
|
*/
|
||||||
public class ApplicationsAdministrationTab extends LayoutPanel implements
|
public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
AdminConstants {
|
AdminConstants {
|
||||||
|
|
||||||
private final Tree applicationTree;
|
private final Tree applicationTree;
|
||||||
private final Map<String, BaseApplicationPane> appPanes
|
private final Map<String, BaseApplicationPane> appPanes
|
||||||
= new HashMap<>();
|
|
||||||
private final Map<String, ApplicationInstancePane> instancePanes
|
|
||||||
= new HashMap<>();
|
= new HashMap<>();
|
||||||
|
private final Map<String, ApplicationInstancePane> instancePanes
|
||||||
|
= new HashMap<>();
|
||||||
private final BoxPanel appPanel;
|
private final BoxPanel appPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -79,21 +79,16 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
setLeft(applicationTree);
|
setLeft(applicationTree);
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final org.libreccm.web.ApplicationManager appManager;
|
final org.libreccm.web.ApplicationManager appManager = cdiUtil.findBean(
|
||||||
try {
|
org.libreccm.web.ApplicationManager.class);
|
||||||
appManager = cdiUtil.findBean(
|
|
||||||
org.libreccm.web.ApplicationManager.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Collection<ApplicationType> applicationTypes = appManager.
|
final Collection<ApplicationType> applicationTypes = appManager.
|
||||||
getApplicationTypes().values();
|
getApplicationTypes().values();
|
||||||
|
|
||||||
final Map<String, ApplicationManager<?>> appManagers
|
final Map<String, ApplicationManager<?>> appManagers
|
||||||
= ApplicationManagers.
|
= ApplicationManagers.
|
||||||
getInstance().
|
getInstance().
|
||||||
getApplicationManagers();
|
getApplicationManagers();
|
||||||
|
|
||||||
for (ApplicationType appType : applicationTypes) {
|
for (ApplicationType appType : applicationTypes) {
|
||||||
if (appType.singleton()) {
|
if (appType.singleton()) {
|
||||||
|
|
@ -110,7 +105,7 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<String, ApplicationInstancePane> entry : instancePanes.
|
for (Map.Entry<String, ApplicationInstancePane> entry : instancePanes.
|
||||||
entrySet()) {
|
entrySet()) {
|
||||||
appPanel.add(entry.getValue());
|
appPanel.add(entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,18 +123,18 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
pane = new SingletonApplicationPane(applicationType, null);
|
pane = new SingletonApplicationPane(applicationType, null);
|
||||||
} else {
|
} else {
|
||||||
pane = new SingletonApplicationPane(
|
pane = new SingletonApplicationPane(
|
||||||
applicationType, appManagers.get(appObjectType).
|
applicationType, appManagers.get(appObjectType).
|
||||||
getApplicationAdminForm());
|
getApplicationAdminForm());
|
||||||
}
|
}
|
||||||
appPanes.put(appObjectType, pane);
|
appPanes.put(appObjectType, pane);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
private void createAppPane(
|
private void createAppPane(
|
||||||
final ApplicationType applicationType,
|
final ApplicationType applicationType,
|
||||||
final Map<String, ApplicationManager<?>> appManagers) {
|
final Map<String, ApplicationManager<?>> appManagers) {
|
||||||
final ApplicationManager<?> appManager = appManagers.get(
|
final ApplicationManager<?> appManager = appManagers.get(
|
||||||
applicationType.name());
|
applicationType.name());
|
||||||
final Form createForm;
|
final Form createForm;
|
||||||
if (appManager == null) {
|
if (appManager == null) {
|
||||||
createForm = null;
|
createForm = null;
|
||||||
|
|
@ -147,24 +142,25 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
createForm = appManager.getApplicationCreateForm();
|
createForm = appManager.getApplicationCreateForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
final MultiInstanceApplicationPane<?> appPane = new MultiInstanceApplicationPane(
|
final MultiInstanceApplicationPane<?> appPane
|
||||||
|
= new MultiInstanceApplicationPane(
|
||||||
applicationType, createForm);
|
applicationType, createForm);
|
||||||
appPanes.put(applicationType.name(), appPane);
|
appPanes.put(applicationType.name(), appPane);
|
||||||
createInstancePane(applicationType, appManagers);
|
createInstancePane(applicationType, appManagers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createInstancePane(
|
private void createInstancePane(
|
||||||
final ApplicationType applicationType,
|
final ApplicationType applicationType,
|
||||||
final Map<String, ApplicationManager<?>> managementForms) {
|
final Map<String, ApplicationManager<?>> managementForms) {
|
||||||
final ApplicationManager<?> manager = managementForms.get(
|
final ApplicationManager<?> manager = managementForms.get(
|
||||||
applicationType.name());
|
applicationType.name());
|
||||||
final ApplicationInstancePane instPane;
|
final ApplicationInstancePane instPane;
|
||||||
if (manager == null) {
|
if (manager == null) {
|
||||||
instPane = new ApplicationInstancePane(new Placeholder());
|
instPane = new ApplicationInstancePane(new Placeholder());
|
||||||
} else {
|
} else {
|
||||||
instPane = new ApplicationInstancePane(managementForms.get(
|
instPane = new ApplicationInstancePane(managementForms.get(
|
||||||
applicationType.name()).
|
applicationType.name()).
|
||||||
getApplicationAdminForm());
|
getApplicationAdminForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
instancePanes.put(applicationType.name(), instPane);
|
instancePanes.put(applicationType.name(), instPane);
|
||||||
|
|
@ -178,7 +174,7 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
page.setVisibleDefault(entry.getValue(), false);
|
page.setVisibleDefault(entry.getValue(), false);
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, ApplicationInstancePane> entry : instancePanes.
|
for (Map.Entry<String, ApplicationInstancePane> entry : instancePanes.
|
||||||
entrySet()) {
|
entrySet()) {
|
||||||
page.setVisibleDefault(entry.getValue(), false);
|
page.setVisibleDefault(entry.getValue(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +185,7 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
entry.getValue().setVisible(state, false);
|
entry.getValue().setVisible(state, false);
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, ApplicationInstancePane> entry : instancePanes.
|
for (Map.Entry<String, ApplicationInstancePane> entry : instancePanes.
|
||||||
entrySet()) {
|
entrySet()) {
|
||||||
entry.getValue().setVisible(state, false);
|
entry.getValue().setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,7 +203,7 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
final String selectedKey = (String) applicationTree.getSelectedKey(
|
final String selectedKey = (String) applicationTree.getSelectedKey(
|
||||||
state);
|
state);
|
||||||
if (selectedKey != null) {
|
if (selectedKey != null) {
|
||||||
if (selectedKey.contains(".")) {
|
if (selectedKey.contains(".")) {
|
||||||
// Selected key is a classname and therefore the key of an ApplicationPane
|
// Selected key is a classname and therefore the key of an ApplicationPane
|
||||||
|
|
@ -218,20 +214,16 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
} else {
|
} else {
|
||||||
// Selected key is the name of a instance pane
|
// Selected key is the name of a instance pane
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final ApplicationRepository appRepo;
|
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||||
try {
|
ApplicationRepository.class);
|
||||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final CcmApplication application = appRepo
|
final CcmApplication application = appRepo
|
||||||
.retrieveApplicationForPath(selectedKey);
|
.retrieveApplicationForPath(selectedKey);
|
||||||
|
|
||||||
final ApplicationInstancePane pane;
|
final ApplicationInstancePane pane;
|
||||||
if (application != null) {
|
if (application != null) {
|
||||||
pane = instancePanes.get(application.getClass().
|
pane = instancePanes.get(application.getClass().
|
||||||
getName());
|
getName());
|
||||||
if (pane != null) {
|
if (pane != null) {
|
||||||
pane.setApplication(application);
|
pane.setApplication(application);
|
||||||
}
|
}
|
||||||
|
|
@ -253,9 +245,10 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
||||||
public Placeholder() {
|
public Placeholder() {
|
||||||
super();
|
super();
|
||||||
final Label label = new Label(GlobalizationUtil.globalize(
|
final Label label = new Label(GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.placeholder"));
|
"ui.admin.applications.placeholder"));
|
||||||
add(label);
|
add(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,15 +30,11 @@ import com.arsdigita.bebop.list.ListCellRenderer;
|
||||||
import com.arsdigita.bebop.list.ListModel;
|
import com.arsdigita.bebop.list.ListModel;
|
||||||
import com.arsdigita.bebop.list.ListModelBuilder;
|
import com.arsdigita.bebop.list.ListModelBuilder;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
|
||||||
import org.libreccm.core.EmailAddress;
|
import org.libreccm.core.EmailAddress;
|
||||||
|
|
||||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -105,11 +101,8 @@ class EmailList extends List
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch(CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// final User user = userRepository.findById(userId);
|
// final User user = userRepository.findById(userId);
|
||||||
// if (user == null) {
|
// if (user == null) {
|
||||||
|
|
@ -198,11 +191,8 @@ class EmailListModelBuilder extends LockableImpl
|
||||||
// } else {
|
// } else {
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch(CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
// final User user = userRepository.findById(userId);
|
// final User user = userRepository.findById(userId);
|
||||||
//
|
//
|
||||||
// return new EmailListModel(user.getEmailAddresses().iterator());
|
// return new EmailListModel(user.getEmailAddresses().iterator());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.arsdigita.ui.admin;
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -14,10 +13,6 @@ import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.bebop.Tree;
|
import com.arsdigita.bebop.Tree;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
|
||||||
//import org.libreccm.core.Group;
|
//import org.libreccm.core.Group;
|
||||||
//import org.libreccm.core.GroupRepository;
|
//import org.libreccm.core.GroupRepository;
|
||||||
|
|
||||||
|
|
@ -60,12 +55,8 @@ public class ExistingGroupAddPane extends SimpleContainer implements
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup GroupRepository", ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// group = groupRepository.findById(id);
|
// group = groupRepository.findById(id);
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -19,21 +19,13 @@
|
||||||
package com.arsdigita.ui.admin;
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.Tree;
|
import com.arsdigita.bebop.Tree;
|
||||||
|
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
|
||||||
|
|
||||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import javax.mail.internet.InternetAddress;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add group form.
|
* Add group form.
|
||||||
|
|
@ -96,12 +88,8 @@ class GroupAddForm extends GroupForm implements FormProcessListener {
|
||||||
//// }
|
//// }
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup GroupRepository", ex);
|
|
||||||
// }
|
|
||||||
// groupRepository.save(group);
|
// groupRepository.save(group);
|
||||||
//
|
//
|
||||||
//// if (parentGroup != null) {
|
//// if (parentGroup != null) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import com.arsdigita.bebop.ActionLink;
|
||||||
import com.arsdigita.bebop.BoxPanel;
|
import com.arsdigita.bebop.BoxPanel;
|
||||||
import com.arsdigita.bebop.ColumnPanel;
|
import com.arsdigita.bebop.ColumnPanel;
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.bebop.ControlLink;
|
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.List;
|
import com.arsdigita.bebop.List;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
|
|
@ -45,14 +44,11 @@ import com.arsdigita.toolbox.ui.LayoutPanel;
|
||||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||||
|
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the panel for administration of groups.
|
* Constructs the panel for administration of groups.
|
||||||
|
|
@ -147,13 +143,9 @@ class GroupAdministrationTab extends LayoutPanel implements AdminConstants,
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil
|
// groupRepository = cdiUtil
|
||||||
// .findBean(GroupRepository.class);
|
// .findBean(GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup GroupRepository", ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// group = groupRepository.findById(id);
|
// group = groupRepository.findById(id);
|
||||||
//
|
//
|
||||||
|
|
@ -373,13 +365,9 @@ class GroupAdministrationTab extends LayoutPanel implements AdminConstants,
|
||||||
// final Long groupId = Long.parseLong(key);
|
// final Long groupId = Long.parseLong(key);
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil
|
// groupRepository = cdiUtil
|
||||||
// .findBean(GroupRepository.class);
|
// .findBean(GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup GroupRepository", ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// final Group group = groupRepository.findById(groupId);
|
// final Group group = groupRepository.findById(groupId);
|
||||||
// final Group parent = getGroup(state);
|
// final Group parent = getGroup(state);
|
||||||
|
|
@ -540,11 +528,8 @@ class GroupAdministrationTab extends LayoutPanel implements AdminConstants,
|
||||||
// if (group != null) {
|
// if (group != null) {
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||||
// } catch(CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// groupRepository.delete(group);
|
// groupRepository.delete(group);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,9 @@ import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import javax.mail.internet.InternetAddress;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
//import org.libreccm.core.Group;
|
//import org.libreccm.core.Group;
|
||||||
//import org.libreccm.core.GroupRepository;
|
//import org.libreccm.core.GroupRepository;
|
||||||
|
|
@ -72,13 +67,9 @@ class GroupEditForm extends GroupForm implements FormInitListener,
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
//
|
//
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil.findBean(
|
// groupRepository = cdiUtil.findBean(
|
||||||
// GroupRepository.class);
|
// GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup GroupRepository", ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// final Group group = groupRepository.findById(id);
|
// final Group group = groupRepository.findById(id);
|
||||||
//
|
//
|
||||||
|
|
@ -97,12 +88,7 @@ class GroupEditForm extends GroupForm implements FormInitListener,
|
||||||
final Long id = (Long) state.getValue(GROUP_ID_PARAM);
|
final Long id = (Long) state.getValue(GROUP_ID_PARAM);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup GroupRepository", ex);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.ui.admin;
|
package com.arsdigita.ui.admin;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -38,12 +37,6 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
|
||||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||||
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cgyg9330
|
* @author cgyg9330
|
||||||
|
|
@ -94,12 +87,7 @@ public class GroupSearchForm extends Form implements FormProcessListener,
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup GroupRepository", ex);
|
|
||||||
// }
|
|
||||||
// results = groupRepository.searchGroupByName(search);
|
// results = groupRepository.searchGroupByName(search);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,10 @@ import com.arsdigita.bebop.PageState;
|
||||||
|
|
||||||
import com.arsdigita.bebop.tree.TreeModel;
|
import com.arsdigita.bebop.tree.TreeModel;
|
||||||
import com.arsdigita.bebop.tree.TreeNode;
|
import com.arsdigita.bebop.tree.TreeNode;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
|
||||||
import org.libreccm.security.Group;
|
import org.libreccm.security.Group;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -110,12 +104,8 @@ public class GroupTreeModel implements TreeModel {
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup GroupRepository", ex);
|
|
||||||
// }
|
|
||||||
// final List<Group> groups = groupRepository.findAll();
|
// final List<Group> groups = groupRepository.findAll();
|
||||||
//
|
//
|
||||||
// return groups.iterator();
|
// return groups.iterator();
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,10 @@ import com.arsdigita.bebop.BoxPanel;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.list.ListCellRenderer;
|
import com.arsdigita.bebop.list.ListCellRenderer;
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.ControlLink;
|
import com.arsdigita.bebop.ControlLink;
|
||||||
import com.arsdigita.bebop.event.ActionListener;
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
import com.arsdigita.bebop.event.ActionEvent;
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||||
|
|
@ -88,13 +85,10 @@ class SubMemberPanel extends BoxPanel {
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// final GroupManager groupManager;
|
// final GroupManager groupManager;
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// groupManager = cdiUtil.findBean(GroupManager.class);
|
// groupManager = cdiUtil.findBean(GroupManager.class);
|
||||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||||
// } catch(CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// final User user = userRepository.findById(userID);
|
// final User user = userRepository.findById(userID);
|
||||||
// final Group group = m_mainTab.getGroup(state);
|
// final Group group = m_mainTab.getGroup(state);
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,11 @@ import com.arsdigita.web.RedirectSignal;
|
||||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||||
|
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
|
|
@ -117,11 +115,8 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
// final PageState state = event.getPageState();
|
// final PageState state = event.getPageState();
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final CcmSessionContext sessionContext;
|
// final CcmSessionContext sessionContext;
|
||||||
// try {
|
|
||||||
// sessionContext = cdiUtil.findBean(CcmSessionContext.class);
|
// sessionContext = cdiUtil.findBean(CcmSessionContext.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// final Subject subject = sessionContext.getCurrentSubject();
|
// final Subject subject = sessionContext.getCurrentSubject();
|
||||||
//
|
//
|
||||||
|
|
@ -150,11 +145,8 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// final User user = userRepository.findById(id);
|
// final User user = userRepository.findById(id);
|
||||||
// if (user == null) {
|
// if (user == null) {
|
||||||
|
|
@ -356,12 +348,9 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final LoginManager loginManager;
|
// final LoginManager loginManager;
|
||||||
// try {
|
|
||||||
// loginManager = cdiUtil.findBean(
|
// loginManager = cdiUtil.findBean(
|
||||||
// LoginManager.class);
|
// LoginManager.class);
|
||||||
// } catch(CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// loginManager.login(CLASS, CLASS);
|
// loginManager.login(CLASS, CLASS);
|
||||||
//
|
//
|
||||||
|
|
@ -434,11 +423,8 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// userRepository.delete(user);
|
// userRepository.delete(user);
|
||||||
|
|
||||||
|
|
@ -477,11 +463,8 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
// userRepository.save(user);
|
// userRepository.save(user);
|
||||||
} // End ActionPerformed method
|
} // End ActionPerformed method
|
||||||
|
|
||||||
|
|
@ -511,11 +494,8 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
//
|
//
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
// userRepository.save(user);
|
// userRepository.save(user);
|
||||||
} // End ActionPerformed method
|
} // End ActionPerformed method
|
||||||
|
|
||||||
|
|
@ -694,12 +674,9 @@ class UserBrowsePane extends SegmentedPanel
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final GroupRepository groupRepository;
|
// final GroupRepository groupRepository;
|
||||||
// try {
|
|
||||||
// groupRepository = cdiUtil
|
// groupRepository = cdiUtil
|
||||||
// .findBean(GroupRepository.class);
|
// .findBean(GroupRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
// final Group group = groupRepository.findById(Long.parseLong(
|
// final Group group = groupRepository.findById(Long.parseLong(
|
||||||
// id));
|
// id));
|
||||||
// m_groupAdministrationTab.setGroup(ps, group);
|
// m_groupAdministrationTab.setGroup(ps, group);
|
||||||
|
|
@ -731,11 +708,8 @@ class UserTableModel implements TableModel {
|
||||||
public UserTableModel() {
|
public UserTableModel() {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// users = userRepository.findAll();
|
// users = userRepository.findAll();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import com.arsdigita.bebop.parameters.EmailParameter;
|
||||||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
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;
|
||||||
|
|
||||||
|
|
@ -41,15 +40,11 @@ import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||||
|
|
||||||
import com.arsdigita.ui.login.PasswordValidationListener;
|
import com.arsdigita.ui.login.PasswordValidationListener;
|
||||||
import com.arsdigita.util.StringUtils;
|
import com.arsdigita.util.StringUtils;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
import java.io.UncheckedIOException;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import javax.mail.internet.InternetAddress;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -244,11 +239,8 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
||||||
*/
|
*/
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// final String screenName = (String) m_screenName.getValue(ps);
|
// final String screenName = (String) m_screenName.getValue(ps);
|
||||||
// final User userByScreenname = userRepository.findByScreenName(
|
// final User userByScreenname = userRepository.findByScreenName(
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,12 @@ import com.arsdigita.mail.Mail;
|
||||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||||
|
|
||||||
import com.arsdigita.ui.login.PasswordValidationListener;
|
import com.arsdigita.ui.login.PasswordValidationListener;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
|
|
@ -137,11 +135,8 @@ class UserPasswordForm extends Form
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch(CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
// final User user = userRepository.findById((Long) state.getValue(
|
// final User user = userRepository.findById((Long) state.getValue(
|
||||||
// USER_ID_PARAM));
|
// USER_ID_PARAM));
|
||||||
//
|
//
|
||||||
|
|
@ -164,11 +159,8 @@ class UserPasswordForm extends Form
|
||||||
|
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// } catch(CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
// final User user = userRepository.findById((Long) state.getValue(
|
// final User user = userRepository.findById((Long) state.getValue(
|
||||||
// USER_ID_PARAM));
|
// USER_ID_PARAM));
|
||||||
// if (user == null) {
|
// if (user == null) {
|
||||||
|
|
@ -217,12 +209,9 @@ class UserPasswordForm extends Form
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final UserRepository userRepository;
|
// final UserRepository userRepository;
|
||||||
// final UserManager userManager;
|
// final UserManager userManager;
|
||||||
// try {
|
|
||||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
// userManager = cdiUtil.findBean(UserManager.class);
|
// userManager = cdiUtil.findBean(UserManager.class);
|
||||||
// } catch(CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(ex);
|
|
||||||
// }
|
|
||||||
// final User user = userRepository.findById((Long) state.getValue(
|
// final User user = userRepository.findById((Long) state.getValue(
|
||||||
// USER_ID_PARAM));
|
// USER_ID_PARAM));
|
||||||
// if (user == null) {
|
// if (user == null) {
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,13 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.ui.admin.applications;
|
package com.arsdigita.ui.admin.applications;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PropertySheet;
|
||||||
import com.arsdigita.bebop.PropertySheetModel;
|
import com.arsdigita.bebop.PropertySheetModel;
|
||||||
import com.arsdigita.ui.admin.GlobalizationUtil;
|
import com.arsdigita.ui.admin.GlobalizationUtil;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.web.ApplicationRepository;
|
import org.libreccm.web.ApplicationRepository;
|
||||||
import org.libreccm.web.ApplicationType;
|
import org.libreccm.web.ApplicationType;
|
||||||
|
|
@ -48,7 +49,7 @@ public class ApplicationInfoPropertySheetModel implements PropertySheetModel {
|
||||||
private int currentIndex = -1;
|
private int currentIndex = -1;
|
||||||
|
|
||||||
public ApplicationInfoPropertySheetModel(
|
public ApplicationInfoPropertySheetModel(
|
||||||
final ApplicationType applicationType) {
|
final ApplicationType applicationType) {
|
||||||
this.applicationType = applicationType;
|
this.applicationType = applicationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,24 +71,24 @@ public class ApplicationInfoPropertySheetModel implements PropertySheetModel {
|
||||||
switch (currentIndex) {
|
switch (currentIndex) {
|
||||||
case APP_TITLE:
|
case APP_TITLE:
|
||||||
return (String) GlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.title.label").
|
"ui.admin.applications.ApplicationInfoSection.title.label").
|
||||||
localize();
|
localize();
|
||||||
case APP_CLASS:
|
case APP_CLASS:
|
||||||
return (String) GlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.app_class.label").
|
"ui.admin.applications.ApplicationInfoSection.app_class.label")
|
||||||
localize();
|
.localize();
|
||||||
case APP_SINGLETON:
|
case APP_SINGLETON:
|
||||||
return (String) GlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.singleton.label").
|
"ui.admin.applications.ApplicationInfoSection.singleton.label")
|
||||||
localize();
|
.localize();
|
||||||
case APP_DESC:
|
case APP_DESC:
|
||||||
return (String) GlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.desc.label").
|
"ui.admin.applications.ApplicationInfoSection.desc.label").
|
||||||
localize();
|
localize();
|
||||||
case SINGLETON_PATH:
|
case SINGLETON_PATH:
|
||||||
return (String) GlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label").
|
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label")
|
||||||
localize();
|
.localize();
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
@ -97,19 +98,19 @@ public class ApplicationInfoPropertySheetModel implements PropertySheetModel {
|
||||||
switch (currentIndex) {
|
switch (currentIndex) {
|
||||||
case APP_TITLE:
|
case APP_TITLE:
|
||||||
return GlobalizationUtil.globalize(
|
return GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.title.label");
|
"ui.admin.applications.ApplicationInfoSection.title.label");
|
||||||
case APP_CLASS:
|
case APP_CLASS:
|
||||||
return GlobalizationUtil.globalize(
|
return GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.app_class.label");
|
"ui.admin.applications.ApplicationInfoSection.app_class.label");
|
||||||
case APP_SINGLETON:
|
case APP_SINGLETON:
|
||||||
return GlobalizationUtil.globalize(
|
return GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.singleton.label");
|
"ui.admin.applications.ApplicationInfoSection.singleton.label");
|
||||||
case APP_DESC:
|
case APP_DESC:
|
||||||
return GlobalizationUtil.globalize(
|
return GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.desc.label");
|
"ui.admin.applications.ApplicationInfoSection.desc.label");
|
||||||
case SINGLETON_PATH:
|
case SINGLETON_PATH:
|
||||||
return GlobalizationUtil.globalize(
|
return GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label");
|
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label");
|
||||||
default:
|
default:
|
||||||
return GlobalizationUtil.globalize("unknown");
|
return GlobalizationUtil.globalize("unknown");
|
||||||
}
|
}
|
||||||
|
|
@ -125,33 +126,29 @@ public class ApplicationInfoPropertySheetModel implements PropertySheetModel {
|
||||||
case APP_SINGLETON:
|
case APP_SINGLETON:
|
||||||
if (applicationType.singleton()) {
|
if (applicationType.singleton()) {
|
||||||
return (String) GlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.singleton.yes").
|
"ui.admin.applications.ApplicationInfoSection.singleton.yes")
|
||||||
localize();
|
.localize();
|
||||||
} else {
|
} else {
|
||||||
return (String) GlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"ui.admin.applications.ApplicationInfoSection.singleton.no").
|
"ui.admin.applications.ApplicationInfoSection.singleton.no")
|
||||||
localize();
|
.localize();
|
||||||
}
|
}
|
||||||
case APP_DESC:
|
case APP_DESC:
|
||||||
return applicationType.description();
|
return applicationType.description();
|
||||||
case SINGLETON_PATH:
|
case SINGLETON_PATH:
|
||||||
final String path;
|
final String path;
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final ApplicationRepository appRepo;
|
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||||
try {
|
ApplicationRepository.class);
|
||||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
final List<CcmApplication> instances
|
final List<CcmApplication> instances
|
||||||
= appRepo.findByType(
|
= appRepo.findByType(
|
||||||
applicationType.name());
|
applicationType.name());
|
||||||
if (instances.isEmpty()) {
|
if (instances.isEmpty()) {
|
||||||
path = "";
|
path = "";
|
||||||
} else {
|
} else {
|
||||||
path = instances.get(0).getPrimaryUrl();
|
path = instances.get(0).getPrimaryUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
import com.arsdigita.ui.admin.GlobalizationUtil;
|
import com.arsdigita.ui.admin.GlobalizationUtil;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.web.ApplicationRepository;
|
import org.libreccm.web.ApplicationRepository;
|
||||||
import org.libreccm.web.ApplicationType;
|
import org.libreccm.web.ApplicationType;
|
||||||
|
|
@ -137,12 +137,7 @@ public class MultiInstanceApplicationPane<T extends CcmApplication>
|
||||||
final String appType) {
|
final String appType) {
|
||||||
this.table = table;
|
this.table = table;
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final ApplicationRepository appRepo;
|
final ApplicationRepository appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||||
try {
|
|
||||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
final List<CcmApplication> applications = appRepo.
|
final List<CcmApplication> applications = appRepo.
|
||||||
findByType(appType);
|
findByType(appType);
|
||||||
for (CcmApplication application : applications) {
|
for (CcmApplication application : applications) {
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,11 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.tree.TreeModel;
|
import com.arsdigita.bebop.tree.TreeModel;
|
||||||
import com.arsdigita.bebop.tree.TreeNode;
|
import com.arsdigita.bebop.tree.TreeNode;
|
||||||
import com.arsdigita.ui.admin.ApplicationsAdministrationTab;
|
import com.arsdigita.ui.admin.ApplicationsAdministrationTab;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.web.ApplicationManager;
|
import org.libreccm.web.ApplicationManager;
|
||||||
import org.libreccm.web.ApplicationRepository;
|
import org.libreccm.web.ApplicationRepository;
|
||||||
|
|
@ -34,9 +34,11 @@ import org.libreccm.web.ApplicationType;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link TreeModel} for the tree of applications in {@link ApplicationsAdministrationTab}. The tree consists of two
|
* A {@link TreeModel} for the tree of applications in
|
||||||
* different types of nodes: Nodes for {@link ApplicationTypes} and nodes for {@link Application} instances.
|
* {@link ApplicationsAdministrationTab}. The tree consists of two different
|
||||||
*
|
* types of nodes: Nodes for {@link ApplicationTypes} and nodes for
|
||||||
|
* {@link CCmApplication} instances.
|
||||||
|
*
|
||||||
* @author Jens Pelzetter <jens@jp-digital.de>
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
* @version $Id: ApplicationTreeModel.java 2406 2013-10-31 19:52:22Z jensp $
|
* @version $Id: ApplicationTreeModel.java 2406 2013-10-31 19:52:22Z jensp $
|
||||||
*/
|
*/
|
||||||
|
|
@ -56,7 +58,8 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
if (node instanceof RootTreeNode) {
|
if (node instanceof RootTreeNode) {
|
||||||
return true;
|
return true;
|
||||||
} else if (node instanceof ApplicationTypeTreeNode) {
|
} else if (node instanceof ApplicationTypeTreeNode) {
|
||||||
final ApplicationTypeTreeNode typeTreeNode = (ApplicationTypeTreeNode) node;
|
final ApplicationTypeTreeNode typeTreeNode
|
||||||
|
= (ApplicationTypeTreeNode) node;
|
||||||
|
|
||||||
//if (typeTreeNode.getApplicationType().isSingleton()) {
|
//if (typeTreeNode.getApplicationType().isSingleton()) {
|
||||||
if (typeTreeNode.isSingleton()) {
|
if (typeTreeNode.isSingleton()) {
|
||||||
|
|
@ -64,14 +67,15 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
} else {
|
} else {
|
||||||
//return !retrieveApplicationInstances(typeTreeNode.getApplicationType()).isEmpty();
|
//return !retrieveApplicationInstances(typeTreeNode.getApplicationType()).isEmpty();
|
||||||
//return !retrieveApplicationInstances(typeTreeNode.getApplicationType()).isEmpty();
|
//return !retrieveApplicationInstances(typeTreeNode.getApplicationType()).isEmpty();
|
||||||
return !retrieveApplicationInstances(typeTreeNode.getObjecType()).isEmpty();
|
return !retrieveApplicationInstances(typeTreeNode.getObjecType())
|
||||||
|
.isEmpty();
|
||||||
}
|
}
|
||||||
} else if (node instanceof ApplicationInstanceTreeNode) {
|
} else if (node instanceof ApplicationInstanceTreeNode) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The ApplicationTreeModel can only work with ApplicationTypeTreeNodes and"
|
"The ApplicationTreeModel can only work with ApplicationTypeTreeNodes and"
|
||||||
+ "ApplicationInstanceTreeNodes.");
|
+ "ApplicationInstanceTreeNodes.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,63 +83,49 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
public Iterator getChildren(final TreeNode node, final PageState state) {
|
public Iterator getChildren(final TreeNode node, final PageState state) {
|
||||||
if (node instanceof RootTreeNode) {
|
if (node instanceof RootTreeNode) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final ApplicationManager appManager;
|
final ApplicationManager appManager = cdiUtil.findBean(
|
||||||
try {
|
ApplicationManager.class);
|
||||||
appManager = cdiUtil.findBean(ApplicationManager.class);
|
|
||||||
} catch(CdiLookupException ex) {
|
final Collection<ApplicationType> appTypes = appManager
|
||||||
throw new UncheckedWrapperException(ex);
|
.getApplicationTypes().values();
|
||||||
}
|
|
||||||
|
|
||||||
final Collection<ApplicationType> appTypes = appManager.getApplicationTypes().values();
|
|
||||||
|
|
||||||
return new AppTypesIterator(appTypes);
|
return new AppTypesIterator(appTypes);
|
||||||
} else if (node instanceof ApplicationTypeTreeNode) {
|
} else if (node instanceof ApplicationTypeTreeNode) {
|
||||||
final ApplicationTypeTreeNode typeTreeNode = (ApplicationTypeTreeNode) node;
|
final ApplicationTypeTreeNode typeTreeNode
|
||||||
|
= (ApplicationTypeTreeNode) node;
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final ApplicationRepository appRepo;
|
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||||
try {
|
ApplicationRepository.class);
|
||||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<CcmApplication> applications = appRepo.findByType(
|
final List<CcmApplication> applications = appRepo.findByType(
|
||||||
typeTreeNode.getObjecType());
|
typeTreeNode.getObjecType());
|
||||||
|
|
||||||
return new AppIterator(applications);
|
return new AppIterator(applications);
|
||||||
} else if (node instanceof ApplicationInstanceTreeNode) {
|
} else if (node instanceof ApplicationInstanceTreeNode) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"The ApplicationTreeModel can only work with ApplicationTypeTreeNodes and"
|
"The ApplicationTreeModel can only work with ApplicationTypeTreeNodes and"
|
||||||
+ "ApplicationInstanceTreeNodes.");
|
+ "ApplicationInstanceTreeNodes.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CcmApplication> retrieveApplicationInstances(
|
private List<CcmApplication> retrieveApplicationInstances(
|
||||||
final ApplicationType applicationType) {
|
final ApplicationType applicationType) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final ApplicationRepository appRepo;
|
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||||
try {
|
ApplicationRepository.class);
|
||||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return appRepo.findByType(applicationType.name());
|
return appRepo.findByType(applicationType.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CcmApplication> retrieveApplicationInstances(
|
private List<CcmApplication> retrieveApplicationInstances(
|
||||||
final String appObjectType) {
|
final String appObjectType) {
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final ApplicationRepository appRepo;
|
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||||
try {
|
ApplicationRepository.class);
|
||||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return appRepo.findByType(appObjectType);
|
return appRepo.findByType(appObjectType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,4 +196,5 @@ public class ApplicationTreeModel implements TreeModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,29 +36,21 @@ import com.arsdigita.bebop.form.Hidden;
|
||||||
import com.arsdigita.bebop.form.Password;
|
import com.arsdigita.bebop.form.Password;
|
||||||
import com.arsdigita.bebop.form.Submit;
|
import com.arsdigita.bebop.form.Submit;
|
||||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
|
||||||
import com.arsdigita.bebop.parameters.URLParameter;
|
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.ui.UI;
|
import com.arsdigita.ui.UI;
|
||||||
import com.arsdigita.web.Web;
|
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.web.ReturnSignal;
|
import com.arsdigita.web.ReturnSignal;
|
||||||
import com.arsdigita.mail.Mail;
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
import org.libreccm.security.UserManager;
|
import org.libreccm.security.UserManager;
|
||||||
import org.libreccm.security.UserRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Form that allows a user to change their password by entering their old
|
* A Form that allows a user to change their password by entering their old
|
||||||
|
|
@ -131,14 +123,8 @@ public class ChangePasswordForm extends Form
|
||||||
add(m_returnURL);
|
add(m_returnURL);
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final Subject subject;
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
final Shiro shiro;
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
try {
|
|
||||||
subject = cdiUtil.findBean(Subject.class);
|
|
||||||
shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||||
final User user = shiro.getUser();
|
final User user = shiro.getUser();
|
||||||
|
|
@ -207,15 +193,9 @@ public class ChangePasswordForm extends Form
|
||||||
String confirmPassword = (String) m_confirmPassword.getValue(state);
|
String confirmPassword = (String) m_confirmPassword.getValue(state);
|
||||||
|
|
||||||
//check oldPassword
|
//check oldPassword
|
||||||
final Shiro shiro;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final UserManager userManager;
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
try {
|
final UserManager userManager = cdiUtil.findBean(UserManager.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
userManager = cdiUtil.findBean(UserManager.class);
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final User user = shiro.getUser();
|
final User user = shiro.getUser();
|
||||||
if (!userManager.verifyPassword(user, oldPassword)) {
|
if (!userManager.verifyPassword(user, oldPassword)) {
|
||||||
|
|
@ -261,16 +241,9 @@ public class ChangePasswordForm extends Form
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final UserManager userManager;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final Shiro shiro;
|
final UserManager userManager = cdiUtil.findBean(UserManager.class);
|
||||||
try {
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
userManager = cdiUtil.findBean(UserManager.class);
|
|
||||||
shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final User user = shiro.getUser();
|
final User user = shiro.getUser();
|
||||||
|
|
||||||
final String newPassword = (String) m_newPassword.getValue(state);
|
final String newPassword = (String) m_newPassword.getValue(state);
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,13 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.ui.login;
|
package com.arsdigita.ui.login;
|
||||||
|
|
||||||
import com.arsdigita.web.Web;
|
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.parameters.EmailParameter;
|
import com.arsdigita.bebop.parameters.EmailParameter;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import javax.mail.internet.AddressException;
|
|
||||||
import javax.mail.internet.InternetAddress;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
@ -59,16 +53,10 @@ public class EmailInitListener implements FormInitListener {
|
||||||
|
|
||||||
s_log.debug("START");
|
s_log.debug("START");
|
||||||
|
|
||||||
final Subject subject;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final Shiro shiro;
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
try {
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
subject = cdiUtil.findBean(Subject.class);
|
|
||||||
shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!subject.isAuthenticated()) {
|
if (!subject.isAuthenticated()) {
|
||||||
s_log.debug("FAILURE not logged in");
|
s_log.debug("FAILURE not logged in");
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -23,60 +23,50 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.web.Web;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
|
|
||||||
// Note: Previously used SiteNodeRequestContext, nows using KernelRequestContext
|
// Note: Previously used SiteNodeRequestContext, nows using KernelRequestContext
|
||||||
// may be one cause that Login doesn't survive if the brwoser window is
|
// may be one cause that Login doesn't survive if the brwoser window is
|
||||||
// closed.
|
// closed.
|
||||||
/**
|
/**
|
||||||
* Initializes the value of the given parameter to the current user's
|
* Initializes the value of the given parameter to the current user's screen
|
||||||
* screen name. Strangely similar to <code>EmailInitListener</code>.
|
* name. Strangely similar to <code>EmailInitListener</code>.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:cwolfe@redhat.com">Crag Wolfe</a>
|
* @author <a href="mailto:cwolfe@redhat.com">Crag Wolfe</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class ScreenNameInitListener implements FormInitListener {
|
public class ScreenNameInitListener implements FormInitListener {
|
||||||
|
|
||||||
private static Logger s_log =
|
private static Logger s_log = Logger.getLogger(ScreenNameInitListener.class
|
||||||
Logger.getLogger(ScreenNameInitListener.class.getName());
|
.getName());
|
||||||
private StringParameter m_param;
|
private StringParameter m_param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param param
|
* @param param
|
||||||
*/
|
*/
|
||||||
public ScreenNameInitListener(StringParameter param) {
|
public ScreenNameInitListener(StringParameter param) {
|
||||||
m_param = param;
|
m_param = param;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
public void init(FormSectionEvent event) {
|
public void init(FormSectionEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
FormData data = event.getFormData();
|
FormData data = event.getFormData();
|
||||||
s_log.debug("START");
|
s_log.debug("START");
|
||||||
|
|
||||||
final Subject subject;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final Shiro shiro;
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
try {
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
subject = cdiUtil.findBean(Subject.class);
|
|
||||||
shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!subject.isAuthenticated()) {
|
if (!subject.isAuthenticated()) {
|
||||||
s_log.debug("FAILURE not logged in");
|
s_log.debug("FAILURE not logged in");
|
||||||
return;
|
return;
|
||||||
|
|
@ -87,8 +77,9 @@ public class ScreenNameInitListener implements FormInitListener {
|
||||||
s_log.debug("FAILURE null screen name");
|
s_log.debug("FAILURE null screen name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.put(m_param.getName(), user.getName());
|
data.put(m_param.getName(), user.getName());
|
||||||
s_log.debug("SUCCESS");
|
s_log.debug("SUCCESS");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,12 @@ import com.arsdigita.kernel.security.Util;
|
||||||
|
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
import com.arsdigita.web.LoginSignal;
|
import com.arsdigita.web.LoginSignal;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.User;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -52,7 +50,7 @@ import org.apache.shiro.subject.Subject;
|
||||||
public class UserAuthenticationListener implements RequestListener {
|
public class UserAuthenticationListener implements RequestListener {
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(
|
private static final Logger s_log = Logger.getLogger(
|
||||||
UserAuthenticationListener.class);
|
UserAuthenticationListener.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the user is logged in, returns the User object.
|
* If the user is logged in, returns the User object.
|
||||||
|
|
@ -62,22 +60,15 @@ public class UserAuthenticationListener implements RequestListener {
|
||||||
* @return the User object for the logged in user
|
* @return the User object for the logged in user
|
||||||
*
|
*
|
||||||
* @throws IllegalStateException if user is not logged in. Call isLoggedIn()
|
* @throws IllegalStateException if user is not logged in. Call isLoggedIn()
|
||||||
* to check for this case.
|
* to check for this case.
|
||||||
*/
|
*/
|
||||||
public Subject getUser(final PageState state) {
|
public Subject getUser(final PageState state) {
|
||||||
if (!isLoggedIn(state)) {
|
if (!isLoggedIn(state)) {
|
||||||
throw new IllegalStateException("User is not logged in");
|
throw new IllegalStateException("User is not logged in");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: aborts processing with an internal error if user not logged in!
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// Not suiteable just to check log in status.
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
final Subject subject;
|
|
||||||
try {
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
subject = cdiUtil.findBean(Subject.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return subject;
|
return subject;
|
||||||
}
|
}
|
||||||
|
|
@ -102,11 +93,11 @@ public class UserAuthenticationListener implements RequestListener {
|
||||||
@Override
|
@Override
|
||||||
public void pageRequested(final RequestEvent event) {
|
public void pageRequested(final RequestEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
if (!isLoggedIn(state)) {
|
if (!isLoggedIn(state)) {
|
||||||
s_log.debug("User is not logged in");
|
s_log.debug("User is not logged in");
|
||||||
redirectToLoginPage(state);
|
redirectToLoginPage(state);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ import com.arsdigita.web.ReturnSignal;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.core.EmailAddress;
|
import org.libreccm.core.EmailAddress;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
@ -46,7 +45,7 @@ import org.libreccm.security.UserRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits a user. If returnURL is passed in to the form, then redirects to that
|
* Edits a user. If returnURL is passed in to the form, then redirects to that
|
||||||
URL_MSG; otherwise redirects to the user workspace.
|
* URL_MSG; otherwise redirects to the user workspace.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Sameer Ajmani
|
* @author Sameer Ajmani
|
||||||
|
|
@ -66,15 +65,10 @@ public class UserEditForm extends UserForm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object initialValue(final PageState ps) {
|
public Object initialValue(final PageState ps) {
|
||||||
final User result;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final User result = shiro.getUser();
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
result = shiro.getUser();
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,14 +103,10 @@ public class UserEditForm extends UserForm
|
||||||
FormData data = event.getFormData();
|
FormData data = event.getFormData();
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
final UserRepository userRepository;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final UserRepository userRepository = cdiUtil.findBean(
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
UserRepository.class);
|
||||||
userRepository = cdiUtil.findBean(UserRepository.class);
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
User user = getUser(state);
|
User user = getUser(state);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new UncheckedWrapperException(
|
throw new UncheckedWrapperException(
|
||||||
|
|
@ -130,7 +120,7 @@ public class UserEditForm extends UserForm
|
||||||
newAddress.setAddress(data.get(FORM_EMAIL).toString());
|
newAddress.setAddress(data.get(FORM_EMAIL).toString());
|
||||||
user.setPrimaryEmailAddress(newAddress);
|
user.setPrimaryEmailAddress(newAddress);
|
||||||
userRepository.save(user);
|
userRepository.save(user);
|
||||||
|
|
||||||
// redirect to workspace or return URL_MSG, if specified
|
// redirect to workspace or return URL_MSG, if specified
|
||||||
final HttpServletRequest req = state.getRequest();
|
final HttpServletRequest req = state.getRequest();
|
||||||
final String path = UI.getWorkspaceURL();
|
final String path = UI.getWorkspaceURL();
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,8 @@ import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
import org.libreccm.security.UserRepository;
|
import org.libreccm.security.UserRepository;
|
||||||
|
|
@ -257,14 +255,9 @@ public abstract class UserForm extends Form
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
final FormData data = event.getFormData();
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
final UserRepository userRepository;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final UserRepository userRepository = cdiUtil.findBean(UserRepository.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
userRepository = cdiUtil.findBean(UserRepository.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (m_newUser) {
|
if (m_newUser) {
|
||||||
// Verify that password and confirmation match
|
// Verify that password and confirmation match
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.SimpleComponent;
|
import com.arsdigita.bebop.SimpleComponent;
|
||||||
import com.arsdigita.bebop.SimpleContainer;
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
|
@ -32,8 +31,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.shiro.subject.Subject;
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
@ -109,15 +106,9 @@ public class UserInfo extends SimpleContainer {
|
||||||
m_contentCenters = new ArrayList<>();
|
m_contentCenters = new ArrayList<>();
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final ApplicationRepository appRepo;
|
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||||
try {
|
|
||||||
appRepo = cdiUtil.findBean(
|
|
||||||
ApplicationRepository.class);
|
ApplicationRepository.class);
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(
|
|
||||||
"Failed to lookup ApplicationRepository", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_contentCenters = appRepo.findByType(
|
m_contentCenters = appRepo.findByType(
|
||||||
"com.arsdigita.cms.ContentCenter");
|
"com.arsdigita.cms.ContentCenter");
|
||||||
}
|
}
|
||||||
|
|
@ -217,14 +208,9 @@ public class UserInfo extends SimpleContainer {
|
||||||
throw new IllegalStateException("user is not logged in");
|
throw new IllegalStateException("user is not logged in");
|
||||||
}
|
}
|
||||||
|
|
||||||
final User user;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final User user = shiro.getUser();
|
||||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
user = shiro.getUser();
|
|
||||||
} catch(CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.*;
|
||||||
|
|
||||||
|
|
@ -53,14 +52,12 @@ import com.arsdigita.web.ParameterMap;
|
||||||
import com.arsdigita.web.RedirectSignal;
|
import com.arsdigita.web.RedirectSignal;
|
||||||
import com.arsdigita.web.ReturnSignal;
|
import com.arsdigita.web.ReturnSignal;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import javax.security.auth.login.FailedLoginException;
|
|
||||||
import javax.security.auth.login.LoginException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
|
@ -142,14 +139,14 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
add(m_timestamp);
|
add(m_timestamp);
|
||||||
|
|
||||||
m_returnURL = new Hidden(new URLParameter(
|
m_returnURL = new Hidden(new URLParameter(
|
||||||
LoginHelper.RETURN_URL_PARAM_NAME));
|
LoginHelper.RETURN_URL_PARAM_NAME));
|
||||||
m_returnURL.setPassIn(true);
|
m_returnURL.setPassIn(true);
|
||||||
add(m_returnURL);
|
add(m_returnURL);
|
||||||
|
|
||||||
setupLogin();
|
setupLogin();
|
||||||
|
|
||||||
add(new Label(LoginHelper.getMessage(
|
add(new Label(LoginHelper.getMessage(
|
||||||
"login.userRegistrationForm.password")));
|
"login.userRegistrationForm.password")));
|
||||||
m_password = new Password(new StringParameter(FORM_PASSWORD));
|
m_password = new Password(new StringParameter(FORM_PASSWORD));
|
||||||
// Since new users should not enter a password, allow null.
|
// Since new users should not enter a password, allow null.
|
||||||
//m_password.addValidationListener(new NotNullValidationListener());
|
//m_password.addValidationListener(new NotNullValidationListener());
|
||||||
|
|
@ -158,7 +155,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
SimpleContainer cookiePanel = new BoxPanel(BoxPanel.HORIZONTAL);
|
SimpleContainer cookiePanel = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||||
m_isPersistent = new CheckboxGroup(FORM_PERSISTENT_LOGIN_P);
|
m_isPersistent = new CheckboxGroup(FORM_PERSISTENT_LOGIN_P);
|
||||||
Label optLabel = new Label(LoginHelper.getMessage(
|
Label optLabel = new Label(LoginHelper.getMessage(
|
||||||
"login.userRegistrationForm.cookieOption"));
|
"login.userRegistrationForm.cookieOption"));
|
||||||
Option opt = new Option(FORM_PERSISTENT_LOGIN_P_DEFAULT, optLabel);
|
Option opt = new Option(FORM_PERSISTENT_LOGIN_P_DEFAULT, optLabel);
|
||||||
m_isPersistent.addOption(opt);
|
m_isPersistent.addOption(opt);
|
||||||
if (KernelConfig.getConfig().isLoginRemembered()) {
|
if (KernelConfig.getConfig().isLoginRemembered()) {
|
||||||
|
|
@ -167,8 +164,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
cookiePanel.add(m_isPersistent);
|
cookiePanel.add(m_isPersistent);
|
||||||
|
|
||||||
cookiePanel.add(new DynamicLink(
|
cookiePanel.add(new DynamicLink(
|
||||||
"login.userRegistrationForm.explainCookieLink",
|
"login.userRegistrationForm.explainCookieLink",
|
||||||
LoginServlet.getCookiesExplainPageURL()));
|
LoginServlet.getCookiesExplainPageURL()));
|
||||||
add(cookiePanel);
|
add(cookiePanel);
|
||||||
|
|
||||||
add(new Submit(SUBMIT), ColumnPanel.CENTER | ColumnPanel.FULL_WIDTH);
|
add(new Submit(SUBMIT), ColumnPanel.CENTER | ColumnPanel.FULL_WIDTH);
|
||||||
|
|
@ -192,8 +189,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*/
|
*/
|
||||||
private void setupLogin() {
|
private void setupLogin() {
|
||||||
SimpleContainer loginMessage = new SimpleContainer(
|
SimpleContainer loginMessage = new SimpleContainer(
|
||||||
"subsite:loginPromptMsg",
|
"subsite:loginPromptMsg",
|
||||||
LoginServlet.SUBSITE_NS_URI);
|
LoginServlet.SUBSITE_NS_URI);
|
||||||
|
|
||||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||||
loginMessage.setClassAttr("email");
|
loginMessage.setClassAttr("email");
|
||||||
|
|
@ -205,17 +202,17 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
|
|
||||||
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
if (KernelConfig.getConfig().emailIsPrimaryIdentifier()) {
|
||||||
add(new Label(LoginHelper.getMessage(
|
add(new Label(LoginHelper.getMessage(
|
||||||
"login.userRegistrationForm.email")));
|
"login.userRegistrationForm.email")));
|
||||||
m_loginName = new TextField(new EmailParameter(FORM_LOGIN));
|
m_loginName = new TextField(new EmailParameter(FORM_LOGIN));
|
||||||
addInitListener(new EmailInitListener((EmailParameter) m_loginName.
|
addInitListener(new EmailInitListener((EmailParameter) m_loginName.
|
||||||
getParameterModel()));
|
getParameterModel()));
|
||||||
} else {
|
} else {
|
||||||
add(new Label(LoginHelper.getMessage(
|
add(new Label(LoginHelper.getMessage(
|
||||||
"login.userRegistrationForm.screenName")));
|
"login.userRegistrationForm.screenName")));
|
||||||
m_loginName = new TextField(new StringParameter(FORM_LOGIN));
|
m_loginName = new TextField(new StringParameter(FORM_LOGIN));
|
||||||
addInitListener(new ScreenNameInitListener(
|
addInitListener(new ScreenNameInitListener(
|
||||||
(StringParameter) m_loginName.
|
(StringParameter) m_loginName.
|
||||||
getParameterModel()));
|
getParameterModel()));
|
||||||
}
|
}
|
||||||
m_loginName.addValidationListener(new NotNullValidationListener());
|
m_loginName.addValidationListener(new NotNullValidationListener());
|
||||||
add(m_loginName);
|
add(m_loginName);
|
||||||
|
|
@ -229,14 +226,14 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void init(FormSectionEvent event)
|
public void init(FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
s_log.info("In init");
|
s_log.info("In init");
|
||||||
if (KernelConfig.getConfig().isSSOenabled()) {
|
if (KernelConfig.getConfig().isSSOenabled()) {
|
||||||
// try SSO login
|
// try SSO login
|
||||||
s_log.info("trying SSO");
|
s_log.info("trying SSO");
|
||||||
// try {
|
// try {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
"SSO currently not supported");
|
"SSO currently not supported");
|
||||||
// Web.getUserContext().loginSSO();
|
// Web.getUserContext().loginSSO();
|
||||||
// s_log.info("loginSSO ok, now processing redirect_url");
|
// s_log.info("loginSSO ok, now processing redirect_url");
|
||||||
// process(event);
|
// process(event);
|
||||||
|
|
@ -267,7 +264,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void validate(FormSectionEvent event)
|
public void validate(FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
|
|
||||||
s_log.debug("In validate");
|
s_log.debug("In validate");
|
||||||
|
|
||||||
|
|
@ -306,7 +303,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void process(final FormSectionEvent event)
|
public void process(final FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
s_log.debug("In process");
|
s_log.debug("In process");
|
||||||
|
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
@ -332,26 +329,20 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void loginUser(final FormSectionEvent event)
|
protected void loginUser(final FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final Subject subject;
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
try {
|
|
||||||
subject = cdiUtil.findBean(Subject.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final UsernamePasswordToken token = new UsernamePasswordToken(
|
final UsernamePasswordToken token = new UsernamePasswordToken(
|
||||||
(String) m_loginName.getValue(state),
|
(String) m_loginName.getValue(state),
|
||||||
(String) m_password.getValue(state)
|
(String) m_password.getValue(state)
|
||||||
);
|
);
|
||||||
token.setRememberMe(getPersistentLoginValue(state,
|
token.setRememberMe(getPersistentLoginValue(state, false));
|
||||||
false));
|
|
||||||
try {
|
try {
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
} catch(AuthenticationException ex) {
|
} catch (AuthenticationException ex) {
|
||||||
onLoginFail(event, ex);
|
onLoginFail(event, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,12 +362,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
// // attempt to log in user
|
// // attempt to log in user
|
||||||
// final CdiUtil cdiUtil = new CdiUtil();
|
// final CdiUtil cdiUtil = new CdiUtil();
|
||||||
// final LoginManager loginManager;
|
// final LoginManager loginManager;
|
||||||
// try {
|
|
||||||
// loginManager = cdiUtil.findBean(LoginManager.class);
|
// loginManager = cdiUtil.findBean(LoginManager.class);
|
||||||
// } catch (CdiLookupException ex) {
|
|
||||||
// throw new UncheckedWrapperException(
|
|
||||||
// "Failed to lookup LoginManager", ex);
|
|
||||||
// }
|
|
||||||
// loginManager.login(username, password);
|
// loginManager.login(username, password);
|
||||||
// onLoginSuccess(event);
|
// onLoginSuccess(event);
|
||||||
// } catch (FailedLoginException e) {
|
// } catch (FailedLoginException e) {
|
||||||
|
|
@ -395,7 +382,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void onLoginSuccess(final FormSectionEvent event)
|
protected void onLoginSuccess(final FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -411,7 +398,6 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
// throws FormProcessException {
|
// throws FormProcessException {
|
||||||
// onLoginFail(event, ex);
|
// onLoginFail(event, ex);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executed when login fails with a bad password or when autoLoginOn is set
|
* Executed when login fails with a bad password or when autoLoginOn is set
|
||||||
* to false and the user doesn't exist. Default implementation marks
|
* to false and the user doesn't exist. Default implementation marks
|
||||||
|
|
@ -425,7 +411,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*/
|
*/
|
||||||
protected void onLoginFail(final FormSectionEvent event,
|
protected void onLoginFail(final FormSectionEvent event,
|
||||||
final AuthenticationException ex)
|
final AuthenticationException ex)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
s_log.debug("Login fail");
|
s_log.debug("Login fail");
|
||||||
event.getFormData().addError(ERROR_LOGIN_FAIL);
|
event.getFormData().addError(ERROR_LOGIN_FAIL);
|
||||||
}
|
}
|
||||||
|
|
@ -436,6 +422,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*
|
*
|
||||||
* @param event
|
* @param event
|
||||||
* @param ex
|
* @param ex
|
||||||
|
*
|
||||||
* @throws com.arsdigita.bebop.FormProcessException
|
* @throws com.arsdigita.bebop.FormProcessException
|
||||||
*/
|
*/
|
||||||
// protected void onLoginException(final FormSectionEvent event,
|
// protected void onLoginException(final FormSectionEvent event,
|
||||||
|
|
@ -445,7 +432,6 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
// s_log.error("Login failed", ex);
|
// s_log.error("Login failed", ex);
|
||||||
// throw new FormProcessException(ex);
|
// throw new FormProcessException(ex);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether a persistent cookie is requested in the given form.
|
* Determines whether a persistent cookie is requested in the given form.
|
||||||
* FORM_PERSISTENT_LOGIN_P whose value is equal to "1". If there is no such
|
* FORM_PERSISTENT_LOGIN_P whose value is equal to "1". If there is no such
|
||||||
|
|
@ -453,6 +439,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
* @param defaultValue
|
* @param defaultValue
|
||||||
|
*
|
||||||
* @return true if the specified formdata has a field named
|
* @return true if the specified formdata has a field named
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,9 @@ package com.arsdigita.ui.login;
|
||||||
|
|
||||||
import com.arsdigita.bebop.event.ActionEvent;
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
import com.arsdigita.bebop.event.ActionListener;
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -47,14 +45,8 @@ public class UserLogoutListener implements ActionListener {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
|
||||||
final Subject subject;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
subject = cdiUtil.findBean(Subject.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
subject.logout();
|
subject.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.bebop.parameters.URLParameter;
|
import com.arsdigita.bebop.parameters.URLParameter;
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
import com.arsdigita.ui.UI;
|
import com.arsdigita.ui.UI;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
import com.arsdigita.web.ReturnSignal;
|
import com.arsdigita.web.ReturnSignal;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import static com.arsdigita.ui.login.LoginConstants.*;
|
import static com.arsdigita.ui.login.LoginConstants.*;
|
||||||
|
|
@ -46,18 +46,16 @@ import org.apache.log4j.Logger;
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
import org.libreccm.security.UserManager;
|
import org.libreccm.security.UserManager;
|
||||||
import org.libreccm.security.UserRepository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new user. Collects user's basic info, such as email, password,
|
* Creates a new user. Collects user's basic info, such as email, password,
|
||||||
first name, last name, etc; then tries to create the user in the database. If
|
* first name, last name, etc; then tries to create the user in the database. If
|
||||||
returnURL is passed in to the form, then redirects to that URL_MSG; otherwise
|
* returnURL is passed in to the form, then redirects to that URL_MSG; otherwise
|
||||||
redirects to the user workspace.
|
* redirects to the user workspace.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @author Michael Bryzek
|
* @author Michael Bryzek
|
||||||
|
|
@ -98,7 +96,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
|
|
||||||
// save return URL_MSG
|
// save return URL_MSG
|
||||||
m_returnURL = new Hidden(new URLParameter(
|
m_returnURL = new Hidden(new URLParameter(
|
||||||
LoginHelper.RETURN_URL_PARAM_NAME));
|
LoginHelper.RETURN_URL_PARAM_NAME));
|
||||||
m_returnURL.setPassIn(true);
|
m_returnURL.setPassIn(true);
|
||||||
add(m_returnURL);
|
add(m_returnURL);
|
||||||
|
|
||||||
|
|
@ -116,7 +114,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final FormSectionEvent event)
|
public void init(final FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
// clear passwords from form data
|
// clear passwords from form data
|
||||||
m_password.setValue(state, "");
|
m_password.setValue(state, "");
|
||||||
|
|
@ -133,11 +131,11 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(final FormSectionEvent event)
|
public void process(final FormSectionEvent event)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
final InternetAddress address = (InternetAddress) m_email
|
final InternetAddress address = (InternetAddress) m_email
|
||||||
.getValue(state);
|
.getValue(state);
|
||||||
final String email = address.getAddress();
|
final String email = address.getAddress();
|
||||||
|
|
||||||
// TODO: set additional emails
|
// TODO: set additional emails
|
||||||
|
|
@ -153,26 +151,17 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
|
|
||||||
final Exception[] formExceptions = new Exception[]{null};
|
final Exception[] formExceptions = new Exception[]{null};
|
||||||
|
|
||||||
final Shiro shiro;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
shiro = cdiUtil.findBean(Shiro.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
shiro.getSystemUser().execute(new Callable<Void>() {
|
shiro.getSystemUser().execute(new Callable<Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void call() throws Exception {
|
public Void call() throws Exception {
|
||||||
|
|
||||||
final UserManager userManager;
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final UserManager userManager = cdiUtil.findBean(
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
UserManager.class);
|
||||||
userManager = cdiUtil.findBean(UserManager.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
userManager.createUser(firstName,
|
userManager.createUser(firstName,
|
||||||
lastName,
|
lastName,
|
||||||
screenName,
|
screenName,
|
||||||
|
|
@ -181,6 +170,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -191,7 +181,6 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
loginName = screenName;
|
loginName = screenName;
|
||||||
}
|
}
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
|
||||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||||
|
|
||||||
if (subject.isAuthenticated()) {
|
if (subject.isAuthenticated()) {
|
||||||
|
|
@ -199,9 +188,9 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
final UsernamePasswordToken token = new UsernamePasswordToken(
|
final UsernamePasswordToken token = new UsernamePasswordToken(
|
||||||
loginName, password);
|
loginName, password);
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
} catch (CdiLookupException | AuthenticationException ex) {
|
} catch (AuthenticationException ex) {
|
||||||
s_log.error("login failed for new user", ex);
|
s_log.error("login failed for new user", ex);
|
||||||
throw new FormProcessException(ex);
|
throw new FormProcessException(ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.web;
|
package com.arsdigita.web;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
import org.libreccm.web.ApplicationRepository;
|
import org.libreccm.web.ApplicationRepository;
|
||||||
|
|
@ -39,7 +37,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* Most CCM applications will extend this class by implementing
|
* Most CCM applications will extend this class by implementing
|
||||||
* {@link #doService(HttpServletRequest,HttpServletResponse,Application)} to
|
* {@link #doService(HttpServletRequest,HttpServletResponse,CcmApplication)} to
|
||||||
* perform application-private dispatch to UI code.</p>
|
* perform application-private dispatch to UI code.</p>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -91,7 +89,7 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Augments the context of the request and delegates to {@link
|
* Augments the context of the request and delegates to {@link
|
||||||
* #doService(HttpServletRequest,HttpServletResponse,Application)}.</p>
|
* #doService(HttpServletRequest,HttpServletResponse,CcmApplication)}.</p>
|
||||||
*
|
*
|
||||||
* @throws javax.servlet.ServletException
|
* @throws javax.servlet.ServletException
|
||||||
* @throws java.io.IOException
|
* @throws java.io.IOException
|
||||||
|
|
@ -119,7 +117,6 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
||||||
//
|
//
|
||||||
// final ServletException[] servletException = {null};
|
// final ServletException[] servletException = {null};
|
||||||
// final IOException[] ioException = {null};
|
// final IOException[] ioException = {null};
|
||||||
|
|
||||||
doService(request, response, app);
|
doService(request, response, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,22 +175,17 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
ApplicationRepository.class);
|
||||||
ApplicationRepository.class);
|
return appRepo.findById(appId);
|
||||||
|
|
||||||
return appRepo.findById(appId);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new IllegalStateException(String.format(
|
|
||||||
"Failed to retrieve application %d from the database.", appId));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param sreq
|
* @param sreq
|
||||||
* @param app
|
* @param app
|
||||||
* @param uc
|
* @param uc
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
// private RequestContext makeLegacyContext(HttpServletRequest sreq,
|
// private RequestContext makeLegacyContext(HttpServletRequest sreq,
|
||||||
|
|
@ -212,6 +204,4 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
||||||
//
|
//
|
||||||
// return krc;
|
// return krc;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package com.arsdigita.web;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.ui.UI;
|
import com.arsdigita.ui.UI;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
@ -39,9 +38,8 @@ import javax.servlet.ServletException;
|
||||||
import javax.servlet.annotation.WebServlet;
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
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.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>The CCM main dispatcher. This servlet serves as the main servlet / main
|
* <p>The CCM main dispatcher. This servlet serves as the main servlet / main
|
||||||
|
|
|
||||||
|
|
@ -35,18 +35,26 @@ import static org.libreccm.core.CoreConstants.*;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.NamedQueries;
|
||||||
|
import javax.persistence.NamedQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Association class describing the association between a category and an
|
* Association class describing the association between a category and an
|
||||||
* object. Instances of these class should not created manually.
|
* object. Instances of these class should not created manually. The methods
|
||||||
* The methods provided by the {@link CategoryManager} take care of that.
|
* provided by the {@link CategoryManager} take care of that.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*
|
*
|
||||||
* @apiviz.has org.libreccm.core.CcmObject
|
* @apiviz.has org.libreccm.core.CcmObject
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "CATEGORIZATIONS", schema = DB_SCHEMA)
|
@Table(name = "CATEGORIZATIONS", schema = DB_SCHEMA)
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name = "Categorization.find",
|
||||||
|
query = "SELECT c FROM Categorization c "
|
||||||
|
+ "WHERE c.category = :category "
|
||||||
|
+ "AND c.categorizedObject = :object")
|
||||||
|
})
|
||||||
public class Categorization implements Serializable {
|
public class Categorization implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 201504301320L;
|
private static final long serialVersionUID = 201504301320L;
|
||||||
|
|
@ -81,19 +89,25 @@ public class Categorization implements Serializable {
|
||||||
private boolean index;
|
private boolean index;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the order in which the categories assigned the the categorised
|
* Defines the order in which the categories assigned the the categorised
|
||||||
* object are shown.
|
* object are shown.
|
||||||
*/
|
*/
|
||||||
@Column(name = "CATEGORY_ORDER")
|
@Column(name = "CATEGORY_ORDER")
|
||||||
private long categoryOrder;
|
private long categoryOrder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the order in which the objects assigned to the category are
|
* Defines the order in which the objects assigned to the category are
|
||||||
* shown.
|
* shown.
|
||||||
*/
|
*/
|
||||||
@Column(name = "OBJECT_ORDER")
|
@Column(name = "OBJECT_ORDER")
|
||||||
private long objectOrder;
|
private long objectOrder;
|
||||||
|
|
||||||
|
public Categorization() {
|
||||||
|
index = false;
|
||||||
|
categoryOrder = 0;
|
||||||
|
objectOrder = 0;
|
||||||
|
}
|
||||||
|
|
||||||
public long getCategorizationId() {
|
public long getCategorizationId() {
|
||||||
return categorizationId;
|
return categorizationId;
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +160,7 @@ public class Categorization implements Serializable {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
int hash = 7;
|
||||||
hash
|
hash
|
||||||
= 89 * hash + (int) (categorizationId ^ (categorizationId >>> 32));
|
= 89 * hash + (int) (categorizationId ^ (categorizationId >>> 32));
|
||||||
hash = 89 * hash + Objects.hashCode(category);
|
hash = 89 * hash + Objects.hashCode(category);
|
||||||
hash = 89 * hash + Objects.hashCode(categorizedObject);
|
hash = 89 * hash + Objects.hashCode(categorizedObject);
|
||||||
hash = 89 * hash + (index ? 1 : 0);
|
hash = 89 * hash + (index ? 1 : 0);
|
||||||
|
|
@ -156,7 +170,7 @@ public class Categorization implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
//No chance to make this method less complex, therefore suppress warning
|
//No chance to make this method less complex, therefore suppress warning
|
||||||
@SuppressWarnings("PMD.NPathComplexity")
|
@SuppressWarnings("PMD.NPathComplexity")
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
|
|
@ -201,13 +215,13 @@ public class Categorization implements Serializable {
|
||||||
|
|
||||||
public String toString(final String data) {
|
public String toString(final String data) {
|
||||||
return String.format("%s{ "
|
return String.format("%s{ "
|
||||||
+ "categorizationId = %d, "
|
+ "categorizationId = %d, "
|
||||||
+ "category = %s, "
|
+ "category = %s, "
|
||||||
+ "categorizedObject = %s, "
|
+ "categorizedObject = %s, "
|
||||||
+ "index = %b,"
|
+ "index = %b,"
|
||||||
+ "categoryOrder = %d, "
|
+ "categoryOrder = %d, "
|
||||||
+ "objectOrder = %d"
|
+ "objectOrder = %d"
|
||||||
+ "%s }",
|
+ "%s }",
|
||||||
super.toString(),
|
super.toString(),
|
||||||
categorizationId,
|
categorizationId,
|
||||||
Objects.toString(category),
|
Objects.toString(category),
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,9 @@ import javax.validation.constraints.Pattern;
|
||||||
@Table(name = "CATEGORIES", schema = DB_SCHEMA)
|
@Table(name = "CATEGORIES", schema = DB_SCHEMA)
|
||||||
@NamedQueries({
|
@NamedQueries({
|
||||||
@NamedQuery(name = "Category.topLevelCategories",
|
@NamedQuery(name = "Category.topLevelCategories",
|
||||||
query = "SELECT c FROM Category c WHERE c.parentCategory IS NULL")
|
query = "SELECT c FROM Category c WHERE c.parentCategory IS NULL"),
|
||||||
|
@NamedQuery(name = "Category.findByName",
|
||||||
|
query = "SELECT c FROM Category c WHERE c.name = :name")
|
||||||
})
|
})
|
||||||
public class Category extends CcmObject implements Serializable {
|
public class Category extends CcmObject implements Serializable {
|
||||||
|
|
||||||
|
|
@ -165,6 +167,10 @@ public class Category extends CcmObject implements Serializable {
|
||||||
description = new LocalizedString();
|
description = new LocalizedString();
|
||||||
objects = new ArrayList<>();
|
objects = new ArrayList<>();
|
||||||
subCategories = new ArrayList<>();
|
subCategories = new ArrayList<>();
|
||||||
|
enabled = true;
|
||||||
|
visible= true;
|
||||||
|
abstractCategory = false;
|
||||||
|
categoryOrder = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUniqueId() {
|
public String getUniqueId() {
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,19 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
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.NoResultException;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.libreccm.core.CcmObjectRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code CategoryManager} provides several helper methods for managing
|
* The {@code CategoryManager} provides several helper methods for managing
|
||||||
|
|
@ -32,33 +41,23 @@ import javax.inject.Inject;
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class CategoryManager {
|
public class CategoryManager {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
|
CategoryManager.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link CategoryRepository} instance used to interact with the database.
|
* A {@link CategoryRepository} instance used to interact with the database.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private CategoryRepository categoryRepo;
|
private CategoryRepository categoryRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CcmObjectRepository ccmObjectRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns an category to an object. The object is added at the position
|
* Assigns an category to an object.
|
||||||
* specified by the {@code order} parameter. If that position is already
|
|
||||||
* occupied the object currently assigned to that position and the objects
|
|
||||||
* after that object are moved one position down (the value of their
|
|
||||||
* {@code order} property is increased by one).
|
|
||||||
*
|
|
||||||
* If the position provided by the {@code order} parameter is larger than
|
|
||||||
* the value of the {@code order} property of the last object plus 1 the
|
|
||||||
* order property is set the the value of the {@code order} property of the
|
|
||||||
* last object plus one.
|
|
||||||
*
|
|
||||||
* If the order property is less than 0, the object is inserted at first
|
|
||||||
* position and the value of the {@code order} property is set to {@code 0}.
|
|
||||||
* The value of the {@code order} property of all other objects is increased
|
|
||||||
* by one.
|
|
||||||
*
|
|
||||||
* If the object is already assigned to the category and the value of the
|
|
||||||
* {@code order} property is different than the provided value the
|
|
||||||
* {@code order} property is set the provided value. No further action will
|
|
||||||
* executed.
|
|
||||||
*
|
*
|
||||||
* Please note: Because the association between {@link Category} and {@code
|
* Please note: Because the association between {@link Category} and {@code
|
||||||
* CcmObject} is a many-to-many association we use an association object to
|
* CcmObject} is a many-to-many association we use an association object to
|
||||||
|
|
@ -73,21 +72,38 @@ public class CategoryManager {
|
||||||
* {@code null}.
|
* {@code null}.
|
||||||
* @param category The category to which the object should be assigned. Can
|
* @param category The category to which the object should be assigned. Can
|
||||||
* never be {@code null}.
|
* never be {@code null}.
|
||||||
* @param order Order value specifying the sort order of the objects
|
|
||||||
* assigned to category.
|
|
||||||
*/
|
*/
|
||||||
public void addObjectToCategory(final CcmObject object,
|
public void addObjectToCategory(final CcmObject object,
|
||||||
final Category category,
|
final Category category) {
|
||||||
final long order) {
|
if (object == null) {
|
||||||
// TODO implement method
|
throw new IllegalArgumentException(
|
||||||
throw new UnsupportedOperationException();
|
"Null can't be added to a category.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (category == null) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Can't add an object to category 'null'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final Categorization categorization = new Categorization();
|
||||||
|
categorization.setCategorizedObject(object);
|
||||||
|
categorization.setCategory(category);
|
||||||
|
categorization.setCategoryOrder(object.getCategories().size() + 1);
|
||||||
|
categorization.setObjectOrder(category.getObjects().size() + 1);
|
||||||
|
|
||||||
|
object.addCategory(categorization);
|
||||||
|
category.addObject(categorization);
|
||||||
|
|
||||||
|
entityManager.persist(categorization);
|
||||||
|
categoryRepo.save(category);
|
||||||
|
ccmObjectRepo.save(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a object from a category. Additionally to removing the object
|
* Removes a object from a category. Additionally to removing the object
|
||||||
* from the category this method also upgrades the order of all objects
|
* from the category this method also upgrades the order of all objects
|
||||||
* sorted in after the removed object so that the values are consistent
|
* sorted in after the removed object so that the values are consistent
|
||||||
* without gaps (which may cause trouble).
|
* without gaps (which may cause trouble otherwise).
|
||||||
*
|
*
|
||||||
* If either the {@code object} or the {@code category} parameter are
|
* If either the {@code object} or the {@code category} parameter are
|
||||||
* {@code null} an {@link IllegalArgumentException} exception is thrown
|
* {@code null} an {@link IllegalArgumentException} exception is thrown
|
||||||
|
|
@ -106,8 +122,52 @@ public class CategoryManager {
|
||||||
public void removeObjectFromCategory(final CcmObject object,
|
public void removeObjectFromCategory(final CcmObject object,
|
||||||
final Category category)
|
final Category category)
|
||||||
throws ObjectNotAssignedToCategoryException {
|
throws ObjectNotAssignedToCategoryException {
|
||||||
// TODO implement method
|
|
||||||
throw new UnsupportedOperationException();
|
if (object == null) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Can't remove object 'null' from a category");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (category == null) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Can't remove an object from category 'null'");
|
||||||
|
}
|
||||||
|
|
||||||
|
final TypedQuery<Categorization> query = entityManager.createNamedQuery(
|
||||||
|
"Categorization.find", Categorization.class);
|
||||||
|
query.setParameter("category", category);
|
||||||
|
query.setParameter("object", object);
|
||||||
|
|
||||||
|
final Categorization categorization;
|
||||||
|
try {
|
||||||
|
categorization = query.getSingleResult();
|
||||||
|
} catch (NoResultException ex) {
|
||||||
|
LOGGER.warn(String.format(
|
||||||
|
"No categorization for category %s and object %s found."
|
||||||
|
+ "Ignoring. Orginal exception: ",
|
||||||
|
category.toString(),
|
||||||
|
object.toString()),
|
||||||
|
ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
object.removeCategory(categorization);
|
||||||
|
category.removeObject(categorization);
|
||||||
|
entityManager.remove(categorization);
|
||||||
|
categoryRepo.save(category);
|
||||||
|
ccmObjectRepo.save(object);
|
||||||
|
|
||||||
|
final List<Categorization> categories = object.getCategories();
|
||||||
|
for (int i = 0; i < categories.size(); i++) {
|
||||||
|
categories.get(i).setCategoryOrder(i);
|
||||||
|
entityManager.merge(categories.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Categorization> objects = category.getObjects();
|
||||||
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
|
objects.get(i).setObjectOrder(i);
|
||||||
|
entityManager.merge(objects.get(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -179,34 +239,25 @@ public class CategoryManager {
|
||||||
* Adds a category as an subcategory to another category. If the category is
|
* Adds a category as an subcategory to another category. If the category is
|
||||||
* assigned to another category that association is removed.
|
* assigned to another category that association is removed.
|
||||||
*
|
*
|
||||||
* The method will ensure that values of the {@code order} properties of all
|
|
||||||
* subcategories will remain consistent. If the provided position is already
|
|
||||||
* occupied a the values of the {@code order} properties of the object
|
|
||||||
* occupying the provided positions and of all following objects are
|
|
||||||
* increased by one.
|
|
||||||
*
|
|
||||||
* If the provided value is larger than the value of the {@code order}
|
|
||||||
* property of the last object the value of the {@code property} is set the
|
|
||||||
* value of the of the {@code order} property of the last object plus one.
|
|
||||||
*
|
|
||||||
* The provided value is less than {@code 0} the object will be the first
|
|
||||||
* one and the value of the {@code order} property will be set to {@code 0}.
|
|
||||||
*
|
|
||||||
* If the provided category is already assigned to the provided parent
|
|
||||||
* category only the value of the {@code order} property is updated.
|
|
||||||
*
|
|
||||||
* @param subCategory The category to add as subcategory. Can't be
|
* @param subCategory The category to add as subcategory. Can't be
|
||||||
* {@code null}.
|
* {@code null}.
|
||||||
* @param parentCategory The category to which the category is added as
|
* @param parentCategory The category to which the category is added as
|
||||||
* subcategory. Can't be {@code null}.
|
* subcategory. Can't be {@code null}.
|
||||||
* @param order The value for the {@code order} property of the
|
|
||||||
* association.
|
|
||||||
*/
|
*/
|
||||||
public void addSubCategoryToCategory(final Category subCategory,
|
public void addSubCategoryToCategory(final Category subCategory,
|
||||||
final Category parentCategory,
|
final Category parentCategory) {
|
||||||
final long order) {
|
if (subCategory.getParentCategory() != null) {
|
||||||
// TODO implement method
|
final Category oldParent = subCategory.getParentCategory();
|
||||||
throw new UnsupportedOperationException();
|
removeSubCategoryFromCategory(subCategory, oldParent);
|
||||||
|
}
|
||||||
|
|
||||||
|
final int order = parentCategory.getCategories().size() + 1;
|
||||||
|
parentCategory.addSubCategory(subCategory);
|
||||||
|
subCategory.setParentCategory(parentCategory);
|
||||||
|
subCategory.setCategoryOrder(order);
|
||||||
|
|
||||||
|
categoryRepo.save(parentCategory);
|
||||||
|
categoryRepo.save(subCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -218,15 +269,32 @@ public class CategoryManager {
|
||||||
* Can't be {@code null}.
|
* Can't be {@code null}.
|
||||||
* @param parentCategory The parent category. Can't be {@code null}.
|
* @param parentCategory The parent category. Can't be {@code null}.
|
||||||
*
|
*
|
||||||
* @throws NotASubCategoryException If the provided subcategory is not
|
* @throws IllegalArgumentException If the provided subcategory is not
|
||||||
* assigned to the provided parent
|
* assigned to the provided parent
|
||||||
* category.
|
* category.
|
||||||
*/
|
*/
|
||||||
public void removeSubCategoryFromCategory(final Category subCategory,
|
public void removeSubCategoryFromCategory(final Category subCategory,
|
||||||
final Category parentCategory)
|
final Category parentCategory) {
|
||||||
throws NotASubCategoryException {
|
|
||||||
// TODO implement method
|
if (subCategory.getParentCategory() == null
|
||||||
throw new UnsupportedOperationException();
|
|| !subCategory.getParentCategory().equals(parentCategory)) {
|
||||||
|
throw new IllegalArgumentException(String.format(
|
||||||
|
"Category %s is not a subcategory of category %s.",
|
||||||
|
subCategory.toString(),
|
||||||
|
parentCategory.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
parentCategory.removeSubCategory(subCategory);
|
||||||
|
subCategory.setParentCategory(null);
|
||||||
|
|
||||||
|
final List<Category> subCategories = parentCategory.getSubCategories();
|
||||||
|
for (int i = 0; i < subCategories.size(); i++) {
|
||||||
|
subCategories.get(i).setCategoryOrder(i);
|
||||||
|
categoryRepo.save(subCategories.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
categoryRepo.save(parentCategory);
|
||||||
|
categoryRepo.save(subCategory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -240,13 +308,12 @@ public class CategoryManager {
|
||||||
* @param parentCategory The parent category of the category. Can't be
|
* @param parentCategory The parent category of the category. Can't be
|
||||||
* {@code null}.
|
* {@code null}.
|
||||||
*
|
*
|
||||||
* @throws NotASubCategoryException If the provided subcategory is not a
|
* @throws IllegalArgumentException If the provided subcategory is not a
|
||||||
* subcategory of the provided parent
|
* subcategory of the provided parent
|
||||||
* category.
|
* category.
|
||||||
*/
|
*/
|
||||||
public void increaseCategoryOrder(final Category subCategory,
|
public void increaseCategoryOrder(final Category subCategory,
|
||||||
final Category parentCategory)
|
final Category parentCategory) {
|
||||||
throws NotASubCategoryException {
|
|
||||||
// TODO implement method
|
// TODO implement method
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -262,13 +329,12 @@ public class CategoryManager {
|
||||||
* @param parentCategory The parent category of the category. Can't be
|
* @param parentCategory The parent category of the category. Can't be
|
||||||
* {@code null}.
|
* {@code null}.
|
||||||
*
|
*
|
||||||
* @throws NotASubCategoryException If the provided subcategory is not a
|
* @throws IllegalArgumentException If the provided subcategory is not a
|
||||||
* subcategory of the provided parent
|
* subcategory of the provided parent
|
||||||
* category.
|
* category.
|
||||||
*/
|
*/
|
||||||
public void decreaseCategoryOrder(final Category subCategory,
|
public void decreaseCategoryOrder(final Category subCategory,
|
||||||
final Category parentCategory)
|
final Category parentCategory) {
|
||||||
throws NotASubCategoryException {
|
|
||||||
// TODO implement method
|
// TODO implement method
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -281,13 +347,13 @@ public class CategoryManager {
|
||||||
* @param parentCategory The parent category of both subcategories. Can't be
|
* @param parentCategory The parent category of both subcategories. Can't be
|
||||||
* {@code null}.
|
* {@code null}.
|
||||||
*
|
*
|
||||||
* @throws NotASubCategoryException If one or both categories are not
|
* @throws IllegalArgumentException If one or both categories are not
|
||||||
* subcategories of the provided parent category.qq
|
* subcategories of the provided parent
|
||||||
|
* category.qq
|
||||||
*/
|
*/
|
||||||
public void swapCategories(final Category subCategoryA,
|
public void swapCategories(final Category subCategoryA,
|
||||||
final Category subCategoryB,
|
final Category subCategoryB,
|
||||||
final Category parentCategory)
|
final Category parentCategory) {
|
||||||
throws NotASubCategoryException {
|
|
||||||
// TODO implement method
|
// TODO implement method
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,11 @@ package org.libreccm.categorization;
|
||||||
import org.libreccm.core.AbstractEntityRepository;
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -32,6 +35,9 @@ import javax.persistence.TypedQuery;
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class CategoryRepository extends AbstractEntityRepository<Long, Category> {
|
public class CategoryRepository extends AbstractEntityRepository<Long, Category> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DomainRepository domainRepo;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Category> getEntityClass() {
|
public Class<Category> getEntityClass() {
|
||||||
return Category.class;
|
return Category.class;
|
||||||
|
|
@ -43,24 +49,93 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of all top level categories (Categories without a
|
* Retrieves a list of all top level categories (Categories without a parent
|
||||||
* parent category).
|
* category).
|
||||||
*
|
*
|
||||||
* @return A list of all top level categories.
|
* @return A list of all top level categories.
|
||||||
*/
|
*/
|
||||||
public List<Category> getTopLevelCategories() {
|
public List<Category> getTopLevelCategories() {
|
||||||
final TypedQuery<Category> query = getEntityManager().createNamedQuery(
|
final TypedQuery<Category> query = getEntityManager().createNamedQuery(
|
||||||
"Category.topLevelCategories", Category.class);
|
"Category.topLevelCategories", Category.class);
|
||||||
|
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Category findByPath(final String path) {
|
||||||
|
if (path == null || path.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("Path can't be null or empty.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final String[] tokens = path.split(":");
|
||||||
|
if (tokens.length > 2) {
|
||||||
|
throw new InvalidCategoryPathException(
|
||||||
|
"The provided path is invalid: More than one colon found. "
|
||||||
|
+ "Valid path format: domainKey:path");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tokens.length < 2) {
|
||||||
|
throw new InvalidCategoryPathException(
|
||||||
|
"The provided path is invalid: No domain found in path. "
|
||||||
|
+ "Valid path format: domainKey:path");
|
||||||
|
}
|
||||||
|
|
||||||
|
final Domain domain;
|
||||||
|
try {
|
||||||
|
domain = domainRepo.findByDomainKey(tokens[0]);
|
||||||
|
} catch (NoResultException ex) {
|
||||||
|
throw new InvalidCategoryPathException(String.format(
|
||||||
|
"No domain identified by the key '%s' found.",
|
||||||
|
tokens[0]),
|
||||||
|
ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return findByPath(domain, tokens[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Category findByPath(final Domain domain, final String path) {
|
||||||
|
if (domain == null) {
|
||||||
|
throw new IllegalArgumentException("Domain can't be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path == null || path.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("Path can't be null or empty.");
|
||||||
|
}
|
||||||
|
|
||||||
|
String normalizedPath = path.replace('.', '/');
|
||||||
|
if (normalizedPath.startsWith("/")) {
|
||||||
|
normalizedPath = normalizedPath.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (normalizedPath.endsWith("/")) {
|
||||||
|
normalizedPath = normalizedPath.substring(0,
|
||||||
|
normalizedPath.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
final String[] tokens = normalizedPath.split("/");
|
||||||
|
Category current = domain.getRoot();
|
||||||
|
for (String token : tokens) {
|
||||||
|
final Optional<Category> result = current.getSubCategories()
|
||||||
|
.stream()
|
||||||
|
.filter((c) -> {
|
||||||
|
return c.getName().equals(token);
|
||||||
|
})
|
||||||
|
.findFirst();
|
||||||
|
if (result.isPresent()) {
|
||||||
|
current = result.get();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all categories which are not assigned to another category as
|
* Retrieves all categories which are not assigned to another category as
|
||||||
* subcategory or the an {@link Domain} as root category.
|
* subcategory or the an {@link Domain} as root category.
|
||||||
*
|
*
|
||||||
* @return A list of all orphaned categories. Normally this list should be
|
* @return A list of all orphaned categories. Normally this list should be
|
||||||
* empty.
|
* empty.
|
||||||
*/
|
*/
|
||||||
public List<Category> getOrphanedCategories() {
|
public List<Category> getOrphanedCategories() {
|
||||||
// TODO implement method
|
// TODO implement method
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.NamedQueries;
|
||||||
|
import javax.persistence.NamedQuery;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
|
|
@ -74,6 +76,12 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "CATEGORY_DOMAINS", schema = DB_SCHEMA)
|
@Table(name = "CATEGORY_DOMAINS", schema = DB_SCHEMA)
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name="Domain.findByKey",
|
||||||
|
query = "SELECT d FROM Domain d WHERE d.domainKey = :key"),
|
||||||
|
@NamedQuery(name="Domain.findByUri",
|
||||||
|
query = "SELECT d FROM Domain d WHERE d.uri = :uri")
|
||||||
|
})
|
||||||
@XmlRootElement(name = "domain", namespace = CAT_XML_NS)
|
@XmlRootElement(name = "domain", namespace = CAT_XML_NS)
|
||||||
public class Domain extends CcmObject implements Serializable {
|
public class Domain extends CcmObject implements Serializable {
|
||||||
|
|
||||||
|
|
@ -102,9 +110,8 @@ public class Domain extends CcmObject implements Serializable {
|
||||||
* http://example.org/domains/example-nav
|
* http://example.org/domains/example-nav
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@Column(name = "URI", nullable = false, unique = true, length = 1024)
|
@Column(name = "URI", nullable = true, unique = true, length = 1024)
|
||||||
@Convert(converter = UriConverter.class)
|
@Convert(converter = UriConverter.class)
|
||||||
@NotBlank
|
|
||||||
@URL
|
@URL
|
||||||
@XmlElement(name = "uri", namespace = CAT_XML_NS)
|
@XmlElement(name = "uri", namespace = CAT_XML_NS)
|
||||||
private URI uri;
|
private URI uri;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ import org.libreccm.web.CcmApplication;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import org.libreccm.web.ApplicationRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides several methods when managing the relations between {@link Domain}s
|
* Provides several methods when managing the relations between {@link Domain}s
|
||||||
|
|
@ -32,8 +34,14 @@ import javax.inject.Inject;
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class DomainManager {
|
public class DomainManager {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ApplicationRepository applicationRepo;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private DomainRepository domainRepo;
|
private DomainRepository domainRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a {@code CcmApplication} to the owners of a {@link Domain}. If the
|
* Adds a {@code CcmApplication} to the owners of a {@link Domain}. If the
|
||||||
|
|
@ -47,8 +55,18 @@ public class DomainManager {
|
||||||
*/
|
*/
|
||||||
public void addDomainOwner(final CcmApplication application,
|
public void addDomainOwner(final CcmApplication application,
|
||||||
final Domain domain) {
|
final Domain domain) {
|
||||||
// TODO implement method
|
final DomainOwnership ownership = new DomainOwnership();
|
||||||
throw new UnsupportedOperationException();
|
ownership.setDomain(domain);
|
||||||
|
ownership.setOwner(application);
|
||||||
|
ownership.setOwnerOrder(domain.getOwners().size() + 1);
|
||||||
|
ownership.setDomainOrder(application.getDomains().size() + 1);
|
||||||
|
|
||||||
|
application.addDomain(ownership);
|
||||||
|
domain.addOwner(ownership);
|
||||||
|
|
||||||
|
entityManager.persist(ownership);
|
||||||
|
applicationRepo.save(application);
|
||||||
|
domainRepo.save(domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import java.net.URI;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A repository for executing CRUD operations on {@link Domain} objects.
|
* A repository for executing CRUD operations on {@link Domain} objects.
|
||||||
|
|
@ -36,7 +37,7 @@ public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Domain> getEntityClass() {
|
public Class<Domain> getEntityClass() {
|
||||||
return Domain.class;
|
return Domain.class;
|
||||||
|
|
@ -53,11 +54,14 @@ public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
||||||
* @param domainKey The domain key of the {@code Domain} to find.
|
* @param domainKey The domain key of the {@code Domain} to find.
|
||||||
*
|
*
|
||||||
* @return The {@code Domain} identified by {@code domainKey} or
|
* @return The {@code Domain} identified by {@code domainKey} or
|
||||||
* {@code null} if there is no such {@code Domain}.
|
* {@code null} if there is no such {@code Domain}.
|
||||||
*/
|
*/
|
||||||
public Domain findByDomainKey(final String domainKey) {
|
public Domain findByDomainKey(final String domainKey) {
|
||||||
// TODO implement method
|
final TypedQuery<Domain> query = entityManager.createNamedQuery(
|
||||||
throw new UnsupportedOperationException();
|
"Domain.findByKey", Domain.class);
|
||||||
|
query.setParameter("key", domainKey);
|
||||||
|
|
||||||
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -66,11 +70,14 @@ public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
||||||
* @param uri The URI of the domain to find.
|
* @param uri The URI of the domain to find.
|
||||||
*
|
*
|
||||||
* @return The {@code Domain} identified by the provided URI or {@code null}
|
* @return The {@code Domain} identified by the provided URI or {@code null}
|
||||||
* if there is so such {@code Domain}.
|
* if there is so such {@code Domain}.
|
||||||
*/
|
*/
|
||||||
public Domain findByUri(final URI uri) {
|
public Domain findByUri(final URI uri) {
|
||||||
// TODO implement method
|
final TypedQuery<Domain> query = entityManager.createNamedQuery(
|
||||||
throw new UnsupportedOperationException();
|
"Domain.findByUri", Domain.class);
|
||||||
|
query.setParameter("uri", uri);
|
||||||
|
|
||||||
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* 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.categorization;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class InvalidCategoryPathException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -428910047165112592L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of <code>InvalidCategoryPathException</code>
|
||||||
|
* without detail message.
|
||||||
|
*/
|
||||||
|
public InvalidCategoryPathException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs an instance of <code>InvalidCategoryPathException</code> with
|
||||||
|
* the specified detail message.
|
||||||
|
*
|
||||||
|
* @param msg the detail message.
|
||||||
|
*/
|
||||||
|
public InvalidCategoryPathException(final String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidCategoryPathException(final Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidCategoryPathException(final String msg,
|
||||||
|
final Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,69 +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.categorization;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates that a category passed to a method is not a sub category of another
|
|
||||||
* category also passed to the method.
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
public class NotASubCategoryException extends Exception {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new instance of <code>NotASubCategoryException</code> without detail message.
|
|
||||||
*/
|
|
||||||
public NotASubCategoryException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an instance of <code>NotASubCategoryException</code> with the specified detail message.
|
|
||||||
*
|
|
||||||
* @param msg The detail message.
|
|
||||||
*/
|
|
||||||
public NotASubCategoryException(final String msg) {
|
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an instance of <code>NotASubCategoryException</code> which wraps the
|
|
||||||
* specified exception.
|
|
||||||
*
|
|
||||||
* @param exception The exception to wrap.
|
|
||||||
*/
|
|
||||||
public NotASubCategoryException(final Exception exception) {
|
|
||||||
super(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an instance of <code>NotASubCategoryException</code> with the specified message which also wraps the
|
|
||||||
* specified exception.
|
|
||||||
*
|
|
||||||
* @param msg The detail message.
|
|
||||||
* @param exception The exception to wrap.
|
|
||||||
*/
|
|
||||||
public NotASubCategoryException(final String msg, final Exception exception) {
|
|
||||||
super(msg, exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,67 +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.cdi.utils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
|
||||||
*/
|
|
||||||
public class CdiLookupException extends Exception {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new instance of <code>CdiLookupException</code> without detail message.
|
|
||||||
*/
|
|
||||||
public CdiLookupException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an instance of <code>CdiLookupException</code> with the specified detail message.
|
|
||||||
*
|
|
||||||
* @param msg The detail message.
|
|
||||||
*/
|
|
||||||
public CdiLookupException(final String msg) {
|
|
||||||
super(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an instance of <code>CdiLookupException</code> which wraps the
|
|
||||||
* specified exception.
|
|
||||||
*
|
|
||||||
* @param exception The exception to wrap.
|
|
||||||
*/
|
|
||||||
public CdiLookupException(final Exception exception) {
|
|
||||||
super(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs an instance of <code>CdiLookupException</code> with the specified message which also wraps the
|
|
||||||
* specified exception.
|
|
||||||
*
|
|
||||||
* @param msg The detail message.
|
|
||||||
* @param exception The exception to wrap.
|
|
||||||
*/
|
|
||||||
public CdiLookupException(final String msg, final Exception exception) {
|
|
||||||
super(msg, exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class CdiUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T findBean(final Class<T> beanType) throws CdiLookupException {
|
public <T> T findBean(final Class<T> beanType) {
|
||||||
final Set<Bean<?>> beans = beanManager.getBeans(beanType);
|
final Set<Bean<?>> beans = beanManager.getBeans(beanType);
|
||||||
final Iterator<Bean<?>> iterator = beans.iterator();
|
final Iterator<Bean<?>> iterator = beans.iterator();
|
||||||
if (iterator.hasNext()) {
|
if (iterator.hasNext()) {
|
||||||
|
|
@ -58,7 +58,7 @@ public class CdiUtil {
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error(new ParameterizedMessage(
|
LOGGER.error(new ParameterizedMessage(
|
||||||
"No CDI Bean for type {0} found.", beanType.getName()));
|
"No CDI Bean for type {0} found.", beanType.getName()));
|
||||||
throw new CdiLookupException(String.format(
|
throw new IllegalStateException(String.format(
|
||||||
"No CDI Bean for type \"%s\" found", beanType.getName()));
|
"No CDI Bean for type \"%s\" found", beanType.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
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;
|
||||||
|
|
@ -31,7 +33,7 @@ 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 = "CONF_ENTRIES_BIG_DECIMAL")
|
@Table(name = "CONF_ENTRIES_BIG_DECIMAL", schema = DB_SCHEMA)
|
||||||
public class BigDecimalConfigurationEntry
|
public class BigDecimalConfigurationEntry
|
||||||
extends AbstractConfigurationEntry<BigDecimal> implements Serializable {
|
extends AbstractConfigurationEntry<BigDecimal> implements Serializable {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* 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 java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks a class as configuration class which is managed by the
|
||||||
|
* {@link ConfigurationManager}.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface Configuration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the configuration. If left blank the simple name of the class
|
||||||
|
* is used.
|
||||||
|
*
|
||||||
|
* @return Name of the configuration.
|
||||||
|
*/
|
||||||
|
String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Points to the {@link ResourceBundle} containing the descriptions
|
||||||
|
* of the configuration and all entries of the configuration.
|
||||||
|
*
|
||||||
|
* @return Fully qualified name of the {@link ResourceBundle}.
|
||||||
|
*/
|
||||||
|
String descBundle() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key of the description of the configuration in the resource bundle
|
||||||
|
* provided by {@link #descBundle()}.
|
||||||
|
*
|
||||||
|
* @return Key of the description.
|
||||||
|
*/
|
||||||
|
String descKey() default "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class ConfigurationConstants {
|
||||||
|
|
||||||
|
public static final String REGISTRY_DOMAIN = "registry";
|
||||||
|
|
||||||
|
private ConfigurationConstants() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* 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 javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import org.libreccm.categorization.CategoryManager;
|
||||||
|
import org.libreccm.categorization.Domain;
|
||||||
|
import org.libreccm.categorization.DomainManager;
|
||||||
|
import org.libreccm.categorization.DomainRepository;
|
||||||
|
|
||||||
|
import static org.libreccm.configuration.ConfigurationConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class ConfigurationManager {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CategoryManager categoryManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DomainRepository domainRepository;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DomainManager domainManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public <T> AbstractConfigurationEntry<T> getEntry(final String name,
|
||||||
|
final Class<T> clazz) {
|
||||||
|
final String[] tokens = name.split(".");
|
||||||
|
|
||||||
|
final Domain registry = domainRepository.findByDomainKey(REGISTRY_DOMAIN);
|
||||||
|
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -22,11 +22,13 @@ import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.Set;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -36,24 +38,27 @@ import javax.persistence.Table;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "CONF_ENTRIES_ENUM", schema = DB_SCHEMA)
|
@Table(name = "CONF_ENTRIES_ENUM", schema = DB_SCHEMA)
|
||||||
public class EnumConfigurationEntry
|
public class EnumConfigurationEntry
|
||||||
extends AbstractConfigurationEntry<List<String>> implements Serializable {
|
extends AbstractConfigurationEntry<Set<String>> implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 8506016944203102813L;
|
private static final long serialVersionUID = 8506016944203102813L;
|
||||||
|
|
||||||
@ElementCollection
|
@ElementCollection
|
||||||
private List<String> value;
|
@JoinTable(name = "ENUM_CONFIGURATION_ENTRIES_VALUES",
|
||||||
|
schema = DB_SCHEMA,
|
||||||
|
joinColumns = {@JoinColumn(name = "ENUM_ID")})
|
||||||
|
private Set<String> value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getValue() {
|
public Set<String> getValue() {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return Collections.unmodifiableList(value);
|
return Collections.unmodifiableSet(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValue(final List<String> value) {
|
public void setValue(final Set<String> value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* 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 java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks a field of a class annotated with {@link Configuration} as setting.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface Setting {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the setting. If left blank the name of annotated field is
|
||||||
|
* used.
|
||||||
|
*
|
||||||
|
* @return The name of the setting.
|
||||||
|
*/
|
||||||
|
String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key of description of the setting.
|
||||||
|
*
|
||||||
|
* @return Key of description of the setting.
|
||||||
|
*/
|
||||||
|
String descKey() default "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -181,7 +181,7 @@ public class CcmObject implements Serializable {
|
||||||
*
|
*
|
||||||
* @param category The domain ownership to add.
|
* @param category The domain ownership to add.
|
||||||
*/
|
*/
|
||||||
protected void addCategory(final Categorization category) {
|
public void addCategory(final Categorization category) {
|
||||||
categories.add(category);
|
categories.add(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,7 +192,7 @@ public class CcmObject implements Serializable {
|
||||||
*
|
*
|
||||||
* @param category The assigned category to remove.
|
* @param category The assigned category to remove.
|
||||||
*/
|
*/
|
||||||
protected void removeCategory(final Categorization category) {
|
public void removeCategory(final Categorization category) {
|
||||||
categories.remove(category);
|
categories.remove(category);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
|
|
@ -38,16 +35,16 @@ import java.util.Iterator;
|
||||||
* check if the current subject is permitted to access the object. If the
|
* check if the current subject is permitted to access the object. If the
|
||||||
* current subject is permitted to access the object the object is returned.
|
* current subject is permitted to access the object the object is returned.
|
||||||
* Otherwise the object is replaced with a virtual object were the
|
* Otherwise the object is replaced with a virtual object were the
|
||||||
* {@link CcmObject#displayName} property is set to {@code Access Denied}.
|
* {@link CcmObject#displayName} property is set to {@code Access Denied}.
|
||||||
* Methods which return arrays or collections of objects from the decorated
|
* Methods which return arrays or collections of objects from the decorated
|
||||||
* collection check each object in the array or collection and replace the
|
* collection check each object in the array or collection and replace the
|
||||||
* objects which the current subject is not permitted to access with a
|
* objects which the current subject is not permitted to access with a
|
||||||
* <em>Access denied</em> object.
|
* <em>Access denied</em> object.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*
|
*
|
||||||
* @param <E> Type of the objects in the collection. Must extend
|
* @param <E> Type of the objects in the collection. Must extend
|
||||||
* {@link CcmObject}.
|
* {@link CcmObject}.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.TooManyMethods")
|
@SuppressWarnings("PMD.TooManyMethods")
|
||||||
public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
||||||
|
|
@ -58,7 +55,7 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
||||||
private final Collection<E> collection;
|
private final Collection<E> collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class of the objects in the collection. Required for creating the
|
* The class of the objects in the collection. Required for creating the
|
||||||
* virtual <em>Access denied</em> object
|
* virtual <em>Access denied</em> object
|
||||||
*/
|
*/
|
||||||
private final Class<E> clazz;
|
private final Class<E> clazz;
|
||||||
|
|
@ -75,11 +72,11 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new secured collection for the provided collection.
|
* Create a new secured collection for the provided collection.
|
||||||
*
|
*
|
||||||
* @param collection The collection to secure.
|
* @param collection The collection to secure.
|
||||||
* @param clazz The class of the objects in the collection.
|
* @param clazz The class of the objects in the collection.
|
||||||
* @param requiredPrivilege The privilege required to access the objects
|
* @param requiredPrivilege The privilege required to access the objects in
|
||||||
* in the collection.
|
* the collection.
|
||||||
*/
|
*/
|
||||||
public SecuredCollection(final Collection<E> collection,
|
public SecuredCollection(final Collection<E> collection,
|
||||||
final Class<E> clazz,
|
final Class<E> clazz,
|
||||||
|
|
@ -114,14 +111,9 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object[] toArray() {
|
public Object[] toArray() {
|
||||||
final PermissionChecker permissionChecker;
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||||
permissionChecker = cdiUtil.findBean(
|
PermissionChecker.class);
|
||||||
PermissionChecker.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Object[] objects = collection.toArray();
|
final Object[] objects = collection.toArray();
|
||||||
for (int i = 0; i < objects.length; i++) {
|
for (int i = 0; i < objects.length; i++) {
|
||||||
|
|
@ -137,14 +129,9 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
||||||
public <T> T[] toArray(final T[] array) {
|
public <T> T[] toArray(final T[] array) {
|
||||||
final PermissionChecker permissionChecker;
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||||
permissionChecker = cdiUtil.findBean(
|
PermissionChecker.class);
|
||||||
PermissionChecker.class);
|
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final T[] objects = collection.toArray(array);
|
final T[] objects = collection.toArray(array);
|
||||||
for (int i = 0; i < objects.length; i++) {
|
for (int i = 0; i < objects.length; i++) {
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
|
|
@ -93,15 +90,10 @@ class SecuredEntrySet<E extends Map.Entry<K, V>, K, V extends CcmObject>
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object[] toArray() {
|
public Object[] toArray() {
|
||||||
final PermissionChecker permissionChecker;
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||||
permissionChecker = cdiUtil.findBean(
|
|
||||||
PermissionChecker.class);
|
PermissionChecker.class);
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Object[] entries = set.toArray();
|
final Object[] entries = set.toArray();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
final E entry = (E) entries[i];
|
final E entry = (E) entries[i];
|
||||||
|
|
@ -117,15 +109,10 @@ class SecuredEntrySet<E extends Map.Entry<K, V>, K, V extends CcmObject>
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
||||||
public <T> T[] toArray(final T[] array) {
|
public <T> T[] toArray(final T[] array) {
|
||||||
final PermissionChecker permissionChecker;
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
try {
|
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||||
permissionChecker = cdiUtil.findBean(
|
|
||||||
PermissionChecker.class);
|
PermissionChecker.class);
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
final E[] entries = (E[]) set.toArray(array);
|
final E[] entries = (E[]) set.toArray(array);
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
if (!permissionChecker.isPermitted(requiredPrivilege,
|
if (!permissionChecker.isPermitted(requiredPrivilege,
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
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 org.libreccm.cdi.utils.CdiLookupException;
|
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
|
|
@ -69,14 +67,9 @@ class SecuredHelper<E extends CcmObject> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final CdiUtil cdiUtil = new CdiUtil();
|
final CdiUtil cdiUtil = new CdiUtil();
|
||||||
final PermissionChecker permissionChecker;
|
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||||
try {
|
|
||||||
permissionChecker = cdiUtil.findBean(
|
|
||||||
PermissionChecker.class);
|
PermissionChecker.class);
|
||||||
} catch (CdiLookupException ex) {
|
|
||||||
throw new UncheckedWrapperException(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (permissionChecker.isPermitted(requiredPrivilege, object)) {
|
if (permissionChecker.isPermitted(requiredPrivilege, object)) {
|
||||||
return object;
|
return object;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ public class CcmApplication extends Resource implements Serializable {
|
||||||
*
|
*
|
||||||
* @param domain The domain ownership to add.
|
* @param domain The domain ownership to add.
|
||||||
*/
|
*/
|
||||||
protected void addDomain(final DomainOwnership domain) {
|
public void addDomain(final DomainOwnership domain) {
|
||||||
domains.add(domain);
|
domains.add(domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ public class CcmApplication extends Resource implements Serializable {
|
||||||
*
|
*
|
||||||
* @param domain The domain to remove.
|
* @param domain The domain to remove.
|
||||||
*/
|
*/
|
||||||
protected void removeDomain(final DomainOwnership domain) {
|
public void removeDomain(final DomainOwnership domain) {
|
||||||
domains.remove(domain);
|
domains.remove(domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
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,
|
||||||
|
|
@ -49,7 +48,7 @@ create schema CCM_CORE;
|
||||||
create table CCM_CORE.CATEGORY_DOMAINS (
|
create table CCM_CORE.CATEGORY_DOMAINS (
|
||||||
DOMAIN_KEY varchar(255) not null,
|
DOMAIN_KEY varchar(255) not null,
|
||||||
RELEASED timestamp,
|
RELEASED timestamp,
|
||||||
URI varchar(1024) not null,
|
URI varchar(1024),
|
||||||
VERSION varchar(255) not null,
|
VERSION varchar(255) not null,
|
||||||
OBJECT_ID bigint not null,
|
OBJECT_ID bigint not null,
|
||||||
ROOT_CATEGORY_ID bigint,
|
ROOT_CATEGORY_ID bigint,
|
||||||
|
|
@ -82,6 +81,59 @@ create schema CCM_CORE;
|
||||||
primary key (ROLE_ID)
|
primary key (ROLE_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONFIGURATION_ENTRIES (
|
||||||
|
comment varchar(2048),
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_BIG_DECIMAL (
|
||||||
|
entry_value decimal(19,2),
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_BOOLEAN (
|
||||||
|
entry_value boolean,
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_DOUBLE (
|
||||||
|
entry_value double,
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_ENUM (
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_INTEGER (
|
||||||
|
entry_value bigint,
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_L10N_STRING (
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_L10N_STR_VALUES (
|
||||||
|
ENTRY_ID bigint not null,
|
||||||
|
LOCALIZED_VALUE clob,
|
||||||
|
LOCALE varchar(255) not null,
|
||||||
|
primary key (ENTRY_ID, LOCALE)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_STRING (
|
||||||
|
entry_value varchar(1024),
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.DIGESTS (
|
create table CCM_CORE.DIGESTS (
|
||||||
FREQUENCY integer,
|
FREQUENCY integer,
|
||||||
HEADER varchar(4096) not null,
|
HEADER varchar(4096) not null,
|
||||||
|
|
@ -118,6 +170,11 @@ create schema CCM_CORE;
|
||||||
primary key (OBJECT_ID, LOCALE)
|
primary key (OBJECT_ID, LOCALE)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.ENUM_CONFIGURATION_ENTRIES_VALUES (
|
||||||
|
ENUM_ID bigint not null,
|
||||||
|
value varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.FORMBUILDER_COMPONENTS (
|
create table CCM_CORE.FORMBUILDER_COMPONENTS (
|
||||||
ACTIVE boolean,
|
ACTIVE boolean,
|
||||||
ADMIN_NAME varchar(255),
|
ADMIN_NAME varchar(255),
|
||||||
|
|
@ -621,6 +678,51 @@ create schema CCM_CORE;
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CATEGORIES;
|
references CCM_CORE.CATEGORIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONFIGURATION_ENTRIES
|
||||||
|
add constraint FK_8u6h7p0gs4ybf0ju240mggb73
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CCM_OBJECTS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_BIG_DECIMAL
|
||||||
|
add constraint FK_3tnub4je6c2bwi0c3p9m2n6d1
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_BOOLEAN
|
||||||
|
add constraint FK_d79uxyam5uhhmw3ijw3c14gk2
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_DOUBLE
|
||||||
|
add constraint FK_l5qxx6wfngl2hvnqaq77oin1s
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_ENUM
|
||||||
|
add constraint FK_blwwj2ht4wbg82meuuxf0t7kk
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_INTEGER
|
||||||
|
add constraint FK_reo0efdw6evf11viwlse1w27
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_L10N_STRING
|
||||||
|
add constraint FK_dbvyqoliuh0d7bl6ksng4abe
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_L10N_STR_VALUES
|
||||||
|
add constraint FK_ftb5yqeoli1m932yp3p8ho74g
|
||||||
|
foreign key (ENTRY_ID)
|
||||||
|
references CCM_CORE.CONF_ENTRIES_L10N_STRING;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_STRING
|
||||||
|
add constraint FK_j31m640x2cn0xl5jcbik06708
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
alter table CCM_CORE.DIGESTS
|
alter table CCM_CORE.DIGESTS
|
||||||
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
||||||
foreign key (FROM_PARTY_ID)
|
foreign key (FROM_PARTY_ID)
|
||||||
|
|
@ -651,6 +753,11 @@ create schema CCM_CORE;
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CATEGORY_DOMAINS;
|
references CCM_CORE.CATEGORY_DOMAINS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.ENUM_CONFIGURATION_ENTRIES_VALUES
|
||||||
|
add constraint FK_ao3evxajxd8y4gy5a6e8ua49j
|
||||||
|
foreign key (ENUM_ID)
|
||||||
|
references CCM_CORE.CONF_ENTRIES_ENUM;
|
||||||
|
|
||||||
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
||||||
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
||||||
foreign key (parentComponent_OBJECT_ID)
|
foreign key (parentComponent_OBJECT_ID)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
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,
|
||||||
|
|
@ -47,7 +48,7 @@
|
||||||
create table CCM_CORE.CATEGORY_DOMAINS (
|
create table CCM_CORE.CATEGORY_DOMAINS (
|
||||||
DOMAIN_KEY varchar(255) not null,
|
DOMAIN_KEY varchar(255) not null,
|
||||||
RELEASED timestamp,
|
RELEASED timestamp,
|
||||||
URI varchar(1024) not null,
|
URI varchar(1024),
|
||||||
VERSION varchar(255) not null,
|
VERSION varchar(255) not null,
|
||||||
OBJECT_ID int8 not null,
|
OBJECT_ID int8 not null,
|
||||||
ROOT_CATEGORY_ID int8,
|
ROOT_CATEGORY_ID int8,
|
||||||
|
|
@ -80,6 +81,59 @@
|
||||||
primary key (ROLE_ID)
|
primary key (ROLE_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONFIGURATION_ENTRIES (
|
||||||
|
comment varchar(2048),
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_BIG_DECIMAL (
|
||||||
|
entry_value numeric(19, 2),
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_BOOLEAN (
|
||||||
|
entry_value boolean,
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_DOUBLE (
|
||||||
|
entry_value float8,
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_ENUM (
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_INTEGER (
|
||||||
|
entry_value int8,
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_L10N_STRING (
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_L10N_STR_VALUES (
|
||||||
|
ENTRY_ID int8 not null,
|
||||||
|
LOCALIZED_VALUE text,
|
||||||
|
LOCALE varchar(255) not null,
|
||||||
|
primary key (ENTRY_ID, LOCALE)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_STRING (
|
||||||
|
entry_value varchar(1024),
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.DIGESTS (
|
create table CCM_CORE.DIGESTS (
|
||||||
FREQUENCY int4,
|
FREQUENCY int4,
|
||||||
HEADER varchar(4096) not null,
|
HEADER varchar(4096) not null,
|
||||||
|
|
@ -116,6 +170,11 @@
|
||||||
primary key (OBJECT_ID, LOCALE)
|
primary key (OBJECT_ID, LOCALE)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.ENUM_CONFIGURATION_ENTRIES_VALUES (
|
||||||
|
ENUM_ID int8 not null,
|
||||||
|
value varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.FORMBUILDER_COMPONENTS (
|
create table CCM_CORE.FORMBUILDER_COMPONENTS (
|
||||||
ACTIVE boolean,
|
ACTIVE boolean,
|
||||||
ADMIN_NAME varchar(255),
|
ADMIN_NAME varchar(255),
|
||||||
|
|
@ -619,6 +678,51 @@
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CATEGORIES;
|
references CCM_CORE.CATEGORIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONFIGURATION_ENTRIES
|
||||||
|
add constraint FK_8u6h7p0gs4ybf0ju240mggb73
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CCM_OBJECTS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_BIG_DECIMAL
|
||||||
|
add constraint FK_3tnub4je6c2bwi0c3p9m2n6d1
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_BOOLEAN
|
||||||
|
add constraint FK_d79uxyam5uhhmw3ijw3c14gk2
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_DOUBLE
|
||||||
|
add constraint FK_l5qxx6wfngl2hvnqaq77oin1s
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_ENUM
|
||||||
|
add constraint FK_blwwj2ht4wbg82meuuxf0t7kk
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_INTEGER
|
||||||
|
add constraint FK_reo0efdw6evf11viwlse1w27
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_L10N_STRING
|
||||||
|
add constraint FK_dbvyqoliuh0d7bl6ksng4abe
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_L10N_STR_VALUES
|
||||||
|
add constraint FK_ftb5yqeoli1m932yp3p8ho74g
|
||||||
|
foreign key (ENTRY_ID)
|
||||||
|
references CCM_CORE.CONF_ENTRIES_L10N_STRING;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_STRING
|
||||||
|
add constraint FK_j31m640x2cn0xl5jcbik06708
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
alter table CCM_CORE.DIGESTS
|
alter table CCM_CORE.DIGESTS
|
||||||
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
||||||
foreign key (FROM_PARTY_ID)
|
foreign key (FROM_PARTY_ID)
|
||||||
|
|
@ -649,6 +753,11 @@
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CATEGORY_DOMAINS;
|
references CCM_CORE.CATEGORY_DOMAINS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.ENUM_CONFIGURATION_ENTRIES_VALUES
|
||||||
|
add constraint FK_ao3evxajxd8y4gy5a6e8ua49j
|
||||||
|
foreign key (ENUM_ID)
|
||||||
|
references CCM_CORE.CONF_ENTRIES_ENUM;
|
||||||
|
|
||||||
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
||||||
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
||||||
foreign key (parentComponent_OBJECT_ID)
|
foreign key (parentComponent_OBJECT_ID)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,238 @@
|
||||||
|
/*
|
||||||
|
* 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.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.persistence.UsingDataSet;
|
||||||
|
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.core.CcmObject;
|
||||||
|
import org.libreccm.core.CcmObjectRepository;
|
||||||
|
import org.libreccm.jpa.EntityManagerProducer;
|
||||||
|
import org.libreccm.jpa.utils.MimeTypeConverter;
|
||||||
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
import org.libreccm.security.Permission;
|
||||||
|
import org.libreccm.tests.categories.IntegrationTest;
|
||||||
|
import org.libreccm.testutils.EqualsVerifier;
|
||||||
|
import org.libreccm.web.CcmApplication;
|
||||||
|
import org.libreccm.workflow.Workflow;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.PersistenceContext;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.*;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @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 CategoryManagerTest {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CategoryRepository categoryRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CategoryManager categoryManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CcmObjectRepository ccmObjectRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DomainRepository domainRepo;
|
||||||
|
|
||||||
|
@PersistenceContext(name = "LibreCCM")
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
public CategoryManagerTest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.CategoryManagerTest.war")
|
||||||
|
.addPackage(CcmObject.class.getPackage())
|
||||||
|
.addPackage(Permission.class.getPackage())
|
||||||
|
.addPackage(CcmApplication.class.getPackage())
|
||||||
|
.addPackage(Categorization.class.getPackage())
|
||||||
|
.addPackage(LocalizedString.class.getPackage())
|
||||||
|
.addPackage(Workflow.class.getPackage())
|
||||||
|
.addPackage(EntityManagerProducer.class.getPackage())
|
||||||
|
.addPackage(MimeTypeConverter.class.getPackage())
|
||||||
|
.addPackage(EqualsVerifier.class.getPackage())
|
||||||
|
.addPackage(IntegrationTest.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
|
||||||
|
@InSequence(1)
|
||||||
|
public void managerIsInjected() {
|
||||||
|
assertThat(categoryManager, is(not(nullValue())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@InSequence(2)
|
||||||
|
public void entityManagerIsInjected() {
|
||||||
|
assertThat(entityManager, is(not((nullValue()))));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryManagerTest/data.yml")
|
||||||
|
@InSequence(3)
|
||||||
|
public void datasetOnly() {
|
||||||
|
System.out.println("Dataset loaded successfully.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryManagerTest/data.yml")
|
||||||
|
@ShouldMatchDataSet(value
|
||||||
|
= "datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml",
|
||||||
|
excludeColumns = {"categorization_id"})
|
||||||
|
@InSequence(1100)
|
||||||
|
public void addObjectToCategory() {
|
||||||
|
final CcmObject object2 = ccmObjectRepo.findById(-3200L);
|
||||||
|
final Category foo = categoryRepo.findById(-2100L);
|
||||||
|
|
||||||
|
assertThat(object2, is(not(nullValue())));
|
||||||
|
assertThat(foo, is(not(nullValue())));
|
||||||
|
|
||||||
|
categoryManager.addObjectToCategory(object2, foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryManagerTest/data.yml")
|
||||||
|
@ShouldMatchDataSet(value
|
||||||
|
= "datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml",
|
||||||
|
excludeColumns = {"categorization_id"})
|
||||||
|
@InSequence(1200)
|
||||||
|
public void removeObjectFromCategory()
|
||||||
|
throws ObjectNotAssignedToCategoryException {
|
||||||
|
|
||||||
|
final CcmObject object1 = ccmObjectRepo.findById(-3100L);
|
||||||
|
final Category foo = categoryRepo.findById(-2100L);
|
||||||
|
|
||||||
|
assertThat(object1, is(not(nullValue())));
|
||||||
|
assertThat(foo, is(not(nullValue())));
|
||||||
|
|
||||||
|
categoryManager.removeObjectFromCategory(object1, foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryManagerTest/data.yml")
|
||||||
|
@ShouldMatchDataSet(
|
||||||
|
value = "datasets/org/libreccm/categorization/"
|
||||||
|
+ "CategoryManagerTest/after-add-subcategory.yml",
|
||||||
|
excludeColumns = {"object_id"})
|
||||||
|
@InSequence(2100)
|
||||||
|
public void addSubCategoryToCategory() {
|
||||||
|
final Category category = new Category();
|
||||||
|
category.setName("category-new");
|
||||||
|
category.setDisplayName("category-new");
|
||||||
|
category.setUniqueId("catnew");
|
||||||
|
categoryRepo.save(category);
|
||||||
|
|
||||||
|
final TypedQuery<Category> query = entityManager.createQuery(
|
||||||
|
"SELECT c FROM Category c WHERE c.name = :name",
|
||||||
|
Category.class);
|
||||||
|
query.setParameter("name", "category-new");
|
||||||
|
final Category sub = query.getSingleResult();
|
||||||
|
|
||||||
|
final Category foo = categoryRepo.findById(-2100L);
|
||||||
|
// final Category sub = categoryRepo.findById(-2200L);
|
||||||
|
|
||||||
|
categoryManager.addSubCategoryToCategory(sub, foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryManagerTest/data.yml")
|
||||||
|
@ShouldMatchDataSet(value
|
||||||
|
= "datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml",
|
||||||
|
excludeColumns = {"categorization_id", "object_id"})
|
||||||
|
@InSequence(2200)
|
||||||
|
public void removeSubCategoryToCategory() {
|
||||||
|
final Category foo = categoryRepo.findById(-2100L);
|
||||||
|
final Category bar = categoryRepo.findById(-2200L);
|
||||||
|
|
||||||
|
categoryManager.removeSubCategoryFromCategory(bar, foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,234 @@
|
||||||
|
/*
|
||||||
|
* 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.categorization;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.PersistenceContext;
|
||||||
|
|
||||||
|
import org.jboss.arquillian.container.test.api.Deployment;
|
||||||
|
import org.jboss.arquillian.container.test.api.ShouldThrowException;
|
||||||
|
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.persistence.UsingDataSet;
|
||||||
|
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.core.CcmObject;
|
||||||
|
import org.libreccm.jpa.EntityManagerProducer;
|
||||||
|
import org.libreccm.jpa.utils.MimeTypeConverter;
|
||||||
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
import org.libreccm.security.Permission;
|
||||||
|
import org.libreccm.tests.categories.IntegrationTest;
|
||||||
|
import org.libreccm.testutils.EqualsVerifier;
|
||||||
|
import org.libreccm.web.CcmApplication;
|
||||||
|
import org.libreccm.workflow.Workflow;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.*;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @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 CategoryRepositoryTest {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CategoryRepository categoryRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DomainRepository domainRepo;
|
||||||
|
|
||||||
|
@PersistenceContext(name = "LibreCCM")
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
public CategoryRepositoryTest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@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.CategoryRepositoryTest.war")
|
||||||
|
.addPackage(CcmObject.class.getPackage())
|
||||||
|
.addPackage(Permission.class.getPackage())
|
||||||
|
.addPackage(CcmApplication.class.getPackage())
|
||||||
|
.addPackage(Categorization.class.getPackage())
|
||||||
|
.addPackage(LocalizedString.class.getPackage())
|
||||||
|
.addPackage(Workflow.class.getPackage())
|
||||||
|
.addPackage(EntityManagerProducer.class.getPackage())
|
||||||
|
.addPackage(MimeTypeConverter.class.getPackage())
|
||||||
|
.addPackage(EqualsVerifier.class.getPackage())
|
||||||
|
.addPackage(IntegrationTest.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
|
||||||
|
@InSequence(1)
|
||||||
|
public void repoIsInjected() {
|
||||||
|
assertThat(categoryRepo, is(not(nullValue())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@InSequence(2)
|
||||||
|
public void entityManagerIsInjected() {
|
||||||
|
assertThat(entityManager, is(not((nullValue()))));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml")
|
||||||
|
@InSequence(3)
|
||||||
|
public void datasetOnly() {
|
||||||
|
System.out.println("Dataset loaded successfully.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml")
|
||||||
|
@InSequence(1100)
|
||||||
|
public void findByPathString() {
|
||||||
|
final Category category1 = categoryRepo.findByPath("test:/foo/bar/");
|
||||||
|
final Category category2 = categoryRepo.findByPath("test:/foo/bar");
|
||||||
|
final Category category3 = categoryRepo.findByPath("test:/foo/");
|
||||||
|
|
||||||
|
final Category notFound = categoryRepo
|
||||||
|
.findByPath("test:/does/not/exist");
|
||||||
|
|
||||||
|
assertThat(category1, is(not(nullValue())));
|
||||||
|
assertThat(category1.getName(), is(equalTo("bar")));
|
||||||
|
|
||||||
|
assertThat(category2, is(not(nullValue())));
|
||||||
|
assertThat(category2.getName(), is(equalTo("bar")));
|
||||||
|
|
||||||
|
assertThat(category3, is(not(nullValue())));
|
||||||
|
assertThat(category3.getName(), is(equalTo("foo")));
|
||||||
|
|
||||||
|
assertThat(notFound, is(nullValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = InvalidCategoryPathException.class)
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml")
|
||||||
|
@ShouldThrowException(InvalidCategoryPathException.class)
|
||||||
|
@InSequence(1200)
|
||||||
|
public void findByPathStringInvalidDomain() {
|
||||||
|
categoryRepo.findByPath("invalid:/foo/bar/");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml")
|
||||||
|
@InSequence(2100)
|
||||||
|
public void findByPathDomainString() {
|
||||||
|
final Domain domain = domainRepo.findByDomainKey("test");
|
||||||
|
|
||||||
|
final Category category1 = categoryRepo.findByPath(domain, "/foo/bar/");
|
||||||
|
final Category category2 = categoryRepo.findByPath(domain, "foo/bar/");
|
||||||
|
final Category category3 = categoryRepo.findByPath(domain, "/foo/bar");
|
||||||
|
final Category category4 = categoryRepo.findByPath(domain, "foo/bar");
|
||||||
|
|
||||||
|
final Category notFound = categoryRepo.findByPath(domain,
|
||||||
|
"/does/not/exist");
|
||||||
|
|
||||||
|
assertThat(category1, is(not(nullValue())));
|
||||||
|
assertThat(category1.getName(), is(equalTo("bar")));
|
||||||
|
|
||||||
|
assertThat(category2, is(not(nullValue())));
|
||||||
|
assertThat(category2.getName(), is(equalTo("bar")));
|
||||||
|
|
||||||
|
assertThat(category3, is(not(nullValue())));
|
||||||
|
assertThat(category3.getName(), is(equalTo("bar")));
|
||||||
|
|
||||||
|
assertThat(category4, is(not(nullValue())));
|
||||||
|
assertThat(category4.getName(), is(equalTo("bar")));
|
||||||
|
|
||||||
|
assertThat(notFound, is(nullValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UsingDataSet(
|
||||||
|
"datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml")
|
||||||
|
@ShouldMatchDataSet(
|
||||||
|
value = "datasets/org/libreccm/categorization/CategoryRepositoryTest/"
|
||||||
|
+ "after-save-new-category.yml",
|
||||||
|
excludeColumns = {"object_id"})
|
||||||
|
@InSequence(3100)
|
||||||
|
public void saveNewCategory() {
|
||||||
|
final Category category = new Category();
|
||||||
|
category.setDisplayName("new-category");
|
||||||
|
category.setName("new-category");
|
||||||
|
category.setUniqueId("new0001");
|
||||||
|
|
||||||
|
categoryRepo.save(category);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* 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.categorization;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.Parameterized;
|
||||||
|
import org.libreccm.tests.categories.UnitTest;
|
||||||
|
import org.libreccm.testutils.DatasetType;
|
||||||
|
import org.libreccm.testutils.DatasetsVerifier;
|
||||||
|
|
||||||
|
import static org.libreccm.testutils.DatasetType.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RunWith(Parameterized.class)
|
||||||
|
@org.junit.experimental.categories.Category(UnitTest.class)
|
||||||
|
public class DatasetsTest extends DatasetsVerifier {
|
||||||
|
|
||||||
|
@Parameterized.Parameters(name = "Dataset {0}")
|
||||||
|
public static Collection<String> data() {
|
||||||
|
return Arrays.asList(new String[]{
|
||||||
|
"/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml",
|
||||||
|
"/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml",
|
||||||
|
"/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml",
|
||||||
|
"/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml",
|
||||||
|
"/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml",
|
||||||
|
"/datasets/org/libreccm/categorization/CategoryManagerTest/data2.yml",
|
||||||
|
"/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml",
|
||||||
|
"/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatasetsTest(final String datasetPath) {
|
||||||
|
super(datasetPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getSchemas() {
|
||||||
|
return new String[]{"ccm_core"};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatasetType getDatasetType() {
|
||||||
|
return YAML;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -40,7 +39,6 @@ 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;
|
||||||
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
import org.jboss.shrinkwrap.api.ShrinkWrap;
|
||||||
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
|
|
||||||
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||||
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
|
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
|
||||||
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
|
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
|
||||||
|
|
@ -141,7 +139,6 @@ public class AuthorizationInterceptorTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -136,7 +135,6 @@ public class GroupManagerTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -150,7 +149,6 @@ public class PermissionCheckerTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -64,7 +63,6 @@ import java.io.File;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -142,7 +140,6 @@ public class PermissionManagerTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -136,7 +135,6 @@ public class RoleManagerTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -167,7 +166,6 @@ public class SecuredCollectionTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -167,7 +166,6 @@ public class SecuredIteratorTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -136,7 +135,6 @@ public class ShiroTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
||||||
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.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||||
import com.arsdigita.web.CCMApplicationContextListener;
|
import com.arsdigita.web.CCMApplicationContextListener;
|
||||||
import com.arsdigita.xml.XML;
|
import com.arsdigita.xml.XML;
|
||||||
|
|
@ -137,7 +136,6 @@ public class UserManagerTest {
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(SecurityConfig.class.getPackage())
|
||||||
.addPackage(AbstractConfig.class.getPackage())
|
.addPackage(AbstractConfig.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(AbstractParameterContext.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(XML.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(DateTimeFormatter.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,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,
|
||||||
|
|
@ -54,7 +55,7 @@ CREATE SCHEMA ccm_core;
|
||||||
create table CCM_CORE.CATEGORY_DOMAINS (
|
create table CCM_CORE.CATEGORY_DOMAINS (
|
||||||
DOMAIN_KEY varchar(255) not null,
|
DOMAIN_KEY varchar(255) not null,
|
||||||
RELEASED timestamp,
|
RELEASED timestamp,
|
||||||
URI varchar(1024) not null,
|
URI varchar(1024),
|
||||||
VERSION varchar(255) not null,
|
VERSION varchar(255) not null,
|
||||||
OBJECT_ID bigint not null,
|
OBJECT_ID bigint not null,
|
||||||
ROOT_CATEGORY_ID bigint,
|
ROOT_CATEGORY_ID bigint,
|
||||||
|
|
@ -83,10 +84,63 @@ CREATE SCHEMA ccm_core;
|
||||||
|
|
||||||
create table CCM_CORE.CCM_ROLES (
|
create table CCM_CORE.CCM_ROLES (
|
||||||
ROLE_ID bigint not null,
|
ROLE_ID bigint not null,
|
||||||
name varchar(512) not null,
|
NAME varchar(512) not null,
|
||||||
primary key (ROLE_ID)
|
primary key (ROLE_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONFIGURATION_ENTRIES (
|
||||||
|
comment varchar(2048),
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_BIG_DECIMAL (
|
||||||
|
entry_value decimal(19,2),
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_BOOLEAN (
|
||||||
|
entry_value boolean,
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_DOUBLE (
|
||||||
|
entry_value double,
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_ENUM (
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_INTEGER (
|
||||||
|
entry_value bigint,
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_L10N_STRING (
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_L10N_STR_VALUES (
|
||||||
|
ENTRY_ID bigint not null,
|
||||||
|
LOCALIZED_VALUE clob,
|
||||||
|
LOCALE varchar(255) not null,
|
||||||
|
primary key (ENTRY_ID, LOCALE)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_STRING (
|
||||||
|
entry_value varchar(1024),
|
||||||
|
OBJECT_ID bigint not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.DIGESTS (
|
create table CCM_CORE.DIGESTS (
|
||||||
FREQUENCY integer,
|
FREQUENCY integer,
|
||||||
HEADER varchar(4096) not null,
|
HEADER varchar(4096) not null,
|
||||||
|
|
@ -123,6 +177,11 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (OBJECT_ID, LOCALE)
|
primary key (OBJECT_ID, LOCALE)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.ENUM_CONFIGURATION_ENTRIES_VALUES (
|
||||||
|
ENUM_ID bigint not null,
|
||||||
|
value varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.FORMBUILDER_COMPONENTS (
|
create table CCM_CORE.FORMBUILDER_COMPONENTS (
|
||||||
ACTIVE boolean,
|
ACTIVE boolean,
|
||||||
ADMIN_NAME varchar(255),
|
ADMIN_NAME varchar(255),
|
||||||
|
|
@ -466,6 +525,13 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (MEMBERSHIP_ID)
|
primary key (MEMBERSHIP_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.TASK_ASSIGNMENTS (
|
||||||
|
TASK_ASSIGNMENT_ID bigint not null,
|
||||||
|
ROLE_ID bigint,
|
||||||
|
TASK_ID bigint,
|
||||||
|
primary key (TASK_ASSIGNMENT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.THREADS (
|
create table CCM_CORE.THREADS (
|
||||||
OBJECT_ID bigint not null,
|
OBJECT_ID bigint not null,
|
||||||
ROOT_ID bigint,
|
ROOT_ID bigint,
|
||||||
|
|
@ -557,16 +623,6 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (TASK_ID)
|
primary key (TASK_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_GROUPS (
|
|
||||||
USER_TASK_ID bigint not null,
|
|
||||||
ASSIGNED_GROUP_ID bigint not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_USERS (
|
|
||||||
USER_TASK_ID bigint not null,
|
|
||||||
ASSIGNED_USER_ID bigint not null
|
|
||||||
);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
@ -579,12 +635,6 @@ CREATE SCHEMA ccm_core;
|
||||||
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.WORKFLOW_USER_TASK_ASSIGNED_GROUPS
|
|
||||||
add constraint UK_q9evs4qcfhr79fha7xgk057wo unique (ASSIGNED_GROUP_ID);
|
|
||||||
|
|
||||||
alter table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_USERS
|
|
||||||
add constraint UK_bb9rm595xsbrpyx95lmwnlg76 unique (ASSIGNED_USER_ID);
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
@ -635,6 +685,51 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CATEGORIES;
|
references CCM_CORE.CATEGORIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONFIGURATION_ENTRIES
|
||||||
|
add constraint FK_8u6h7p0gs4ybf0ju240mggb73
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CCM_OBJECTS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_BIG_DECIMAL
|
||||||
|
add constraint FK_3tnub4je6c2bwi0c3p9m2n6d1
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_BOOLEAN
|
||||||
|
add constraint FK_d79uxyam5uhhmw3ijw3c14gk2
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_DOUBLE
|
||||||
|
add constraint FK_l5qxx6wfngl2hvnqaq77oin1s
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_ENUM
|
||||||
|
add constraint FK_blwwj2ht4wbg82meuuxf0t7kk
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_INTEGER
|
||||||
|
add constraint FK_reo0efdw6evf11viwlse1w27
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_L10N_STRING
|
||||||
|
add constraint FK_dbvyqoliuh0d7bl6ksng4abe
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_L10N_STR_VALUES
|
||||||
|
add constraint FK_ftb5yqeoli1m932yp3p8ho74g
|
||||||
|
foreign key (ENTRY_ID)
|
||||||
|
references CCM_CORE.CONF_ENTRIES_L10N_STRING;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_STRING
|
||||||
|
add constraint FK_j31m640x2cn0xl5jcbik06708
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
alter table CCM_CORE.DIGESTS
|
alter table CCM_CORE.DIGESTS
|
||||||
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
||||||
foreign key (FROM_PARTY_ID)
|
foreign key (FROM_PARTY_ID)
|
||||||
|
|
@ -665,6 +760,11 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CATEGORY_DOMAINS;
|
references CCM_CORE.CATEGORY_DOMAINS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.ENUM_CONFIGURATION_ENTRIES_VALUES
|
||||||
|
add constraint FK_ao3evxajxd8y4gy5a6e8ua49j
|
||||||
|
foreign key (ENUM_ID)
|
||||||
|
references CCM_CORE.CONF_ENTRIES_ENUM;
|
||||||
|
|
||||||
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
||||||
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
||||||
foreign key (parentComponent_OBJECT_ID)
|
foreign key (parentComponent_OBJECT_ID)
|
||||||
|
|
@ -955,6 +1055,16 @@ 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.TASK_ASSIGNMENTS
|
||||||
|
add constraint FK_klh64or0yq26c63181j1tps2o
|
||||||
|
foreign key (ROLE_ID)
|
||||||
|
references CCM_CORE.CCM_ROLES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||||
|
add constraint FK_fu6ukne6hj8ihlfxtmp17xpfj
|
||||||
|
foreign key (TASK_ID)
|
||||||
|
references CCM_CORE.WORKFLOW_USER_TASKS;
|
||||||
|
|
||||||
alter table CCM_CORE.THREADS
|
alter table CCM_CORE.THREADS
|
||||||
add constraint FK_oopqroe5a8fg932teo0cyifcv
|
add constraint FK_oopqroe5a8fg932teo0cyifcv
|
||||||
foreign key (ROOT_ID)
|
foreign key (ROOT_ID)
|
||||||
|
|
@ -1005,24 +1115,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.WORKFLOW_USER_TASK_ASSIGNED_GROUPS
|
|
||||||
add constraint FK_q9evs4qcfhr79fha7xgk057wo
|
|
||||||
foreign key (ASSIGNED_GROUP_ID)
|
|
||||||
references CCM_CORE.GROUPS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_GROUPS
|
|
||||||
add constraint FK_lqtfvnswn0k8kjghoi4jk3qfe
|
|
||||||
foreign key (USER_TASK_ID)
|
|
||||||
references CCM_CORE.WORKFLOW_USER_TASKS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_USERS
|
|
||||||
add constraint FK_bb9rm595xsbrpyx95lmwnlg76
|
|
||||||
foreign key (ASSIGNED_USER_ID)
|
|
||||||
references CCM_CORE.USERS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_USERS
|
|
||||||
add constraint FK_7qgn3rbw4wgpd77hhqogfh53x
|
|
||||||
foreign key (USER_TASK_ID)
|
|
||||||
references CCM_CORE.WORKFLOW_USER_TASKS;
|
|
||||||
|
|
||||||
create sequence hibernate_sequence start with 1 increment by 1;
|
create sequence hibernate_sequence start with 1 increment by 1;
|
||||||
|
|
@ -5,6 +5,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,
|
||||||
|
|
@ -54,7 +55,7 @@ CREATE SCHEMA ccm_core;
|
||||||
create table CCM_CORE.CATEGORY_DOMAINS (
|
create table CCM_CORE.CATEGORY_DOMAINS (
|
||||||
DOMAIN_KEY varchar(255) not null,
|
DOMAIN_KEY varchar(255) not null,
|
||||||
RELEASED timestamp,
|
RELEASED timestamp,
|
||||||
URI varchar(1024) not null,
|
URI varchar(1024),
|
||||||
VERSION varchar(255) not null,
|
VERSION varchar(255) not null,
|
||||||
OBJECT_ID int8 not null,
|
OBJECT_ID int8 not null,
|
||||||
ROOT_CATEGORY_ID int8,
|
ROOT_CATEGORY_ID int8,
|
||||||
|
|
@ -83,10 +84,63 @@ CREATE SCHEMA ccm_core;
|
||||||
|
|
||||||
create table CCM_CORE.CCM_ROLES (
|
create table CCM_CORE.CCM_ROLES (
|
||||||
ROLE_ID int8 not null,
|
ROLE_ID int8 not null,
|
||||||
name varchar(512) not null,
|
NAME varchar(512) not null,
|
||||||
primary key (ROLE_ID)
|
primary key (ROLE_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONFIGURATION_ENTRIES (
|
||||||
|
comment varchar(2048),
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_BIG_DECIMAL (
|
||||||
|
entry_value numeric(19, 2),
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_BOOLEAN (
|
||||||
|
entry_value boolean,
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_DOUBLE (
|
||||||
|
entry_value float8,
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_ENUM (
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_INTEGER (
|
||||||
|
entry_value int8,
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_L10N_STRING (
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_L10N_STR_VALUES (
|
||||||
|
ENTRY_ID int8 not null,
|
||||||
|
LOCALIZED_VALUE text,
|
||||||
|
LOCALE varchar(255) not null,
|
||||||
|
primary key (ENTRY_ID, LOCALE)
|
||||||
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.CONF_ENTRIES_STRING (
|
||||||
|
entry_value varchar(1024),
|
||||||
|
OBJECT_ID int8 not null,
|
||||||
|
primary key (OBJECT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.DIGESTS (
|
create table CCM_CORE.DIGESTS (
|
||||||
FREQUENCY int4,
|
FREQUENCY int4,
|
||||||
HEADER varchar(4096) not null,
|
HEADER varchar(4096) not null,
|
||||||
|
|
@ -123,6 +177,11 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (OBJECT_ID, LOCALE)
|
primary key (OBJECT_ID, LOCALE)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.ENUM_CONFIGURATION_ENTRIES_VALUES (
|
||||||
|
ENUM_ID int8 not null,
|
||||||
|
value varchar(255)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.FORMBUILDER_COMPONENTS (
|
create table CCM_CORE.FORMBUILDER_COMPONENTS (
|
||||||
ACTIVE boolean,
|
ACTIVE boolean,
|
||||||
ADMIN_NAME varchar(255),
|
ADMIN_NAME varchar(255),
|
||||||
|
|
@ -466,6 +525,13 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (MEMBERSHIP_ID)
|
primary key (MEMBERSHIP_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table CCM_CORE.TASK_ASSIGNMENTS (
|
||||||
|
TASK_ASSIGNMENT_ID int8 not null,
|
||||||
|
ROLE_ID int8,
|
||||||
|
TASK_ID int8,
|
||||||
|
primary key (TASK_ASSIGNMENT_ID)
|
||||||
|
);
|
||||||
|
|
||||||
create table CCM_CORE.THREADS (
|
create table CCM_CORE.THREADS (
|
||||||
OBJECT_ID int8 not null,
|
OBJECT_ID int8 not null,
|
||||||
ROOT_ID int8,
|
ROOT_ID int8,
|
||||||
|
|
@ -557,16 +623,6 @@ CREATE SCHEMA ccm_core;
|
||||||
primary key (TASK_ID)
|
primary key (TASK_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_GROUPS (
|
|
||||||
USER_TASK_ID int8 not null,
|
|
||||||
ASSIGNED_GROUP_ID int8 not null
|
|
||||||
);
|
|
||||||
|
|
||||||
create table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_USERS (
|
|
||||||
USER_TASK_ID int8 not null,
|
|
||||||
ASSIGNED_USER_ID int8 not null
|
|
||||||
);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
@ -579,12 +635,6 @@ CREATE SCHEMA ccm_core;
|
||||||
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.WORKFLOW_USER_TASK_ASSIGNED_GROUPS
|
|
||||||
add constraint UK_q9evs4qcfhr79fha7xgk057wo unique (ASSIGNED_GROUP_ID);
|
|
||||||
|
|
||||||
alter table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_USERS
|
|
||||||
add constraint UK_bb9rm595xsbrpyx95lmwnlg76 unique (ASSIGNED_USER_ID);
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
@ -635,6 +685,51 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CATEGORIES;
|
references CCM_CORE.CATEGORIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONFIGURATION_ENTRIES
|
||||||
|
add constraint FK_8u6h7p0gs4ybf0ju240mggb73
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CCM_OBJECTS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_BIG_DECIMAL
|
||||||
|
add constraint FK_3tnub4je6c2bwi0c3p9m2n6d1
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_BOOLEAN
|
||||||
|
add constraint FK_d79uxyam5uhhmw3ijw3c14gk2
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_DOUBLE
|
||||||
|
add constraint FK_l5qxx6wfngl2hvnqaq77oin1s
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_ENUM
|
||||||
|
add constraint FK_blwwj2ht4wbg82meuuxf0t7kk
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_INTEGER
|
||||||
|
add constraint FK_reo0efdw6evf11viwlse1w27
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_L10N_STRING
|
||||||
|
add constraint FK_dbvyqoliuh0d7bl6ksng4abe
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_L10N_STR_VALUES
|
||||||
|
add constraint FK_ftb5yqeoli1m932yp3p8ho74g
|
||||||
|
foreign key (ENTRY_ID)
|
||||||
|
references CCM_CORE.CONF_ENTRIES_L10N_STRING;
|
||||||
|
|
||||||
|
alter table CCM_CORE.CONF_ENTRIES_STRING
|
||||||
|
add constraint FK_j31m640x2cn0xl5jcbik06708
|
||||||
|
foreign key (OBJECT_ID)
|
||||||
|
references CCM_CORE.CONFIGURATION_ENTRIES;
|
||||||
|
|
||||||
alter table CCM_CORE.DIGESTS
|
alter table CCM_CORE.DIGESTS
|
||||||
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
||||||
foreign key (FROM_PARTY_ID)
|
foreign key (FROM_PARTY_ID)
|
||||||
|
|
@ -665,6 +760,11 @@ CREATE SCHEMA ccm_core;
|
||||||
foreign key (OBJECT_ID)
|
foreign key (OBJECT_ID)
|
||||||
references CCM_CORE.CATEGORY_DOMAINS;
|
references CCM_CORE.CATEGORY_DOMAINS;
|
||||||
|
|
||||||
|
alter table CCM_CORE.ENUM_CONFIGURATION_ENTRIES_VALUES
|
||||||
|
add constraint FK_ao3evxajxd8y4gy5a6e8ua49j
|
||||||
|
foreign key (ENUM_ID)
|
||||||
|
references CCM_CORE.CONF_ENTRIES_ENUM;
|
||||||
|
|
||||||
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
alter table CCM_CORE.FORMBUILDER_COMPONENTS
|
||||||
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
||||||
foreign key (parentComponent_OBJECT_ID)
|
foreign key (parentComponent_OBJECT_ID)
|
||||||
|
|
@ -955,6 +1055,16 @@ 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.TASK_ASSIGNMENTS
|
||||||
|
add constraint FK_klh64or0yq26c63181j1tps2o
|
||||||
|
foreign key (ROLE_ID)
|
||||||
|
references CCM_CORE.CCM_ROLES;
|
||||||
|
|
||||||
|
alter table CCM_CORE.TASK_ASSIGNMENTS
|
||||||
|
add constraint FK_fu6ukne6hj8ihlfxtmp17xpfj
|
||||||
|
foreign key (TASK_ID)
|
||||||
|
references CCM_CORE.WORKFLOW_USER_TASKS;
|
||||||
|
|
||||||
alter table CCM_CORE.THREADS
|
alter table CCM_CORE.THREADS
|
||||||
add constraint FK_oopqroe5a8fg932teo0cyifcv
|
add constraint FK_oopqroe5a8fg932teo0cyifcv
|
||||||
foreign key (ROOT_ID)
|
foreign key (ROOT_ID)
|
||||||
|
|
@ -1005,24 +1115,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.WORKFLOW_USER_TASK_ASSIGNED_GROUPS
|
|
||||||
add constraint FK_q9evs4qcfhr79fha7xgk057wo
|
|
||||||
foreign key (ASSIGNED_GROUP_ID)
|
|
||||||
references CCM_CORE.GROUPS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_GROUPS
|
|
||||||
add constraint FK_lqtfvnswn0k8kjghoi4jk3qfe
|
|
||||||
foreign key (USER_TASK_ID)
|
|
||||||
references CCM_CORE.WORKFLOW_USER_TASKS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_USERS
|
|
||||||
add constraint FK_bb9rm595xsbrpyx95lmwnlg76
|
|
||||||
foreign key (ASSIGNED_USER_ID)
|
|
||||||
references CCM_CORE.USERS;
|
|
||||||
|
|
||||||
alter table CCM_CORE.WORKFLOW_USER_TASK_ASSIGNED_USERS
|
|
||||||
add constraint FK_7qgn3rbw4wgpd77hhqogfh53x
|
|
||||||
foreign key (USER_TASK_ID)
|
|
||||||
references CCM_CORE.WORKFLOW_USER_TASKS;
|
|
||||||
|
|
||||||
create sequence hibernate_sequence start 1 increment 1;
|
create sequence hibernate_sequence start 1 increment 1;
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
ccm_core.ccm_objects:
|
||||||
|
- object_id: -1000
|
||||||
|
display_name: test
|
||||||
|
- object_id: -2000
|
||||||
|
display_name: test_root
|
||||||
|
- object_id: -2100
|
||||||
|
display_name: foo
|
||||||
|
- object_id: -2200
|
||||||
|
display_name: bar
|
||||||
|
- object_id: -3100
|
||||||
|
display_name: object1
|
||||||
|
- object_id: -3200
|
||||||
|
display_name: object2
|
||||||
|
- object_id: -3300
|
||||||
|
display_name: object3
|
||||||
|
|
||||||
|
ccm_core.categories:
|
||||||
|
- object_id: -2000
|
||||||
|
unique_id: test0001
|
||||||
|
name: test-root
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2100
|
||||||
|
unique_id: test0002
|
||||||
|
name: foo
|
||||||
|
parent_category_id: -2000
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2200
|
||||||
|
unique_id: test0003
|
||||||
|
name: bar
|
||||||
|
parent_category_id: -2100
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
|
||||||
|
ccm_core.category_domains:
|
||||||
|
- object_id: -1000
|
||||||
|
domain_key: test
|
||||||
|
root_category_id: -2000
|
||||||
|
uri: http://libreccm.org/test
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
|
ccm_core.categorizations:
|
||||||
|
- categorization_id: -10000
|
||||||
|
category_id: -2100
|
||||||
|
object_id: -3100
|
||||||
|
object_order: 1
|
||||||
|
category_order: 1
|
||||||
|
category_index: false
|
||||||
|
- categorization_id: -10100
|
||||||
|
category_id: -2200
|
||||||
|
object_id: -3300
|
||||||
|
category_order: 1
|
||||||
|
object_order: 1
|
||||||
|
category_index: false
|
||||||
|
- categorization_id: -10200
|
||||||
|
object_id: -3200
|
||||||
|
category_id: -2100
|
||||||
|
category_order: 1
|
||||||
|
object_order: 2
|
||||||
|
category_index: false
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
ccm_core.ccm_objects:
|
||||||
|
- object_id: -1000
|
||||||
|
display_name: test
|
||||||
|
- object_id: -2000
|
||||||
|
display_name: test_root
|
||||||
|
- object_id: -2100
|
||||||
|
display_name: foo
|
||||||
|
- object_id: -2200
|
||||||
|
display_name: bar
|
||||||
|
- object_id: -3100
|
||||||
|
display_name: object1
|
||||||
|
- object_id: -3200
|
||||||
|
display_name: object2
|
||||||
|
- object_id: -3300
|
||||||
|
display_name: object3
|
||||||
|
- object_id: -2300
|
||||||
|
display_name: category-new
|
||||||
|
|
||||||
|
ccm_core.categories:
|
||||||
|
- object_id: -2000
|
||||||
|
unique_id: test0001
|
||||||
|
name: test-root
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2100
|
||||||
|
unique_id: test0002
|
||||||
|
name: foo
|
||||||
|
parent_category_id: -2000
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2200
|
||||||
|
unique_id: test0003
|
||||||
|
name: bar
|
||||||
|
parent_category_id: -2100
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2300
|
||||||
|
unique_id: catnew
|
||||||
|
name: category-new
|
||||||
|
parent_category_id: -2100
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 1
|
||||||
|
|
||||||
|
ccm_core.category_domains:
|
||||||
|
- object_id: -1000
|
||||||
|
domain_key: test
|
||||||
|
root_category_id: -2000
|
||||||
|
uri: http://libreccm.org/test
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
|
ccm_core.categorizations:
|
||||||
|
- categorization_id: -10000
|
||||||
|
category_id: -2100
|
||||||
|
object_id: -3100
|
||||||
|
object_order: 1
|
||||||
|
category_order: 1
|
||||||
|
category_index: false
|
||||||
|
- categorization_id: -10100
|
||||||
|
category_id: -2200
|
||||||
|
object_id: -3300
|
||||||
|
category_order: 1
|
||||||
|
object_order: 1
|
||||||
|
category_index: false
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
ccm_core.ccm_objects:
|
||||||
|
- object_id: -1000
|
||||||
|
display_name: test
|
||||||
|
- object_id: -2000
|
||||||
|
display_name: test_root
|
||||||
|
- object_id: -2100
|
||||||
|
display_name: foo
|
||||||
|
- object_id: -2200
|
||||||
|
display_name: bar
|
||||||
|
- object_id: -3100
|
||||||
|
display_name: object1
|
||||||
|
- object_id: -3200
|
||||||
|
display_name: object2
|
||||||
|
- object_id: -3300
|
||||||
|
display_name: object3
|
||||||
|
|
||||||
|
ccm_core.categories:
|
||||||
|
- object_id: -2000
|
||||||
|
unique_id: test0001
|
||||||
|
name: test-root
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2100
|
||||||
|
unique_id: test0002
|
||||||
|
name: foo
|
||||||
|
parent_category_id: -2000
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2200
|
||||||
|
unique_id: test0003
|
||||||
|
name: bar
|
||||||
|
parent_category_id: -2100
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
|
||||||
|
ccm_core.category_domains:
|
||||||
|
- object_id: -1000
|
||||||
|
domain_key: test
|
||||||
|
root_category_id: -2000
|
||||||
|
uri: http://libreccm.org/test
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
|
ccm_core.categorizations:
|
||||||
|
- categorization_id: -10100
|
||||||
|
category_id: -2200
|
||||||
|
object_id: -3300
|
||||||
|
category_order: 1
|
||||||
|
object_order: 1
|
||||||
|
category_index: false
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
ccm_core.ccm_objects:
|
||||||
|
- object_id: -1000
|
||||||
|
display_name: test
|
||||||
|
- object_id: -2000
|
||||||
|
display_name: test_root
|
||||||
|
- object_id: -2100
|
||||||
|
display_name: foo
|
||||||
|
- object_id: -2200
|
||||||
|
display_name: bar
|
||||||
|
- object_id: -3100
|
||||||
|
display_name: object1
|
||||||
|
- object_id: -3200
|
||||||
|
display_name: object2
|
||||||
|
- object_id: -3300
|
||||||
|
display_name: object3
|
||||||
|
|
||||||
|
ccm_core.categories:
|
||||||
|
- object_id: -2000
|
||||||
|
unique_id: test0001
|
||||||
|
name: test-root
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2100
|
||||||
|
unique_id: test0002
|
||||||
|
name: foo
|
||||||
|
parent_category_id: -2000
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2200
|
||||||
|
unique_id: test0003
|
||||||
|
name: bar
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
|
||||||
|
ccm_core.category_domains:
|
||||||
|
- object_id: -1000
|
||||||
|
domain_key: test
|
||||||
|
root_category_id: -2000
|
||||||
|
uri: http://libreccm.org/test
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
|
ccm_core.categorizations:
|
||||||
|
- categorization_id: -10000
|
||||||
|
category_id: -2100
|
||||||
|
object_id: -3100
|
||||||
|
object_order: 1
|
||||||
|
category_order: 1
|
||||||
|
category_index: false
|
||||||
|
- categorization_id: -10100
|
||||||
|
category_id: -2200
|
||||||
|
object_id: -3300
|
||||||
|
category_order: 1
|
||||||
|
object_order: 1
|
||||||
|
category_index: false
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
ccm_core.ccm_objects:
|
||||||
|
- object_id: -1000
|
||||||
|
display_name: test
|
||||||
|
- object_id: -2000
|
||||||
|
display_name: test_root
|
||||||
|
- object_id: -2100
|
||||||
|
display_name: foo
|
||||||
|
- object_id: -2200
|
||||||
|
display_name: bar
|
||||||
|
- object_id: -3100
|
||||||
|
display_name: object1
|
||||||
|
- object_id: -3200
|
||||||
|
display_name: object2
|
||||||
|
- object_id: -3300
|
||||||
|
display_name: object3
|
||||||
|
|
||||||
|
ccm_core.categories:
|
||||||
|
- object_id: -2000
|
||||||
|
unique_id: test0001
|
||||||
|
name: test-root
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2100
|
||||||
|
unique_id: test0002
|
||||||
|
name: foo
|
||||||
|
parent_category_id: -2000
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2200
|
||||||
|
unique_id: test0003
|
||||||
|
name: bar
|
||||||
|
parent_category_id: -2100
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
|
||||||
|
ccm_core.category_domains:
|
||||||
|
- object_id: -1000
|
||||||
|
domain_key: test
|
||||||
|
root_category_id: -2000
|
||||||
|
uri: http://libreccm.org/test
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
|
ccm_core.categorizations:
|
||||||
|
- categorization_id: -10000
|
||||||
|
category_id: -2100
|
||||||
|
object_id: -3100
|
||||||
|
object_order: 1
|
||||||
|
category_order: 1
|
||||||
|
category_index: false
|
||||||
|
- categorization_id: -10100
|
||||||
|
category_id: -2200
|
||||||
|
object_id: -3300
|
||||||
|
category_order: 1
|
||||||
|
object_order: 1
|
||||||
|
category_index: false
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
ccm_core.ccm_objects:
|
||||||
|
- object_id: -1000
|
||||||
|
display_name: test
|
||||||
|
- object_id: -2000
|
||||||
|
display_name: test_root
|
||||||
|
- object_id: -2100
|
||||||
|
display_name: foo
|
||||||
|
- object_id: -2200
|
||||||
|
display_name: bar
|
||||||
|
- object_id: -3100
|
||||||
|
display_name: object1
|
||||||
|
- object_id: -3200
|
||||||
|
display_name: object2
|
||||||
|
- object_id: -3300
|
||||||
|
display_name: object3
|
||||||
|
- object_id: -2300
|
||||||
|
display_name: category-new
|
||||||
|
|
||||||
|
ccm_core.categories:
|
||||||
|
- object_id: -2000
|
||||||
|
unique_id: test0001
|
||||||
|
name: test-root
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2100
|
||||||
|
unique_id: test0002
|
||||||
|
name: foo
|
||||||
|
parent_category_id: -2000
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2200
|
||||||
|
unique_id: test0003
|
||||||
|
name: bar
|
||||||
|
parent_category_id: -2100
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2300
|
||||||
|
unique_id: catnew
|
||||||
|
name: category-new
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 1
|
||||||
|
|
||||||
|
|
||||||
|
ccm_core.category_domains:
|
||||||
|
- object_id: -1000
|
||||||
|
domain_key: test
|
||||||
|
root_category_id: -2000
|
||||||
|
uri: http://libreccm.org/test
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
|
ccm_core.categorizations:
|
||||||
|
- categorization_id: -10000
|
||||||
|
category_id: -2100
|
||||||
|
object_id: -3100
|
||||||
|
object_order: 1
|
||||||
|
category_order: 1
|
||||||
|
category_index: false
|
||||||
|
- categorization_id: -10100
|
||||||
|
category_id: -2200
|
||||||
|
object_id: -3300
|
||||||
|
category_order: 1
|
||||||
|
object_order: 1
|
||||||
|
category_index: false
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
ccm_core.ccm_objects:
|
||||||
|
- object_id: -1000
|
||||||
|
display_name: test
|
||||||
|
- object_id: -2000
|
||||||
|
display_name: test_root
|
||||||
|
- object_id: -2100
|
||||||
|
display_name: foo
|
||||||
|
- object_id: -2200
|
||||||
|
display_name: bar
|
||||||
|
- object_id: -2300
|
||||||
|
display_name: new-category
|
||||||
|
|
||||||
|
ccm_core.categories:
|
||||||
|
- object_id: -2000
|
||||||
|
unique_id: test0001
|
||||||
|
name: test-root
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2100
|
||||||
|
unique_id: test0002
|
||||||
|
name: foo
|
||||||
|
parent_category_id: -2000
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2200
|
||||||
|
unique_id: test0003
|
||||||
|
name: bar
|
||||||
|
parent_category_id: -2100
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2300
|
||||||
|
unique_id: new0001
|
||||||
|
name: new-category
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
|
||||||
|
ccm_core.category_domains:
|
||||||
|
- object_id: -1000
|
||||||
|
domain_key: test
|
||||||
|
root_category_id: -2000
|
||||||
|
uri: http://libreccm.org/test
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
ccm_core.ccm_objects:
|
||||||
|
- object_id: -1000
|
||||||
|
display_name: test
|
||||||
|
- object_id: -2000
|
||||||
|
display_name: test_root
|
||||||
|
- object_id: -2100
|
||||||
|
display_name: foo
|
||||||
|
- object_id: -2200
|
||||||
|
display_name: bar
|
||||||
|
|
||||||
|
ccm_core.categories:
|
||||||
|
- object_id: -2000
|
||||||
|
unique_id: test0001
|
||||||
|
name: test-root
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2100
|
||||||
|
unique_id: test0002
|
||||||
|
name: foo
|
||||||
|
parent_category_id: -2000
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
- object_id: -2200
|
||||||
|
unique_id: test0003
|
||||||
|
name: bar
|
||||||
|
parent_category_id: -2100
|
||||||
|
enabled: true
|
||||||
|
visible: true
|
||||||
|
abstract_category: false
|
||||||
|
category_order: 0
|
||||||
|
|
||||||
|
ccm_core.category_domains:
|
||||||
|
- object_id: -1000
|
||||||
|
domain_key: test
|
||||||
|
root_category_id: -2000
|
||||||
|
uri: http://libreccm.org/test
|
||||||
|
version: 1.0
|
||||||
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
DELETE FROM ccm_core.categorizations;
|
||||||
|
|
||||||
|
DELETE FROM ccm_core.category_domains;
|
||||||
|
|
||||||
|
DELETE FROM ccm_core.categories;
|
||||||
|
|
||||||
DELETE FROM ccm_core.permissions;
|
DELETE FROM ccm_core.permissions;
|
||||||
|
|
||||||
DELETE FROM ccm_core.ccm_objects;
|
DELETE FROM ccm_core.ccm_objects;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,23 @@
|
||||||
DELETE FROM ccm_core.permissions;
|
-- DELETE FROM ccm_core.categorizations;
|
||||||
|
--
|
||||||
DELETE FROM ccm_core.ccm_privileges;
|
-- DELETE FROM ccm_core.category_domains;
|
||||||
|
--
|
||||||
DELETE FROM ccm_core.ccm_objects;
|
-- DELETE FROM ccm_core.categories;
|
||||||
|
--
|
||||||
DELETE FROM ccm_core.user_email_addresses;
|
-- DELETE FROM ccm_core.permissions;
|
||||||
|
--
|
||||||
DELETE FROM ccm_core.parties;
|
-- DELETE FROM ccm_core.ccm_objects;
|
||||||
|
--
|
||||||
|
-- DELETE FROM ccm_core.role_memberships;
|
||||||
|
--
|
||||||
|
-- DELETE FROM ccm_core.group_memberships;
|
||||||
|
--
|
||||||
|
-- DELETE FROM ccm_core.groups;
|
||||||
|
--
|
||||||
|
-- DELETE FROM ccm_core.users;
|
||||||
|
--
|
||||||
|
-- DELETE FROM ccm_core.user_email_addresses;
|
||||||
|
--
|
||||||
|
-- DELETE FROM ccm_core.parties;
|
||||||
|
--
|
||||||
|
-- DELETE FROM ccm_core.ccm_roles;
|
||||||
Loading…
Reference in New Issue