CCM NG: Several small things

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4556 8810af33-2d31-482b-a856-94f89814c4df

Former-commit-id: 642b528358
pull/2/head
jensp 2017-02-08 15:01:21 +00:00
parent 25491c4b87
commit b22235d53a
29 changed files with 231 additions and 212 deletions

View File

@ -29,6 +29,7 @@ import org.apache.logging.log4j.Logger;
import org.libreccm.categorization.Category;
import org.libreccm.categorization.CategoryRepository;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.contentsection.FolderManager;
class FolderEditForm extends FolderBaseForm {
@ -52,7 +53,11 @@ class FolderEditForm extends FolderBaseForm {
final FolderRequestLocal parent = new FolderRequestLocal(null) {
@Override
protected final Object initialValue(final PageState state) {
return folder.getFolder(state).getParentFolder();
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final FolderManager folderManager = cdiUtil.findBean(
FolderManager.class);
return folderManager.getParentFolder(getFolder(state))
.orElse(null);
}
};

View File

@ -21,14 +21,17 @@ package com.arsdigita.cms.ui.permissions;
import com.arsdigita.cms.CMS;
import org.libreccm.core.CcmObject;
import org.libreccm.security.Permission;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.security.PermissionChecker;
import org.libreccm.security.PermissionManager;
import org.libreccm.security.Role;
import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.privileges.ItemPrivileges;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped;
@ -42,6 +45,9 @@ import javax.transaction.Transactional;
@RequestScoped
class CMSPermissionsTableController {
@Inject
private ContentSectionRepository sectionRepo;
@Inject
private PermissionManager permissionManager;
@ -52,7 +58,14 @@ class CMSPermissionsTableController {
public List<CMSPermissionsTableRow> buildDirectPermissionsRows(
final CcmObject object) {
final List<Role> roles = CMS.getContext().getContentSection().getRoles();
final Optional<ContentSection> section = sectionRepo.findById(CMS
.getContext().getContentSection().getObjectId());
final List<Role> roles = section
.orElseThrow(() -> new UnexpectedErrorException(String.format(
"The content section %s from the CMS context was not found in"
+ "the database.",
Objects.toString(CMS.getContext().getContentSection()))))
.getRoles();
return roles.stream()
.map(role -> buildRow(role, object))

View File

@ -24,6 +24,7 @@ import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.configuration.Configuration;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.configuration.Setting;
import org.libreccm.core.UnexpectedErrorException;
import org.librecms.dispatcher.ItemResolver;
import org.librecms.dispatcher.SimpleItemResolver;
@ -695,7 +696,7 @@ public class CMSConfig {
resolverClasses.add((Class<ItemResolver>) Class.forName(
className));
} catch (ClassNotFoundException ex) {
throw new UncheckedWrapperException(String.format(
throw new UnexpectedErrorException(String.format(
"ItemResolver class \"%s\" not found.", className), ex);
}
}
@ -720,7 +721,7 @@ public class CMSConfig {
// resolverClasses.add((Class<TemplateResolver>) Class.forName(
// className));
// } catch (ClassNotFoundException ex) {
// throw new UncheckedWrapperException(String.format(
// throw new UnexpectedErrorException(String.format(
// "ItemResolver class \"%s\" not found.", className), ex);
// }
// }

View File

@ -18,8 +18,6 @@
*/
package org.librecms.contentsection;
import com.arsdigita.util.UncheckedWrapperException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -45,6 +43,7 @@ import org.librecms.contentsection.privileges.AssetPrivileges;
import java.util.Objects;
import org.libreccm.categorization.ObjectNotAssignedToCategoryException;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.l10n.LocalizedString;
import java.beans.BeanInfo;
@ -196,7 +195,7 @@ public class AssetManager {
categoryManager.removeObjectFromCategory(asset,
currentFolder.get());
} catch (ObjectNotAssignedToCategoryException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
}
@ -238,14 +237,14 @@ public class AssetManager {
try {
copy = asset.getClass().newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
final BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(asset.getClass());
} catch (IntrospectionException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
for (final PropertyDescriptor propertyDescriptor : beanInfo
@ -286,7 +285,7 @@ public class AssetManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
try {
@ -294,7 +293,7 @@ public class AssetManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
} else if (propType != null
&& propType.isAssignableFrom(List.class)) {
@ -306,7 +305,7 @@ public class AssetManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
target.addAll(source);
@ -321,7 +320,7 @@ public class AssetManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new RuntimeException(ex);
throw new UnexpectedErrorException(ex);
}
source.forEach((key, value) -> target.put(key, value));
@ -348,7 +347,7 @@ public class AssetManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
}
}
@ -425,7 +424,8 @@ public class AssetManager {
/**
* Returns the path of an item as String.
*
* @param asset The {@link Asset} for which the path is generated.
* @param asset The {@link Asset} for which the path is
* generated.
* @param withContentSection Whether to include the content section into the
* path or not.
*
@ -459,9 +459,16 @@ public class AssetManager {
final String path = String.join("/", tokens);
if (withContentSection) {
final String sectionName
= ((Folder) result.get(0).getCategory()).
getSection().getDisplayName();
final Category category = result.get(0).getCategory();
final Optional<Folder> folder = folderRepo.findById(
category.getObjectId());
final String sectionName;
if (folder.isPresent()) {
sectionName = folder.get().getSection().getDisplayName();
} else {
sectionName = "?";
}
return String.format("%s:/%s", sectionName, path);
} else {
return String.format("/%s", path);
@ -538,15 +545,17 @@ public class AssetManager {
return Optional.empty();
}
return asset.getCategories().stream()
.filter(categorization -> {
return CATEGORIZATION_TYPE_FOLDER.equals(
categorization.getType());
})
.map(categorization -> {
return (Folder) categorization.getCategory();
})
final Optional<Category> category = asset.getCategories().stream()
.filter(categorization -> CATEGORIZATION_TYPE_FOLDER.equals(
categorization.getType()))
.map(categorization -> categorization.getCategory())
.findFirst();
if (category.isPresent()) {
return folderRepo.findById(category.get().getObjectId());
} else {
return Optional.empty();
}
}
}

View File

@ -18,13 +18,13 @@
*/
package org.librecms.contentsection;
import com.arsdigita.util.UncheckedWrapperException;
import org.libreccm.auditing.AbstractAuditedEntityRepository;
import org.libreccm.categorization.Category;
import org.libreccm.categorization.CategoryManager;
import org.libreccm.categorization.ObjectNotAssignedToCategoryException;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.RequiresPrivilege;
import org.librecms.contentsection.privileges.AssetPrivileges;
@ -130,7 +130,7 @@ public class AssetRepository
try {
categoryManager.removeObjectFromCategory(asset, category);
} catch (ObjectNotAssignedToCategoryException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
}

View File

@ -19,14 +19,13 @@
package org.librecms.contentsection;
import com.arsdigita.kernel.KernelConfig;
import com.arsdigita.util.UncheckedWrapperException;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.PermissionChecker;
import org.libreccm.security.RequiresPrivilege;
import org.librecms.CmsConstants;
import org.librecms.contentsection.privileges.ItemPrivileges;
import java.beans.IntrospectionException;
@ -91,7 +90,7 @@ public class ContentItemL10NManager {
LocalizedString.class))
.collect(Collectors.toList());
} catch (IntrospectionException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
}
@ -102,7 +101,7 @@ public class ContentItemL10NManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
}

View File

@ -19,7 +19,6 @@
package org.librecms.contentsection;
import com.arsdigita.kernel.KernelConfig;
import com.arsdigita.util.UncheckedWrapperException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -42,6 +41,7 @@ import org.libreccm.categorization.Categorization;
import org.libreccm.categorization.CategoryManager;
import org.libreccm.categorization.ObjectNotAssignedToCategoryException;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.RequiresPrivilege;
@ -68,8 +68,8 @@ import java.util.UUID;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
import org.libreccm.security.PermissionChecker;
import org.libreccm.security.PermissionManager;
import org.librecms.contentsection.privileges.TypePrivileges;
/**
@ -615,7 +615,7 @@ public class ContentItemManager {
try {
target = source.getClass().newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
copyAsset(source, target);
@ -655,7 +655,7 @@ public class ContentItemManager {
try {
beanInfo = Introspector.getBeanInfo(source.getClass());
} catch (IntrospectionException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
for (final PropertyDescriptor propertyDescriptor : beanInfo.
@ -685,7 +685,7 @@ public class ContentItemManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
copyLocalizedString(sourceStr, targetStr);
@ -697,7 +697,7 @@ public class ContentItemManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
}
}
@ -860,7 +860,7 @@ public class ContentItemManager {
targetAsset = sourceAttachment.getAsset().getClass()
.newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
copyAsset(sourceAsset, targetAsset);

View File

@ -19,11 +19,11 @@
package org.librecms.contentsection;
import com.arsdigita.kernel.KernelConfig;
import com.arsdigita.util.UncheckedWrapperException;
import org.libreccm.categorization.CategoryRepository;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.CoreConstants;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.Permission;
import org.libreccm.security.PermissionManager;
@ -459,14 +459,14 @@ public class ContentSectionManager {
itemResolverClazz);
if (instance.isUnsatisfied()) {
throw new UncheckedWrapperException(String.format(
throw new UnexpectedErrorException(String.format(
"No ItemResolver \"{}\" found.",
itemResolverClazz.getName()));
} else {
return instance.get();
}
} catch (ClassNotFoundException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
}

View File

@ -107,14 +107,14 @@ public class Folder extends Category implements Serializable {
.collect(Collectors.toList()));
}
public Folder getParentFolder() {
final Category parent = getParentCategory();
if (parent == null) {
return null;
} else {
return (Folder) getParentCategory();
}
}
// public Folder getParentFolder() {
// final Category parent = getParentCategory();
// if (parent == null) {
// return null;
// } else {
// return (Folder) getParentCategory();
// }
// }
@Override
public int hashCode() {

View File

@ -20,12 +20,14 @@ package org.librecms.contentsection;
import com.arsdigita.kernel.KernelConfig;
import org.libreccm.categorization.Category;
import org.libreccm.categorization.CategoryManager;
import org.libreccm.configuration.ConfigurationManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
@ -106,6 +108,15 @@ public class FolderManager {
HAS_LIVE_ITEMS
}
public Optional<Folder> getParentFolder(final Folder folder) {
final Category parentCategory = folder.getParentCategory();
if (parentCategory == null) {
return Optional.empty();
} else {
return folderRepo.findById(parentCategory.getObjectId());
}
}
/**
* Creates new folder as sub folder of the provided parent folder. The type
* and the content section to which the folder belongs are the same as for
@ -158,7 +169,7 @@ public class FolderManager {
return FolderIsDeletable.IS_NOT_EMPTY;
}
if (folder.getParentFolder() == null) {
if (!getParentFolder(folder).isPresent()) {
return FolderIsDeletable.IS_ROOT_FOLDER;
}
@ -225,7 +236,7 @@ public class FolderManager {
final FolderIsMovable status = folderIsMovable(folder, target);
switch (status) {
case YES: {
final Folder source = folder.getParentFolder();
final Folder source = getParentFolder(folder).get();
categoryManager.removeSubCategoryFromCategory(folder, source);
final boolean sameName = target.getSubCategories()
.stream()
@ -348,7 +359,7 @@ public class FolderManager {
"Can't check if a server can be moved to null.");
}
if (folder.getParentFolder() == null) {
if (!getParentFolder(folder).isPresent()) {
return FolderIsMovable.IS_ROOT_FOLDER;
}
@ -427,8 +438,8 @@ public class FolderManager {
tokens.add(folder.getName());
Folder current = folder;
while (current.getParentFolder() != null) {
current = current.getParentFolder();
while (getParentFolder(current).isPresent()) {
current = getParentFolder(current).get();
tokens.add(current.getName());
}
@ -458,11 +469,11 @@ public class FolderManager {
}
final List<Folder> folders = new ArrayList<>();
if (folder.getParentFolder() != null) {
Folder currentFolder = folder.getParentFolder();
while(currentFolder != null) {
folders.add(currentFolder);
currentFolder = folder.getParentFolder();
if (getParentFolder(folder).isPresent()) {
Optional<Folder> currentFolder = getParentFolder(folder);
while(currentFolder.isPresent()) {
folders.add(currentFolder.get());
currentFolder = getParentFolder(currentFolder.get());
}
}

View File

@ -19,8 +19,8 @@
package org.librecms.workflow;
import com.arsdigita.cms.workflow.TaskURLGenerator;
import com.arsdigita.util.UncheckedWrapperException;
import org.libreccm.core.UnexpectedErrorException;
import org.librecms.contentsection.ContentItem;
import javax.enterprise.context.RequestScoped;
@ -48,7 +48,7 @@ public class CmsTaskManager {
urlGenerator = urlGeneratorClass.newInstance();
} catch (IllegalAccessException
| InstantiationException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
return urlGenerator.generateURL(item.getObjectId(), task.getTaskId());

View File

@ -18,11 +18,10 @@
*/
package org.libreccm.pagemodel;
import com.arsdigita.util.UncheckedWrapperException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.core.CoreConstants;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.modules.CcmModule;
import org.libreccm.modules.Module;
import org.libreccm.security.AuthorizationRequired;
@ -301,7 +300,7 @@ public class PageModelManager {
try {
liveModel = clazz.newInstance();
} catch (InstantiationException | IllegalAccessException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
liveModel.setModelUuid(draftModel.getModelUuid());
@ -310,7 +309,7 @@ public class PageModelManager {
try {
beanInfo = Introspector.getBeanInfo(clazz);
} catch (IntrospectionException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
for (final PropertyDescriptor propertyDescriptor : beanInfo.
@ -338,7 +337,7 @@ public class PageModelManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
target.addAll(source);
@ -354,7 +353,7 @@ public class PageModelManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
source.forEach((key, value) -> target.put(key, value));
@ -371,7 +370,7 @@ public class PageModelManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
target.addAll(source);
@ -383,7 +382,7 @@ public class PageModelManager {
} catch (IllegalAccessException
| IllegalArgumentException
| InvocationTargetException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
}
}

View File

@ -35,9 +35,8 @@ import java.util.List;
/**
* Abstract class responsible for ex- and importing entity-objects to several
* file-formats. Every entity-class (e.g. DocRepo.File) needs to have its own
* extension of this class to override the abstract methods, making it
* possible to ex- or import that extending entity-class (e.g. DocRepo
* .FileMarshal).
* extension of this class to override the abstract methods, making it possible
* to ex- or import that extending entity-class (e.g. DocRepo .FileMarshal).
*
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @version created the 2/10/16
@ -45,8 +44,8 @@ import java.util.List;
*/
public abstract class AbstractMarshaller<P extends Portable> {
private static final Logger LOGGER = LogManager.getLogger(AbstractMarshaller
.class);
private static final Logger LOGGER = LogManager.getLogger(
AbstractMarshaller.class);
private Format format;
private String filename;
@ -55,8 +54,8 @@ public abstract class AbstractMarshaller<P extends Portable> {
ObjectMapper xmlMapper;
/**
* Prepares import and export routine. Sets the format in which the ex-
* or import will take place and sets the name of the file exported to or
* Prepares import and export routine. Sets the format in which the ex- or
* import will take place and sets the name of the file exported to or
* imported from. Furthermore it is possible to decide for or against
* indentation in the output file.
*
@ -83,15 +82,14 @@ public abstract class AbstractMarshaller<P extends Portable> {
break;
default:
break;
}
}
/**
* Same as {@code prepare}-methode above. Adds distinction between path
* and filename.
* Same as {@code prepare}-methode above. Adds distinction between path and
* filename.
*
* @param format The format of the ex-/import
* @param folderPath The folderPath of the file exported to or imported
@ -108,7 +106,6 @@ public abstract class AbstractMarshaller<P extends Portable> {
}
}
/**
* Export routine for lists with the same object type {@code P}. Creates a
* new file with the prepared filename and starts, depending on the set
@ -123,8 +120,8 @@ public abstract class AbstractMarshaller<P extends Portable> {
try {
fileWriter = new FileWriter(file);
} catch (IOException e) {
LOGGER.error("Unable to open a fileWriter for the file" +
" with the name {}.", file.getName());
LOGGER.error("Unable to open a fileWriter for the file"
+ " with the name {}.", file.getName());
LOGGER.error(e);
}
if (fileWriter != null) {
@ -137,8 +134,8 @@ public abstract class AbstractMarshaller<P extends Portable> {
line = xmlMapper.writeValueAsString(object);
//LOGGER.info(line);
} catch (IOException e) {
LOGGER.error("Unable to write objetct " +
"of class {} as XML string with name {}.",
LOGGER.error("Unable to write objetct "
+ "of class {} as XML string with name {}.",
object.getClass(), file.getName());
LOGGER.error(e);
}
@ -152,8 +149,8 @@ public abstract class AbstractMarshaller<P extends Portable> {
fileWriter.write(line);
fileWriter.write(System.getProperty("line.separator"));
} catch (IOException e) {
LOGGER.error("Unable to write to file with" +
" the name {}.", file.getName());
LOGGER.error("Unable to write to file with"
+ " the name {}.", file.getName());
LOGGER.error(e);
}
}
@ -161,8 +158,8 @@ public abstract class AbstractMarshaller<P extends Portable> {
try {
fileWriter.close();
} catch (IOException e) {
LOGGER.error("Unable to close a fileWriter for the" +
" file with the name {}.", file.getName());
LOGGER.error("Unable to close a fileWriter for the"
+ " file with the name {}.", file.getName());
LOGGER.error(e);
}
}
@ -170,8 +167,8 @@ public abstract class AbstractMarshaller<P extends Portable> {
/**
* Import routine for files containing objects of the same type {@code P}.
* Creates a new list of strings to read the file line by line. Each line
* of the list represents an object of the file. Then retrieves each object
* Creates a new list of strings to read the file line by line. Each line of
* the list represents an object of the file. Then retrieves each object
* from the corresponding string in the list.
*
* @return If error occurs true, otherwise false.
@ -184,8 +181,8 @@ public abstract class AbstractMarshaller<P extends Portable> {
try {
lines = Files.readAllLines(file.toPath());
} catch (IOException e) {
LOGGER.error("Unable to read lines of the file with " +
"name {}.", file.getName());
LOGGER.error("Unable to read lines of the file with " + "name {}.",
file.getName());
LOGGER.error(e);
error = true;
}
@ -200,8 +197,8 @@ public abstract class AbstractMarshaller<P extends Portable> {
try {
object = xmlMapper.readValue(line, getObjectClass());
} catch (IOException e) {
LOGGER.error("Unable to read objects " +
"from XML line:\n \"{}\"", line);
LOGGER.error("Unable to read objects "
+ "from XML line:\n \"{}\"", line);
LOGGER.error(e);
error = true;
}
@ -237,4 +234,5 @@ public abstract class AbstractMarshaller<P extends Portable> {
* @param portableObject An object of type {@code P}
*/
protected abstract void insertIntoDb(P portableObject);
}

View File

@ -18,7 +18,6 @@
*/
package org.libreccm.security;
import com.arsdigita.util.UncheckedWrapperException;
import java.util.List;
@ -29,6 +28,7 @@ import javax.persistence.TypedQuery;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CoreConstants;
import org.libreccm.core.UnexpectedErrorException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
@ -241,7 +241,7 @@ public class PermissionManager {
try {
value = field.get(owner);
} catch (IllegalAccessException ex) {
throw new UncheckedWrapperException(ex);
throw new UnexpectedErrorException(ex);
}
if (value == null) {

View File

@ -45,10 +45,15 @@ public class RoleMembershipMarshaller extends AbstractMarshaller<RoleMembership>
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(RoleMembership portableObject) {
// if (portableObject.getMembershipId() == 0) {
entityManager.persist(portableObject);
// portableObject.setMembershipId(0);
portableObject.setMembershipId(portableObject.getMembershipId() * -1);
// entityManager.persist(portableObject);
entityManager.merge(portableObject);
// } else {
// entityManager.merge(portableObject);
// }
}
}

View File

@ -119,7 +119,6 @@ public class CcmObjectRepositoryTest {
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(com.arsdigita.util.UncheckedWrapperException.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -108,8 +108,6 @@ public class CoreDataImportTest {
.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer
.class.getPackage())
.addClass(com.arsdigita.util.UncheckedWrapperException
.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -55,7 +55,7 @@ import javax.inject.Inject;
*/
@RequestScoped
class ImportHelper {
private String repoPath = "/home/tosmers/Svn/libreccm/";
private String repoPath = "/home/jensp/pwi/libreccm/ccm/";
//private String repoPath = "";
private String projectPath = "ccm_ng/ccm-core/src/test/resources/" +
"portation/trunk-iaw-exports";

View File

@ -121,8 +121,6 @@ public class AuthorizationInterceptorTest {
.getPackage())
.addPackage(com.arsdigita.runtime.CCMResourceManager.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addPackage(com.arsdigita.web.CCMApplicationContextListener.class
.getPackage())
.addPackage(com.arsdigita.xml.XML.class.getPackage())
@ -130,6 +128,7 @@ public class AuthorizationInterceptorTest {
.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(org.libreccm.portation.Portable.class)
.addClass(com.arsdigita.util.UncheckedWrapperException.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -118,8 +118,6 @@ public class GroupManagerTest {
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)

View File

@ -122,7 +122,6 @@ public class GroupRepositoryTest {
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(com.arsdigita.util.UncheckedWrapperException.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -129,8 +129,6 @@ public class PermissionCheckerTest {
.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",

View File

@ -129,8 +129,6 @@ public class PermissionManagerTest {
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage()).
addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())

View File

@ -117,8 +117,6 @@ public class RoleManagerTest {
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())

View File

@ -128,7 +128,6 @@ public class RoleRepositoryTest {
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(com.arsdigita.util.UncheckedWrapperException.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -145,8 +145,6 @@ public class SecuredCollectionTest {
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",

View File

@ -147,8 +147,6 @@ public class SecuredIteratorTest {
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",

View File

@ -121,7 +121,6 @@ public class ShiroTest {
.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addClass(org.libreccm.security.authorization.LabBean.class)
.addClass(com.arsdigita.util.UncheckedWrapperException.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -120,8 +120,6 @@ public class UserManagerTest {
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies())