diff --git a/src/main/java/de/bps/olat/portal/links/LinksPortlet.java b/src/main/java/de/bps/olat/portal/links/LinksPortlet.java index 598e05f4049367af2e08cac057e562e09bc3b03a..277aa0d09c917eb9382b7a1d53ee57a0d11227b2 100644 --- a/src/main/java/de/bps/olat/portal/links/LinksPortlet.java +++ b/src/main/java/de/bps/olat/portal/links/LinksPortlet.java @@ -20,7 +20,6 @@ package de.bps.olat.portal.links; import java.io.File; - import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -29,6 +28,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; +import org.apache.logging.log4j.Logger; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; @@ -39,15 +39,16 @@ import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.portal.AbstractPortlet; import org.olat.core.gui.control.generic.portal.Portlet; import org.olat.core.logging.AssertException; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.FileUtils; import org.olat.core.util.StringHelper; import org.olat.core.util.Util; import org.olat.core.util.WebappHelper; import org.olat.core.util.xml.XStreamHelper; +import org.olat.modules.quality.analysis.MultiGroupBy; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ExplicitTypePermission; /** * @@ -81,21 +82,22 @@ public class LinksPortlet extends AbstractPortlet { private static final XStream xstream = XStreamHelper.createXStreamInstance(); static { - XStreamHelper.allowDefaultPackage(xstream); + Class<?>[] types = new Class[] { + MultiGroupBy.class, PortletLink.class, PortletInstitution.class }; + xstream.addPermission(new ExplicitTypePermission(types)); + xstream.alias("LinksPortlet", Map.class); xstream.alias(ELEM_LINK, PortletLink.class); xstream.alias(ELEM_INSTITUTION, PortletInstitution.class); xstream.aliasAttribute(PortletInstitution.class, ATTR_INSTITUTION_NAME, ATTR_INSTITUTION_NAME); } - private static HashMap<String, PortletInstitution> content; + private static Map<String, PortletInstitution> content; private static File fxConfXStreamFile; private Controller runCtr; - /** - * @see org.olat.gui.control.generic.portal.AbstractPortlet#createInstance(org.olat.gui.control.WindowControl, org.olat.gui.UserRequest, java.util.Map) - */ + @Override public Portlet createInstance(WindowControl wControl, UserRequest ureq, Map<String,String> configuration) { if(content == null) init(); LinksPortlet p = new LinksPortlet(); @@ -136,7 +138,7 @@ public class LinksPortlet extends AbstractPortlet { if (!fxConfXStreamFile.exists()){ try { - SAXReader reader = SAXReader.createDefault();; + SAXReader reader = SAXReader.createDefault(); Document doc = reader.read(fxConfFile); Element rootElement = doc.getRootElement(); List<Element> lstInst = rootElement.elements(ELEM_INSTITUTION); @@ -164,10 +166,15 @@ public class LinksPortlet extends AbstractPortlet { saveLinkList(content); FileUtils.copyFileToFile(fxConfFile, new File(fxConfFile + ".bak"), true); } else { - content = (HashMap<String, PortletInstitution>) XStreamHelper.readObject(xstream, fxConfXStreamFile); + content = readConfiguration(fxConfXStreamFile); } } + @SuppressWarnings("unchecked") + public static Map<String, PortletInstitution> readConfiguration(File file) { + return (Map<String, PortletInstitution>) XStreamHelper.readObject(xstream, file); + } + public static boolean saveLinkList(Map<String, PortletInstitution> portletMap){ XStreamHelper.writeObject(xstream, fxConfXStreamFile, portletMap); return true; diff --git a/src/main/java/de/bps/olat/user/ChangeEMailExecuteController.java b/src/main/java/de/bps/olat/user/ChangeEMailExecuteController.java index 9de61c58a63594827d8b20da0d7d83e0385ad6bc..50b5c31a0b27d99c6d6a60086a4c7919ce4d8239 100644 --- a/src/main/java/de/bps/olat/user/ChangeEMailExecuteController.java +++ b/src/main/java/de/bps/olat/user/ChangeEMailExecuteController.java @@ -19,7 +19,7 @@ */ package de.bps.olat.user; -import java.util.HashMap; +import java.util.Map; import org.olat.basesecurity.BaseSecurity; import org.olat.core.gui.UserRequest; @@ -107,11 +107,7 @@ public class ChangeEMailExecuteController extends ChangeEMailController implemen * @return */ public boolean changeEMail(WindowControl wControl) { - XStream xml = XStreamHelper.createXStreamInstance(); - XStreamHelper.allowDefaultPackage(xml); - @SuppressWarnings("unchecked") - HashMap<String, String> mails = (HashMap<String, String>) xml.fromXML(tempKey.getEmailAddress()); - + Map<String, String> mails = getMails(tempKey.getEmailAddress()); Identity identity = securityManager.loadIdentityByKey(tempKey.getIdentityKey()); if (identity != null) { String oldEmail = identity.getUser().getEmail(); @@ -140,6 +136,12 @@ public class ChangeEMailExecuteController extends ChangeEMailController implemen return true; } + + @SuppressWarnings("unchecked") + protected static Map<String, String> getMails(String emailAdress) { + XStream xstream = XStreamHelper.createXStreamInstance(); + return (Map<String, String>)xstream.fromXML(emailAdress); + } public boolean isLinkClicked() { Object entry = userRequest.getUserSession().getEntry(ChangeEMailController.CHANGE_EMAIL_ENTRY); diff --git a/src/main/java/org/olat/core/commons/services/license/manager/LicenseXStreamHelper.java b/src/main/java/org/olat/core/commons/services/license/manager/LicenseXStreamHelper.java index 2ae907eb287cc4102edf317090c0b33a4b2873bf..0cf2ddb9c56fd0af1c265c2e358a2ba73adfc0f6 100644 --- a/src/main/java/org/olat/core/commons/services/license/manager/LicenseXStreamHelper.java +++ b/src/main/java/org/olat/core/commons/services/license/manager/LicenseXStreamHelper.java @@ -19,17 +19,19 @@ */ package org.olat.core.commons.services.license.manager; +import org.apache.logging.log4j.Logger; import org.olat.core.commons.services.license.License; +import org.olat.core.commons.services.license.LicenseType; import org.olat.core.commons.services.license.model.LicenseImpl; import org.olat.core.commons.services.license.model.LicenseTypeImpl; import org.olat.core.commons.services.license.model.ResourceLicenseImpl; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.StringHelper; import org.olat.core.util.xml.XStreamHelper; import org.springframework.stereotype.Component; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ExplicitTypePermission; /** * @@ -44,7 +46,12 @@ class LicenseXStreamHelper { private static final XStream licenseXStream = XStreamHelper.createXStreamInstanceForDBObjects(); static { - XStreamHelper.allowDefaultPackage(licenseXStream); + Class<?>[] types = new Class[] { + License.class, LicenseImpl.class, ResourceLicenseImpl.class, + LicenseType.class, LicenseTypeImpl.class, + }; + licenseXStream.addPermission(new ExplicitTypePermission(types)); + licenseXStream.alias("license", LicenseImpl.class); licenseXStream.alias("license", ResourceLicenseImpl.class); licenseXStream.alias("licenseType", LicenseTypeImpl.class); diff --git a/src/main/java/org/olat/core/commons/services/license/model/ResourceLicenseImpl.java b/src/main/java/org/olat/core/commons/services/license/model/ResourceLicenseImpl.java index ecfd605dc1404731e93f5d1dd8887104ce8d34ce..662664ec07675752fe50df247c203dfb24437952 100644 --- a/src/main/java/org/olat/core/commons/services/license/model/ResourceLicenseImpl.java +++ b/src/main/java/org/olat/core/commons/services/license/model/ResourceLicenseImpl.java @@ -77,7 +77,7 @@ public class ResourceLicenseImpl implements ResourceLicense, Persistable { @Override public Long getKey() { return key; - }; + } @Override public Date getCreationDate() { diff --git a/src/main/java/org/olat/core/gui/control/navigation/SiteDefinitions.java b/src/main/java/org/olat/core/gui/control/navigation/SiteDefinitions.java index f771304fc3c02449db0802c55af4b90237f74f1c..c0a01efd0c3ba51b6c7897287add26770365211c 100644 --- a/src/main/java/org/olat/core/gui/control/navigation/SiteDefinitions.java +++ b/src/main/java/org/olat/core/gui/control/navigation/SiteDefinitions.java @@ -34,9 +34,9 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.apache.logging.log4j.Logger; import org.olat.core.CoreSpringFactory; import org.olat.core.configuration.AbstractSpringModule; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.StringHelper; import org.olat.core.util.coordinate.CoordinatorManager; @@ -47,6 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ExplicitTypePermission; /** * Description:<br> @@ -77,7 +78,12 @@ public class SiteDefinitions extends AbstractSpringModule { private static final XStream xStream = XStreamHelper.createXStreamInstance(); static { - XStreamHelper.allowDefaultPackage(xStream); + Class<?>[] types = new Class[] { + CourseSiteConfiguration.class, LanguageConfiguration.class, + SiteConfiguration.class + }; + xStream.addPermission(new ExplicitTypePermission(types)); + xStream.alias("coursesite", CourseSiteConfiguration.class); xStream.alias("languageConfig", LanguageConfiguration.class); xStream.alias("siteconfig", SiteConfiguration.class); @@ -226,7 +232,7 @@ public class SiteDefinitions extends AbstractSpringModule { @Override public void init() { if(configurers != null) { - log.debug(configurers.size() + " sites configurers found."); + log.debug("{} sites configurers found.", configurers.size()); } String sitesObj = getStringPropertyValue("sites.config", true); diff --git a/src/main/java/org/olat/core/util/xml/EnhancedXStream.java b/src/main/java/org/olat/core/util/xml/EnhancedXStream.java index 17f3027bedbb2874cf8967492f20f5afc5513317..ebd0c6af40580c4f6a25e1f0d307dfa151fb76e5 100644 --- a/src/main/java/org/olat/core/util/xml/EnhancedXStream.java +++ b/src/main/java/org/olat/core/util/xml/EnhancedXStream.java @@ -37,7 +37,7 @@ import com.thoughtworks.xstream.converters.collections.MapConverter; import com.thoughtworks.xstream.mapper.MapperWrapper; /** - * This implmentation of XStream automatically convert hibernat list, set and + * This implementation of XStream automatically convert hibernate list, set and * map to standard java collections and convert by import / deserialization the * old hibernate 3 collection packages to the new one. * diff --git a/src/main/java/org/olat/core/util/xml/XStreamHelper.java b/src/main/java/org/olat/core/util/xml/XStreamHelper.java index a9d6cae5f52b17085f38c2582b84487d1cbaaad4..d5ab86fc0d3c9851f4a72bc4bc28ad490a89a43b 100644 --- a/src/main/java/org/olat/core/util/xml/XStreamHelper.java +++ b/src/main/java/org/olat/core/util/xml/XStreamHelper.java @@ -90,98 +90,16 @@ public class XStreamHelper { "at.ac.uibk.**", "org.hibernate.collection.**" }; - private static final XStream unconfiguredXStream = new XStream(); + private static final XStream cloneXStream = new XStream(); static { - XStream.setupDefaultSecurity(unconfiguredXStream); - allowDefaultPackage(unconfiguredXStream); + XStream.setupDefaultSecurity(cloneXStream); + allowDefaultPackage(cloneXStream); } public static final void allowDefaultPackage(XStream xstream) { xstream.allowTypesByWildcard(DEFAULT_PACKAGES); } - /** - * Write a an object to an XML file. UTF-8 is used as encoding - * <p> - * This method uses an unconfigured XStream, thus a default mapping which - * includes the object class name will be used. This should only be used for - * quick prototyping. For long term persisting of data in real applications, - * hide classnames and attributes by mapping attributes and fields on the - * xStream instance. - * <p> - * Use writeObject(XStream stream, VFSLeaf vfsLeaf, Object obj) and - * configure the mapping there! - * - * @param vfsLeaf - * @param obj - */ - @Deprecated - public static void writeObject(VFSLeaf vfsLeaf, Object obj) { - writeObject(unconfiguredXStream, vfsLeaf, obj); - } - - /** - * Write a an object to an XML file. UTF-8 is used as encoding - * <p> - * This method uses an unconfigured XStream, thus a default mapping which - * includes the object class name will be used. This should only be used for - * quick prototyping. For long term persisting of data in real applications, - * hide classnames and attributes by mapping attributes and fields on the - * xStream instance. - * <p> - * Use writeObject(XStream stream, File file, Object obj) and configure the - * mapping there! - * - * @param file - * @param obj - */ - @Deprecated - public static void writeObject(File file, Object obj) { - writeObject(unconfiguredXStream, file, obj); - } - - /** - * Write a an object to an XML file. UTF-8 is used as encoding - * <p> - * This method uses an unconfigured XStream, thus a default mapping which - * includes the object class name will be used. This should only be used for - * quick prototyping. For long term persisting of data in real applications, - * hide classnames and attributes by mapping attributes and fields on the - * xStream instance. - * <p> - * Use writeObject(XStream stream, OutputStream os, Object obj) and - * configure the mapping there! - * - * @param file - * @param obj - */ - @Deprecated - public static void writeObject(OutputStream os, Object obj) { - writeObject(unconfiguredXStream, os, obj); - } - - /** - * Create an XML string from the given object using an unconfigured XStream - * - * @param obj - * @return the Object in XStream form as an xml-String - */ - @Deprecated - public static String toXML2(Object obj) { - return unconfiguredXStream.toXML(obj); - } - - /** - * Create an object from the given XML using an unconfigured XStream - * - * @param xml - * @return the Object reconstructed from the xml structure - */ - @Deprecated - public static Object fromXML2(String xml) { - return unconfiguredXStream.fromXML(xml); - } - /** * clones an object with the library XStream. The object to be cloned does * not need to be serializable, but must have a default constructor. @@ -190,50 +108,8 @@ public class XStreamHelper { * @return the clone Object */ public static Object xstreamClone(Object in) { - String data = unconfiguredXStream.toXML(in); - return unconfiguredXStream.fromXML(data); - } - - /** - * Read a structure from XML from the given input stream - * <p> - * This method uses an unconfigured XStream, thus a default mapping which - * includes the object class name will be used. This should only be used for - * quick prototyping. For long term persisting of data in real applications, - * hide classnames and attributes by mapping attributes and fields on the - * xStream instance. - * <p> - * Use readObject(XStream stream, InputStream is) and configure the mapping - * there! - * - * @param is - * @return the object - */ - @Deprecated - public static Object readObject(InputStream is) { - return readObject(unconfiguredXStream, is); - } - - /** - * Read a structure from XML file within the provided folder. - * <p> - * This method uses an unconfigured XStream, thus a default mapping which - * includes the object class name will be used. This should only be used for - * quick prototyping. For long term persisting of data in real applications, - * hide classnames and attributes by mapping attributes and fields on the - * xStream instance. - * <p> - * Use readObject(XStream stream, File file) and configure the mapping - * there! - * - * @param file - * @return de-serialized object - * @throws OLATRuntimeException - * if de-serialization fails. - */ - @Deprecated - public static Object readObject(File file) { - return readObject(unconfiguredXStream, file); + String data = cloneXStream.toXML(in); + return cloneXStream.fromXML(data); } /** diff --git a/src/main/java/org/olat/course/assessment/manager/EfficiencyStatementManager.java b/src/main/java/org/olat/course/assessment/manager/EfficiencyStatementManager.java index da244b2b8177abd55fe840490d322e56dd984f2e..4042de82e5971260a8a173076e4f13ca985bb291 100644 --- a/src/main/java/org/olat/course/assessment/manager/EfficiencyStatementManager.java +++ b/src/main/java/org/olat/course/assessment/manager/EfficiencyStatementManager.java @@ -79,6 +79,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ExplicitTypePermission; /** * Description:<br> @@ -105,7 +106,10 @@ public class EfficiencyStatementManager implements UserDataDeletable, UserDataEx private static final XStream xstream = XStreamHelper.createXStreamInstance(); static { - XStreamHelper.allowDefaultPackage(xstream); + Class<?>[] types = new Class[] { + EfficiencyStatement.class + }; + xstream.addPermission(new ExplicitTypePermission(types)); } public static EfficiencyStatement fromXML(String xml) { diff --git a/src/main/java/org/olat/course/config/ui/courselayout/CustomConfigManager.java b/src/main/java/org/olat/course/config/ui/courselayout/CustomConfigManager.java index 0adb390b5ef62fa45298bd7a0bcf4061c7752398..ea0a7a6583b88f1fdc3ef3f272c517d1c8e2df47 100644 --- a/src/main/java/org/olat/course/config/ui/courselayout/CustomConfigManager.java +++ b/src/main/java/org/olat/course/config/ui/courselayout/CustomConfigManager.java @@ -58,9 +58,6 @@ public class CustomConfigManager { private static final Logger log = Tracing.createLoggerFor(CustomConfigManager.class); private static final XStream xstream = XStreamHelper.createXStreamInstance(); - static { - XStreamHelper.allowDefaultPackage(xstream); - } private static final String IFRAME_CSS = "iframe.css"; private static final String MAIN_CSS = "main.css"; diff --git a/src/main/java/org/olat/ims/qti/editor/QTIEditorPackageImpl.java b/src/main/java/org/olat/ims/qti/editor/QTIEditorPackageImpl.java index 2092c7a06fa948b6fe0065d6ac745f8966c98c29..70d420f8834af9f92d6dbb5d221521e0fadbd456 100644 --- a/src/main/java/org/olat/ims/qti/editor/QTIEditorPackageImpl.java +++ b/src/main/java/org/olat/ims/qti/editor/QTIEditorPackageImpl.java @@ -74,6 +74,8 @@ import org.olat.ims.qti.process.AssessmentInstance; import org.olat.ims.qti.process.ImsRepositoryResolver; import org.olat.ims.resources.IMSEntityResolver; +import com.thoughtworks.xstream.XStream; + /** *Initial Date: 27.08.2003 * @author Mike Stock @@ -89,6 +91,12 @@ public class QTIEditorPackageImpl implements QTIEditorPackage { */ private static final String SERIALIZED_QTI_DOCUMENT = "__qti.xstream.xml"; private static final String CURRENT_HISTORY ="__qti.history.xml"; + + + private static final XStream xstream = XStreamHelper.createXStreamInstance(); + static { + XStreamHelper.allowDefaultPackage(xstream); + } private Identity identity = null; private FileResource fileResource = null; @@ -324,7 +332,7 @@ public class QTIEditorPackageImpl implements QTIEditorPackage { * */ public void serializeQTIDocument() { - XStreamHelper.writeObject(new File(packageDir, SERIALIZED_QTI_DOCUMENT), qtiDocument); + XStreamHelper.writeObject(xstream, new File(packageDir, SERIALIZED_QTI_DOCUMENT), qtiDocument); } private boolean hasSerializedQTIDocument() { @@ -332,7 +340,7 @@ public class QTIEditorPackageImpl implements QTIEditorPackage { } private QTIDocument loadSerializedQTIDocument() { - return (QTIDocument)XStreamHelper.readObject(new File(packageDir, SERIALIZED_QTI_DOCUMENT)); + return (QTIDocument)XStreamHelper.readObject(xstream, new File(packageDir, SERIALIZED_QTI_DOCUMENT)); } /** @@ -340,7 +348,7 @@ public class QTIEditorPackageImpl implements QTIEditorPackage { * @param history */ public void serializeChangelog(Map history){ - XStreamHelper.writeObject(new File(packageDir, CURRENT_HISTORY), history); + XStreamHelper.writeObject(xstream, new File(packageDir, CURRENT_HISTORY), history); } /** * check if a serialized change log exists @@ -354,7 +362,7 @@ public class QTIEditorPackageImpl implements QTIEditorPackage { * @return */ public Map loadChangelog(){ - return (Map)XStreamHelper.readObject(new File(packageDir, CURRENT_HISTORY)); + return (Map)XStreamHelper.readObject(xstream, new File(packageDir, CURRENT_HISTORY)); } /** diff --git a/src/main/java/org/olat/modules/portfolio/handler/BinderXStream.java b/src/main/java/org/olat/modules/portfolio/handler/BinderXStream.java index 8e1d5fff705839870cac6d3ef818be174a270eb4..5c7935877f70c60cb467ec8c1ad9999af69f2fe0 100644 --- a/src/main/java/org/olat/modules/portfolio/handler/BinderXStream.java +++ b/src/main/java/org/olat/modules/portfolio/handler/BinderXStream.java @@ -27,12 +27,25 @@ import java.nio.file.Path; import java.util.zip.ZipOutputStream; import org.apache.logging.log4j.Logger; +import org.olat.basesecurity.model.GroupImpl; import org.olat.core.logging.Tracing; import org.olat.core.util.io.ShieldOutputStream; import org.olat.core.util.xml.XStreamHelper; +import org.olat.modules.portfolio.Assignment; import org.olat.modules.portfolio.Binder; +import org.olat.modules.portfolio.Page; +import org.olat.modules.portfolio.PageBody; +import org.olat.modules.portfolio.Section; +import org.olat.modules.portfolio.model.AssignmentImpl; +import org.olat.modules.portfolio.model.BinderImpl; +import org.olat.modules.portfolio.model.PageBodyImpl; +import org.olat.modules.portfolio.model.PageImpl; +import org.olat.modules.portfolio.model.SectionImpl; +import org.olat.repository.RepositoryEntry; +import org.olat.resource.OLATResourceImpl; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ExplicitTypePermission; /** * @@ -43,20 +56,23 @@ import com.thoughtworks.xstream.XStream; public class BinderXStream { private static final Logger log = Tracing.createLoggerFor(BinderXStream.class); - private static final XStream myStream = XStreamHelper.createXStreamInstanceForDBObjects(); + private static final XStream xstream = XStreamHelper.createXStreamInstanceForDBObjects(); static { - XStreamHelper.allowDefaultPackage(myStream); - } - - public static final Binder copy(Binder binder) { - String stringuified = myStream.toXML(binder); - return (Binder)myStream.fromXML(stringuified); + Class<?>[] types = new Class[] { + OLATResourceImpl.class, GroupImpl.class, RepositoryEntry.class, + Binder.class, BinderImpl.class, + Section.class, SectionImpl.class, + Page.class, PageImpl.class, PageBody.class, PageBodyImpl.class, + Assignment.class, AssignmentImpl.class, + org.hibernate.proxy.pojo.bytebuddy.SerializableProxy.class + }; + xstream.addPermission(new ExplicitTypePermission(types)); } public static final Binder fromPath(Path path) throws IOException { try(InputStream inStream = Files.newInputStream(path)) { - return (Binder)myStream.fromXML(inStream); + return (Binder)xstream.fromXML(inStream); } catch (Exception e) { log.error("Cannot import this map: {}", path, e); return null; @@ -66,9 +82,14 @@ public class BinderXStream { public static final void toStream(Binder binder, ZipOutputStream zout) throws IOException { try(OutputStream out=new ShieldOutputStream(zout)) { - myStream.toXML(binder, out); + xstream.toXML(binder, out); } catch (Exception e) { log.error("Cannot export this map: {}", binder, e); } } + + public static final String toXML(Binder binder) + throws IOException { + return xstream.toXML(binder); + } } diff --git a/src/main/java/org/olat/modules/portfolio/manager/MetadataXStream.java b/src/main/java/org/olat/modules/portfolio/manager/MetadataXStream.java index 4cfa12545c5dd4ab99c5c1aeda8f2c9fd7f1da67..62281c602f3749d0894b98589145c55525b833de 100644 --- a/src/main/java/org/olat/modules/portfolio/manager/MetadataXStream.java +++ b/src/main/java/org/olat/modules/portfolio/manager/MetadataXStream.java @@ -20,8 +20,12 @@ package org.olat.modules.portfolio.manager; import org.olat.core.util.xml.XStreamHelper; +import org.olat.modules.portfolio.Citation; +import org.olat.modules.portfolio.CitationSourceType; +import org.olat.modules.portfolio.model.CitationXml; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ExplicitTypePermission; /** * For XStream @@ -34,7 +38,10 @@ public class MetadataXStream { private static final XStream xstream = XStreamHelper.createXStreamInstance(); static { - XStreamHelper.allowDefaultPackage(xstream); + Class<?>[] types = new Class[] { + Citation.class, CitationSourceType.class, CitationXml.class + }; + xstream.addPermission(new ExplicitTypePermission(types)); xstream.alias("citation", org.olat.modules.portfolio.model.CitationXml.class); xstream.aliasType("citation", org.olat.modules.portfolio.model.CitationXml.class); } diff --git a/src/main/java/org/olat/modules/qpool/manager/MetadataConverterHelper.java b/src/main/java/org/olat/modules/qpool/manager/MetadataConverterHelper.java index f51f0501487d533f55dc006ce2ff39b6db2816a4..2d111779188ba8cda877dfe7549a15183421c2e3 100644 --- a/src/main/java/org/olat/modules/qpool/manager/MetadataConverterHelper.java +++ b/src/main/java/org/olat/modules/qpool/manager/MetadataConverterHelper.java @@ -20,16 +20,7 @@ package org.olat.modules.qpool.manager; import org.olat.core.util.StringHelper; -import org.olat.core.util.xml.XStreamHelper; -import org.olat.modules.qpool.QuestionItem; import org.olat.modules.qpool.model.LOMDuration; -import org.olat.modules.qpool.model.QEducationalContext; -import org.olat.modules.qpool.model.QItemType; -import org.olat.modules.qpool.model.QLicense; -import org.olat.modules.qpool.model.QuestionItemImpl; -import org.olat.modules.taxonomy.model.TaxonomyLevelImpl; - -import com.thoughtworks.xstream.XStream; /** * @@ -40,20 +31,6 @@ import com.thoughtworks.xstream.XStream; * */ public class MetadataConverterHelper { - - private static XStream metadatXstream = XStreamHelper.createXStreamInstance(); - static { - XStreamHelper.allowDefaultPackage(metadatXstream);//TODO XStream - metadatXstream.alias("item", QuestionItemImpl.class); - metadatXstream.alias("educationalContext", QEducationalContext.class); - metadatXstream.alias("itemType", QItemType.class); - metadatXstream.alias("license", QLicense.class); - metadatXstream.alias("taxonomyLevel", TaxonomyLevelImpl.class); - } - - public static String toXml(QuestionItem item) { - return metadatXstream.toXML(item); - } /** * P[yY][mM][dD][T[hH][nM][s[.s]S]] where:<br> diff --git a/src/main/java/org/olat/modules/webFeed/manager/FeedFileStorge.java b/src/main/java/org/olat/modules/webFeed/manager/FeedFileStorge.java index a4c0be976953875ffdb90670f3d1395cfd3e28b2..5d805109abd36747f8bfe69d57a0e6faddada31b 100644 --- a/src/main/java/org/olat/modules/webFeed/manager/FeedFileStorge.java +++ b/src/main/java/org/olat/modules/webFeed/manager/FeedFileStorge.java @@ -28,10 +28,10 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import org.apache.logging.log4j.Logger; import org.olat.core.commons.services.image.ImageService; import org.olat.core.gui.components.form.flexible.elements.FileElement; import org.olat.core.id.OLATResourceable; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.CodeHelper; import org.olat.core.util.FileUtils; @@ -57,6 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ExplicitTypePermission; /** * This class helps to store data like images and videos in the file systems @@ -82,6 +83,27 @@ import com.thoughtworks.xstream.XStream; public class FeedFileStorge { private static final Logger log = Tracing.createLoggerFor(FeedFileStorge.class); + + private static final XStream xstream = XStreamHelper.createXStreamInstance(); + static { + Class<?>[] types = new Class[] { + Feed.class, FeedImpl.class, Item.class, ItemImpl.class, + Enclosure.class, EnclosureImpl.class + }; + xstream.addPermission(new ExplicitTypePermission(types)); + + xstream.alias("feed", FeedImpl.class); + xstream.aliasField("type", FeedImpl.class, "resourceableType"); + xstream.omitField(FeedImpl.class, "id"); + xstream.omitField(FeedImpl.class, "itemIds"); + xstream.omitField(FeedImpl.class, "key"); + xstream.omitField(FeedImpl.class, "wrappers"); + xstream.alias("item", ItemImpl.class); + xstream.omitField(ItemImpl.class, "key"); + xstream.omitField(ItemImpl.class, "feed"); + xstream.alias("enclosure", Enclosure.class, EnclosureImpl.class); + xstream.ignoreUnknownElements(); + } private static final String MEDIA_DIR = "media"; private static final String ITEMS_DIR = "items"; @@ -92,26 +114,12 @@ public class FeedFileStorge { private static final int PICTUREWIDTH = 570; private FileResourceManager fileResourceManager; - private final XStream xstream; @Autowired private ImageService imageHelper; public FeedFileStorge() { fileResourceManager = FileResourceManager.getInstance(); - xstream = XStreamHelper.createXStreamInstance(); - XStreamHelper.allowDefaultPackage(xstream); - xstream.alias("feed", FeedImpl.class); - xstream.aliasField("type", FeedImpl.class, "resourceableType"); - xstream.omitField(FeedImpl.class, "id"); - xstream.omitField(FeedImpl.class, "itemIds"); - xstream.omitField(FeedImpl.class, "key"); - xstream.omitField(FeedImpl.class, "wrappers"); - xstream.alias("item", ItemImpl.class); - xstream.omitField(ItemImpl.class, "key"); - xstream.omitField(ItemImpl.class, "feed"); - xstream.alias("enclosure", Enclosure.class, EnclosureImpl.class); - xstream.ignoreUnknownElements(); } /** @@ -291,7 +299,7 @@ public class FeedFileStorge { if (leaf == null) { leaf = feedContainer.createChildLeaf(FEED_FILE_NAME); } - XStreamHelper.writeObject(xstream, leaf, feed); + toXML(leaf, feed); } } @@ -309,11 +317,11 @@ public class FeedFileStorge { if (feedContainer != null) { VFSLeaf leaf = (VFSLeaf) feedContainer.resolve(FEED_FILE_NAME); if (leaf != null) { - feed = (FeedImpl) XStreamHelper.readObject(xstream, leaf); + feed = (FeedImpl)fromXML(leaf); shorteningFeedToLengthOfDbAttribues(feed); } } else { - log.warn("Feed XML-File could not be found on file system. Feed container: " + feedContainer); + log.warn("Feed XML-File could not be found on file system. Feed container: {}", feedContainer); } return feed; @@ -354,9 +362,9 @@ public class FeedFileStorge { Path feedPath = feedDir.resolve(FeedFileStorge.FEED_FILE_NAME); try (InputStream in = Files.newInputStream(feedPath); BufferedInputStream bis = new BufferedInputStream(in, FileUtils.BSIZE)) { - feed = (FeedImpl) XStreamHelper.readObject(xstream, bis); + feed = (FeedImpl)fromXML(bis); } catch (IOException e) { - log.warn("Feed XML-File could not be found on file system. Feed path: " + feedPath, e); + log.warn("Feed XML-File could not be found on file system. Feed path: {}", feedPath, e); } } @@ -390,7 +398,7 @@ public class FeedFileStorge { if (leaf == null) { leaf = itemContainer.createChildLeaf(ITEM_FILE_NAME); } - XStreamHelper.writeObject(xstream, leaf, item); + toXML(leaf, item); } } @@ -409,15 +417,27 @@ public class FeedFileStorge { VFSLeaf leaf = (VFSLeaf) itemContainer.resolve(ITEM_FILE_NAME); if (leaf != null) { try { - item = (ItemImpl) XStreamHelper.readObject(xstream, leaf); + item = (ItemImpl)fromXML(leaf); } catch (Exception e) { - log.warn("Item XML-File could not be read. Item container: " + leaf); + log.warn("Item XML-File could not be read. Item container: {}", leaf); } } } return item; } + + public static Object fromXML(VFSLeaf leaf) { + return XStreamHelper.readObject(xstream, leaf); + } + + public static Object fromXML(InputStream in) { + return XStreamHelper.readObject(xstream, in); + } + + public static void toXML(VFSLeaf leaf, Object obj) { + XStreamHelper.writeObject(xstream, leaf, obj); + } /** * Load the XML file of all items of a feed and convert them to items. diff --git a/src/main/java/org/olat/modules/webFeed/model/FeedImpl.java b/src/main/java/org/olat/modules/webFeed/model/FeedImpl.java index 65a9e38df9b331e6f913d250aa8a66d8292d8525..67a902054e3c20fab443a920a3e9e10c1f9dcec0 100644 --- a/src/main/java/org/olat/modules/webFeed/model/FeedImpl.java +++ b/src/main/java/org/olat/modules/webFeed/model/FeedImpl.java @@ -28,7 +28,6 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; @@ -46,10 +45,8 @@ import org.olat.modules.webFeed.Feed; */ @Entity(name="feed") @Table(name="o_feed") -@NamedQueries({ - @NamedQuery(name="loadFeedByRessourceable", +@NamedQuery(name="loadFeedByRessourceable", query="select data from feed data where f_resourceable_id=:key and f_resourceable_type=:name") -}) public class FeedImpl implements Feed, Serializable { private static final long serialVersionUID = 6005283969959964489L; diff --git a/src/main/java/org/olat/modules/webFeed/model/ItemImpl.java b/src/main/java/org/olat/modules/webFeed/model/ItemImpl.java index f945f225218ef1b030b46eda1eb5ee8eb8d2cb16..707248aeb30c05a45ca95d1b728c7ee079e5cfc5 100644 --- a/src/main/java/org/olat/modules/webFeed/model/ItemImpl.java +++ b/src/main/java/org/olat/modules/webFeed/model/ItemImpl.java @@ -33,7 +33,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; @@ -55,22 +54,20 @@ import org.olat.user.UserManager; */ @Entity(name="item") @Table(name="o_feed_item") -@NamedQueries({ - @NamedQuery(name="loadItemByGuid", - query="select data from item data where data.feed.key=:feedKey and data.guid=:guid"), - @NamedQuery(name="loadItemByGuidWithoutFeed", - query="select data from item data where data.guid=:guid"), - @NamedQuery(name="loadItemsByFeed", - query="select data from item data where data.feed=:feed"), - @NamedQuery(name="loadItemsByAuthorWithFeed", - query="select data from item data inner join fetch data.feed as feed where data.authorKey=:authorKey"), - @NamedQuery(name="loadItemsGuidByFeed", - query="select guid from item data where data.feed=:feed"), - @NamedQuery(name="removeItem", - query="delete from item data where data.key=:key"), - @NamedQuery(name="removeItemsForFeed", - query="delete from item data where data.feed.key=:feedKey") -}) +@NamedQuery(name="loadItemByGuid", + query="select data from item data where data.feed.key=:feedKey and data.guid=:guid") +@NamedQuery(name="loadItemByGuidWithoutFeed", + query="select data from item data where data.guid=:guid") +@NamedQuery(name="loadItemsByFeed", + query="select data from item data where data.feed=:feed") +@NamedQuery(name="loadItemsByAuthorWithFeed", + query="select data from item data inner join fetch data.feed as feed where data.authorKey=:authorKey") +@NamedQuery(name="loadItemsGuidByFeed", + query="select guid from item data where data.feed=:feed") +@NamedQuery(name="removeItem", + query="delete from item data where data.key=:key") +@NamedQuery(name="removeItemsForFeed", + query="delete from item data where data.feed.key=:feedKey") public class ItemImpl implements Item, Serializable { private static final long serialVersionUID = 4504634251127072211L; diff --git a/src/main/java/org/olat/modules/webFeed/portfolio/BlogEntryMediaController.java b/src/main/java/org/olat/modules/webFeed/portfolio/BlogEntryMediaController.java index 40a6d789bac5f8aa7f119711a3419df963cdfe17..1b1f818432dadacbe27c61333117538d3a8dc8c1 100644 --- a/src/main/java/org/olat/modules/webFeed/portfolio/BlogEntryMediaController.java +++ b/src/main/java/org/olat/modules/webFeed/portfolio/BlogEntryMediaController.java @@ -36,17 +36,14 @@ import org.olat.core.util.vfs.VFSContainer; import org.olat.core.util.vfs.VFSContainerMapper; import org.olat.core.util.vfs.VFSItem; import org.olat.core.util.vfs.VFSLeaf; -import org.olat.core.util.xml.XStreamHelper; import org.olat.modules.portfolio.Media; import org.olat.modules.portfolio.MediaRenderingHints; import org.olat.modules.portfolio.manager.PortfolioFileStorage; import org.olat.modules.portfolio.ui.MediaMetadataController; import org.olat.modules.webFeed.Item; -import org.olat.modules.webFeed.model.ItemImpl; +import org.olat.modules.webFeed.manager.FeedFileStorge; import org.springframework.beans.factory.annotation.Autowired; -import com.thoughtworks.xstream.XStream; - /** * * Description:<br> @@ -58,12 +55,6 @@ import com.thoughtworks.xstream.XStream; */ public class BlogEntryMediaController extends BasicController { - private static final XStream xstream = XStreamHelper.createXStreamInstance(); - static { - XStreamHelper.allowDefaultPackage(xstream); - xstream.alias("item", ItemImpl.class); - } - @Autowired private PortfolioFileStorage fileStorage; @@ -76,7 +67,7 @@ public class BlogEntryMediaController extends BasicController { if(item instanceof VFSLeaf) { VFSLeaf itemLeaf = (VFSLeaf)item; try(InputStream in = itemLeaf.getInputStream()) { - Item blogItem = (ItemImpl)xstream.fromXML(in); + Item blogItem = (Item)FeedFileStorge.fromXML(in); if(blogItem.getDate() != null) { DateComponentFactory.createDateComponentWithYear("dateComp", blogItem.getDate(), mainVC); } diff --git a/src/main/java/org/olat/user/propertyhandlers/UserInterestsPropertyHandler.java b/src/main/java/org/olat/user/propertyhandlers/UserInterestsPropertyHandler.java index d5c698ea9958812071b4a3f645e007707989aece..89cd51c81c7ce82fb2165d744e4def38f3885fa1 100644 --- a/src/main/java/org/olat/user/propertyhandlers/UserInterestsPropertyHandler.java +++ b/src/main/java/org/olat/user/propertyhandlers/UserInterestsPropertyHandler.java @@ -31,12 +31,12 @@ import java.util.Locale; import java.util.Map; import java.util.Vector; +import org.apache.logging.log4j.Logger; import org.olat.core.gui.components.form.ValidationError; import org.olat.core.gui.components.form.flexible.FormItem; import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.translator.Translator; import org.olat.core.id.User; -import org.apache.logging.log4j.Logger; import org.olat.core.logging.Tracing; import org.olat.core.util.Util; import org.olat.core.util.WebappHelper; @@ -45,6 +45,7 @@ import org.olat.core.util.xml.XStreamHelper; import org.olat.user.AbstractUserPropertyHandler; import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.security.ExplicitTypePermission; /** * <h3>Description:</h3> @@ -64,7 +65,11 @@ public class UserInterestsPropertyHandler extends AbstractUserPropertyHandler { private static final XStream interestsXStream = XStreamHelper.createXStreamInstance(); static { - XStreamHelper.allowDefaultPackage(interestsXStream); + Class<?>[] types = new Class[] { + UserInterestsCategory.class + }; + interestsXStream.addPermission(new ExplicitTypePermission(types)); + interestsXStream.alias("category", UserInterestsCategory.class); interestsXStream.alias("categories", List.class); interestsXStream.addImplicitCollection(UserInterestsCategory.class, "subcategories"); @@ -136,7 +141,7 @@ public class UserInterestsPropertyHandler extends AbstractUserPropertyHandler { availableUserInterests.addAll(available); } } catch (Exception e) { - log.warn("Unable to load user interests from configuration file " + userInterestsConfigurationFile.getAbsolutePath(), e); + log.warn("Unable to load user interests from configuration file {}", userInterestsConfigurationFile, e); } } return availableUserInterests; diff --git a/src/test/java/de/bps/olat/portal/links/LinksPortletTest.java b/src/test/java/de/bps/olat/portal/links/LinksPortletTest.java new file mode 100644 index 0000000000000000000000000000000000000000..32c7182f5bb05c54754f28970fea8f596eee470a --- /dev/null +++ b/src/test/java/de/bps/olat/portal/links/LinksPortletTest.java @@ -0,0 +1,49 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package de.bps.olat.portal.links; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; + +/** + * + * Initial date: 22 juin 2021<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class LinksPortletTest { + + @Test + public void readPortletLinks() throws URISyntaxException { + URL xmlUrl = LinksPortletTest.class.getResource("portlet.xml"); + File xmlFile = new File(xmlUrl.toURI()); + + Map<String,PortletInstitution> institutions = LinksPortlet.readConfiguration(xmlFile); + Assert.assertNotNull(institutions); + PortletInstitution institution = institutions.get("*"); + Assert.assertNotNull(institution); + } + +} diff --git a/src/test/java/de/bps/olat/portal/links/portlet.xml b/src/test/java/de/bps/olat/portal/links/portlet.xml new file mode 100644 index 0000000000000000000000000000000000000000..d0f65cdb1ae894c75d1f370ae9a994d20aa27173 --- /dev/null +++ b/src/test/java/de/bps/olat/portal/links/portlet.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<LinksPortlet> + <entry> + <string>*</string> + <University name="*"> + <links> + <Link> + <title>OpenOLAT</title> + <url>http://www.openolat.org</url> + <target>blank</target> + <language>de</language> + <description>Projektseite zu OpenOLAT</description> + <identifier>905fc36d893f4e948fd77e8f5030b0e0</identifier> + </Link> + </links> + </University> + </entry> +</LinksPortlet> \ No newline at end of file diff --git a/src/test/java/de/bps/olat/user/ChangeEMailExecuteControllerTest.java b/src/test/java/de/bps/olat/user/ChangeEMailExecuteControllerTest.java new file mode 100644 index 0000000000000000000000000000000000000000..daf3d5c2b3ab7db0eb257cc75e8f6800039b8f8e --- /dev/null +++ b/src/test/java/de/bps/olat/user/ChangeEMailExecuteControllerTest.java @@ -0,0 +1,53 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package de.bps.olat.user; + +import java.util.Map; + +import org.junit.Assert; +import org.junit.Test; + + +/** + * + * Initial date: 22 juin 2021<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class ChangeEMailExecuteControllerTest { + + @Test + public void readEmailsAdrress() { + String emailAdressXml ="<map>\n" + + " <entry>\n" + + " <string>changedEMail</string>\n" + + " <string>m@frentix.com</string>\n" + + " </entry> \n" + + " <entry>\n" + + " <string>currentEMail</string>\n" + + " <string>m@openolat.org</string>\n" + + " </entry>\n" + + "</map> "; + + Map<String,String> mails = ChangeEMailExecuteController.getMails(emailAdressXml); + Assert.assertEquals("m@frentix.com", mails.get("changedEMail")); + Assert.assertEquals("m@openolat.org", mails.get("currentEMail")); + } +} diff --git a/src/test/java/org/olat/core/commons/services/license/manager/LicenseXStreamHelperTest.java b/src/test/java/org/olat/core/commons/services/license/manager/LicenseXStreamHelperTest.java index 73f7d32fb49e240058bff6de85e581e735fe7468..e2f6bf46622e826ce8e1470ffc4ee1d6760342da 100644 --- a/src/test/java/org/olat/core/commons/services/license/manager/LicenseXStreamHelperTest.java +++ b/src/test/java/org/olat/core/commons/services/license/manager/LicenseXStreamHelperTest.java @@ -25,6 +25,9 @@ import org.junit.Test; import org.olat.core.commons.services.license.License; import org.olat.core.commons.services.license.model.LicenseImpl; import org.olat.core.commons.services.license.model.LicenseTypeImpl; +import org.olat.core.commons.services.license.model.ResourceLicenseImpl; +import org.olat.core.id.OLATResourceable; +import org.olat.core.util.resource.OresHelper; /** * @@ -55,5 +58,30 @@ public class LicenseXStreamHelperTest { assertThat(licenseFromXml.getFreetext()).isEqualTo(freetext); assertThat(licenseFromXml.getLicenseType().getName()).isEqualTo(licenseTypeName); } + + @Test + public void shouldConvertResourceLicenseToXmlAndBack() { + String licensor = "licenseOR"; + String freetext = "free"; + String licenseTypeName = "strictlicense"; + OLATResourceable ores = OresHelper.createOLATResourceableInstance("Course", Long.valueOf(32)); + + LicenseTypeImpl licenseType = new LicenseTypeImpl(); + licenseType.setName(licenseTypeName); + ResourceLicenseImpl license = new ResourceLicenseImpl(); + license.setLicensor(licensor); + license.setFreetext(freetext); + license.setLicenseType(licenseType); + license.setOLATResourceable(ores); + + LicenseXStreamHelper licenseXStreamHelper = new LicenseXStreamHelper(); + String licenseAsXml = licenseXStreamHelper.toXml(license); + assertThat(licenseAsXml).isNotNull(); + License licenseFromXml = licenseXStreamHelper.licenseFromXml(licenseAsXml); + + assertThat(licenseFromXml.getLicensor()).isEqualTo(licensor); + assertThat(licenseFromXml.getFreetext()).isEqualTo(freetext); + assertThat(licenseFromXml.getLicenseType().getName()).isEqualTo(licenseTypeName); + } } diff --git a/src/test/java/org/olat/core/util/xml/XStreamHelperTest.java b/src/test/java/org/olat/core/util/xml/XStreamHelperTest.java index 6b5fa58a64e6f20749dc49e2f0cc6b2bdd3b2bc0..6dd51b24b83ccc5d96074f15c4aef99ef6019459 100644 --- a/src/test/java/org/olat/core/util/xml/XStreamHelperTest.java +++ b/src/test/java/org/olat/core/util/xml/XStreamHelperTest.java @@ -25,7 +25,6 @@ import java.net.URL; import org.junit.Assert; import org.junit.Test; -import org.olat.core.logging.OLATRuntimeException; import com.thoughtworks.xstream.converters.ConversionException; @@ -52,14 +51,6 @@ public class XStreamHelperTest { Object obj = XStreamHelper.createXStreamInstanceForDBObjects().fromXML(file); Assert.assertNotNull(obj); } - - @Test - public void readXmlMapUnconfiguredAllowed() throws URISyntaxException { - URL url = XStreamHelperTest.class.getResource("xstream_map_strings.xml"); - File file = new File(url.toURI()); - Object obj = XStreamHelper.readObject(file); - Assert.assertNotNull(obj); - } @Test(expected = ConversionException.class) public void readXmlMapNotAllowed() throws URISyntaxException { @@ -74,11 +65,4 @@ public class XStreamHelperTest { File file = new File(url.toURI()); XStreamHelper.createXStreamInstanceForDBObjects().fromXML(file); } - - @Test(expected = OLATRuntimeException.class) - public void readXmlMapUnconfiguredNotAllowed() throws URISyntaxException { - URL url = XStreamHelperTest.class.getResource("xstream_map_alien.xml"); - File file = new File(url.toURI()); - XStreamHelper.readObject(file); - } } diff --git a/src/test/java/org/olat/course/assessment/AssessmentManagerTest.java b/src/test/java/org/olat/course/assessment/AssessmentManagerTest.java index 02ceb25721ddb9f2573acc7dc2747e632aa4f796..5fdb84fa1be8a5df80080569974a0576e42108c3 100644 --- a/src/test/java/org/olat/course/assessment/AssessmentManagerTest.java +++ b/src/test/java/org/olat/course/assessment/AssessmentManagerTest.java @@ -85,7 +85,7 @@ public class AssessmentManagerTest extends OlatTestCase { private CourseNode assessableCourseNode; private Identity tutor; private Identity student; - private final Float score = new Float(10); + private final Float score = Float.valueOf(10); private final Boolean passed = Boolean.TRUE; @Autowired @@ -152,7 +152,7 @@ public class AssessmentManagerTest extends OlatTestCase { assessmentManager = course.getCourseEnvironment().getAssessmentManager(); - Long assessmentID = new Long("123456"); + Long assessmentID = Long.valueOf("123456"); Integer attempts = 1; String coachComment = "SomeUselessCoachComment"; String userComment = "UselessUserComment"; @@ -275,12 +275,12 @@ public class AssessmentManagerTest extends OlatTestCase { if(assessmentMap.get(AssessmentHelper.KEY_IDENTIFYER).equals(assessableCourseNode.getIdent())) { String scoreString = (String) assessmentMap.get(AssessmentHelper.KEY_SCORE); log.info("scoreString: " + scoreString); - assertEquals(score, new Float(scoreString)); + assertEquals(score, Float.valueOf(scoreString)); } } Double scoreDouble = efficiencyStatementManager.getScore(assessableCourseNode.getIdent(), efficiencyStatement); log.info("scoreDouble: " + scoreDouble); - assertEquals(new Double(score),efficiencyStatementManager.getScore(assessableCourseNode.getIdent(), efficiencyStatement)); + assertEquals(Double.valueOf(score),efficiencyStatementManager.getScore(assessableCourseNode.getIdent(), efficiencyStatement)); assertEquals(passed,efficiencyStatementManager.getPassed(assessableCourseNode.getIdent(), efficiencyStatement)); return efficiencyStatement; } diff --git a/src/test/java/org/olat/course/assessment/manager/EfficiencyStatementManagerXStreamTest.java b/src/test/java/org/olat/course/assessment/manager/EfficiencyStatementManagerXStreamTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0bd00282bc6320497313eb6a033638235d81ba5c --- /dev/null +++ b/src/test/java/org/olat/course/assessment/manager/EfficiencyStatementManagerXStreamTest.java @@ -0,0 +1,5 @@ +package org.olat.course.assessment.manager; + +public class EfficiencyStatementManagerXStreamTest { + +} diff --git a/src/test/java/org/olat/course/assessment/manager/efficiency_statement.xml b/src/test/java/org/olat/course/assessment/manager/efficiency_statement.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe7202ec7889adadd392c47577f6ccd0671f8320 --- /dev/null +++ b/src/test/java/org/olat/course/assessment/manager/efficiency_statement.xml @@ -0,0 +1,98 @@ +<org.olat.course.assessment.EfficiencyStatement> + <assessmentNodes> + <map> + <entry> + <string>identifyer</string> + <string>103769899903862</string> + </entry> + <entry> + <string>indent</string> + <int>0</int> + </entry> + <entry> + <string>selectable</string> + <boolean>false</boolean> + </entry> + <entry> + <string>long.title</string> + <string>QTI Course</string> + </entry> + <entry> + <string>lastUserModified</string> + <sql-timestamp>2021-05-26 15:47:13.438</sql-timestamp> + </entry> + <entry> + <string>lastCoachModified</string> + <date>2021-06-04 15:22:47.56 UTC</date> + </entry> + <entry> + <string>type</string> + <string>st</string> + </entry> + <entry> + <string>short.title</string> + <string>QTI Course</string> + </entry> + </map> + <map> + <entry> + <string>minScore</string> + <float>0.0</float> + </entry> + <entry> + <string>indent</string> + <int>1</int> + </entry> + <entry> + <string>selectable</string> + <boolean>true</boolean> + </entry> + <entry> + <string>lastUserModified</string> + <sql-timestamp reference="../../../map/entry[5]/sql-timestamp"/> + </entry> + <entry> + <string>type</string> + <string>iqtest</string> + </entry> + <entry> + <string>short.title</string> + <string>Test QTI</string> + </entry> + <entry> + <string>maxScore</string> + <float>3.0</float> + </entry> + <entry> + <string>identifyer</string> + <string>103769899903897</string> + </entry> + <entry> + <string>score</string> + <string>3</string> + </entry> + <entry> + <string>long.title</string> + <string></string> + </entry> + <entry> + <string>lastCoachModified</string> + <date reference="../../../map/entry[6]/date"/> + </entry> + <entry> + <string>fscore</string> + <float>3.0</float> + </entry> + <entry> + <string>attempts</string> + <int>2</int> + </entry> + </map> + </assessmentNodes> + <courseTitle>QTI Course</courseTitle> + <courseRepoEntryKey>2446196736</courseRepoEntryKey> + <displayableUserInfo>Seibl, Karin Josepha</displayableUserInfo> + <lastUpdated>1622820167067</lastUpdated> + <lastUserModified>1622044033438</lastUserModified> + <lastCoachModified>1622820167056</lastCoachModified> +</org.olat.course.assessment.EfficiencyStatement> \ No newline at end of file diff --git a/src/test/java/org/olat/modules/portfolio/handler/BinderXStreamTest.java b/src/test/java/org/olat/modules/portfolio/handler/BinderXStreamTest.java new file mode 100644 index 0000000000000000000000000000000000000000..10bfcad4987e1a5dde5c447d30e2ab135f393a51 --- /dev/null +++ b/src/test/java/org/olat/modules/portfolio/handler/BinderXStreamTest.java @@ -0,0 +1,70 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.portfolio.handler; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; + +import org.junit.Assert; +import org.junit.Test; +import org.olat.modules.portfolio.Binder; + +/** + * + * Initial date: 22 juin 2021<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class BinderXStreamTest { + + @Test + public void readBinderExportXML() throws URISyntaxException, IOException { + URL binderUrl = BinderXStreamTest.class.getResource("binder_simple.xml"); + File binderFile = new File(binderUrl.toURI()); + + Binder binder = BinderXStream.fromPath(binderFile.toPath()); + Assert.assertNotNull(binder); + } + + @Test + public void readBinderAssignmentsExportXML() throws URISyntaxException, IOException { + URL binderUrl = BinderXStreamTest.class.getResource("binder_assignments.xml"); + File binderFile = new File(binderUrl.toURI()); + + Binder binder = BinderXStream.fromPath(binderFile.toPath()); + Assert.assertNotNull(binder); + } + + @Test + public void readWriteBinder() throws URISyntaxException, IOException { + URL binderUrl = BinderXStreamTest.class.getResource("binder_simple.xml"); + File binderFile = new File(binderUrl.toURI()); + + Binder binder = BinderXStream.fromPath(binderFile.toPath()); + Assert.assertNotNull(binder); + + String xml = BinderXStream.toXML(binder); + Assert.assertNotNull(xml); + + } + +} diff --git a/src/test/java/org/olat/modules/portfolio/handler/binder_assignments.xml b/src/test/java/org/olat/modules/portfolio/handler/binder_assignments.xml new file mode 100644 index 0000000000000000000000000000000000000000..a90dfa54b34ec049b4bf7fcfdc0cdd7fd2c35201 --- /dev/null +++ b/src/test/java/org/olat/modules/portfolio/handler/binder_assignments.xml @@ -0,0 +1,120 @@ +<org.olat.modules.portfolio.model.BinderImpl> + <key>78</key> + <creationDate class="sql-timestamp">2016-10-24 16:11:38.734</creationDate> + <lastModified class="sql-timestamp">2016-10-24 16:11:38.734</lastModified> + <title>Portfolio can add pages</title> + <summary></summary> + <olatResource class="org.olat.resource.OLATResourceImpl"> + <key>559087616</key> + <version>0</version> + <creationDate class="sql-timestamp">2016-10-24 16:11:38.728</creationDate> + <resName>BinderTemplate</resName> + <resId>94548827393094</resId> + </olatResource> + <sections> + <org.olat.modules.portfolio.model.SectionImpl> + <key>158</key> + <creationDate class="sql-timestamp">2016-10-24 16:12:06.867</creationDate> + <lastModified class="sql-timestamp">2016-10-24 16:12:06.867</lastModified> + <pos>0</pos> + <title>Section 1</title> + <description></description> + <status>notStarted</status> + <overrideBeginEndDates>false</overrideBeginEndDates> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <pages/> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>109</key> + <creationDate class="sql-timestamp">2016-11-03 20:42:49.222</creationDate> + <lastModified class="sql-timestamp">2016-11-03 20:42:49.222</lastModified> + <pos>0</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Task 3 of 1</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/40/00002</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>true</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>110</key> + <creationDate class="sql-timestamp">2016-11-03 20:43:00.362</creationDate> + <lastModified class="sql-timestamp">2016-11-03 20:43:00.362</lastModified> + <pos>1</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Task 4 of 1</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/c7/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>true</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>106</key> + <creationDate class="sql-timestamp">2016-10-24 16:12:36.838</creationDate> + <lastModified class="sql-timestamp">2016-10-24 16:12:36.838</lastModified> + <pos>2</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Task 1 of 1</title> + <summary><p>Work</p></summary> + <content><p>Make the task</p></content> + <storage>portfolio/assignments/40/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>true</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>108</key> + <creationDate class="sql-timestamp">2016-11-03 20:42:29.001</creationDate> + <lastModified class="sql-timestamp">2016-11-03 20:42:29.001</lastModified> + <pos>3</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Task 2 of 1</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/65/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>true</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> + </org.olat.modules.portfolio.model.SectionImpl> + </sections> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>440</key> + <creationDate class="sql-timestamp">2021-06-22 12:23:20.703</creationDate> + <lastModified class="sql-timestamp">2021-06-22 12:23:20.703</lastModified> + <pos>0</pos> + <status>template</status> + <type>document</type> + <version>0</version> + <template>true</template> + <title>FormuleGravi.odf</title> + <storage>portfolio/assignments/9b/00001</storage> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> +</org.olat.modules.portfolio.model.BinderImpl> \ No newline at end of file diff --git a/src/test/java/org/olat/modules/portfolio/handler/binder_simple.xml b/src/test/java/org/olat/modules/portfolio/handler/binder_simple.xml new file mode 100644 index 0000000000000000000000000000000000000000..70f9c24e467b9009d8bff084ed90e177538a04ae --- /dev/null +++ b/src/test/java/org/olat/modules/portfolio/handler/binder_simple.xml @@ -0,0 +1,683 @@ +<org.olat.modules.portfolio.model.BinderImpl> + <key>6</key> + <creationDate class="sql-timestamp">2016-06-17 08:51:46.621</creationDate> + <lastModified class="sql-timestamp">2018-11-23 10:12:10.724</lastModified> + <title>Portfolio template</title> + <summary></summary> + <imagePath>portfolio/posters/binders/b9/Hi There.png</imagePath> + <baseGroup class="org.olat.basesecurity.model.GroupImpl"> + <key>459407361</key> + <creationDate class="sql-timestamp">2016-06-17 08:51:46.621</creationDate> + <members> + <isTempSession>false</isTempSession> + <initialized>false</initialized> + <owner class="org.olat.basesecurity.model.GroupImpl" reference="../.."/> + <cachedSize>-1</cachedSize> + <role>org.olat.basesecurity.model.GroupImpl.members</role> + <key class="long">459407361</key> + <dirty>false</dirty> + <elementRemoved>false</elementRemoved> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + </members> + </baseGroup> + <olatResource class="org.olat.resource.OLATResourceImpl"> + <key>459341824</key> + <version>0</version> + <creationDate class="sql-timestamp">2016-06-17 08:51:46.614</creationDate> + <resName>BinderTemplate</resName> + <resId>93833819624849</resId> + </olatResource> + <sections> + <org.olat.modules.portfolio.model.SectionImpl> + <key>5</key> + <creationDate class="sql-timestamp">2016-06-17 08:51:46.637</creationDate> + <lastModified class="sql-timestamp">2018-05-18 09:17:32.085</lastModified> + <pos>0</pos> + <title>Section (1)</title> + <description><p>This is the first section's description</p></description> + <status>notStarted</status> + <beginDate class="sql-timestamp">2017-03-05 23:00:00</beginDate> + <endDate class="sql-timestamp">2017-03-30 22:00:00</endDate> + <overrideBeginEndDates>false</overrideBeginEndDates> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">459407362</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces> + <java-class>org.hibernate.proxy.HibernateProxy</java-class> + </interfaces> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <pages> + <null/> + <org.olat.modules.portfolio.model.PageImpl> + <key>12</key> + <creationDate class="sql-timestamp">2016-06-21 15:24:15.608</creationDate> + <lastModified class="sql-timestamp">2016-06-21 15:24:15.608</lastModified> + <pos>1</pos> + <title>Entry with images</title> + <summary></summary> + <editable>true</editable> + <version>0</version> + <body class="org.olat.modules.portfolio.model.PageBodyImpl$HibernateProxy$572ph9QL" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.modules.portfolio.model.PageBodyImpl</entityName> + <id class="long">12</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.modules.portfolio.model.PageBodyImpl</persistentClass> + <interfaces> + <java-class>org.hibernate.proxy.HibernateProxy</java-class> + </interfaces> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.modules.portfolio.model.PageBodyImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.modules.portfolio.model.PageBodyImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </body> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">465666050</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces reference="../../../../baseGroup/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + </org.olat.modules.portfolio.model.PageImpl> + <org.olat.modules.portfolio.model.PageImpl> + <key>13</key> + <creationDate class="sql-timestamp">2016-06-21 15:26:15.26</creationDate> + <lastModified class="sql-timestamp">2016-06-21 15:26:15.26</lastModified> + <pos>2</pos> + <title>entry with image 2</title> + <summary></summary> + <editable>true</editable> + <version>0</version> + <body class="org.olat.modules.portfolio.model.PageBodyImpl$HibernateProxy$572ph9QL" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.modules.portfolio.model.PageBodyImpl</entityName> + <id class="long">13</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.modules.portfolio.model.PageBodyImpl</persistentClass> + <interfaces reference="../../../org.olat.modules.portfolio.model.PageImpl/body/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.modules.portfolio.model.PageBodyImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.modules.portfolio.model.PageBodyImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </body> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">465666051</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces reference="../../../../baseGroup/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + </org.olat.modules.portfolio.model.PageImpl> + </pages> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>410</key> + <creationDate class="sql-timestamp">2020-09-22 13:17:03.532</creationDate> + <lastModified class="sql-timestamp">2020-09-22 13:17:03.532</lastModified> + <pos>0</pos> + <status>template</status> + <type>form</type> + <version>0</version> + <template>false</template> + <title>Ceci est un test</title> + <summary><p>Bla bla</p></summary> + <content></content> + <storage>portfolio/assignments/ff/00002</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + <formEntry class="org.olat.repository.RepositoryEntry$HibernateProxy$7EDKH5aq" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.repository.RepositoryEntry</entityName> + <id class="long">2059501572</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.repository.RepositoryEntry</persistentClass> + <interfaces> + <java-class>org.hibernate.proxy.HibernateProxy</java-class> + </interfaces> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.repository.RepositoryEntry</identifierGetterMethodClass> + </formEntry> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> + </org.olat.modules.portfolio.model.SectionImpl> + <org.olat.modules.portfolio.model.SectionImpl> + <key>13</key> + <creationDate class="sql-timestamp">2016-06-21 15:26:30.699</creationDate> + <lastModified class="sql-timestamp">2017-03-23 08:45:04.312</lastModified> + <pos>1</pos> + <title>Section (2)</title> + <description><p>This is a whole new section</p></description> + <status>notStarted</status> + <beginDate class="sql-timestamp">2017-05-09 22:00:00</beginDate> + <overrideBeginEndDates>false</overrideBeginEndDates> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">465666052</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces reference="../../../org.olat.modules.portfolio.model.SectionImpl/baseGroup/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <pages> + <null/> + <org.olat.modules.portfolio.model.PageImpl> + <key>14</key> + <creationDate class="sql-timestamp">2016-06-21 15:26:40.838</creationDate> + <lastModified class="sql-timestamp">2016-06-21 15:26:40.838</lastModified> + <pos>1</pos> + <title>Entry with PDFs</title> + <summary></summary> + <editable>true</editable> + <version>0</version> + <body class="org.olat.modules.portfolio.model.PageBodyImpl$HibernateProxy$572ph9QL" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.modules.portfolio.model.PageBodyImpl</entityName> + <id class="long">14</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.modules.portfolio.model.PageBodyImpl</persistentClass> + <interfaces reference="../../../../../org.olat.modules.portfolio.model.SectionImpl/pages/org.olat.modules.portfolio.model.PageImpl/body/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.modules.portfolio.model.PageBodyImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.modules.portfolio.model.PageBodyImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </body> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">465666053</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces reference="../../../../../org.olat.modules.portfolio.model.SectionImpl/baseGroup/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + </org.olat.modules.portfolio.model.PageImpl> + </pages> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>148</key> + <creationDate class="sql-timestamp">2017-02-09 08:07:41.376</creationDate> + <lastModified class="sql-timestamp">2017-02-09 08:07:41.376</lastModified> + <pos>0</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Travail 1.</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/35/00002</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>149</key> + <creationDate class="sql-timestamp">2017-02-09 08:07:51.388</creationDate> + <lastModified class="sql-timestamp">2017-03-23 10:33:42.042</lastModified> + <pos>1</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Travail 2.</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/54/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>150</key> + <creationDate class="sql-timestamp">2017-02-09 08:08:01.176</creationDate> + <lastModified class="sql-timestamp">2017-03-23 10:33:48.84</lastModified> + <pos>2</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Travail 3.</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/c2/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>151</key> + <creationDate class="sql-timestamp">2017-02-09 08:08:10.313</creationDate> + <lastModified class="sql-timestamp">2017-02-09 08:08:10.313</lastModified> + <pos>3</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Travail 4.</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/f1/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> + </org.olat.modules.portfolio.model.SectionImpl> + <org.olat.modules.portfolio.model.SectionImpl> + <key>18</key> + <creationDate class="sql-timestamp">2016-06-22 14:20:16.843</creationDate> + <lastModified class="sql-timestamp">2016-08-03 17:04:56.256</lastModified> + <pos>2</pos> + <title>Section (3)</title> + <description></description> + <status>notStarted</status> + <beginDate class="sql-timestamp">2016-08-01 22:00:00</beginDate> + <endDate class="sql-timestamp">2016-08-30 22:00:00</endDate> + <overrideBeginEndDates>false</overrideBeginEndDates> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">466518018</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces reference="../../../org.olat.modules.portfolio.model.SectionImpl/baseGroup/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <pages/> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>178</key> + <creationDate class="sql-timestamp">2017-03-23 08:42:05.542</creationDate> + <lastModified class="sql-timestamp">2017-03-23 10:33:33.577</lastModified> + <pos>0</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Travail 1.</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/18/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>179</key> + <creationDate class="sql-timestamp">2017-03-23 08:42:17.297</creationDate> + <lastModified class="sql-timestamp">2017-03-23 10:47:00.683</lastModified> + <pos>1</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Travail 2</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/98/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>180</key> + <creationDate class="sql-timestamp">2017-03-23 08:42:29.197</creationDate> + <lastModified class="sql-timestamp">2017-03-23 08:42:29.197</lastModified> + <pos>2</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Travail 2</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/62/00002</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>181</key> + <creationDate class="sql-timestamp">2017-03-23 08:42:40.769</creationDate> + <lastModified class="sql-timestamp">2017-03-23 10:48:28.236</lastModified> + <pos>3</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Travail 4</title> + <summary><p>project list</p></summary> + <content><p>Work with a project list</p></content> + <storage>portfolio/assignments/98/00002</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> + </org.olat.modules.portfolio.model.SectionImpl> + <org.olat.modules.portfolio.model.SectionImpl> + <key>20</key> + <creationDate class="sql-timestamp">2016-06-22 16:34:01.974</creationDate> + <lastModified class="sql-timestamp">2017-03-23 08:45:26.624</lastModified> + <pos>3</pos> + <title>Section (4)</title> + <description><p>Et ecnore beaucoup de texte &agrave; &eacute;crire</p></description> + <status>notStarted</status> + <beginDate class="sql-timestamp">2017-06-23 22:00:00</beginDate> + <endDate class="sql-timestamp">2017-07-28 22:00:00</endDate> + <overrideBeginEndDates>false</overrideBeginEndDates> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">466845696</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces reference="../../../org.olat.modules.portfolio.model.SectionImpl/baseGroup/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <pages/> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>5</key> + <creationDate class="sql-timestamp">2016-07-20 16:16:17.613</creationDate> + <lastModified class="sql-timestamp">2016-11-23 13:36:46.123</lastModified> + <pos>0</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Upload a document</title> + <summary><p>Upload a <em>document</em> with <strong>some</strong> formatting</p></summary> + <content><p>Upload a document</p></content> + <storage>portfolio/assignments/2d/001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>true</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>4</key> + <creationDate class="sql-timestamp">2016-07-20 16:15:46.168</creationDate> + <lastModified class="sql-timestamp">2016-08-26 09:47:49.539</lastModified> + <pos>1</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Essay</title> + <summary>Write an essay</summary> + <content><p>Write an essay</p></content> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>true</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>146</key> + <creationDate class="sql-timestamp">2017-02-09 08:06:03.253</creationDate> + <lastModified class="sql-timestamp">2017-02-09 08:06:03.253</lastModified> + <pos>2</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Essay</title> + <summary><p>An essay</p></summary> + <content></content> + <storage>portfolio/assignments/67/00002</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>147</key> + <creationDate class="sql-timestamp">2017-02-09 08:07:00.96</creationDate> + <lastModified class="sql-timestamp">2017-03-23 10:52:47.78</lastModified> + <pos>3</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Little test</title> + <summary><p>Writing sample</p></summary> + <content><p>Updated assignment</p></content> + <storage>portfolio/assignments/b9/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> + </org.olat.modules.portfolio.model.SectionImpl> + <org.olat.modules.portfolio.model.SectionImpl> + <key>239</key> + <creationDate class="sql-timestamp">2018-05-18 09:17:54.113</creationDate> + <lastModified class="sql-timestamp">2018-05-18 09:17:54.113</lastModified> + <pos>4</pos> + <title>Section (5) evaluation</title> + <description><p>The final evaluation</p></description> + <status>notStarted</status> + <overrideBeginEndDates>false</overrideBeginEndDates> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">1344602112</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces reference="../../../org.olat.modules.portfolio.model.SectionImpl/baseGroup/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <pages/> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>279</key> + <creationDate class="sql-timestamp">2018-05-18 09:19:35.988</creationDate> + <lastModified class="sql-timestamp">2018-05-18 10:27:23.807</lastModified> + <pos>0</pos> + <status>template</status> + <type>form</type> + <version>0</version> + <template>false</template> + <title>Evaluation and external evaluation (not visible)</title> + <summary><p>Evaluation and external evaluation (not visible)</p></summary> + <content></content> + <storage>portfolio/assignments/80/00002</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>false</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>true</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + <formEntry class="org.olat.repository.RepositoryEntry$HibernateProxy$7EDKH5aq" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.repository.RepositoryEntry</entityName> + <id class="long">1167425536</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.repository.RepositoryEntry</persistentClass> + <interfaces reference="../../../../../org.olat.modules.portfolio.model.SectionImpl/assignments/org.olat.modules.portfolio.model.AssignmentImpl/formEntry/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.repository.RepositoryEntry</identifierGetterMethodClass> + </formEntry> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> + </org.olat.modules.portfolio.model.SectionImpl> + <org.olat.modules.portfolio.model.SectionImpl> + <key>241</key> + <creationDate class="sql-timestamp">2018-05-18 10:22:57.72</creationDate> + <lastModified class="sql-timestamp">2018-05-18 10:22:57.72</lastModified> + <pos>5</pos> + <title>Section (6) documents</title> + <description></description> + <status>notStarted</status> + <overrideBeginEndDates>false</overrideBeginEndDates> + <baseGroup class="org.olat.basesecurity.model.GroupImpl$HibernateProxy$KjV2FAyo" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.basesecurity.model.GroupImpl</entityName> + <id class="long">1344602115</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.basesecurity.model.GroupImpl</persistentClass> + <interfaces reference="../../../org.olat.modules.portfolio.model.SectionImpl/baseGroup/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierGetterMethodClass> + <identifierSetterMethodName>setKey</identifierSetterMethodName> + <identifierSetterMethodClass>org.olat.basesecurity.model.GroupImpl</identifierSetterMethodClass> + <identifierSetterMethodParams> + <java-class>java.lang.Long</java-class> + </identifierSetterMethodParams> + </baseGroup> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <pages/> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>281</key> + <creationDate class="sql-timestamp">2018-05-18 10:23:33.675</creationDate> + <lastModified class="sql-timestamp">2018-05-18 10:23:33.675</lastModified> + <pos>0</pos> + <status>template</status> + <type>essay</type> + <version>0</version> + <template>false</template> + <title>Documents</title> + <summary><p>Documents</p></summary> + <content></content> + <storage>portfolio/assignments/ad/00001</storage> + <section class="org.olat.modules.portfolio.model.SectionImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> + </org.olat.modules.portfolio.model.SectionImpl> + </sections> + <assignments> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>306</key> + <creationDate class="sql-timestamp">2018-11-14 09:34:54.52</creationDate> + <lastModified class="sql-timestamp">2018-11-21 20:28:47.968</lastModified> + <pos>0</pos> + <status>template</status> + <type>document</type> + <version>0</version> + <template>true</template> + <title>IMG 1484.jpg</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/e3/00001</storage> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + </org.olat.modules.portfolio.model.AssignmentImpl> + <org.olat.modules.portfolio.model.AssignmentImpl> + <key>311</key> + <creationDate class="sql-timestamp">2018-11-14 17:50:48.34</creationDate> + <lastModified class="sql-timestamp">2018-11-21 18:01:31.4</lastModified> + <pos>1</pos> + <status>template</status> + <type>form</type> + <version>0</version> + <template>true</template> + <title>Form 1(b)</title> + <summary></summary> + <content></content> + <storage>portfolio/assignments/40/00003</storage> + <binder class="org.olat.modules.portfolio.model.BinderImpl" reference="../../.."/> + <onlyAutoEvaluation>true</onlyAutoEvaluation> + <reviewerSeeAutoEvaluation>false</reviewerSeeAutoEvaluation> + <anonymousExternalEvaluation>false</anonymousExternalEvaluation> + <formEntry class="org.olat.repository.RepositoryEntry$HibernateProxy$7EDKH5aq" resolves-to="org.hibernate.proxy.pojo.bytebuddy.SerializableProxy"> + <entityName>org.olat.repository.RepositoryEntry</entityName> + <id class="long">630718464</id> + <readOnly>false</readOnly> + <allowLoadOutsideTransaction>false</allowLoadOutsideTransaction> + <persistentClass>org.olat.repository.RepositoryEntry</persistentClass> + <interfaces reference="../../../../sections/org.olat.modules.portfolio.model.SectionImpl/assignments/org.olat.modules.portfolio.model.AssignmentImpl/formEntry/interfaces"/> + <identifierGetterMethodName>getKey</identifierGetterMethodName> + <identifierGetterMethodClass>org.olat.repository.RepositoryEntry</identifierGetterMethodClass> + </formEntry> + </org.olat.modules.portfolio.model.AssignmentImpl> + </assignments> +</org.olat.modules.portfolio.model.BinderImpl> \ No newline at end of file diff --git a/src/test/java/org/olat/modules/portfolio/manager/MetadataXStreamTest.java b/src/test/java/org/olat/modules/portfolio/manager/MetadataXStreamTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6a385103dfd7a0d11a1e106eb2443806b28aebe9 --- /dev/null +++ b/src/test/java/org/olat/modules/portfolio/manager/MetadataXStreamTest.java @@ -0,0 +1,65 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.modules.portfolio.manager; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Date; + +import org.junit.Assert; +import org.junit.Test; +import org.olat.modules.portfolio.Citation; +import org.olat.modules.portfolio.CitationSourceType; +import org.olat.modules.portfolio.model.CitationXml; + +/** + * + * Initial date: 22 juin 2021<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class MetadataXStreamTest { + + @Test + public void readCitationXml() throws URISyntaxException { + URL citationUrl = MetadataXStreamTest.class.getResource("citation.xml"); + File citationFile = new File(citationUrl.toURI()); + Citation citation = (Citation)MetadataXStream.get().fromXML(citationFile); + Assert.assertNotNull(citation); + Assert.assertEquals("SBN-3458794958", citation.getIsbn()); + Assert.assertEquals("Volumen 23", citation.getVolume()); + } + + @Test + public void writeReadCitationXml() throws URISyntaxException { + CitationXml citation = new CitationXml(); + citation.setLastVisit(new Date()); + citation.setEdition("First edition"); + citation.setItemType(CitationSourceType.film); + + String xml = MetadataXStream.get().toXML(citation); + Citation reloaded = (Citation)MetadataXStream.get().fromXML(xml); + + Assert.assertNotNull(reloaded); + Assert.assertEquals("First edition", reloaded.getEdition()); + Assert.assertEquals(CitationSourceType.film, reloaded.getItemType()); + } +} diff --git a/src/test/java/org/olat/modules/portfolio/manager/citation.xml b/src/test/java/org/olat/modules/portfolio/manager/citation.xml new file mode 100644 index 0000000000000000000000000000000000000000..3de48debb94441e2d2f6edca19134c952928a69b --- /dev/null +++ b/src/test/java/org/olat/modules/portfolio/manager/citation.xml @@ -0,0 +1,12 @@ +<citation> + <itemType>book</itemType> + <edition>Auflage</edition> + <editor>Verlag</editor> + <volume>Volumen 23</volume> + <series>Serien nummer</series> + <publicationTitle></publicationTitle> + <issue></issue> + <pages></pages> + <institution></institution> + <isbn>SBN-3458794958</isbn> +</citation> \ No newline at end of file diff --git a/src/test/java/org/olat/modules/webFeed/manager/FeedFileStorgeTest.java b/src/test/java/org/olat/modules/webFeed/manager/FeedFileStorgeTest.java index 5773263cf4012c976c9391ebd3384f2374b538b4..d339a5c01b1f5e43dd520eb51aba0709748a4fe6 100644 --- a/src/test/java/org/olat/modules/webFeed/manager/FeedFileStorgeTest.java +++ b/src/test/java/org/olat/modules/webFeed/manager/FeedFileStorgeTest.java @@ -21,6 +21,8 @@ package org.olat.modules.webFeed.manager; import static org.assertj.core.api.Assertions.assertThat; +import java.net.URISyntaxException; +import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; @@ -28,6 +30,7 @@ import java.util.List; import org.junit.Before; import org.junit.Test; import org.olat.core.util.vfs.VFSContainer; +import org.olat.core.util.vfs.VFSLeaf; import org.olat.core.util.vfs.filters.VFSSystemItemFilter; import org.olat.fileresource.FileResourceManager; import org.olat.fileresource.types.BlogFileResource; @@ -37,6 +40,7 @@ import org.olat.modules.webFeed.Item; import org.olat.modules.webFeed.model.FeedImpl; import org.olat.modules.webFeed.model.ItemImpl; import org.olat.test.OlatTestCase; +import org.olat.test.VFSJavaIOFile; /** * Test the FeedFileStorage. @@ -437,7 +441,7 @@ public class FeedFileStorgeTest extends OlatTestCase { @Test public void loadFeedFromXML_shortening_values() { - StringBuffer sb = new StringBuffer(5000); + StringBuilder sb = new StringBuilder(5000); for (int i = 0; i < 5000; i++){ sb.append("A"); } @@ -489,6 +493,33 @@ public class FeedFileStorgeTest extends OlatTestCase { assertThat(reloaded).isNull(); } + + @Test + public void loadFeedFromXMLFile() throws URISyntaxException { + URL feedUrl = FeedFileStorgeTest.class.getResource("feed.xml"); + VFSLeaf feedLeaf = new VFSJavaIOFile(feedUrl.toURI()); + + Feed loadedFeed = (Feed)FeedFileStorge.fromXML(feedLeaf); + + assertThat(loadedFeed).isNotNull(); + assertThat(loadedFeed.getAuthor()).isEqualTo("jeremy"); + assertThat(loadedFeed.getTitle()).isEqualTo("XStream feed"); + assertThat(loadedFeed.getResourceableTypeName()).isEqualTo("FileResource.BLOG"); + } + + @Test + public void loadExternalFeedFromXMLFile() throws URISyntaxException { + URL feedUrl = FeedFileStorgeTest.class.getResource("feed_external.xml"); + VFSLeaf feedLeaf = new VFSJavaIOFile(feedUrl.toURI()); + + Feed loadedFeed = (Feed)FeedFileStorge.fromXML(feedLeaf); + + assertThat(loadedFeed).isNotNull(); + assertThat(loadedFeed.getTitle()).isEqualTo("Blog OpenOlat"); + assertThat(loadedFeed.isExternal()).isTrue(); + assertThat(loadedFeed.getExternalFeedUrl()).isEqualTo("https://blog.openolat.ch/?feed=rss2"); + assertThat(loadedFeed.getResourceableTypeName()).isEqualTo("FileResource.BLOG"); + } @Test public void deleteFeedXML() { @@ -702,6 +733,18 @@ public class FeedFileStorgeTest extends OlatTestCase { fileResourceManager.deleteFileResource(resource); } + + @Test + public void loadItemFromXMLFile() throws URISyntaxException { + URL itemUrl = FeedFileStorgeTest.class.getResource("item_with_enclosure.xml"); + VFSLeaf itemLeaf = new VFSJavaIOFile(itemUrl.toURI()); + + Item loadedItem = (Item)FeedFileStorge.fromXML(itemLeaf); + + assertThat(loadedItem).isNotNull(); + assertThat(loadedItem.getTitle()).isEqualTo("Test XStream"); + assertThat(loadedItem.getEnclosure().getFileName()).isEqualTo("demo_movie.mp4"); + } @Test public void deleteItemXML() { diff --git a/src/test/java/org/olat/modules/webFeed/manager/feed.xml b/src/test/java/org/olat/modules/webFeed/manager/feed.xml new file mode 100644 index 0000000000000000000000000000000000000000..c1c41090564f5efe21548a442f6ab4f9209a689d --- /dev/null +++ b/src/test/java/org/olat/modules/webFeed/manager/feed.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed> + <creationDate class="sql-timestamp">2017-06-13 07:07:03.795</creationDate> + <lastModified class="sql-timestamp">2015-10-08 13:29:51.696</lastModified> + <resourceableId>92307707729692</resourceableId> + <type>FileResource.BLOG</type> + <title>XStream feed</title> + <description><p>Test</p></description> + <author>jeremy</author> + <isExternal>false</isExternal> + <modelVersion>3</modelVersion> +</feed> \ No newline at end of file diff --git a/src/test/java/org/olat/modules/webFeed/manager/feed_external.xml b/src/test/java/org/olat/modules/webFeed/manager/feed_external.xml new file mode 100644 index 0000000000000000000000000000000000000000..156512f1ebbe54579d9af5edbf8cc2b149755b23 --- /dev/null +++ b/src/test/java/org/olat/modules/webFeed/manager/feed_external.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed> + <creationDate class="sql-timestamp">2017-06-19 07:10:45.978</creationDate> + <lastModified class="sql-timestamp">2021-06-22 11:55:06.837</lastModified> + <resourceableId>91352657861130</resourceableId> + <type>FileResource.BLOG</type> + <title>Blog OpenOlat</title> + <description></description> + <externalFeedURL>https://blog.openolat.ch/?feed=rss2</externalFeedURL> + <isExternal>true</isExternal> + <modelVersion>3</modelVersion> +</feed> \ No newline at end of file diff --git a/src/test/java/org/olat/modules/webFeed/manager/item_with_enclosure.xml b/src/test/java/org/olat/modules/webFeed/manager/item_with_enclosure.xml new file mode 100644 index 0000000000000000000000000000000000000000..b4cc2eb766d806c5e2ecadc51d5b9889458133f6 --- /dev/null +++ b/src/test/java/org/olat/modules/webFeed/manager/item_with_enclosure.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<item> + <creationDate class="sql-timestamp">2017-06-13 07:07:03.807</creationDate> + <lastModified class="sql-timestamp">2021-06-22 11:39:34.373</lastModified> + <title>Test XStream</title> + <description><p>Test video</p></description> + <content></content> + <modifierKey>720898</modifierKey> + <guid>sropenpg_1_92435892740461</guid> + <draft>false</draft> + <publishDate class="sql-timestamp">2015-10-08 13:28:00</publishDate> + <enclosure> + <fileName>demo_movie.mp4</fileName> + <type>video/mp4</type> + <length>102779</length> + </enclosure> + <width>320</width> + <height>240</height> +</item> \ No newline at end of file diff --git a/src/test/java/org/olat/test/AllTestsJunit4.java b/src/test/java/org/olat/test/AllTestsJunit4.java index 9487448a5835940c8e11f648a7b99aa9209c461f..383c7ef7e28119cb896d161b46efc06c7325cc3b 100644 --- a/src/test/java/org/olat/test/AllTestsJunit4.java +++ b/src/test/java/org/olat/test/AllTestsJunit4.java @@ -283,6 +283,8 @@ import org.junit.runners.Suite; org.olat.modules.portfolio.manager.PortfolioServiceTest.class, org.olat.modules.portfolio.manager.BinderUserInformationsDAOTest.class, org.olat.modules.portfolio.manager.InvitationDAOTest.class, + org.olat.modules.portfolio.manager.MetadataXStreamTest.class, + org.olat.modules.portfolio.handler.BinderXStreamTest.class, org.olat.modules.quality.analysis.manager.AnalysisFilterDAOTest.class, org.olat.modules.quality.analysis.manager.AnalysisPresentationDAOTest.class, org.olat.modules.quality.analysis.manager.EvaluationFormDAOTest.class, @@ -484,6 +486,8 @@ import org.junit.runners.Suite; org.olat.restapi.TaxonomyWebServiceTest.class, org.olat.restapi.security.RestSecurityBeanTest.class, de.bps.olat.portal.institution.InstitutionPortletTest.class, + de.bps.olat.portal.links.LinksPortletTest.class, + de.bps.olat.user.ChangeEMailExecuteControllerTest.class, de.bps.course.nodes.ChecklistCourseNodeTest.class, org.olat.group.manager.BusinessGroupImportExportXStreamTest.class, org.olat.group.test.BusinessGroupImportExportTest.class,