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.templating.Templating;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.web.BaseApplicationServlet;
|
||||
import com.arsdigita.web.LoginSignal;
|
||||
import com.arsdigita.xml.Document;
|
||||
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.PermissionChecker;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
|
@ -108,14 +106,8 @@ public class AdminServlet extends BaseApplicationServlet implements
|
|||
// /////// Some preparational steps ///////////////
|
||||
/* Determine access privilege: only logged in users may access */
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final Subject subject;
|
||||
final PermissionChecker permissionChecker;
|
||||
try {
|
||||
subject = cdiUtil.findBean(Subject.class);
|
||||
permissionChecker = cdiUtil.findBean(PermissionChecker.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(PermissionChecker.class);
|
||||
|
||||
if (!subject.isAuthenticated()) {
|
||||
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.SingletonApplicationPane;
|
||||
import com.arsdigita.ui.admin.applications.tree.ApplicationTreeModelBuilder;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
import org.libreccm.web.ApplicationType;
|
||||
|
|
@ -79,13 +79,8 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
|||
setLeft(applicationTree);
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final org.libreccm.web.ApplicationManager appManager;
|
||||
try {
|
||||
appManager = cdiUtil.findBean(
|
||||
final org.libreccm.web.ApplicationManager appManager = cdiUtil.findBean(
|
||||
org.libreccm.web.ApplicationManager.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
final Collection<ApplicationType> applicationTypes = appManager.
|
||||
getApplicationTypes().values();
|
||||
|
|
@ -147,7 +142,8 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
|||
createForm = appManager.getApplicationCreateForm();
|
||||
}
|
||||
|
||||
final MultiInstanceApplicationPane<?> appPane = new MultiInstanceApplicationPane(
|
||||
final MultiInstanceApplicationPane<?> appPane
|
||||
= new MultiInstanceApplicationPane(
|
||||
applicationType, createForm);
|
||||
appPanes.put(applicationType.name(), appPane);
|
||||
createInstancePane(applicationType, appManagers);
|
||||
|
|
@ -218,12 +214,8 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
|||
} else {
|
||||
// Selected key is the name of a instance pane
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ApplicationRepository appRepo;
|
||||
try {
|
||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||
ApplicationRepository.class);
|
||||
|
||||
final CcmApplication application = appRepo
|
||||
.retrieveApplicationForPath(selectedKey);
|
||||
|
|
@ -258,4 +250,5 @@ public class ApplicationsAdministrationTab extends LayoutPanel implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,15 +30,11 @@ import com.arsdigita.bebop.list.ListCellRenderer;
|
|||
import com.arsdigita.bebop.list.ListModel;
|
||||
import com.arsdigita.bebop.list.ListModelBuilder;
|
||||
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 static com.arsdigita.ui.admin.AdminConstants.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
|
|
@ -105,11 +101,8 @@ class EmailList extends List
|
|||
if (userId != null) {
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch(CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
//
|
||||
// final User user = userRepository.findById(userId);
|
||||
// if (user == null) {
|
||||
|
|
@ -198,11 +191,8 @@ class EmailListModelBuilder extends LockableImpl
|
|||
// } else {
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch(CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
// final User user = userRepository.findById(userId);
|
||||
//
|
||||
// return new EmailListModel(user.getEmailAddresses().iterator());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.arsdigita.ui.admin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -14,10 +13,6 @@ import com.arsdigita.bebop.SimpleContainer;
|
|||
import com.arsdigita.bebop.Tree;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
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.GroupRepository;
|
||||
|
||||
|
|
@ -60,12 +55,8 @@ public class ExistingGroupAddPane extends SimpleContainer implements
|
|||
//
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
|
||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup GroupRepository", ex);
|
||||
// }
|
||||
//
|
||||
// group = groupRepository.findById(id);
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -19,21 +19,13 @@
|
|||
package com.arsdigita.ui.admin;
|
||||
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.Tree;
|
||||
|
||||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
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 java.math.BigDecimal;
|
||||
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
/**
|
||||
* Add group form.
|
||||
|
|
@ -96,12 +88,8 @@ class GroupAddForm extends GroupForm implements FormProcessListener {
|
|||
//// }
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
|
||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup GroupRepository", ex);
|
||||
// }
|
||||
// groupRepository.save(group);
|
||||
//
|
||||
//// if (parentGroup != null) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import com.arsdigita.bebop.ActionLink;
|
|||
import com.arsdigita.bebop.BoxPanel;
|
||||
import com.arsdigita.bebop.ColumnPanel;
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.List;
|
||||
import com.arsdigita.bebop.Page;
|
||||
|
|
@ -45,14 +44,11 @@ import com.arsdigita.toolbox.ui.LayoutPanel;
|
|||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
/**
|
||||
* Constructs the panel for administration of groups.
|
||||
|
|
@ -147,13 +143,9 @@ class GroupAdministrationTab extends LayoutPanel implements AdminConstants,
|
|||
//
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
|
||||
// groupRepository = cdiUtil
|
||||
// .findBean(GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup GroupRepository", ex);
|
||||
// }
|
||||
//
|
||||
// group = groupRepository.findById(id);
|
||||
//
|
||||
|
|
@ -373,13 +365,9 @@ class GroupAdministrationTab extends LayoutPanel implements AdminConstants,
|
|||
// final Long groupId = Long.parseLong(key);
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
|
||||
// groupRepository = cdiUtil
|
||||
// .findBean(GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup GroupRepository", ex);
|
||||
// }
|
||||
//
|
||||
// final Group group = groupRepository.findById(groupId);
|
||||
// final Group parent = getGroup(state);
|
||||
|
|
@ -540,11 +528,8 @@ class GroupAdministrationTab extends LayoutPanel implements AdminConstants,
|
|||
// if (group != null) {
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
|
||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||
// } catch(CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
|
||||
// groupRepository.delete(group);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,9 @@ import com.arsdigita.bebop.event.FormProcessListener;
|
|||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
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.core.Group;
|
||||
//import org.libreccm.core.GroupRepository;
|
||||
|
|
@ -72,13 +67,9 @@ class GroupEditForm extends GroupForm implements FormInitListener,
|
|||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
//
|
||||
// try {
|
||||
|
||||
// groupRepository = cdiUtil.findBean(
|
||||
// GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup GroupRepository", ex);
|
||||
// }
|
||||
//
|
||||
// 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 CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup GroupRepository", ex);
|
||||
// }
|
||||
|
||||
if (id == null) {
|
||||
throw new FormProcessException(GlobalizationUtil.globalize(
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.ui.admin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -38,12 +37,6 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
|||
|
||||
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
|
||||
|
|
@ -94,12 +87,7 @@ public class GroupSearchForm extends Form implements FormProcessListener,
|
|||
//
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup GroupRepository", ex);
|
||||
// }
|
||||
// results = groupRepository.searchGroupByName(search);
|
||||
//
|
||||
//
|
||||
|
|
|
|||
|
|
@ -22,16 +22,10 @@ import com.arsdigita.bebop.PageState;
|
|||
|
||||
import com.arsdigita.bebop.tree.TreeModel;
|
||||
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 java.math.BigDecimal;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -110,12 +104,8 @@ public class GroupTreeModel implements TreeModel {
|
|||
//
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
|
||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup GroupRepository", ex);
|
||||
// }
|
||||
// final List<Group> groups = groupRepository.findAll();
|
||||
//
|
||||
// return groups.iterator();
|
||||
|
|
|
|||
|
|
@ -26,13 +26,10 @@ import com.arsdigita.bebop.BoxPanel;
|
|||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.list.ListCellRenderer;
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.event.ActionListener;
|
||||
import com.arsdigita.bebop.event.ActionEvent;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||
|
|
@ -88,13 +85,10 @@ class SubMemberPanel extends BoxPanel {
|
|||
// final UserRepository userRepository;
|
||||
// final GroupManager groupManager;
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// groupManager = cdiUtil.findBean(GroupManager.class);
|
||||
// groupRepository = cdiUtil.findBean(GroupRepository.class);
|
||||
// } catch(CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
//
|
||||
// final User user = userRepository.findById(userID);
|
||||
// final Group group = m_mainTab.getGroup(state);
|
||||
|
|
|
|||
|
|
@ -56,13 +56,11 @@ import com.arsdigita.web.RedirectSignal;
|
|||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.User;
|
||||
|
||||
|
|
@ -117,11 +115,8 @@ class UserBrowsePane extends SegmentedPanel
|
|||
// final PageState state = event.getPageState();
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final CcmSessionContext sessionContext;
|
||||
// try {
|
||||
|
||||
// sessionContext = cdiUtil.findBean(CcmSessionContext.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
//
|
||||
// final Subject subject = sessionContext.getCurrentSubject();
|
||||
//
|
||||
|
|
@ -150,11 +145,8 @@ class UserBrowsePane extends SegmentedPanel
|
|||
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
//
|
||||
// final User user = userRepository.findById(id);
|
||||
// if (user == null) {
|
||||
|
|
@ -356,12 +348,9 @@ class UserBrowsePane extends SegmentedPanel
|
|||
//
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final LoginManager loginManager;
|
||||
// try {
|
||||
|
||||
// loginManager = cdiUtil.findBean(
|
||||
// LoginManager.class);
|
||||
// } catch(CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
//
|
||||
// loginManager.login(CLASS, CLASS);
|
||||
//
|
||||
|
|
@ -434,11 +423,8 @@ class UserBrowsePane extends SegmentedPanel
|
|||
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
|
||||
// userRepository.delete(user);
|
||||
|
||||
|
|
@ -477,11 +463,8 @@ class UserBrowsePane extends SegmentedPanel
|
|||
//
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
// userRepository.save(user);
|
||||
} // End ActionPerformed method
|
||||
|
||||
|
|
@ -511,11 +494,8 @@ class UserBrowsePane extends SegmentedPanel
|
|||
//
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
// userRepository.save(user);
|
||||
} // End ActionPerformed method
|
||||
|
||||
|
|
@ -694,12 +674,9 @@ class UserBrowsePane extends SegmentedPanel
|
|||
if (id != null) {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final GroupRepository groupRepository;
|
||||
// try {
|
||||
|
||||
// groupRepository = cdiUtil
|
||||
// .findBean(GroupRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
// final Group group = groupRepository.findById(Long.parseLong(
|
||||
// id));
|
||||
// m_groupAdministrationTab.setGroup(ps, group);
|
||||
|
|
@ -731,11 +708,8 @@ class UserTableModel implements TableModel {
|
|||
public UserTableModel() {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
|
||||
// users = userRepository.findAll();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import com.arsdigita.bebop.parameters.EmailParameter;
|
|||
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
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.util.StringUtils;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
import java.io.UncheckedIOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
|
|
@ -244,11 +239,8 @@ class UserForm extends Form implements FormValidationListener, AdminConstants {
|
|||
*/
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
//
|
||||
// final String screenName = (String) m_screenName.getValue(ps);
|
||||
// final User userByScreenname = userRepository.findByScreenName(
|
||||
|
|
|
|||
|
|
@ -38,14 +38,12 @@ import com.arsdigita.mail.Mail;
|
|||
import static com.arsdigita.ui.admin.AdminConstants.*;
|
||||
|
||||
import com.arsdigita.ui.login.PasswordValidationListener;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.User;
|
||||
|
||||
|
|
@ -137,11 +135,8 @@ class UserPasswordForm extends Form
|
|||
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch(CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
// final User user = userRepository.findById((Long) state.getValue(
|
||||
// USER_ID_PARAM));
|
||||
//
|
||||
|
|
@ -164,11 +159,8 @@ class UserPasswordForm extends Form
|
|||
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// } catch(CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
// final User user = userRepository.findById((Long) state.getValue(
|
||||
// USER_ID_PARAM));
|
||||
// if (user == null) {
|
||||
|
|
@ -217,12 +209,9 @@ class UserPasswordForm extends Form
|
|||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final UserRepository userRepository;
|
||||
// final UserManager userManager;
|
||||
// try {
|
||||
|
||||
// userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
// userManager = cdiUtil.findBean(UserManager.class);
|
||||
// } catch(CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(ex);
|
||||
// }
|
||||
// final User user = userRepository.findById((Long) state.getValue(
|
||||
// USER_ID_PARAM));
|
||||
// if (user == null) {
|
||||
|
|
|
|||
|
|
@ -18,12 +18,13 @@
|
|||
*/
|
||||
package com.arsdigita.ui.admin.applications;
|
||||
|
||||
import com.arsdigita.bebop.PropertySheet;
|
||||
import com.arsdigita.bebop.PropertySheetModel;
|
||||
import com.arsdigita.ui.admin.GlobalizationUtil;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.util.List;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
import org.libreccm.web.ApplicationType;
|
||||
|
|
@ -74,20 +75,20 @@ public class ApplicationInfoPropertySheetModel implements PropertySheetModel {
|
|||
localize();
|
||||
case APP_CLASS:
|
||||
return (String) GlobalizationUtil.globalize(
|
||||
"ui.admin.applications.ApplicationInfoSection.app_class.label").
|
||||
localize();
|
||||
"ui.admin.applications.ApplicationInfoSection.app_class.label")
|
||||
.localize();
|
||||
case APP_SINGLETON:
|
||||
return (String) GlobalizationUtil.globalize(
|
||||
"ui.admin.applications.ApplicationInfoSection.singleton.label").
|
||||
localize();
|
||||
"ui.admin.applications.ApplicationInfoSection.singleton.label")
|
||||
.localize();
|
||||
case APP_DESC:
|
||||
return (String) GlobalizationUtil.globalize(
|
||||
"ui.admin.applications.ApplicationInfoSection.desc.label").
|
||||
localize();
|
||||
case SINGLETON_PATH:
|
||||
return (String) GlobalizationUtil.globalize(
|
||||
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label").
|
||||
localize();
|
||||
"ui.admin.applications.ApplicationInfoSection.singleton_instance.path.label")
|
||||
.localize();
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
|
|
@ -125,24 +126,20 @@ public class ApplicationInfoPropertySheetModel implements PropertySheetModel {
|
|||
case APP_SINGLETON:
|
||||
if (applicationType.singleton()) {
|
||||
return (String) GlobalizationUtil.globalize(
|
||||
"ui.admin.applications.ApplicationInfoSection.singleton.yes").
|
||||
localize();
|
||||
"ui.admin.applications.ApplicationInfoSection.singleton.yes")
|
||||
.localize();
|
||||
} else {
|
||||
return (String) GlobalizationUtil.globalize(
|
||||
"ui.admin.applications.ApplicationInfoSection.singleton.no").
|
||||
localize();
|
||||
"ui.admin.applications.ApplicationInfoSection.singleton.no")
|
||||
.localize();
|
||||
}
|
||||
case APP_DESC:
|
||||
return applicationType.description();
|
||||
case SINGLETON_PATH:
|
||||
final String path;
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ApplicationRepository appRepo;
|
||||
try {
|
||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||
ApplicationRepository.class);
|
||||
final List<CcmApplication> instances
|
||||
= appRepo.findByType(
|
||||
applicationType.name());
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ import com.arsdigita.bebop.table.TableModel;
|
|||
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||
import com.arsdigita.ui.admin.GlobalizationUtil;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
import org.libreccm.web.ApplicationType;
|
||||
|
|
@ -137,12 +137,7 @@ public class MultiInstanceApplicationPane<T extends CcmApplication>
|
|||
final String appType) {
|
||||
this.table = table;
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ApplicationRepository appRepo;
|
||||
try {
|
||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||
final List<CcmApplication> applications = appRepo.
|
||||
findByType(appType);
|
||||
for (CcmApplication application : applications) {
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ import com.arsdigita.bebop.PageState;
|
|||
import com.arsdigita.bebop.tree.TreeModel;
|
||||
import com.arsdigita.bebop.tree.TreeNode;
|
||||
import com.arsdigita.ui.admin.ApplicationsAdministrationTab;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.web.ApplicationManager;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
|
|
@ -34,8 +34,10 @@ import org.libreccm.web.ApplicationType;
|
|||
import org.libreccm.web.CcmApplication;
|
||||
|
||||
/**
|
||||
* A {@link TreeModel} for the tree of applications in {@link ApplicationsAdministrationTab}. The tree consists of two
|
||||
* different types of nodes: Nodes for {@link ApplicationTypes} and nodes for {@link Application} instances.
|
||||
* A {@link TreeModel} for the tree of applications in
|
||||
* {@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>
|
||||
* @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) {
|
||||
return true;
|
||||
} else if (node instanceof ApplicationTypeTreeNode) {
|
||||
final ApplicationTypeTreeNode typeTreeNode = (ApplicationTypeTreeNode) node;
|
||||
final ApplicationTypeTreeNode typeTreeNode
|
||||
= (ApplicationTypeTreeNode) node;
|
||||
|
||||
//if (typeTreeNode.getApplicationType().isSingleton()) {
|
||||
if (typeTreeNode.isSingleton()) {
|
||||
|
|
@ -64,7 +67,8 @@ public class ApplicationTreeModel implements TreeModel {
|
|||
} else {
|
||||
//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) {
|
||||
return false;
|
||||
|
|
@ -79,26 +83,20 @@ public class ApplicationTreeModel implements TreeModel {
|
|||
public Iterator getChildren(final TreeNode node, final PageState state) {
|
||||
if (node instanceof RootTreeNode) {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ApplicationManager appManager;
|
||||
try {
|
||||
appManager = cdiUtil.findBean(ApplicationManager.class);
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final ApplicationManager appManager = cdiUtil.findBean(
|
||||
ApplicationManager.class);
|
||||
|
||||
final Collection<ApplicationType> appTypes = appManager.getApplicationTypes().values();
|
||||
final Collection<ApplicationType> appTypes = appManager
|
||||
.getApplicationTypes().values();
|
||||
|
||||
return new AppTypesIterator(appTypes);
|
||||
} else if (node instanceof ApplicationTypeTreeNode) {
|
||||
final ApplicationTypeTreeNode typeTreeNode = (ApplicationTypeTreeNode) node;
|
||||
final ApplicationTypeTreeNode typeTreeNode
|
||||
= (ApplicationTypeTreeNode) node;
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ApplicationRepository appRepo;
|
||||
try {
|
||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||
ApplicationRepository.class);
|
||||
|
||||
final List<CcmApplication> applications = appRepo.findByType(
|
||||
typeTreeNode.getObjecType());
|
||||
|
|
@ -116,12 +114,8 @@ public class ApplicationTreeModel implements TreeModel {
|
|||
private List<CcmApplication> retrieveApplicationInstances(
|
||||
final ApplicationType applicationType) {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ApplicationRepository appRepo;
|
||||
try {
|
||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||
ApplicationRepository.class);
|
||||
|
||||
return appRepo.findByType(applicationType.name());
|
||||
}
|
||||
|
|
@ -129,12 +123,8 @@ public class ApplicationTreeModel implements TreeModel {
|
|||
private List<CcmApplication> retrieveApplicationInstances(
|
||||
final String appObjectType) {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ApplicationRepository appRepo;
|
||||
try {
|
||||
appRepo = cdiUtil.findBean(ApplicationRepository.class);
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||
ApplicationRepository.class);
|
||||
|
||||
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.Submit;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.ReturnSignal;
|
||||
import com.arsdigita.mail.Mail;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.User;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.libreccm.security.Shiro;
|
||||
import org.libreccm.security.UserManager;
|
||||
import org.libreccm.security.UserRepository;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final Subject subject;
|
||||
final Shiro shiro;
|
||||
try {
|
||||
subject = cdiUtil.findBean(Subject.class);
|
||||
shiro = cdiUtil.findBean(Shiro.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final User user = shiro.getUser();
|
||||
|
|
@ -207,15 +193,9 @@ public class ChangePasswordForm extends Form
|
|||
String confirmPassword = (String) m_confirmPassword.getValue(state);
|
||||
|
||||
//check oldPassword
|
||||
final Shiro shiro;
|
||||
final UserManager userManager;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
shiro = cdiUtil.findBean(Shiro.class);
|
||||
userManager = cdiUtil.findBean(UserManager.class);
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
final UserManager userManager = cdiUtil.findBean(UserManager.class);
|
||||
|
||||
final User user = shiro.getUser();
|
||||
if (!userManager.verifyPassword(user, oldPassword)) {
|
||||
|
|
@ -261,16 +241,9 @@ public class ChangePasswordForm extends Form
|
|||
return;
|
||||
}
|
||||
|
||||
final UserManager userManager;
|
||||
final Shiro shiro;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
userManager = cdiUtil.findBean(UserManager.class);
|
||||
shiro = cdiUtil.findBean(Shiro.class);
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
final UserManager userManager = cdiUtil.findBean(UserManager.class);
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
final User user = shiro.getUser();
|
||||
|
||||
final String newPassword = (String) m_newPassword.getValue(state);
|
||||
|
|
|
|||
|
|
@ -18,19 +18,13 @@
|
|||
*/
|
||||
package com.arsdigita.ui.login;
|
||||
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
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.shiro.subject.Subject;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.Shiro;
|
||||
import org.libreccm.security.User;
|
||||
|
|
@ -59,15 +53,9 @@ public class EmailInitListener implements FormInitListener {
|
|||
|
||||
s_log.debug("START");
|
||||
|
||||
final Subject subject;
|
||||
final Shiro shiro;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
subject = cdiUtil.findBean(Subject.class);
|
||||
shiro = cdiUtil.findBean(Shiro.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
|
||||
if (!subject.isAuthenticated()) {
|
||||
s_log.debug("FAILURE not logged in");
|
||||
|
|
|
|||
|
|
@ -23,31 +23,27 @@ import com.arsdigita.bebop.PageState;
|
|||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.web.Web;
|
||||
|
||||
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.security.Shiro;
|
||||
import org.libreccm.security.User;
|
||||
|
||||
|
||||
// Note: Previously used SiteNodeRequestContext, nows using KernelRequestContext
|
||||
// may be one cause that Login doesn't survive if the brwoser window is
|
||||
// closed.
|
||||
/**
|
||||
* Initializes the value of the given parameter to the current user's
|
||||
* screen name. Strangely similar to <code>EmailInitListener</code>.
|
||||
* Initializes the value of the given parameter to the current user's screen
|
||||
* name. Strangely similar to <code>EmailInitListener</code>.
|
||||
*
|
||||
* @author <a href="mailto:cwolfe@redhat.com">Crag Wolfe</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ScreenNameInitListener implements FormInitListener {
|
||||
|
||||
private static Logger s_log =
|
||||
Logger.getLogger(ScreenNameInitListener.class.getName());
|
||||
private static Logger s_log = Logger.getLogger(ScreenNameInitListener.class
|
||||
.getName());
|
||||
private StringParameter m_param;
|
||||
|
||||
/**
|
||||
|
|
@ -67,15 +63,9 @@ public class ScreenNameInitListener implements FormInitListener {
|
|||
FormData data = event.getFormData();
|
||||
s_log.debug("START");
|
||||
|
||||
final Subject subject;
|
||||
final Shiro shiro;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
subject = cdiUtil.findBean(Subject.class);
|
||||
shiro = cdiUtil.findBean(Shiro.class);
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
|
||||
if (!subject.isAuthenticated()) {
|
||||
s_log.debug("FAILURE not logged in");
|
||||
|
|
@ -91,4 +81,5 @@ public class ScreenNameInitListener implements FormInitListener {
|
|||
data.put(m_param.getName(), user.getName());
|
||||
s_log.debug("SUCCESS");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,14 +25,12 @@ import com.arsdigita.kernel.security.Util;
|
|||
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.web.LoginSignal;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.subject.Subject;
|
||||
|
||||
/**
|
||||
|
|
@ -69,15 +67,8 @@ public class UserAuthenticationListener implements RequestListener {
|
|||
throw new IllegalStateException("User is not logged in");
|
||||
}
|
||||
|
||||
// Note: aborts processing with an internal error if user not logged in!
|
||||
// Not suiteable just to check log in status.
|
||||
final Subject subject;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
subject = cdiUtil.findBean(Subject.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
|
||||
return subject;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import com.arsdigita.web.ReturnSignal;
|
|||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.core.EmailAddress;
|
||||
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
|
||||
URL_MSG; otherwise redirects to the user workspace.
|
||||
* URL_MSG; otherwise redirects to the user workspace.
|
||||
*
|
||||
*
|
||||
* @author Sameer Ajmani
|
||||
|
|
@ -66,14 +65,9 @@ public class UserEditForm extends UserForm
|
|||
|
||||
@Override
|
||||
public Object initialValue(final PageState ps) {
|
||||
final User result;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
result = shiro.getUser();
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final User result = shiro.getUser();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -109,13 +103,9 @@ public class UserEditForm extends UserForm
|
|||
FormData data = event.getFormData();
|
||||
PageState state = event.getPageState();
|
||||
|
||||
final UserRepository userRepository;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final UserRepository userRepository = cdiUtil.findBean(
|
||||
UserRepository.class);
|
||||
|
||||
User user = getUser(state);
|
||||
if (user == null) {
|
||||
|
|
|
|||
|
|
@ -37,10 +37,8 @@ import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
|||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.User;
|
||||
import org.libreccm.security.UserRepository;
|
||||
|
|
@ -257,13 +255,8 @@ public abstract class UserForm extends Form
|
|||
final PageState state = event.getPageState();
|
||||
final FormData data = event.getFormData();
|
||||
|
||||
final UserRepository userRepository;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final UserRepository userRepository = cdiUtil.findBean(UserRepository.class);
|
||||
|
||||
try {
|
||||
if (m_newUser) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import com.arsdigita.bebop.PageState;
|
|||
import com.arsdigita.bebop.SimpleComponent;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
||||
|
|
@ -32,8 +31,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
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.security.Shiro;
|
||||
import org.libreccm.security.User;
|
||||
|
|
@ -109,14 +106,8 @@ public class UserInfo extends SimpleContainer {
|
|||
m_contentCenters = new ArrayList<>();
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final ApplicationRepository appRepo;
|
||||
try {
|
||||
appRepo = cdiUtil.findBean(
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||
ApplicationRepository.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(
|
||||
"Failed to lookup ApplicationRepository", ex);
|
||||
}
|
||||
|
||||
m_contentCenters = appRepo.findByType(
|
||||
"com.arsdigita.cms.ContentCenter");
|
||||
|
|
@ -217,14 +208,9 @@ public class UserInfo extends SimpleContainer {
|
|||
throw new IllegalStateException("user is not logged in");
|
||||
}
|
||||
|
||||
final User user;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
user = shiro.getUser();
|
||||
} catch(CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final User user = shiro.getUser();
|
||||
|
||||
return user;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ import com.arsdigita.bebop.parameters.URLParameter;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
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.ReturnSignal;
|
||||
import com.arsdigita.web.URL;
|
||||
import javax.security.auth.login.FailedLoginException;
|
||||
import javax.security.auth.login.LoginException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
import org.apache.shiro.subject.Subject;
|
||||
|
|
@ -336,19 +333,13 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
PageState state = event.getPageState();
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final Subject subject;
|
||||
try {
|
||||
subject = cdiUtil.findBean(Subject.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
|
||||
final UsernamePasswordToken token = new UsernamePasswordToken(
|
||||
(String) m_loginName.getValue(state),
|
||||
(String) m_password.getValue(state)
|
||||
);
|
||||
token.setRememberMe(getPersistentLoginValue(state,
|
||||
false));
|
||||
token.setRememberMe(getPersistentLoginValue(state, false));
|
||||
try {
|
||||
subject.login(token);
|
||||
} catch (AuthenticationException ex) {
|
||||
|
|
@ -371,12 +362,8 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
// // attempt to log in user
|
||||
// final CdiUtil cdiUtil = new CdiUtil();
|
||||
// final LoginManager loginManager;
|
||||
// try {
|
||||
|
||||
// loginManager = cdiUtil.findBean(LoginManager.class);
|
||||
// } catch (CdiLookupException ex) {
|
||||
// throw new UncheckedWrapperException(
|
||||
// "Failed to lookup LoginManager", ex);
|
||||
// }
|
||||
// loginManager.login(username, password);
|
||||
// onLoginSuccess(event);
|
||||
// } catch (FailedLoginException e) {
|
||||
|
|
@ -411,7 +398,6 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
// throws FormProcessException {
|
||||
// onLoginFail(event, ex);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Executed when login fails with a bad password or when autoLoginOn is set
|
||||
* to false and the user doesn't exist. Default implementation marks
|
||||
|
|
@ -436,6 +422,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*
|
||||
* @param event
|
||||
* @param ex
|
||||
*
|
||||
* @throws com.arsdigita.bebop.FormProcessException
|
||||
*/
|
||||
// protected void onLoginException(final FormSectionEvent event,
|
||||
|
|
@ -445,7 +432,6 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
// s_log.error("Login failed", ex);
|
||||
// throw new FormProcessException(ex);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
@ -453,6 +439,7 @@ public class UserLoginForm extends Form implements LoginConstants,
|
|||
*
|
||||
* @param state
|
||||
* @param defaultValue
|
||||
*
|
||||
* @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.ActionListener;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
|
||||
/**
|
||||
|
|
@ -47,14 +45,8 @@ public class UserLogoutListener implements ActionListener {
|
|||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
|
||||
final Subject subject;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
subject = cdiUtil.findBean(Subject.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
subject.logout();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
|||
import com.arsdigita.bebop.parameters.URLParameter;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.web.ReturnSignal;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
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.UsernamePasswordToken;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.security.Shiro;
|
||||
import org.libreccm.security.User;
|
||||
import org.libreccm.security.UserManager;
|
||||
import org.libreccm.security.UserRepository;
|
||||
|
||||
/**
|
||||
* 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
|
||||
returnURL is passed in to the form, then redirects to that URL_MSG; otherwise
|
||||
redirects to the user workspace.
|
||||
* 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
|
||||
* redirects to the user workspace.
|
||||
*
|
||||
*
|
||||
* @author Michael Bryzek
|
||||
|
|
@ -153,26 +151,17 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
|
||||
final Exception[] formExceptions = new Exception[]{null};
|
||||
|
||||
final Shiro shiro;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
shiro = cdiUtil.findBean(Shiro.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
final Shiro shiro = cdiUtil.findBean(Shiro.class);
|
||||
|
||||
shiro.getSystemUser().execute(new Callable<Void>() {
|
||||
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
|
||||
final UserManager userManager;
|
||||
try {
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
userManager = cdiUtil.findBean(UserManager.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
final UserManager userManager = cdiUtil.findBean(
|
||||
UserManager.class);
|
||||
userManager.createUser(firstName,
|
||||
lastName,
|
||||
screenName,
|
||||
|
|
@ -181,6 +170,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
try {
|
||||
|
|
@ -191,7 +181,6 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
loginName = screenName;
|
||||
}
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final Subject subject = cdiUtil.findBean(Subject.class);
|
||||
|
||||
if (subject.isAuthenticated()) {
|
||||
|
|
@ -201,7 +190,7 @@ public class UserNewForm extends UserForm implements FormInitListener,
|
|||
final UsernamePasswordToken token = new UsernamePasswordToken(
|
||||
loginName, password);
|
||||
subject.login(token);
|
||||
} catch (CdiLookupException | AuthenticationException ex) {
|
||||
} catch (AuthenticationException ex) {
|
||||
s_log.error("login failed for new user", ex);
|
||||
throw new FormProcessException(ex);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.web;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
|
|
@ -39,7 +37,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
*
|
||||
* <p>
|
||||
* 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>
|
||||
*
|
||||
* <p>
|
||||
|
|
@ -91,7 +89,7 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
|||
/**
|
||||
* <p>
|
||||
* 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 java.io.IOException
|
||||
|
|
@ -119,7 +117,6 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
|||
//
|
||||
// final ServletException[] servletException = {null};
|
||||
// final IOException[] ioException = {null};
|
||||
|
||||
doService(request, response, app);
|
||||
}
|
||||
|
||||
|
|
@ -178,15 +175,9 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
|||
}
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
try {
|
||||
final ApplicationRepository appRepo = cdiUtil.findBean(
|
||||
ApplicationRepository.class);
|
||||
|
||||
return appRepo.findById(appId);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new IllegalStateException(String.format(
|
||||
"Failed to retrieve application %d from the database.", appId));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -194,6 +185,7 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
|||
* @param sreq
|
||||
* @param app
|
||||
* @param uc
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
// private RequestContext makeLegacyContext(HttpServletRequest sreq,
|
||||
|
|
@ -212,6 +204,4 @@ public abstract class BaseApplicationServlet extends BaseServlet {
|
|||
//
|
||||
// return krc;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package com.arsdigita.web;
|
|||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.ui.UI;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
|
@ -39,9 +38,8 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -35,11 +35,13 @@ import static org.libreccm.core.CoreConstants.*;
|
|||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
|
||||
/**
|
||||
* Association class describing the association between a category and an
|
||||
* object. Instances of these class should not created manually.
|
||||
* The methods provided by the {@link CategoryManager} take care of that.
|
||||
* object. Instances of these class should not created manually. The methods
|
||||
* provided by the {@link CategoryManager} take care of that.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*
|
||||
|
|
@ -47,6 +49,12 @@ import javax.persistence.JoinColumn;
|
|||
*/
|
||||
@Entity
|
||||
@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 {
|
||||
|
||||
private static final long serialVersionUID = 201504301320L;
|
||||
|
|
@ -94,6 +102,12 @@ public class Categorization implements Serializable {
|
|||
@Column(name = "OBJECT_ORDER")
|
||||
private long objectOrder;
|
||||
|
||||
public Categorization() {
|
||||
index = false;
|
||||
categoryOrder = 0;
|
||||
objectOrder = 0;
|
||||
}
|
||||
|
||||
public long getCategorizationId() {
|
||||
return categorizationId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ import javax.validation.constraints.Pattern;
|
|||
@Table(name = "CATEGORIES", schema = DB_SCHEMA)
|
||||
@NamedQueries({
|
||||
@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 {
|
||||
|
||||
|
|
@ -165,6 +167,10 @@ public class Category extends CcmObject implements Serializable {
|
|||
description = new LocalizedString();
|
||||
objects = new ArrayList<>();
|
||||
subCategories = new ArrayList<>();
|
||||
enabled = true;
|
||||
visible= true;
|
||||
abstractCategory = false;
|
||||
categoryOrder = 0;
|
||||
}
|
||||
|
||||
public String getUniqueId() {
|
||||
|
|
|
|||
|
|
@ -18,10 +18,19 @@
|
|||
*/
|
||||
package org.libreccm.categorization;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreccm.core.CcmObject;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
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
|
||||
|
|
@ -32,33 +41,23 @@ import javax.inject.Inject;
|
|||
@RequestScoped
|
||||
public class CategoryManager {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(
|
||||
CategoryManager.class);
|
||||
|
||||
/**
|
||||
* A {@link CategoryRepository} instance used to interact with the database.
|
||||
*/
|
||||
@Inject
|
||||
private CategoryRepository categoryRepo;
|
||||
|
||||
@Inject
|
||||
private CcmObjectRepository ccmObjectRepo;
|
||||
|
||||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
/**
|
||||
* Assigns an category to an object. The object is added at the position
|
||||
* 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.
|
||||
* Assigns an category to an object.
|
||||
*
|
||||
* Please note: Because the association between {@link Category} and {@code
|
||||
* CcmObject} is a many-to-many association we use an association object to
|
||||
|
|
@ -73,21 +72,38 @@ public class CategoryManager {
|
|||
* {@code null}.
|
||||
* @param category The category to which the object should be assigned. Can
|
||||
* never be {@code null}.
|
||||
* @param order Order value specifying the sort order of the objects
|
||||
* assigned to category.
|
||||
*/
|
||||
public void addObjectToCategory(final CcmObject object,
|
||||
final Category category,
|
||||
final long order) {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
final Category category) {
|
||||
if (object == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"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
|
||||
* from the category this method also upgrades the order of all objects
|
||||
* 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
|
||||
* {@code null} an {@link IllegalArgumentException} exception is thrown
|
||||
|
|
@ -106,8 +122,52 @@ public class CategoryManager {
|
|||
public void removeObjectFromCategory(final CcmObject object,
|
||||
final Category category)
|
||||
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
|
||||
* 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
|
||||
* {@code null}.
|
||||
* @param parentCategory The category to which the category is added as
|
||||
* subcategory. Can't be {@code null}.
|
||||
* @param order The value for the {@code order} property of the
|
||||
* association.
|
||||
*/
|
||||
public void addSubCategoryToCategory(final Category subCategory,
|
||||
final Category parentCategory,
|
||||
final long order) {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
final Category parentCategory) {
|
||||
if (subCategory.getParentCategory() != null) {
|
||||
final Category oldParent = subCategory.getParentCategory();
|
||||
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}.
|
||||
* @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
|
||||
* category.
|
||||
*/
|
||||
public void removeSubCategoryFromCategory(final Category subCategory,
|
||||
final Category parentCategory)
|
||||
throws NotASubCategoryException {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
final Category parentCategory) {
|
||||
|
||||
if (subCategory.getParentCategory() == null
|
||||
|| !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
|
||||
* {@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
|
||||
* category.
|
||||
*/
|
||||
public void increaseCategoryOrder(final Category subCategory,
|
||||
final Category parentCategory)
|
||||
throws NotASubCategoryException {
|
||||
final Category parentCategory) {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
@ -262,13 +329,12 @@ public class CategoryManager {
|
|||
* @param parentCategory The parent category of the category. Can't be
|
||||
* {@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
|
||||
* category.
|
||||
*/
|
||||
public void decreaseCategoryOrder(final Category subCategory,
|
||||
final Category parentCategory)
|
||||
throws NotASubCategoryException {
|
||||
final Category parentCategory) {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
@ -281,13 +347,13 @@ public class CategoryManager {
|
|||
* @param parentCategory The parent category of both subcategories. Can't be
|
||||
* {@code null}.
|
||||
*
|
||||
* @throws NotASubCategoryException If one or both categories are not
|
||||
* subcategories of the provided parent category.qq
|
||||
* @throws IllegalArgumentException If one or both categories are not
|
||||
* subcategories of the provided parent
|
||||
* category.qq
|
||||
*/
|
||||
public void swapCategories(final Category subCategoryA,
|
||||
final Category subCategoryB,
|
||||
final Category parentCategory)
|
||||
throws NotASubCategoryException {
|
||||
final Category parentCategory) {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,11 @@ package org.libreccm.categorization;
|
|||
import org.libreccm.core.AbstractEntityRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
/**
|
||||
|
|
@ -32,6 +35,9 @@ import javax.persistence.TypedQuery;
|
|||
@RequestScoped
|
||||
public class CategoryRepository extends AbstractEntityRepository<Long, Category> {
|
||||
|
||||
@Inject
|
||||
private DomainRepository domainRepo;
|
||||
|
||||
@Override
|
||||
public Class<Category> getEntityClass() {
|
||||
return Category.class;
|
||||
|
|
@ -43,8 +49,8 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of all top level categories (Categories without a
|
||||
* parent category).
|
||||
* Retrieves a list of all top level categories (Categories without a parent
|
||||
* category).
|
||||
*
|
||||
* @return A list of all top level categories.
|
||||
*/
|
||||
|
|
@ -55,6 +61,75 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
|||
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
|
||||
* subcategory or the an {@link Domain} as root category.
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
|
|
@ -74,6 +76,12 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
*/
|
||||
@Entity
|
||||
@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)
|
||||
public class Domain extends CcmObject implements Serializable {
|
||||
|
||||
|
|
@ -102,9 +110,8 @@ public class Domain extends CcmObject implements Serializable {
|
|||
* http://example.org/domains/example-nav
|
||||
* </pre>
|
||||
*/
|
||||
@Column(name = "URI", nullable = false, unique = true, length = 1024)
|
||||
@Column(name = "URI", nullable = true, unique = true, length = 1024)
|
||||
@Convert(converter = UriConverter.class)
|
||||
@NotBlank
|
||||
@URL
|
||||
@XmlElement(name = "uri", namespace = CAT_XML_NS)
|
||||
private URI uri;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ import org.libreccm.web.CcmApplication;
|
|||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import org.libreccm.web.ApplicationRepository;
|
||||
|
||||
/**
|
||||
* Provides several methods when managing the relations between {@link Domain}s
|
||||
|
|
@ -32,9 +34,15 @@ import javax.inject.Inject;
|
|||
@RequestScoped
|
||||
public class DomainManager {
|
||||
|
||||
@Inject
|
||||
private ApplicationRepository applicationRepo;
|
||||
|
||||
@Inject
|
||||
private DomainRepository domainRepo;
|
||||
|
||||
@Inject
|
||||
private EntityManager entityManager;
|
||||
|
||||
/**
|
||||
* Adds a {@code CcmApplication} to the owners of a {@link Domain}. If the
|
||||
* provided {@code CcmApplication} is already an owner of the provided
|
||||
|
|
@ -47,8 +55,18 @@ public class DomainManager {
|
|||
*/
|
||||
public void addDomainOwner(final CcmApplication application,
|
||||
final Domain domain) {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
final DomainOwnership ownership = new DomainOwnership();
|
||||
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.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
/**
|
||||
* A repository for executing CRUD operations on {@link Domain} objects.
|
||||
|
|
@ -56,8 +57,11 @@ public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
|||
* {@code null} if there is no such {@code Domain}.
|
||||
*/
|
||||
public Domain findByDomainKey(final String domainKey) {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
final TypedQuery<Domain> query = entityManager.createNamedQuery(
|
||||
"Domain.findByKey", Domain.class);
|
||||
query.setParameter("key", domainKey);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -69,8 +73,11 @@ public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
|||
* if there is so such {@code Domain}.
|
||||
*/
|
||||
public Domain findByUri(final URI uri) {
|
||||
// TODO implement method
|
||||
throw new UnsupportedOperationException();
|
||||
final TypedQuery<Domain> query = entityManager.createNamedQuery(
|
||||
"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")
|
||||
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 Iterator<Bean<?>> iterator = beans.iterator();
|
||||
if (iterator.hasNext()) {
|
||||
|
|
@ -58,7 +58,7 @@ public class CdiUtil {
|
|||
} else {
|
||||
LOGGER.error(new ParameterizedMessage(
|
||||
"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()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.libreccm.configuration;
|
||||
|
||||
import static org.libreccm.core.CoreConstants.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
|
@ -31,7 +33,7 @@ import javax.persistence.Table;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "CONF_ENTRIES_BIG_DECIMAL")
|
||||
@Table(name = "CONF_ENTRIES_BIG_DECIMAL", schema = DB_SCHEMA)
|
||||
public class BigDecimalConfigurationEntry
|
||||
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.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
|
|
@ -36,24 +38,27 @@ import javax.persistence.Table;
|
|||
@Entity
|
||||
@Table(name = "CONF_ENTRIES_ENUM", schema = DB_SCHEMA)
|
||||
public class EnumConfigurationEntry
|
||||
extends AbstractConfigurationEntry<List<String>> implements Serializable {
|
||||
extends AbstractConfigurationEntry<Set<String>> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8506016944203102813L;
|
||||
|
||||
@ElementCollection
|
||||
private List<String> value;
|
||||
@JoinTable(name = "ENUM_CONFIGURATION_ENTRIES_VALUES",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {@JoinColumn(name = "ENUM_ID")})
|
||||
private Set<String> value;
|
||||
|
||||
@Override
|
||||
public List<String> getValue() {
|
||||
public Set<String> getValue() {
|
||||
if (value == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Collections.unmodifiableList(value);
|
||||
return Collections.unmodifiableSet(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final List<String> value) {
|
||||
public void setValue(final Set<String> 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.
|
||||
*/
|
||||
protected void addCategory(final Categorization category) {
|
||||
public void addCategory(final Categorization category) {
|
||||
categories.add(category);
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ public class CcmObject implements Serializable {
|
|||
*
|
||||
* @param category The assigned category to remove.
|
||||
*/
|
||||
protected void removeCategory(final Categorization category) {
|
||||
public void removeCategory(final Categorization category) {
|
||||
categories.remove(category);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.core.CcmObject;
|
||||
|
||||
|
|
@ -78,8 +75,8 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
|||
*
|
||||
* @param collection The collection to secure.
|
||||
* @param clazz The class of the objects in the collection.
|
||||
* @param requiredPrivilege The privilege required to access the objects
|
||||
* in the collection.
|
||||
* @param requiredPrivilege The privilege required to access the objects in
|
||||
* the collection.
|
||||
*/
|
||||
public SecuredCollection(final Collection<E> collection,
|
||||
final Class<E> clazz,
|
||||
|
|
@ -114,14 +111,9 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
|||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object[] toArray() {
|
||||
final PermissionChecker permissionChecker;
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
try {
|
||||
permissionChecker = cdiUtil.findBean(
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||
PermissionChecker.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
final Object[] objects = collection.toArray();
|
||||
for (int i = 0; i < objects.length; i++) {
|
||||
|
|
@ -137,14 +129,9 @@ public class SecuredCollection<E extends CcmObject> implements Collection<E> {
|
|||
@Override
|
||||
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
||||
public <T> T[] toArray(final T[] array) {
|
||||
final PermissionChecker permissionChecker;
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
try {
|
||||
permissionChecker = cdiUtil.findBean(
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||
PermissionChecker.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
final T[] objects = collection.toArray(array);
|
||||
for (int i = 0; i < objects.length; i++) {
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.core.CcmObject;
|
||||
|
||||
|
|
@ -93,14 +90,9 @@ class SecuredEntrySet<E extends Map.Entry<K, V>, K, V extends CcmObject>
|
|||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object[] toArray() {
|
||||
final PermissionChecker permissionChecker;
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
try {
|
||||
permissionChecker = cdiUtil.findBean(
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||
PermissionChecker.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
final Object[] entries = set.toArray();
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
|
|
@ -117,14 +109,9 @@ class SecuredEntrySet<E extends Map.Entry<K, V>, K, V extends CcmObject>
|
|||
@Override
|
||||
@SuppressWarnings({"unchecked", "PMD.UseVarargs"})
|
||||
public <T> T[] toArray(final T[] array) {
|
||||
final PermissionChecker permissionChecker;
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
try {
|
||||
permissionChecker = cdiUtil.findBean(
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||
PermissionChecker.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
final E[] entries = (E[]) set.toArray(array);
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
|
|
|
|||
|
|
@ -18,13 +18,11 @@
|
|||
*/
|
||||
package org.libreccm.security;
|
||||
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import static org.libreccm.core.CoreConstants.*;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.libreccm.cdi.utils.CdiLookupException;
|
||||
import org.libreccm.cdi.utils.CdiUtil;
|
||||
import org.libreccm.core.CcmObject;
|
||||
|
||||
|
|
@ -69,13 +67,8 @@ class SecuredHelper<E extends CcmObject> {
|
|||
}
|
||||
|
||||
final CdiUtil cdiUtil = new CdiUtil();
|
||||
final PermissionChecker permissionChecker;
|
||||
try {
|
||||
permissionChecker = cdiUtil.findBean(
|
||||
final PermissionChecker permissionChecker = cdiUtil.findBean(
|
||||
PermissionChecker.class);
|
||||
} catch (CdiLookupException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
|
||||
if (permissionChecker.isPermitted(requiredPrivilege, object)) {
|
||||
return object;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ public class CcmApplication extends Resource implements Serializable {
|
|||
*
|
||||
* @param domain The domain ownership to add.
|
||||
*/
|
||||
protected void addDomain(final DomainOwnership domain) {
|
||||
public void addDomain(final DomainOwnership domain) {
|
||||
domains.add(domain);
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ public class CcmApplication extends Resource implements Serializable {
|
|||
*
|
||||
* @param domain The domain to remove.
|
||||
*/
|
||||
protected void removeDomain(final DomainOwnership domain) {
|
||||
public void removeDomain(final DomainOwnership domain) {
|
||||
domains.remove(domain);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
create schema CCM_CORE;
|
||||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
|
|
@ -49,7 +48,7 @@ create schema CCM_CORE;
|
|||
create table CCM_CORE.CATEGORY_DOMAINS (
|
||||
DOMAIN_KEY varchar(255) not null,
|
||||
RELEASED timestamp,
|
||||
URI varchar(1024) not null,
|
||||
URI varchar(1024),
|
||||
VERSION varchar(255) not null,
|
||||
OBJECT_ID bigint not null,
|
||||
ROOT_CATEGORY_ID bigint,
|
||||
|
|
@ -82,6 +81,59 @@ create schema CCM_CORE;
|
|||
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 (
|
||||
FREQUENCY integer,
|
||||
HEADER varchar(4096) not null,
|
||||
|
|
@ -118,6 +170,11 @@ create schema CCM_CORE;
|
|||
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 (
|
||||
ACTIVE boolean,
|
||||
ADMIN_NAME varchar(255),
|
||||
|
|
@ -621,6 +678,51 @@ create schema CCM_CORE;
|
|||
foreign key (OBJECT_ID)
|
||||
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
|
||||
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
||||
foreign key (FROM_PARTY_ID)
|
||||
|
|
@ -651,6 +753,11 @@ create schema CCM_CORE;
|
|||
foreign key (OBJECT_ID)
|
||||
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
|
||||
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
||||
foreign key (parentComponent_OBJECT_ID)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
PRIMARY_URL varchar(1024) not null,
|
||||
|
|
@ -47,7 +48,7 @@
|
|||
create table CCM_CORE.CATEGORY_DOMAINS (
|
||||
DOMAIN_KEY varchar(255) not null,
|
||||
RELEASED timestamp,
|
||||
URI varchar(1024) not null,
|
||||
URI varchar(1024),
|
||||
VERSION varchar(255) not null,
|
||||
OBJECT_ID int8 not null,
|
||||
ROOT_CATEGORY_ID int8,
|
||||
|
|
@ -80,6 +81,59 @@
|
|||
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 (
|
||||
FREQUENCY int4,
|
||||
HEADER varchar(4096) not null,
|
||||
|
|
@ -116,6 +170,11 @@
|
|||
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 (
|
||||
ACTIVE boolean,
|
||||
ADMIN_NAME varchar(255),
|
||||
|
|
@ -619,6 +678,51 @@
|
|||
foreign key (OBJECT_ID)
|
||||
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
|
||||
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
||||
foreign key (FROM_PARTY_ID)
|
||||
|
|
@ -649,6 +753,11 @@
|
|||
foreign key (OBJECT_ID)
|
||||
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
|
||||
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
||||
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.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
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.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;
|
||||
|
|
@ -141,7 +139,6 @@ public class AuthorizationInterceptorTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
|
@ -136,7 +135,6 @@ public class GroupManagerTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
|
@ -150,7 +149,6 @@ public class PermissionCheckerTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
|
@ -64,7 +63,6 @@ import java.io.File;
|
|||
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
|
@ -142,7 +140,6 @@ public class PermissionManagerTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
|
@ -136,7 +135,6 @@ public class RoleManagerTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
|
@ -167,7 +166,6 @@ public class SecuredCollectionTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
|
@ -167,7 +166,6 @@ public class SecuredIteratorTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
|
@ -136,7 +135,6 @@ public class ShiroTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package org.libreccm.security;
|
|||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.kernel.security.SecurityConfig;
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.AbstractParameterContext;
|
||||
import com.arsdigita.web.CCMApplicationContextListener;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
|
@ -137,7 +136,6 @@ public class UserManagerTest {
|
|||
.addPackage(SecurityConfig.class.getPackage())
|
||||
.addPackage(AbstractConfig.class.getPackage())
|
||||
.addPackage(AbstractParameterContext.class.getPackage())
|
||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
||||
.addPackage(XML.class.getPackage())
|
||||
.addPackage(DateTimeFormatter.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
|||
CREATE SCHEMA ccm_core;
|
||||
|
||||
|
||||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
PRIMARY_URL varchar(1024) not null,
|
||||
|
|
@ -54,7 +55,7 @@ CREATE SCHEMA ccm_core;
|
|||
create table CCM_CORE.CATEGORY_DOMAINS (
|
||||
DOMAIN_KEY varchar(255) not null,
|
||||
RELEASED timestamp,
|
||||
URI varchar(1024) not null,
|
||||
URI varchar(1024),
|
||||
VERSION varchar(255) not null,
|
||||
OBJECT_ID bigint not null,
|
||||
ROOT_CATEGORY_ID bigint,
|
||||
|
|
@ -83,10 +84,63 @@ CREATE SCHEMA ccm_core;
|
|||
|
||||
create table CCM_CORE.CCM_ROLES (
|
||||
ROLE_ID bigint not null,
|
||||
name varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
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 (
|
||||
FREQUENCY integer,
|
||||
HEADER varchar(4096) not null,
|
||||
|
|
@ -123,6 +177,11 @@ CREATE SCHEMA ccm_core;
|
|||
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 (
|
||||
ACTIVE boolean,
|
||||
ADMIN_NAME varchar(255),
|
||||
|
|
@ -466,6 +525,13 @@ CREATE SCHEMA ccm_core;
|
|||
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 (
|
||||
OBJECT_ID bigint not null,
|
||||
ROOT_ID bigint,
|
||||
|
|
@ -557,16 +623,6 @@ CREATE SCHEMA ccm_core;
|
|||
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
|
||||
add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY);
|
||||
|
||||
|
|
@ -579,12 +635,6 @@ CREATE SCHEMA ccm_core;
|
|||
alter table CCM_CORE.INSTALLED_MODULES
|
||||
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
|
||||
add constraint FK_sn1sqtx94nhxgv282ymoqiock
|
||||
foreign key (OBJECT_ID)
|
||||
|
|
@ -635,6 +685,51 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (OBJECT_ID)
|
||||
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
|
||||
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
||||
foreign key (FROM_PARTY_ID)
|
||||
|
|
@ -665,6 +760,11 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (OBJECT_ID)
|
||||
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
|
||||
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
||||
foreign key (parentComponent_OBJECT_ID)
|
||||
|
|
@ -955,6 +1055,16 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (ROLE_ID)
|
||||
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
|
||||
add constraint FK_oopqroe5a8fg932teo0cyifcv
|
||||
foreign key (ROOT_ID)
|
||||
|
|
@ -1005,24 +1115,4 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (WORKFLOW_ID)
|
||||
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;
|
||||
|
|
@ -5,6 +5,7 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
|||
CREATE SCHEMA ccm_core;
|
||||
|
||||
|
||||
|
||||
create table CCM_CORE.APPLICATIONS (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
PRIMARY_URL varchar(1024) not null,
|
||||
|
|
@ -54,7 +55,7 @@ CREATE SCHEMA ccm_core;
|
|||
create table CCM_CORE.CATEGORY_DOMAINS (
|
||||
DOMAIN_KEY varchar(255) not null,
|
||||
RELEASED timestamp,
|
||||
URI varchar(1024) not null,
|
||||
URI varchar(1024),
|
||||
VERSION varchar(255) not null,
|
||||
OBJECT_ID int8 not null,
|
||||
ROOT_CATEGORY_ID int8,
|
||||
|
|
@ -83,10 +84,63 @@ CREATE SCHEMA ccm_core;
|
|||
|
||||
create table CCM_CORE.CCM_ROLES (
|
||||
ROLE_ID int8 not null,
|
||||
name varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
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 (
|
||||
FREQUENCY int4,
|
||||
HEADER varchar(4096) not null,
|
||||
|
|
@ -123,6 +177,11 @@ CREATE SCHEMA ccm_core;
|
|||
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 (
|
||||
ACTIVE boolean,
|
||||
ADMIN_NAME varchar(255),
|
||||
|
|
@ -466,6 +525,13 @@ CREATE SCHEMA ccm_core;
|
|||
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 (
|
||||
OBJECT_ID int8 not null,
|
||||
ROOT_ID int8,
|
||||
|
|
@ -557,16 +623,6 @@ CREATE SCHEMA ccm_core;
|
|||
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
|
||||
add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY);
|
||||
|
||||
|
|
@ -579,12 +635,6 @@ CREATE SCHEMA ccm_core;
|
|||
alter table CCM_CORE.INSTALLED_MODULES
|
||||
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
|
||||
add constraint FK_sn1sqtx94nhxgv282ymoqiock
|
||||
foreign key (OBJECT_ID)
|
||||
|
|
@ -635,6 +685,51 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (OBJECT_ID)
|
||||
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
|
||||
add constraint FK_3xrcpufumqnh4ke4somt89rvh
|
||||
foreign key (FROM_PARTY_ID)
|
||||
|
|
@ -665,6 +760,11 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (OBJECT_ID)
|
||||
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
|
||||
add constraint FK_72108sd6vsqt88g3fb4kl6o81
|
||||
foreign key (parentComponent_OBJECT_ID)
|
||||
|
|
@ -955,6 +1055,16 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (ROLE_ID)
|
||||
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
|
||||
add constraint FK_oopqroe5a8fg932teo0cyifcv
|
||||
foreign key (ROOT_ID)
|
||||
|
|
@ -1005,24 +1115,4 @@ CREATE SCHEMA ccm_core;
|
|||
foreign key (WORKFLOW_ID)
|
||||
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;
|
||||
|
|
@ -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.ccm_objects;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,23 @@
|
|||
DELETE FROM ccm_core.permissions;
|
||||
|
||||
DELETE FROM ccm_core.ccm_privileges;
|
||||
|
||||
DELETE FROM ccm_core.ccm_objects;
|
||||
|
||||
DELETE FROM ccm_core.user_email_addresses;
|
||||
|
||||
DELETE FROM ccm_core.parties;
|
||||
-- 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.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