diff --git a/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/h2/package-info.java b/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/h2/package-info.java
new file mode 100644
index 000000000..19db3d6cf
--- /dev/null
+++ b/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/h2/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Java based migrations for the H2 database.
+ */
+package db.migrations.org.libreccm.ccm_core.h2;
diff --git a/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/package-info.java b/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/package-info.java
new file mode 100644
index 000000000..9dc34eb4f
--- /dev/null
+++ b/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Java based database migrations that use no database specific SQL.
+ */
+package db.migrations.org.libreccm.ccm_core;
diff --git a/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/pgsql/package-info.java b/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/pgsql/package-info.java
new file mode 100644
index 000000000..d201824dc
--- /dev/null
+++ b/ccm-core/src/main/java/db/migrations/org/libreccm/ccm_core/pgsql/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Java based migrations for PostgreSQL.
+ */
+package db.migrations.org.libreccm.ccm_core.pgsql;
diff --git a/ccm-core/src/main/java/org/libreccm/admin/ui/AdminJsfApplicationCreator.java b/ccm-core/src/main/java/org/libreccm/admin/ui/AdminJsfApplicationCreator.java
index aa27b8484..16c34034e 100644
--- a/ccm-core/src/main/java/org/libreccm/admin/ui/AdminJsfApplicationCreator.java
+++ b/ccm-core/src/main/java/org/libreccm/admin/ui/AdminJsfApplicationCreator.java
@@ -27,10 +27,12 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
/**
- *
+ *
+ *
* @author Jens Pelzetter
*/
@RequestScoped
+@Deprecated
public class AdminJsfApplicationCreator implements ApplicationCreator{
@Inject
diff --git a/ccm-core/src/main/java/org/libreccm/admin/ui/AdminJsfApplicationSetup.java b/ccm-core/src/main/java/org/libreccm/admin/ui/AdminJsfApplicationSetup.java
index 1b47adb49..8987fa9ec 100644
--- a/ccm-core/src/main/java/org/libreccm/admin/ui/AdminJsfApplicationSetup.java
+++ b/ccm-core/src/main/java/org/libreccm/admin/ui/AdminJsfApplicationSetup.java
@@ -28,6 +28,7 @@ import java.util.UUID;
*
* @author Jens Pelzetter
*/
+@Deprecated
public class AdminJsfApplicationSetup extends AbstractCcmApplicationSetup {
public static final String ADMIN_APP_NAME = "CcmAdminJsf";
diff --git a/ccm-core/src/main/java/org/libreccm/admin/ui/package-info.java b/ccm-core/src/main/java/org/libreccm/admin/ui/package-info.java
new file mode 100644
index 000000000..cc44bbec2
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/admin/ui/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Some experiments with JSF. To be removed.
+ *
+ */
+@Deprecated
+package org.libreccm.admin.ui;
diff --git a/ccm-core/src/main/java/org/libreccm/admin/ui/sysinfo/SysInfoController.java b/ccm-core/src/main/java/org/libreccm/admin/ui/sysinfo/SysInfoController.java
index 2fa8c1cf9..3737d7baa 100644
--- a/ccm-core/src/main/java/org/libreccm/admin/ui/sysinfo/SysInfoController.java
+++ b/ccm-core/src/main/java/org/libreccm/admin/ui/sysinfo/SysInfoController.java
@@ -39,6 +39,7 @@ import java.util.ResourceBundle;
*
* @author Jens Pelzetter
*/
+@Deprecated
@RequestScoped
@Named
public class SysInfoController {
diff --git a/ccm-core/src/main/java/org/libreccm/admin/ui/sysinfo/SysInfoProperty.java b/ccm-core/src/main/java/org/libreccm/admin/ui/sysinfo/SysInfoProperty.java
index d865f9b32..60e8e5762 100644
--- a/ccm-core/src/main/java/org/libreccm/admin/ui/sysinfo/SysInfoProperty.java
+++ b/ccm-core/src/main/java/org/libreccm/admin/ui/sysinfo/SysInfoProperty.java
@@ -22,6 +22,7 @@ package org.libreccm.admin.ui.sysinfo;
*
* @author Jens Pelzetter
*/
+@Deprecated
public class SysInfoProperty {
private final String name;
diff --git a/ccm-core/src/main/java/org/libreccm/auditing/AbstractAuditedEntityRepository.java b/ccm-core/src/main/java/org/libreccm/auditing/AbstractAuditedEntityRepository.java
index e372360c6..ed8ba3df1 100644
--- a/ccm-core/src/main/java/org/libreccm/auditing/AbstractAuditedEntityRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/auditing/AbstractAuditedEntityRepository.java
@@ -33,7 +33,9 @@ import java.util.stream.Collectors;
import javax.persistence.EntityManager;
/**
- *
+ * Base repository for audited entities. Provides access the the revision of
+ * an entity.
+ *
* @author Jens Pelzetter
* @author Tobias Osmers
* @param Primary key of the entity.
diff --git a/ccm-core/src/main/java/org/libreccm/auditing/AuditQueryException.java b/ccm-core/src/main/java/org/libreccm/auditing/AuditQueryException.java
index 4af78718d..7e5d5376a 100644
--- a/ccm-core/src/main/java/org/libreccm/auditing/AuditQueryException.java
+++ b/ccm-core/src/main/java/org/libreccm/auditing/AuditQueryException.java
@@ -20,7 +20,8 @@
package org.libreccm.auditing;
/**
- *
+ * Expectation thrown when an query for revision etc fails.
+ *
* @author Jens Pelzetter
*/
public class AuditQueryException extends RuntimeException {
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategorizationImExporter.java b/ccm-core/src/main/java/org/libreccm/categorization/CategorizationImExporter.java
index 8a9ff2ef5..ebb62da5b 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategorizationImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/CategorizationImExporter.java
@@ -32,7 +32,8 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
- *
+ * Exporter/Importer for {@link Categorization} entities.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Category.java b/ccm-core/src/main/java/org/libreccm/categorization/Category.java
index 713e6b7b7..c105d6b32 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/Category.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Category.java
@@ -22,7 +22,6 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
-import org.hibernate.validator.constraints.NotBlank;
import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.RecursivePermissions;
@@ -58,6 +57,7 @@ import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
/**
* The category entity represents a single category. Each category is part of a
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategoryIdResolver.java b/ccm-core/src/main/java/org/libreccm/categorization/CategoryIdResolver.java
index 4f27e09dd..c3078e77b 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategoryIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/CategoryIdResolver.java
@@ -29,6 +29,7 @@ import java.io.Serializable;
* @author Tobias Osmers
* @version created on 3/23/17
*/
+@Deprecated
@RequestScoped
public class CategoryIdResolver implements Serializable, ObjectIdResolver {
private static final long serialVersionUID = -5750627754502675522L;
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategoryImExporter.java b/ccm-core/src/main/java/org/libreccm/categorization/CategoryImExporter.java
index 477fc0fb2..bf1278104 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategoryImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/CategoryImExporter.java
@@ -30,7 +30,8 @@ import javax.inject.Inject;
import javax.transaction.Transactional;
/**
- *
+ * Exporter/Importer for {@link Category} entities.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategoryRepository.java b/ccm-core/src/main/java/org/libreccm/categorization/CategoryRepository.java
index 4210d315f..83ec5d88e 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategoryRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/CategoryRepository.java
@@ -36,7 +36,7 @@ import java.util.Optional;
import java.util.UUID;
/**
- * Provides CRUB operations for {@link Category} objects.
+ * Provides CRUD operations for {@link Category} objects.
*
* Note: This repository class does no permission checks when retrieving
* categories. This is the responsibility of the application which uses the
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategoryTreeModelLiteController.java b/ccm-core/src/main/java/org/libreccm/categorization/CategoryTreeModelLiteController.java
index 193c7b20f..f1eae3b10 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategoryTreeModelLiteController.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/CategoryTreeModelLiteController.java
@@ -18,6 +18,7 @@
*/
package org.libreccm.categorization;
+import org.hibernate.LazyInitializationException;
import org.libreccm.l10n.GlobalizationHelper;
import java.util.ArrayList;
@@ -29,7 +30,10 @@ import javax.inject.Inject;
import javax.transaction.Transactional;
/**
- *
+ * CDI bean used as interface between Bebop ({@link CategoryTreeModelLite}) and
+ * CDI. The CDI beans primarly takes are care of transactions and avoids
+ * {@link LazyInitializationException}.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Domain.java b/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
index dcb3a5e36..de95bee8f 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
-import org.hibernate.validator.constraints.NotBlank;
+
import org.hibernate.validator.constraints.URL;
import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString;
@@ -65,6 +65,7 @@ import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import javax.validation.constraints.NotBlank;
/**
* A domain is collection of categories designed a specific purpose. This entity
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainIdResolver.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainIdResolver.java
index 068c4f514..88ef6949d 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/DomainIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/DomainIdResolver.java
@@ -29,6 +29,7 @@ import java.io.Serializable;
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnershipImExporter.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnershipImExporter.java
index f68029c00..124cc643f 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnershipImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnershipImExporter.java
@@ -32,7 +32,9 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
- *
+ * Exporter/Importer for {@link DomainOwnership} entities.
+ *
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/InvalidCategoryPathException.java b/ccm-core/src/main/java/org/libreccm/categorization/InvalidCategoryPathException.java
index a0ef30617..d0a7b451e 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/InvalidCategoryPathException.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/InvalidCategoryPathException.java
@@ -19,7 +19,10 @@
package org.libreccm.categorization;
/**
- *
+ * Thrown by {@link CategoryRepository#findByPath(java.lang.String)} and
+ * {@link CategoryRepository#findByPath(org.libreccm.categorization.Domain, java.lang.String)}
+ * if the provided category path is invalid.
+ *
* @author Jens Pelzetter
*/
public class InvalidCategoryPathException extends RuntimeException {
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/package-info.java b/ccm-core/src/main/java/org/libreccm/categorization/package-info.java
index a89abab6f..7f73aeb97 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/package-info.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/package-info.java
@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
+/**
+ * This package provides the category system used by CCM.
+ */
@XmlSchema(xmlns = {@XmlNs(prefix = "cat", namespaceURI = CAT_XML_NS)})
@XmlAccessorType(XmlAccessType.NONE)
package org.libreccm.categorization;
diff --git a/ccm-core/src/main/java/org/libreccm/cdi/utils/CdiUtil.java b/ccm-core/src/main/java/org/libreccm/cdi/utils/CdiUtil.java
index 03bd7315c..28b86c119 100644
--- a/ccm-core/src/main/java/org/libreccm/cdi/utils/CdiUtil.java
+++ b/ccm-core/src/main/java/org/libreccm/cdi/utils/CdiUtil.java
@@ -31,6 +31,8 @@ import java.util.Iterator;
import java.util.Set;
/**
+ * Utility class providing access the CDI beans in classes not eligible for
+ * injection.
*
* @author Jens Pelzetter
*/
@@ -40,21 +42,41 @@ public class CdiUtil {
private final BeanManager beanManager;
- private CdiUtil(final BeanManager beanManager) {
+ private CdiUtil(final BeanManager beanManager) {
this.beanManager = beanManager;
}
+ /**
+ * Get a new instance of {@code CdiUtil}.
+ *
+ * This factory method looks up the {@link BeanManager} using JNDI and
+ * passes the {@link BeanManager} to the constructor of {@code CdiUtil}.
+ *
+ * @return A new instance of {@code CdiUtil}.
+ */
public static CdiUtil createCdiUtil() {
try {
- final InitialContext context = new InitialContext();
+ final InitialContext context = new InitialContext();
final BeanManager beanManager = (BeanManager) context.lookup(
- "java:comp/BeanManager");
+ "java:comp/BeanManager"
+ );
return new CdiUtil(beanManager);
- } catch(NamingException ex) {
+ } catch (NamingException ex) {
throw new IllegalStateException("Unable to lookup BeanManager.", ex);
}
}
-
+
+ /**
+ * Get an instance of the CDI bean of the provided class.
+ *
+ * @param Type of the CDI bean.
+ * @param beanType The type of the bean to retrieve.
+ *
+ * @return An instance of {@code beanType}.
+ *
+ * @throws IllegalStateException if no CDI bean of the type {@code beanType}
+ * is available.
+ */
@SuppressWarnings("unchecked")
public T findBean(final Class beanType) {
final Set> beans = beanManager.getBeans(beanType);
diff --git a/ccm-core/src/main/java/org/libreccm/cdi/utils/package-info.java b/ccm-core/src/main/java/org/libreccm/cdi/utils/package-info.java
new file mode 100644
index 000000000..cd5ca86e4
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/cdi/utils/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Utilities for working with CDI.
+ */
+package org.libreccm.cdi.utils;
diff --git a/ccm-core/src/main/java/org/libreccm/core/api/ApiConstants.java b/ccm-core/src/main/java/org/libreccm/core/api/ApiConstants.java
index 31d6489e1..d2e829c69 100644
--- a/ccm-core/src/main/java/org/libreccm/core/api/ApiConstants.java
+++ b/ccm-core/src/main/java/org/libreccm/core/api/ApiConstants.java
@@ -19,7 +19,8 @@
package org.libreccm.core.api;
/**
- *
+ * Constants for the RESTful API endpoints provided by ccm-core
+ *
* @author Jens Pelzetter
*/
public final class ApiConstants {
@@ -28,7 +29,13 @@ public final class ApiConstants {
// Nothing
}
+ /**
+ * Prefix for an ID identifier.
+ */
public static final String IDENTIFIER_PREFIX_ID = "ID-";
+ /**
+ * Prefix for an UUID identifier
+ */
public static final String IDENTIFIER_PREFIX_UUID = "UUID-";
}
diff --git a/ccm-core/src/main/java/org/libreccm/core/api/CcmCoreApi.java b/ccm-core/src/main/java/org/libreccm/core/api/CcmCoreApi.java
index 4c4802bb7..10f91309c 100644
--- a/ccm-core/src/main/java/org/libreccm/core/api/CcmCoreApi.java
+++ b/ccm-core/src/main/java/org/libreccm/core/api/CcmCoreApi.java
@@ -17,7 +17,8 @@ import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
- *
+ * JAX-RS application for ccm-core.
+ *
* @author Jens Pelzetter
*/
@ApplicationPath("/api/ccm-core")
diff --git a/ccm-core/src/main/java/org/libreccm/core/api/ExtractedIdentifier.java b/ccm-core/src/main/java/org/libreccm/core/api/ExtractedIdentifier.java
index faf20ca54..e1f56b1f7 100644
--- a/ccm-core/src/main/java/org/libreccm/core/api/ExtractedIdentifier.java
+++ b/ccm-core/src/main/java/org/libreccm/core/api/ExtractedIdentifier.java
@@ -19,7 +19,10 @@
package org.libreccm.core.api;
/**
- *
+ * Helper class containing the parts of an extracted identifier.
+ *
+ * @see IdentifierExtractor
+ *
* @author Jens Pelzetter
*/
public class ExtractedIdentifier {
@@ -35,10 +38,20 @@ public class ExtractedIdentifier {
this.identifier = identifier;
}
+ /**
+ * The identifier type.
+ *
+ * @return
+ */
public IdentifierType getType() {
return type;
}
+ /**
+ * The identifier itself.
+ *
+ * @return
+ */
public String getIdentifier() {
return identifier;
}
diff --git a/ccm-core/src/main/java/org/libreccm/core/api/IdentifierExtractor.java b/ccm-core/src/main/java/org/libreccm/core/api/IdentifierExtractor.java
index d0894e1d2..a57ece955 100644
--- a/ccm-core/src/main/java/org/libreccm/core/api/IdentifierExtractor.java
+++ b/ccm-core/src/main/java/org/libreccm/core/api/IdentifierExtractor.java
@@ -23,12 +23,27 @@ import java.util.Objects;
import javax.enterprise.context.Dependent;
/**
- *
+ * Extracts the identifier for an entity from a parameter.
+ *
* @author Jens Pelzetter
*/
@Dependent
public class IdentifierExtractor {
+ /**
+ * Extracts the identifier for an entity from a parameter.
+ *
+ * If the parameter starts with {@link ApiConstants#IDENTIFIER_PREFIX_ID}
+ * the identifier is assume to be an ID.
+ *
+ * If the parameter starts with {@link ApiConstants#IDENTIFIER_PREFIX_UUID}
+ * the identifier is assume to be an UUID.
+ *
+ * Otherwise the identifier is some property of an entity.
+ *
+ * @param identifierParam
+ * @return
+ */
public ExtractedIdentifier extractIdentifier(final String identifierParam) {
Objects.requireNonNull(identifierParam, "identifier param is null.");
diff --git a/ccm-core/src/main/java/org/libreccm/core/api/IdentifierType.java b/ccm-core/src/main/java/org/libreccm/core/api/IdentifierType.java
index a2a2b1551..ea8dac097 100644
--- a/ccm-core/src/main/java/org/libreccm/core/api/IdentifierType.java
+++ b/ccm-core/src/main/java/org/libreccm/core/api/IdentifierType.java
@@ -19,7 +19,8 @@
package org.libreccm.core.api;
/**
- *
+ * Enum for the supported types of identifiers.
+ *
* @author Jens Pelzetter
*/
public enum IdentifierType {
diff --git a/ccm-core/src/main/java/org/libreccm/core/api/JsonArrayCollector.java b/ccm-core/src/main/java/org/libreccm/core/api/JsonArrayCollector.java
index a3aba14a5..7d0a8cc87 100644
--- a/ccm-core/src/main/java/org/libreccm/core/api/JsonArrayCollector.java
+++ b/ccm-core/src/main/java/org/libreccm/core/api/JsonArrayCollector.java
@@ -33,7 +33,9 @@ import javax.json.JsonArrayBuilder;
import javax.json.JsonValue;
/**
- *
+ * A {@link Collector} implementation that collects {@link JsonValue}s to
+ * a {@link JsonArray}.
+ *
* @author Jens Pelzetter
*/
public class JsonArrayCollector implements Collector{
diff --git a/ccm-core/src/main/java/org/libreccm/core/api/package-info.java b/ccm-core/src/main/java/org/libreccm/core/api/package-info.java
new file mode 100644
index 000000000..16ebe4aaf
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/core/api/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Common classes for the RESTful API endpoints provided by ccm-core
+ */
+package org.libreccm.core.api;
diff --git a/ccm-core/src/main/java/org/libreccm/files/CcmFilesConfiguration.java b/ccm-core/src/main/java/org/libreccm/files/CcmFilesConfiguration.java
index 28a54cea3..3f2437cd8 100644
--- a/ccm-core/src/main/java/org/libreccm/files/CcmFilesConfiguration.java
+++ b/ccm-core/src/main/java/org/libreccm/files/CcmFilesConfiguration.java
@@ -22,7 +22,8 @@ import org.libreccm.configuration.Configuration;
import org.libreccm.configuration.Setting;
/**
- *
+ * Configuration for the CCM files system.
+ *
* @author Jens Pelzetter
*/
@Configuration(descBundle
diff --git a/ccm-core/src/main/java/org/libreccm/files/FileAccessException.java b/ccm-core/src/main/java/org/libreccm/files/FileAccessException.java
index 88dde614c..cf05be501 100644
--- a/ccm-core/src/main/java/org/libreccm/files/FileAccessException.java
+++ b/ccm-core/src/main/java/org/libreccm/files/FileAccessException.java
@@ -30,20 +30,10 @@ public class FileAccessException extends Exception {
private static final String MESSAGE_TEMPLATE = "Error accessing file '%s'.";
-// /**
-// * Creates a new instance of FileAccessException without detail
-// * message.
-// */
-// FileAccessException() {
-// super();
-// }
FileAccessException(final String path) {
super(String.format(MESSAGE_TEMPLATE, path));
}
-// FileAccessException(final Exception ex) {
-// super(ex);
-// }
FileAccessException(final String path, final Exception ex) {
super(String.format(MESSAGE_TEMPLATE, path), ex);
}
diff --git a/ccm-core/src/main/java/org/libreccm/files/FileAlreadyExistsException.java b/ccm-core/src/main/java/org/libreccm/files/FileAlreadyExistsException.java
index 0a0deb955..94bcaaa76 100644
--- a/ccm-core/src/main/java/org/libreccm/files/FileAlreadyExistsException.java
+++ b/ccm-core/src/main/java/org/libreccm/files/FileAlreadyExistsException.java
@@ -29,24 +29,11 @@ public class FileAlreadyExistsException extends Exception {
private static final long serialVersionUID = 2237027823060973043L;
private static final String MESSAGE_TEMPLATE = "The file '%s' already exists.";
-
-// /**
-// * Creates a new instance of FileAlreadyExistsException without
-// * detail message.
-// */
-// FileAlreadyExistsException() {
-// super();
-// }
-
FileAlreadyExistsException(final String path) {
super(String.format(MESSAGE_TEMPLATE, path));
}
-// FileAlreadyExistsException(final Exception ex) {
-// super(ex);
-// }
-
FileAlreadyExistsException(final String path, final Exception ex) {
super(String.format(MESSAGE_TEMPLATE, path), ex);
}
diff --git a/ccm-core/src/main/java/org/libreccm/files/FileDoesNotExistException.java b/ccm-core/src/main/java/org/libreccm/files/FileDoesNotExistException.java
index da71056af..20b06a1e3 100644
--- a/ccm-core/src/main/java/org/libreccm/files/FileDoesNotExistException.java
+++ b/ccm-core/src/main/java/org/libreccm/files/FileDoesNotExistException.java
@@ -27,25 +27,16 @@ package org.libreccm.files;
public class FileDoesNotExistException extends Exception {
private static final long serialVersionUID = 1L;
-
- private static final String MESSAGE_TEMPLATE = "The file '%s' does not exist.";
-// /**
-// * Creates a new instance of FileDoesNotExistException without
-// * detail message.
-// */
-// FileDoesNotExistException() {
-// }
+ private static final String MESSAGE_TEMPLATE
+ = "The file '%s' does not exist.";
FileDoesNotExistException(final String path) {
super(String.format(MESSAGE_TEMPLATE, path));
}
-// FileDoesNotExistException(final Exception ex) {
-// super(ex);
-// }
-
FileDoesNotExistException(final String path, final Exception ex) {
super(String.format(MESSAGE_TEMPLATE, path), ex);
}
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/files/FileSystemAdapter.java b/ccm-core/src/main/java/org/libreccm/files/FileSystemAdapter.java
index 5de4c978d..60a348462 100644
--- a/ccm-core/src/main/java/org/libreccm/files/FileSystemAdapter.java
+++ b/ccm-core/src/main/java/org/libreccm/files/FileSystemAdapter.java
@@ -24,7 +24,12 @@ import java.io.Reader;
import java.io.Writer;
import java.util.List;
+import javax.enterprise.context.RequestScoped;
+
/**
+ * Interface for a file system adapter. Implement this interface to add support
+ * for a method for storing (large} files. The implementation must be a CDI
+ * bean. It is recommanded that the bean is {@link RequestScoped}.
*
* @author Jens Pelzetter
*/
@@ -136,15 +141,15 @@ public interface FileSystemAdapter {
InsufficientPermissionsException;
String getMimeType(String path) throws FileAccessException;
-
+
long getSize(String path) throws FileAccessException;
-
- void copy(String sourcePath,
- String targetPath,
+
+ void copy(String sourcePath,
+ String targetPath,
boolean recursive) throws FileAccessException;
-
+
void move(String sourcePath, String targetPath) throws FileAccessException;
-
+
/**
* checks if the provided path points to a directory.
*
@@ -243,8 +248,7 @@ public interface FileSystemAdapter {
* @throws FileDoesNotExistException If the requested file does not
* exist.
* @throws DirectoryNotEmptyException If the directory is not empty
- * and {@code recursively}
- * is set to {@code false}.
+ * and {@code recursively} is set to {@code false}.
* @throws InsufficientPermissionsException If the user which runs the
* application server does not have
* the permission to access the
diff --git a/ccm-core/src/main/java/org/libreccm/files/NoDirectoryException.java b/ccm-core/src/main/java/org/libreccm/files/NoDirectoryException.java
index 79c26e3b7..758bd0307 100644
--- a/ccm-core/src/main/java/org/libreccm/files/NoDirectoryException.java
+++ b/ccm-core/src/main/java/org/libreccm/files/NoDirectoryException.java
@@ -29,24 +29,11 @@ public class NoDirectoryException extends Exception {
private static final long serialVersionUID = -5811387600385322767L;
private static final String MESSAGE_TEMPLATE = "The file '%s' is not a directory.";
-
-// /**
-// * Creates a new instance of NoDirectoryException without
-// * detail message.
-// */
-// NoDirectoryException() {
-// super();
-// }
-
NoDirectoryException(final String path) {
super(String.format(MESSAGE_TEMPLATE, path));
}
-// NoDirectoryException(final Exception ex) {
-// super(ex);
-// }
-
NoDirectoryException(final String path, final Exception ex) {
super(String.format(MESSAGE_TEMPLATE, path), ex);
}
diff --git a/ccm-core/src/main/java/org/libreccm/files/package-info.java b/ccm-core/src/main/java/org/libreccm/files/package-info.java
new file mode 100644
index 000000000..981bb598f
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/files/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * This package provides an API for managing (large) files in different sources.
+ *
+ * For details please refer to the documentation of the classes. The main entry
+ * point is {@link CcmFiles}.
+ *
+ */
+package org.libreccm.files;
diff --git a/ccm-core/src/main/java/org/libreccm/formbuilder/Component.java b/ccm-core/src/main/java/org/libreccm/formbuilder/Component.java
index 17f9fbec7..2bed82dae 100644
--- a/ccm-core/src/main/java/org/libreccm/formbuilder/Component.java
+++ b/ccm-core/src/main/java/org/libreccm/formbuilder/Component.java
@@ -21,7 +21,6 @@ package org.libreccm.formbuilder;
import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
@@ -29,6 +28,16 @@ import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.AssociationOverride;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
/**
*
* @author Jens Pelzetter
diff --git a/ccm-core/src/main/java/org/libreccm/formbuilder/actions/package-info.java b/ccm-core/src/main/java/org/libreccm/formbuilder/actions/package-info.java
new file mode 100644
index 000000000..bdca614f7
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/formbuilder/actions/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Entities for the form builder migrated from PDL. Not tested yet.
+ */
+package org.libreccm.formbuilder.actions;
diff --git a/ccm-core/src/main/java/org/libreccm/formbuilder/package-info.java b/ccm-core/src/main/java/org/libreccm/formbuilder/package-info.java
new file mode 100644
index 000000000..e132065f8
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/formbuilder/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Base entities for the form builder. Migrated from PDL, not tested yet.
+ */
+package org.libreccm.formbuilder;
diff --git a/ccm-core/src/main/java/org/libreccm/imexport/DependencyException.java b/ccm-core/src/main/java/org/libreccm/imexport/DependencyException.java
index d2ef26784..aad64ed23 100644
--- a/ccm-core/src/main/java/org/libreccm/imexport/DependencyException.java
+++ b/ccm-core/src/main/java/org/libreccm/imexport/DependencyException.java
@@ -19,7 +19,9 @@
package org.libreccm.imexport;
/**
- *
+ * Thrown by the {@link AbstractEntityImExporter} if the something is wrong
+ * with the dependencies between entity types (eg circular dependencies).
+ *
* @author Jens Pelzetter
*/
public class DependencyException extends Exception {
diff --git a/ccm-core/src/main/java/org/libreccm/imexport/EntityImExporterTreeNode.java b/ccm-core/src/main/java/org/libreccm/imexport/EntityImExporterTreeNode.java
index 6f1d4d040..012c57ad2 100644
--- a/ccm-core/src/main/java/org/libreccm/imexport/EntityImExporterTreeNode.java
+++ b/ccm-core/src/main/java/org/libreccm/imexport/EntityImExporterTreeNode.java
@@ -24,7 +24,8 @@ import java.util.List;
import java.util.Objects;
/**
- *
+ * A node in the dependency tree managed by {@link EntityImExporterTreeManager}.
+ *
* @author Jens Pelzetter
*/
final class EntityImExporterTreeNode {
diff --git a/ccm-core/src/main/java/org/libreccm/imexport/ExportException.java b/ccm-core/src/main/java/org/libreccm/imexport/ExportException.java
index a3e71a224..ad109790b 100644
--- a/ccm-core/src/main/java/org/libreccm/imexport/ExportException.java
+++ b/ccm-core/src/main/java/org/libreccm/imexport/ExportException.java
@@ -20,7 +20,8 @@
package org.libreccm.imexport;
/**
- *
+ * Thrown if something goes wrong during an export.
+ *
* @author Jens Pelzetter
*/
public class ExportException extends Exception {
diff --git a/ccm-core/src/main/java/org/libreccm/imexport/ImportExpection.java b/ccm-core/src/main/java/org/libreccm/imexport/ImportExpection.java
index f1a1f977f..d295dcccf 100644
--- a/ccm-core/src/main/java/org/libreccm/imexport/ImportExpection.java
+++ b/ccm-core/src/main/java/org/libreccm/imexport/ImportExpection.java
@@ -20,7 +20,8 @@
package org.libreccm.imexport;
/**
- *
+ * Thrown if something goes wrong during an import process.
+ *
* @author Jens Pelzetter
*/
public class ImportExpection extends Exception {
diff --git a/ccm-core/src/main/java/org/libreccm/imexport/ImportManifest.java b/ccm-core/src/main/java/org/libreccm/imexport/ImportManifest.java
index 140e551f1..dbcf6fe66 100644
--- a/ccm-core/src/main/java/org/libreccm/imexport/ImportManifest.java
+++ b/ccm-core/src/main/java/org/libreccm/imexport/ImportManifest.java
@@ -23,7 +23,8 @@ import java.util.Date;
import java.util.List;
/**
- *
+ * Java class containg the properties of an parsed import manifest.
+ *
* @author Jens Pelzetter
*/
public class ImportManifest {
diff --git a/ccm-core/src/main/java/org/libreccm/imexport/package-info.java b/ccm-core/src/main/java/org/libreccm/imexport/package-info.java
new file mode 100644
index 000000000..181f540e2
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/imexport/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * The classes in this package provide a facility from exporting and importing
+ * entities to and from CCM installation.
+ */
+package org.libreccm.imexport;
diff --git a/ccm-core/src/main/java/org/libreccm/jpa/AuditReaderProducer.java b/ccm-core/src/main/java/org/libreccm/jpa/AuditReaderProducer.java
index d5143e837..0bc143f4e 100644
--- a/ccm-core/src/main/java/org/libreccm/jpa/AuditReaderProducer.java
+++ b/ccm-core/src/main/java/org/libreccm/jpa/AuditReaderProducer.java
@@ -27,7 +27,8 @@ import javax.inject.Inject;
import javax.persistence.EntityManager;
/**
- *
+ * CDI producer for the {@link AuditReader} of Hibernate Envers.
+ *
* @author Jens Pelzetter
*/
@ApplicationScoped
diff --git a/ccm-core/src/main/java/org/libreccm/jpa/EntityManagerProducer.java b/ccm-core/src/main/java/org/libreccm/jpa/EntityManagerProducer.java
index 2226968cb..597eb19ee 100644
--- a/ccm-core/src/main/java/org/libreccm/jpa/EntityManagerProducer.java
+++ b/ccm-core/src/main/java/org/libreccm/jpa/EntityManagerProducer.java
@@ -6,7 +6,9 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
- *
+ * CDI producer providing access to the JPA {@link EntityManager} using
+ * {@code @Inject}.
+ *
* @author Jens Pelzetter
*/
@ApplicationScoped
diff --git a/ccm-core/src/main/java/org/libreccm/jpa/package-info.java b/ccm-core/src/main/java/org/libreccm/jpa/package-info.java
new file mode 100644
index 000000000..428ddbb26
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/jpa/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * General classes for JPA
+ */
+package org.libreccm.jpa;
diff --git a/ccm-core/src/main/java/org/libreccm/jpa/utils/package-info.java b/ccm-core/src/main/java/org/libreccm/jpa/utils/package-info.java
new file mode 100644
index 000000000..457428c5f
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/jpa/utils/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Utility classes for JPA.
+ */
+package org.libreccm.jpa.utils;
diff --git a/ccm-core/src/main/java/org/libreccm/l10n/GlobalizationHelper.java b/ccm-core/src/main/java/org/libreccm/l10n/GlobalizationHelper.java
index b6bfd9168..350ec4e34 100644
--- a/ccm-core/src/main/java/org/libreccm/l10n/GlobalizationHelper.java
+++ b/ccm-core/src/main/java/org/libreccm/l10n/GlobalizationHelper.java
@@ -43,6 +43,11 @@ import java.util.concurrent.Callable;
import java.util.stream.Collectors;
/**
+ * This CDI bean provides most functions for localization in CCM.
+ *
+ * In addition to providing the negoiated locale is also provides some utility
+ * methods for working with {@link LocalizedString}.
+ *
* Provides the locale which has been selected based on the available languages
* configured in the {@link KernelConfig}, the preferred languages of the client
* provided an the request, the (optional) {@code lang} attribute in the current
@@ -95,8 +100,8 @@ public class GlobalizationHelper implements Serializable {
*
* First tries to get a value for the negotiated locale. If the
* {@code localizedString} does not have a value for the negotiated locale
- * the default locale set in {@link KernelConfig} is used. If that also
- * values the first value available locale (ordered alphabetically) is used.
+ * the default locale set in {@link KernelConfig} is used. If that also failes
+ * the first value available locale (ordered alphabetically) is used.
*
* @param localizedString
*
@@ -136,6 +141,16 @@ public class GlobalizationHelper implements Serializable {
.getValue();
}
+ /**
+ * Retrieve the value of a {@link LocalizedString} for the current locale.
+ * This variant allows it to provide a method which provides a fallback
+ * which is used when the localized string has no value for the current
+ * locale and the default locale.
+ *
+ * @param localizedString
+ * @param fallbackProvider
+ * @return
+ */
public String getValueFromLocalizedString(
final LocalizedString localizedString,
final Callable fallbackProvider) {
@@ -159,6 +174,11 @@ public class GlobalizationHelper implements Serializable {
}
}
+ /**
+ * Gets the negotiated locale.
+ *
+ * @return
+ */
public Locale getNegotiatedLocale() {
final KernelConfig kernelConfig = confManager.findConfiguration(
@@ -186,6 +206,11 @@ public class GlobalizationHelper implements Serializable {
return preferred;
}
+ /**
+ * Gets the locale selected by the user agent.
+ *
+ * @return
+ */
public Locale getSelectedLocale() {
// Get the current session, create one if there is none
final HttpSession session = request.getSession(true);
@@ -215,6 +240,11 @@ public class GlobalizationHelper implements Serializable {
return selected;
}
+ /**
+ * Lists all available locales.
+ *
+ * @return All locales configured in the {@link KernelConfig}.
+ */
public List getAvailableLocales() {
final KernelConfig kernelConfig = confManager
@@ -230,6 +260,11 @@ public class GlobalizationHelper implements Serializable {
.collect(Collectors.toList());
}
+ /**
+ * Sets the selected locale.
+ *
+ * @param locale
+ */
public void setSelectedLocale(final Locale locale) {
final HttpSession session = request.getSession(true);
@@ -310,6 +345,11 @@ public class GlobalizationHelper implements Serializable {
return new GlobalizedMessagesUtil(bundleName);
}
+ /**
+ * Helper function for converting a string to a locale.
+ * @param language
+ * @return The locale, or null if the string is not a locale.
+ */
private Locale scanLocale(final String language) {
if (language == null || language.isEmpty()) {
return null;
diff --git a/ccm-core/src/main/java/org/libreccm/l10n/L10NConstants.java b/ccm-core/src/main/java/org/libreccm/l10n/L10NConstants.java
index 73f3b20a0..945b2f87a 100644
--- a/ccm-core/src/main/java/org/libreccm/l10n/L10NConstants.java
+++ b/ccm-core/src/main/java/org/libreccm/l10n/L10NConstants.java
@@ -19,7 +19,8 @@
package org.libreccm.l10n;
/**
- *
+ * Constants for the classes in the {@link org.libreccm.l10n} package.
+ *
* @author Jens Pelzetter
*/
public final class L10NConstants {
diff --git a/ccm-core/src/main/java/org/libreccm/l10n/jaxb/LocalizedStringValue.java b/ccm-core/src/main/java/org/libreccm/l10n/jaxb/LocalizedStringValue.java
index 260a45dd6..d67f97033 100644
--- a/ccm-core/src/main/java/org/libreccm/l10n/jaxb/LocalizedStringValue.java
+++ b/ccm-core/src/main/java/org/libreccm/l10n/jaxb/LocalizedStringValue.java
@@ -20,6 +20,8 @@ package org.libreccm.l10n.jaxb;
import static org.libreccm.l10n.L10NConstants.*;
+import org.libreccm.l10n.LocalizedString;
+
import java.io.Serializable;
import java.util.Objects;
@@ -29,7 +31,8 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;
/**
- *
+ * Simple bean class for the value of a {@link LocalizedString} used by JAXB.
+ *
* @author Jens Pelzetter
*/
@XmlAccessorType(XmlAccessType.FIELD)
diff --git a/ccm-core/src/main/java/org/libreccm/l10n/jaxb/LocalizedStringValues.java b/ccm-core/src/main/java/org/libreccm/l10n/jaxb/LocalizedStringValues.java
index ee74ccc20..a434750fd 100644
--- a/ccm-core/src/main/java/org/libreccm/l10n/jaxb/LocalizedStringValues.java
+++ b/ccm-core/src/main/java/org/libreccm/l10n/jaxb/LocalizedStringValues.java
@@ -21,6 +21,7 @@ package org.libreccm.l10n.jaxb;
import static org.libreccm.l10n.L10NConstants.*;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import org.libreccm.l10n.LocalizedString;
import java.io.Serializable;
import java.util.ArrayList;
@@ -32,7 +33,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
/**
- *
+ * Simple bean class for the values of a {@link LocalizedString} used by JAXB.
+ *
* @author Jens Pelzetter
*/
@XmlAccessorType(XmlAccessType.FIELD)
diff --git a/ccm-core/src/main/java/org/libreccm/l10n/jaxb/package-info.java b/ccm-core/src/main/java/org/libreccm/l10n/jaxb/package-info.java
new file mode 100644
index 000000000..265199cbc
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/l10n/jaxb/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Utility classes for processing {@link LocalizedString} with JAXB.
+ */
+package org.libreccm.l10n.jaxb;
diff --git a/ccm-core/src/main/java/org/libreccm/l10n/package-info.java b/ccm-core/src/main/java/org/libreccm/l10n/package-info.java
index 023849365..043070adf 100644
--- a/ccm-core/src/main/java/org/libreccm/l10n/package-info.java
+++ b/ccm-core/src/main/java/org/libreccm/l10n/package-info.java
@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
+/**
+ * This package provides several classes for localizing texts.
+ */
@XmlSchema(xmlns = {@XmlNs(prefix = "l10n", namespaceURI = L10N_XML_NS)})
@XmlAccessorType(XmlAccessType.NONE)
package org.libreccm.l10n;
diff --git a/ccm-core/src/main/java/org/libreccm/messaging/Attachment.java b/ccm-core/src/main/java/org/libreccm/messaging/Attachment.java
index 0b550476f..73b68d65c 100644
--- a/ccm-core/src/main/java/org/libreccm/messaging/Attachment.java
+++ b/ccm-core/src/main/java/org/libreccm/messaging/Attachment.java
@@ -21,13 +21,24 @@ package org.libreccm.messaging;
import org.libreccm.jpa.utils.MimeTypeConverter;
import javax.activation.MimeType;
-import javax.persistence.*;
+
import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
/**
*
* @author Jens Pelzetter
diff --git a/ccm-core/src/main/java/org/libreccm/messaging/Message.java b/ccm-core/src/main/java/org/libreccm/messaging/Message.java
index f8e06d251..49999aeb0 100644
--- a/ccm-core/src/main/java/org/libreccm/messaging/Message.java
+++ b/ccm-core/src/main/java/org/libreccm/messaging/Message.java
@@ -23,7 +23,7 @@ import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.security.User;
import javax.activation.MimeType;
-import javax.persistence.*;
+
import java.io.Serializable;
import java.util.Collections;
import java.util.Date;
@@ -32,6 +32,18 @@ import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
/**
*
* @author Jens Pelzetter
diff --git a/ccm-core/src/main/java/org/libreccm/messaging/package-info.java b/ccm-core/src/main/java/org/libreccm/messaging/package-info.java
new file mode 100644
index 000000000..5ec4ef8a6
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/messaging/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Entities for messaging. Ported from PDL, old classes had no documentation.
+ * These might be removed.
+ */
+package org.libreccm.messaging;
diff --git a/ccm-core/src/main/java/org/libreccm/modules/InstalledModule.java b/ccm-core/src/main/java/org/libreccm/modules/InstalledModule.java
index 02f6c5e20..27bf2404c 100644
--- a/ccm-core/src/main/java/org/libreccm/modules/InstalledModule.java
+++ b/ccm-core/src/main/java/org/libreccm/modules/InstalledModule.java
@@ -18,12 +18,18 @@
*/
package org.libreccm.modules;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
/**
* A JPA entity bean for for installed modules table for use in the LibreCCM
* administration UI.
diff --git a/ccm-core/src/main/java/org/libreccm/notification/Digest.java b/ccm-core/src/main/java/org/libreccm/notification/Digest.java
index 8f403a598..9d4ebb33c 100644
--- a/ccm-core/src/main/java/org/libreccm/notification/Digest.java
+++ b/ccm-core/src/main/java/org/libreccm/notification/Digest.java
@@ -21,13 +21,20 @@ package org.libreccm.notification;
import org.libreccm.core.CcmObject;
import org.libreccm.security.Party;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
/**
*
* Models the envelope information associated with a digest.
diff --git a/ccm-core/src/main/java/org/libreccm/notification/Notification.java b/ccm-core/src/main/java/org/libreccm/notification/Notification.java
index 1a76038e8..dfbbb1a20 100644
--- a/ccm-core/src/main/java/org/libreccm/notification/Notification.java
+++ b/ccm-core/src/main/java/org/libreccm/notification/Notification.java
@@ -22,13 +22,20 @@ import org.libreccm.core.CcmObject;
import org.libreccm.messaging.Message;
import org.libreccm.security.Party;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
/**
*
* The {@code Notification} class is used to create and send messages via email
diff --git a/ccm-core/src/main/java/org/libreccm/notification/QueueItem.java b/ccm-core/src/main/java/org/libreccm/notification/QueueItem.java
index 2a4f22f9a..dee86e599 100644
--- a/ccm-core/src/main/java/org/libreccm/notification/QueueItem.java
+++ b/ccm-core/src/main/java/org/libreccm/notification/QueueItem.java
@@ -21,12 +21,20 @@ package org.libreccm.notification;
import org.libreccm.messaging.Message;
import org.libreccm.security.Party;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
/**
* Represents a notification that has been transferred to the outbound message
* queue. During processing, this class is used to retrieve information
@@ -202,13 +210,13 @@ public class QueueItem implements Serializable {
@Override
public String toString() {
return String.format("%s{ "
- + "queueItemId = %d, "
- + "receiver = %s, "
- + "retryCount = %d, "
- + "successful = %b, "
- + "receiverAddress = \"%s\", "
- + "message = %s"
- + " }",
+ + "queueItemId = %d, "
+ + "receiver = %s, "
+ + "retryCount = %d, "
+ + "successful = %b, "
+ + "receiverAddress = \"%s\", "
+ + "message = %s"
+ + " }",
super.toString(),
queueItemId,
Objects.toString(receiver),
diff --git a/ccm-core/src/main/java/org/libreccm/notification/package-info.java b/ccm-core/src/main/java/org/libreccm/notification/package-info.java
new file mode 100644
index 000000000..d5a7d7d8e
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/notification/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Entites for the notificiation system of CCM. Ported from CCM
+ * ToDo: Check if these entities are still of use. If no remove them
+ */
+package org.libreccm.notification;
diff --git a/ccm-core/src/main/java/org/libreccm/portal/Portlet.java b/ccm-core/src/main/java/org/libreccm/portal/Portlet.java
index 73bb5ce76..f94f18503 100644
--- a/ccm-core/src/main/java/org/libreccm/portal/Portlet.java
+++ b/ccm-core/src/main/java/org/libreccm/portal/Portlet.java
@@ -20,12 +20,17 @@ package org.libreccm.portal;
import org.libreccm.core.Resource;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
/**
*
*
diff --git a/ccm-core/src/main/java/org/libreccm/portal/package-info.java b/ccm-core/src/main/java/org/libreccm/portal/package-info.java
new file mode 100644
index 000000000..2c6e1b651
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/portal/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Entities for building portals. Ported from PDL.
+ *
+ * ToDo: Check if these entities are still useful. If not remove them.
+ */
+package org.libreccm.portal;
diff --git a/ccm-core/src/main/java/org/libreccm/runtime/Initalizer.java b/ccm-core/src/main/java/org/libreccm/runtime/Initalizer.java
index 00f1cb820..057a82946 100644
--- a/ccm-core/src/main/java/org/libreccm/runtime/Initalizer.java
+++ b/ccm-core/src/main/java/org/libreccm/runtime/Initalizer.java
@@ -18,7 +18,7 @@
*/
package org.libreccm.runtime;
-import javax.persistence.*;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
@@ -27,6 +27,17 @@ import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
/**
*
* @author Jens Pelzetter
diff --git a/ccm-core/src/main/java/org/libreccm/search/lucene/Document.java b/ccm-core/src/main/java/org/libreccm/search/lucene/Document.java
index 6db08165a..ee4dfd9d8 100644
--- a/ccm-core/src/main/java/org/libreccm/search/lucene/Document.java
+++ b/ccm-core/src/main/java/org/libreccm/search/lucene/Document.java
@@ -20,13 +20,24 @@ package org.libreccm.search.lucene;
import org.libreccm.security.User;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
/**
*
* @author Jens Pelzetter
diff --git a/ccm-core/src/main/java/org/libreccm/search/lucene/Index.java b/ccm-core/src/main/java/org/libreccm/search/lucene/Index.java
index 80792e6da..21c7b9e23 100644
--- a/ccm-core/src/main/java/org/libreccm/search/lucene/Index.java
+++ b/ccm-core/src/main/java/org/libreccm/search/lucene/Index.java
@@ -20,12 +20,20 @@ package org.libreccm.search.lucene;
import org.libreccm.web.Host;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
/**
*
* @author Jens Pelzetter
diff --git a/ccm-core/src/main/java/org/libreccm/search/lucene/package-info.java b/ccm-core/src/main/java/org/libreccm/search/lucene/package-info.java
new file mode 100644
index 000000000..b67e201b9
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/search/lucene/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Entities ported from the old CCM search system.
+ *
+ * ToDo: Check if still useful. Refactor or remove if necssary.
+ */
+package org.libreccm.search.lucene;
diff --git a/ccm-core/src/main/java/org/libreccm/security/CcmJwtAuthentication.java b/ccm-core/src/main/java/org/libreccm/security/CcmJwtAuthentication.java
index 534f5cc23..62a5b9432 100644
--- a/ccm-core/src/main/java/org/libreccm/security/CcmJwtAuthentication.java
+++ b/ccm-core/src/main/java/org/libreccm/security/CcmJwtAuthentication.java
@@ -25,7 +25,8 @@ import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
- *
+ * JAX-RS application for authenticating via JSON Web Token
+ *
* @author Jens Pelzetter
*/
@ApplicationPath("/jwt")
diff --git a/ccm-core/src/main/java/org/libreccm/security/ChallengeFailedException.java b/ccm-core/src/main/java/org/libreccm/security/ChallengeFailedException.java
index 1aea8dc9d..62269d351 100644
--- a/ccm-core/src/main/java/org/libreccm/security/ChallengeFailedException.java
+++ b/ccm-core/src/main/java/org/libreccm/security/ChallengeFailedException.java
@@ -20,7 +20,8 @@
package org.libreccm.security;
/**
- *
+ * Thrown if a challenge for user activation or password reset fails.
+ *
* @author Jens Pelzetter
*/
public class ChallengeFailedException extends Exception {
diff --git a/ccm-core/src/main/java/org/libreccm/security/ChallengeManager.java b/ccm-core/src/main/java/org/libreccm/security/ChallengeManager.java
index be36424bc..66267dfdd 100644
--- a/ccm-core/src/main/java/org/libreccm/security/ChallengeManager.java
+++ b/ccm-core/src/main/java/org/libreccm/security/ChallengeManager.java
@@ -23,6 +23,7 @@ import com.arsdigita.mail.Mail;
import com.arsdigita.ui.login.LoginConstants;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
+
import org.apache.commons.lang.text.StrSubstitutor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -32,11 +33,16 @@ import org.libreccm.core.CoreConstants;
import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.l10n.LocalizedString;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.mail.MessagingException;
import javax.servlet.http.HttpServletRequest;
-import java.util.*;
import static com.arsdigita.ui.login.LoginServlet.*;
diff --git a/ccm-core/src/main/java/org/libreccm/security/GroupImExporter.java b/ccm-core/src/main/java/org/libreccm/security/GroupImExporter.java
index 7bc7a55df..9d0253018 100644
--- a/ccm-core/src/main/java/org/libreccm/security/GroupImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/security/GroupImExporter.java
@@ -31,7 +31,8 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
- *
+ * Exporter/Importer for {@link Group}s.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/security/GroupMembership.java b/ccm-core/src/main/java/org/libreccm/security/GroupMembership.java
index 0d897f9e0..533f97c36 100644
--- a/ccm-core/src/main/java/org/libreccm/security/GroupMembership.java
+++ b/ccm-core/src/main/java/org/libreccm/security/GroupMembership.java
@@ -35,7 +35,6 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.imexport.Exportable;
import javax.json.Json;
-import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;
import javax.persistence.Column;
import javax.persistence.Entity;
diff --git a/ccm-core/src/main/java/org/libreccm/security/GroupMembershipImExporter.java b/ccm-core/src/main/java/org/libreccm/security/GroupMembershipImExporter.java
index 6c08bc790..8f26d5c91 100644
--- a/ccm-core/src/main/java/org/libreccm/security/GroupMembershipImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/security/GroupMembershipImExporter.java
@@ -30,12 +30,15 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
+ * Exporter/Importer for {@link GroupMembership} entities.
+ *
*
* @author Jens Pelzetter
*/
@Processes(GroupMembership.class)
-public class GroupMembershipImExporter extends AbstractEntityImExporter {
-
+public class GroupMembershipImExporter
+ extends AbstractEntityImExporter {
+
@Inject
private EntityManager entityManager;
@@ -44,14 +47,14 @@ public class GroupMembershipImExporter extends AbstractEntityImExporter> getRequiredEntities() {
-
+
final Set> entities = new HashSet<>();
entities.add(User.class);
entities.add(Group.class);
-
+
return entities;
}
diff --git a/ccm-core/src/main/java/org/libreccm/security/JwtProvider.java b/ccm-core/src/main/java/org/libreccm/security/JwtProvider.java
index cb22aef9c..f00378bc4 100644
--- a/ccm-core/src/main/java/org/libreccm/security/JwtProvider.java
+++ b/ccm-core/src/main/java/org/libreccm/security/JwtProvider.java
@@ -49,6 +49,7 @@ import javax.transaction.Transactional;
import javax.ws.rs.POST;
/**
+ * JAX-RS endpoint for generating JSON Web Tokens for authenticiation.
*
* @author Jens Pelzetter
*/
@@ -62,6 +63,16 @@ public class JwtProvider {
@Inject
private Shiro shiro;
+ /**
+ * Generates a new JSON Web Token
+ *
+ * @param requestCredentials Credentials for authentication as JSON object
+ * with the properties {@code username} and
+ * {@code password}.
+ *
+ * @return A response with the JSON Web Token for a Forbidden response if
+ * the credentials are incorrect.
+ */
@POST
@Path("/")
@Transactional(Transactional.TxType.REQUIRED)
@@ -74,7 +85,6 @@ public class JwtProvider {
.build();
}
- final JsonObjectBuilder jsonObjBuilder = Json.createObjectBuilder();
final StringReader credentialsReader = new StringReader(
requestCredentials);
final JsonReader jsonReader = Json.createReader(credentialsReader);
@@ -139,6 +149,12 @@ public class JwtProvider {
}
}
+ /**
+ * Helper method for generating a secret for the JSON Web Tokens.
+ *
+ * Only called if no secret if found in the {@link KernelConfig}. The secret
+ * is stored in the {@link KernelConfig}.
+ */
private void generateSecret() {
final Random random = new SecureRandom();
final byte[] randomBytes = new byte[64];
diff --git a/ccm-core/src/main/java/org/libreccm/security/JwtVerifyingFilter.java b/ccm-core/src/main/java/org/libreccm/security/JwtVerifyingFilter.java
index b81a8463a..0841d1848 100644
--- a/ccm-core/src/main/java/org/libreccm/security/JwtVerifyingFilter.java
+++ b/ccm-core/src/main/java/org/libreccm/security/JwtVerifyingFilter.java
@@ -37,7 +37,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
- *
+ * Shiro filter using JSON Web Tokens for authenticiation.
+ *
* @author Jens Pelzetter
*/
public class JwtVerifyingFilter extends AccessControlFilter {
@@ -62,8 +63,9 @@ public class JwtVerifyingFilter extends AccessControlFilter {
final String jwtClaims = jwt.substring(jwt.indexOf((" ")));
final Claims claims = Jwts
- .parser()
+ .parserBuilder()
.setSigningKey(key)
+ .build()
.parseClaimsJws(jwtClaims)
.getBody();
diff --git a/ccm-core/src/main/java/org/libreccm/security/OneTimeAuthToken.java b/ccm-core/src/main/java/org/libreccm/security/OneTimeAuthToken.java
index 6c5dbafbb..fa5eaa1c8 100644
--- a/ccm-core/src/main/java/org/libreccm/security/OneTimeAuthToken.java
+++ b/ccm-core/src/main/java/org/libreccm/security/OneTimeAuthToken.java
@@ -18,13 +18,27 @@
*/
package org.libreccm.security;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
/**
* The {@code OneTimeAuthToken} is used as a one time authentication mechanism
* for several purposes. Usually a {@link OneTimeAuthToken} is used together
diff --git a/ccm-core/src/main/java/org/libreccm/security/PartyIdResolver.java b/ccm-core/src/main/java/org/libreccm/security/PartyIdResolver.java
index ec5679fc8..5d8d73ddb 100644
--- a/ccm-core/src/main/java/org/libreccm/security/PartyIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/security/PartyIdResolver.java
@@ -29,6 +29,7 @@ import java.io.Serializable;
* @author Tobias Osmers
* @version created on 3/23/17
*/
+@Deprecated
@RequestScoped
public class PartyIdResolver implements Serializable, ObjectIdResolver {
private static final long serialVersionUID = -1208121020457080214L;
diff --git a/ccm-core/src/main/java/org/libreccm/security/Permission.java b/ccm-core/src/main/java/org/libreccm/security/Permission.java
index a692ccf1f..a7be25110 100644
--- a/ccm-core/src/main/java/org/libreccm/security/Permission.java
+++ b/ccm-core/src/main/java/org/libreccm/security/Permission.java
@@ -55,7 +55,8 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
- * A permission grants a privilege on an object or system wide to {@link Role}.
+ * A permission grants a privilege on an object or system wide to a
+ * {@link Role}.
*
* @author Jens Pelzetter
*/
@@ -63,48 +64,40 @@ import javax.persistence.TemporalType;
@Table(name = "PERMISSIONS", schema = DB_SCHEMA)
@NamedQueries({
@NamedQuery(name = "Permission.findByUuid",
- query = "SELECT p FROM Permission p WHERE p.uuid = :uuid")
- ,
+ query = "SELECT p FROM Permission p WHERE p.uuid = :uuid"),
@NamedQuery(name = "Permission.findByCustomPermId",
query = "SELECT p FROM Permission p "
+ "WHERE p.grantedPrivilege = :privilege "
+ "AND p.grantee = :grantee "
- + "AND p.object = :object")
- ,
+ + "AND p.object = :object"),
@NamedQuery(name = "Permission.existsForPrivilegeRoleObject",
query = "SELECT COUNT(p) FROM Permission p "
+ "WHERE p.grantedPrivilege = :privilege "
+ "AND p.grantee = :grantee "
- + "AND p.object = :object")
- ,
+ + "AND p.object = :object"),
@NamedQuery(name = "Permission.existsDirectForPrivilegeRoleObject",
query = "SELECT COUNT(p) FROM Permission p "
+ "WHERE p.grantedPrivilege = :privilege "
+ "AND p.grantee = :grantee "
+ "AND p.object = :object "
- + "AND p.inherited = false")
- ,
+ + "AND p.inherited = false"),
@NamedQuery(name = "Permission.existsInheritedForPrivilegeRoleObject",
query = "SELECT COUNT(p) FROM Permission p "
+ "WHERE p.grantedPrivilege = :privilege "
+ "AND p.grantee = :grantee "
+ "AND p.object = :object "
- + "AND p.inherited = true")
- ,
+ + "AND p.inherited = true"),
@NamedQuery(name = "Permission.existsForPrivilegeAndRole",
query = "SELECT COUNT(p) FROM Permission p "
+ "WHERE p.grantedPrivilege = :privilege "
+ "AND p.grantee = :grantee "
- + "AND p.object IS NULL")
- ,
+ + "AND p.object IS NULL"),
@NamedQuery(name = "Permission.findPermissionsForRole",
query = "SELECT p FROM Permission p "
- + "WHERE p.grantee = :grantee")
- ,
+ + "WHERE p.grantee = :grantee"),
@NamedQuery(name = "Permission.findPermissionsForCcmObject",
query = "SELECT p FROM Permission p "
- + "WHERE p.object = :object")
- ,
+ + "WHERE p.object = :object"),
@NamedQuery(name = "Permission.findPermissionsForRoleAndObject",
query = "SELECT p FROM Permission p "
+ "WHERE p.object = :object and p.grantee = :grantee")
diff --git a/ccm-core/src/main/java/org/libreccm/security/PermissionIdResolver.java b/ccm-core/src/main/java/org/libreccm/security/PermissionIdResolver.java
index 6e6c32f4e..73c464a8d 100644
--- a/ccm-core/src/main/java/org/libreccm/security/PermissionIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/security/PermissionIdResolver.java
@@ -27,9 +27,10 @@ import javax.enterprise.context.RequestScoped;
import java.io.Serializable;
/**
- * @author Tobias Osmers
* @version created on 3/23/17
*/
+@Deprecated
@RequestScoped
public class PermissionIdResolver implements Serializable, ObjectIdResolver {
private static final long serialVersionUID = -8397366681202009916L;
diff --git a/ccm-core/src/main/java/org/libreccm/security/PermissionImExporter.java b/ccm-core/src/main/java/org/libreccm/security/PermissionImExporter.java
index 50f1e29e9..48275d0dc 100644
--- a/ccm-core/src/main/java/org/libreccm/security/PermissionImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/security/PermissionImExporter.java
@@ -29,7 +29,8 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
/**
- *
+ * Exporter/Importer for {@link Permission}s.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/security/PermissionRepository.java b/ccm-core/src/main/java/org/libreccm/security/PermissionRepository.java
index 0720a84f4..b0623e56c 100644
--- a/ccm-core/src/main/java/org/libreccm/security/PermissionRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/security/PermissionRepository.java
@@ -30,7 +30,7 @@ import java.util.UUID;
/**
* A repository class for {@link Permission}.
*
- * @author Tobias Osmers
* @version created on 3/29/17
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/security/RequiresPrivilege.java b/ccm-core/src/main/java/org/libreccm/security/RequiresPrivilege.java
index 2dedda7cc..9a048d236 100644
--- a/ccm-core/src/main/java/org/libreccm/security/RequiresPrivilege.java
+++ b/ccm-core/src/main/java/org/libreccm/security/RequiresPrivilege.java
@@ -20,7 +20,11 @@ package org.libreccm.security;
import org.libreccm.core.CcmObject;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* This annotation is used together with the {@link AuthorizationRequired}
diff --git a/ccm-core/src/main/java/org/libreccm/security/Role.java b/ccm-core/src/main/java/org/libreccm/security/Role.java
index 7cb3eac16..6771a57c4 100644
--- a/ccm-core/src/main/java/org/libreccm/security/Role.java
+++ b/ccm-core/src/main/java/org/libreccm/security/Role.java
@@ -22,7 +22,6 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.hibernate.search.annotations.Field;
-import org.hibernate.validator.constraints.NotBlank;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.workflow.TaskAssignment;
@@ -57,6 +56,7 @@ import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
+import javax.validation.constraints.NotBlank;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
diff --git a/ccm-core/src/main/java/org/libreccm/security/RoleIdResolver.java b/ccm-core/src/main/java/org/libreccm/security/RoleIdResolver.java
index afedb0e77..79360d00d 100644
--- a/ccm-core/src/main/java/org/libreccm/security/RoleIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/security/RoleIdResolver.java
@@ -26,9 +26,10 @@ import javax.enterprise.context.RequestScoped;
import java.io.Serializable;
/**
- * @author Tobias Osmers
* @version created on 3/23/17
*/
+@Deprecated
@RequestScoped
public class RoleIdResolver implements Serializable, ObjectIdResolver {
private static final long serialVersionUID = -1651704701257277011L;
diff --git a/ccm-core/src/main/java/org/libreccm/security/RoleImExporter.java b/ccm-core/src/main/java/org/libreccm/security/RoleImExporter.java
index f20f33bbd..05f6cdc45 100644
--- a/ccm-core/src/main/java/org/libreccm/security/RoleImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/security/RoleImExporter.java
@@ -28,7 +28,8 @@ import java.util.Set;
import javax.inject.Inject;
/**
- *
+ * Exporter/Importer for {@link Role}s.
+ *
* @author Jens Pelzetter
*/
@Processes(Role.class)
diff --git a/ccm-core/src/main/java/org/libreccm/security/RoleManager.java b/ccm-core/src/main/java/org/libreccm/security/RoleManager.java
index 903aae702..8bed9abaa 100644
--- a/ccm-core/src/main/java/org/libreccm/security/RoleManager.java
+++ b/ccm-core/src/main/java/org/libreccm/security/RoleManager.java
@@ -37,8 +37,8 @@ import java.util.UUID;
import java.util.stream.Collectors;
/**
- * Manager for roles providing methods for assigning the role the {@link Party}
- * entities and for removing them.
+ * Manager for roles providing methods for assigning the role and adding and
+ * removing {@link Party} entities entities to the role and for removing them.
*
* @author Jens Pelzetter
*/
diff --git a/ccm-core/src/main/java/org/libreccm/security/RoleMembershipImExporter.java b/ccm-core/src/main/java/org/libreccm/security/RoleMembershipImExporter.java
index df067996f..a397299ce 100644
--- a/ccm-core/src/main/java/org/libreccm/security/RoleMembershipImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/security/RoleMembershipImExporter.java
@@ -30,7 +30,8 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
- *
+ * Exporter/Importer for {@link RoleMembership}s.
+ *
* @author Jens Pelzetter
*/
@Processes(RoleMembership.class)
diff --git a/ccm-core/src/main/java/org/libreccm/security/UserIdResolver.java b/ccm-core/src/main/java/org/libreccm/security/UserIdResolver.java
index bfeb9c231..c9d03f2fd 100644
--- a/ccm-core/src/main/java/org/libreccm/security/UserIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/security/UserIdResolver.java
@@ -29,6 +29,7 @@ import java.io.Serializable;
* @author Tobias Osmers
* @author Jens Pelzetter
*/
+@Deprecated
@RequestScoped
public class UserIdResolver implements Serializable, ObjectIdResolver {
diff --git a/ccm-core/src/main/java/org/libreccm/security/UserImExporter.java b/ccm-core/src/main/java/org/libreccm/security/UserImExporter.java
index 112292ae4..bf34502ee 100644
--- a/ccm-core/src/main/java/org/libreccm/security/UserImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/security/UserImExporter.java
@@ -31,7 +31,8 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
- *
+ * Exporter/Importer for users.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/security/UserManager.java b/ccm-core/src/main/java/org/libreccm/security/UserManager.java
index 22fcbe298..ca13d1764 100644
--- a/ccm-core/src/main/java/org/libreccm/security/UserManager.java
+++ b/ccm-core/src/main/java/org/libreccm/security/UserManager.java
@@ -44,7 +44,6 @@ import java.io.Serializable;
/**
* Provides various operations for user objects.
*
- *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/security/UsersApi.java b/ccm-core/src/main/java/org/libreccm/security/UsersApi.java
index b14e840a0..b1795bb85 100644
--- a/ccm-core/src/main/java/org/libreccm/security/UsersApi.java
+++ b/ccm-core/src/main/java/org/libreccm/security/UsersApi.java
@@ -42,7 +42,8 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
/**
- *
+ * Unstable! First try for a RESTful API for user management.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/themes/StaticThemesServlet.java b/ccm-core/src/main/java/org/libreccm/themes/StaticThemesServlet.java
index acf0b1d42..c5d21d3e4 100644
--- a/ccm-core/src/main/java/org/libreccm/themes/StaticThemesServlet.java
+++ b/ccm-core/src/main/java/org/libreccm/themes/StaticThemesServlet.java
@@ -34,7 +34,8 @@ import java.io.PrintWriter;
import java.util.Set;
/**
- *
+ * Serves static theme resources from the classpath.
+ *
* @author Jens Pelzetter
*/
@WebServlet(urlPatterns = {"/themes/static/*"})
diff --git a/ccm-core/src/main/java/org/libreccm/theming/FileSystemThemeProvider.java b/ccm-core/src/main/java/org/libreccm/theming/FileSystemThemeProvider.java
index f366e9db4..b66210d5f 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/FileSystemThemeProvider.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/FileSystemThemeProvider.java
@@ -38,15 +38,15 @@ import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
/**
- *
+ * {@link ThemeProvider} implementation that loads themes from the file system
+ * using {@link CcmFiles}.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/theming/StaticThemeProvider.java b/ccm-core/src/main/java/org/libreccm/theming/StaticThemeProvider.java
index 14d0b5663..3a8836b7e 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/StaticThemeProvider.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/StaticThemeProvider.java
@@ -53,7 +53,9 @@ import javax.json.JsonObject;
import javax.json.JsonReader;
/**
- *
+ * Implementation of {@link ThemeProvider} for serves themes stored in the
+ * classpath.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/theming/ThemeConstants.java b/ccm-core/src/main/java/org/libreccm/theming/ThemeConstants.java
index 3ed285aca..29ff4cf21 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/ThemeConstants.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/ThemeConstants.java
@@ -19,7 +19,8 @@
package org.libreccm.theming;
/**
- *
+ * Some constants for the classes managing themes.
+ *
* @author Jens Pelzetter
*/
public final class ThemeConstants {
diff --git a/ccm-core/src/main/java/org/libreccm/theming/ThemeFiles.java b/ccm-core/src/main/java/org/libreccm/theming/ThemeFiles.java
index 7db5a9f52..046b8ddd5 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/ThemeFiles.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/ThemeFiles.java
@@ -36,7 +36,9 @@ import javax.ws.rs.core.Response;
/**
- *
+ * JAX-RS endpoint for serving files from a theme.
+ *
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/theming/ThemeProvider.java b/ccm-core/src/main/java/org/libreccm/theming/ThemeProvider.java
index ccd4fbe5a..451e4b683 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/ThemeProvider.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/ThemeProvider.java
@@ -25,9 +25,12 @@ import java.io.Serializable;
import java.util.List;
import java.util.Optional;
+import javax.enterprise.context.RequestScoped;
+
/**
* A theme provider provides access to the files of a theme. It abstracts from
- * the location and method of loading.
+ * the location and method of loading. Implementation must be CDI beans.
+ * Recommanded scope: {@link RequestScoped}.
*
* @author Jens Pelzetter
*/
@@ -149,8 +152,8 @@ public interface ThemeProvider extends Serializable {
* {@link Optional}.
*/
Optional getThemeFileInfo(String theme,
- ThemeVersion version,
- String path);
+ ThemeVersion version,
+ String path);
/**
* Retrieve a file from a theme. We use an {@link InputStream} here because
diff --git a/ccm-core/src/main/java/org/libreccm/theming/ThemeVersion.java b/ccm-core/src/main/java/org/libreccm/theming/ThemeVersion.java
index f6e4a0dee..2391a919a 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/ThemeVersion.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/ThemeVersion.java
@@ -19,7 +19,8 @@
package org.libreccm.theming;
/**
- *
+ * Enum for the possible version states of a theme.
+ *
* @author Jens Pelzetter
*/
public enum ThemeVersion {
diff --git a/ccm-core/src/main/java/org/libreccm/theming/Themes.java b/ccm-core/src/main/java/org/libreccm/theming/Themes.java
index c9fb4313b..fcf2a4eae 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/Themes.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/Themes.java
@@ -53,9 +53,6 @@ public class Themes implements Serializable {
@Any
private Instance providers;
//
-// @Inject
-// private Instance processors;
-
@Inject
private ThemeProcessors themeProcessors;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/ThemesService.java b/ccm-core/src/main/java/org/libreccm/theming/ThemesService.java
index 20a178880..9916cd790 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/ThemesService.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/ThemesService.java
@@ -25,7 +25,8 @@ import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
- *
+ * JAX-RS application providing access to the files of a theme.
+ *
* @author Jens Pelzetter
*/
@ApplicationPath("/theming")
diff --git a/ccm-core/src/main/java/org/libreccm/theming/db/Theme.java b/ccm-core/src/main/java/org/libreccm/theming/db/Theme.java
index 8a7cb3ec8..c08b18d32 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/db/Theme.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/db/Theme.java
@@ -38,7 +38,8 @@ import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
- *
+ * Enitity for a theme stored in the database.
+ *
* @author Jens Pelzetter
*/
@Entity
diff --git a/ccm-core/src/main/java/org/libreccm/theming/db/ThemeFileRepository.java b/ccm-core/src/main/java/org/libreccm/theming/db/ThemeFileRepository.java
index a71b17485..e16c94734 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/db/ThemeFileRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/db/ThemeFileRepository.java
@@ -36,7 +36,8 @@ import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
/**
- *
+ * Repository for {@link ThemeFile} entities.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/theming/db/ThemeRepository.java b/ccm-core/src/main/java/org/libreccm/theming/db/ThemeRepository.java
index eee8febde..04a30149f 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/db/ThemeRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/db/ThemeRepository.java
@@ -33,7 +33,8 @@ import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
/**
- *
+ * Repository for {@link Theme} entities.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/theming/db/package-info.java b/ccm-core/src/main/java/org/libreccm/theming/db/package-info.java
new file mode 100644
index 000000000..2421464e2
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/theming/db/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Classes for managing themes in the database.
+ */
+package org.libreccm.theming.db;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/freemarker/FreemarkerConfigurationProvider.java b/ccm-core/src/main/java/org/libreccm/theming/freemarker/FreemarkerConfigurationProvider.java
index e7d5f573c..000918402 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/freemarker/FreemarkerConfigurationProvider.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/freemarker/FreemarkerConfigurationProvider.java
@@ -24,7 +24,6 @@ import freemarker.cache.TemplateLoader;
import freemarker.cache.WebappTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.TemplateExceptionHandler;
-import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.theming.ThemeInfo;
import org.libreccm.theming.Themes;
@@ -41,6 +40,8 @@ import javax.inject.Inject;
import javax.servlet.ServletContext;
/**
+ * CDI bean providing the Freemarker configuration for the
+ * {@link FreemarkerThemeProcessor}.
*
* @author Jens Pelzetter
*/
@@ -49,7 +50,7 @@ class FreemarkerConfigurationProvider {
@Inject
private ServletContext servletContext;
-
+
@Inject
private Themes themes;
@@ -71,17 +72,17 @@ class FreemarkerConfigurationProvider {
configuration.setLogTemplateExceptions(false);
configuration.setWrapUncheckedExceptions(false);
configuration.setLocalizedLookup(false);
-
+
configuration.setTemplateLoader(
new MultiTemplateLoader(new TemplateLoader[]{
- // For for files from themes
- new CcmTemplateLoader(forTheme),
- // Loader for MacroLibs provided by CCM modules
- new WebappTemplateLoader(
- servletContext, "/themes/freemarker"
- ),
- new ClassTemplateLoader(getClass(), "/themes/freemarker")
- })
+ // For for files from themes
+ new CcmTemplateLoader(forTheme),
+ // Loader for MacroLibs provided by CCM modules
+ new WebappTemplateLoader(
+ servletContext, "/themes/freemarker"
+ ),
+ new ClassTemplateLoader(getClass(), "/themes/freemarker")
+ })
);
configurations.put(forTheme, configuration);
@@ -101,7 +102,8 @@ class FreemarkerConfigurationProvider {
@Override
public Object findTemplateSource(final String name) throws IOException {
- final Optional source = themes.getFileFromTheme(fromTheme, name);
+ final Optional source = themes.getFileFromTheme(
+ fromTheme, name);
if (source.isPresent()) {
return source.get();
} else {
diff --git a/ccm-core/src/main/java/org/libreccm/theming/freemarker/FreemarkerThemeProcessor.java b/ccm-core/src/main/java/org/libreccm/theming/freemarker/FreemarkerThemeProcessor.java
index 28c3a1083..8e15d7241 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/freemarker/FreemarkerThemeProcessor.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/freemarker/FreemarkerThemeProcessor.java
@@ -21,7 +21,6 @@ package org.libreccm.theming.freemarker;
import static org.libreccm.theming.ThemeConstants.*;
import freemarker.template.SimpleNumber;
-import freemarker.template.SimpleScalar;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateMethodModelEx;
@@ -48,7 +47,8 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
/**
- *
+ * A {@link ThemeProcessor} implementation for Freemarker based themes.
+ *
* @author Jens Pelzetter
*/
@ProcessesThemes("freemarker")
diff --git a/ccm-core/src/main/java/org/libreccm/theming/freemarker/package-info.java b/ccm-core/src/main/java/org/libreccm/theming/freemarker/package-info.java
new file mode 100644
index 000000000..72e2202ee
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/theming/freemarker/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Classes for processing Freemarker based themes.
+ */
+package org.libreccm.theming.freemarker;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/manager/Themes.java b/ccm-core/src/main/java/org/libreccm/theming/manager/Themes.java
index f5a948871..3781333e0 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/manager/Themes.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/manager/Themes.java
@@ -29,7 +29,6 @@ import org.libreccm.theming.ThemeVersion;
import org.libreccm.theming.ThemingPrivileges;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/manager/package-info.java b/ccm-core/src/main/java/org/libreccm/theming/manager/package-info.java
new file mode 100644
index 000000000..df1b8e469
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/theming/manager/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Provides a experimental JAX-RS application form managing themes.
+ */
+package org.libreccm.theming.manager;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/manifest/package-info.java b/ccm-core/src/main/java/org/libreccm/theming/manifest/package-info.java
new file mode 100644
index 000000000..76e1c0d14
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/theming/manifest/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Classes for proccessing the manifest of a theme.
+ */
+package org.libreccm.theming.manifest;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/package-info.java b/ccm-core/src/main/java/org/libreccm/theming/package-info.java
new file mode 100644
index 000000000..93bbe5bbf
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/theming/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * The classes and interfaces in this package provided the foundation
+ * for the theming system of CCM.
+ */
+package org.libreccm.theming;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/utils/L10NUtils.java b/ccm-core/src/main/java/org/libreccm/theming/utils/L10NUtils.java
index f18982076..c26df4e4d 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/utils/L10NUtils.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/utils/L10NUtils.java
@@ -39,7 +39,8 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
/**
- *
+ * Utility for getting localized texts for a theme.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/theming/utils/TextUtils.java b/ccm-core/src/main/java/org/libreccm/theming/utils/TextUtils.java
index 15fdeff67..648f9f25b 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/utils/TextUtils.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/utils/TextUtils.java
@@ -23,7 +23,8 @@ import java.util.Objects;
import javax.enterprise.context.RequestScoped;
/**
- *
+ * Utils for working with text inside of a theme.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/theming/webdav/package-info.java b/ccm-core/src/main/java/org/libreccm/theming/webdav/package-info.java
new file mode 100644
index 000000000..5f2fcf4a4
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/theming/webdav/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Experimental classes providing access via WEB DAV to the files of a theme.
+ */
+package org.libreccm.theming.webdav;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/xslt/XsltThemeProcessor.java b/ccm-core/src/main/java/org/libreccm/theming/xslt/XsltThemeProcessor.java
index 16e572dab..fdafe86e0 100644
--- a/ccm-core/src/main/java/org/libreccm/theming/xslt/XsltThemeProcessor.java
+++ b/ccm-core/src/main/java/org/libreccm/theming/xslt/XsltThemeProcessor.java
@@ -69,10 +69,6 @@ import java.io.Reader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import java.util.Objects;
import java.util.Optional;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
diff --git a/ccm-core/src/main/java/org/libreccm/theming/xslt/package-info.java b/ccm-core/src/main/java/org/libreccm/theming/xslt/package-info.java
new file mode 100644
index 000000000..43076b904
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/theming/xslt/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Support of legacy XSL based themes.
+ */
+package org.libreccm.theming.xslt;
diff --git a/ccm-core/src/main/java/org/libreccm/web/AbstractCcmApplicationSetup.java b/ccm-core/src/main/java/org/libreccm/web/AbstractCcmApplicationSetup.java
index cfed6282b..1cba1ab1d 100644
--- a/ccm-core/src/main/java/org/libreccm/web/AbstractCcmApplicationSetup.java
+++ b/ccm-core/src/main/java/org/libreccm/web/AbstractCcmApplicationSetup.java
@@ -32,7 +32,9 @@ import java.io.InputStream;
import java.util.Properties;
/**
- *
+ * Base class for application setups. For each CCM application it is necessary
+ * to provide an implementation of this class.
+ *
* @author Jens Pelzetter
*/
public abstract class AbstractCcmApplicationSetup {
diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationCreateException.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationCreateException.java
index 7d0832e83..ee3203903 100644
--- a/ccm-core/src/main/java/org/libreccm/web/ApplicationCreateException.java
+++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationCreateException.java
@@ -20,7 +20,8 @@
package org.libreccm.web;
/**
- *
+ * Thrown if the creation of a application instance fails.
+ *
* @author Jens Pelzetter
*/
public class ApplicationCreateException extends Exception {
diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationCreator.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationCreator.java
index 69b29b5d8..35568c6f1 100644
--- a/ccm-core/src/main/java/org/libreccm/web/ApplicationCreator.java
+++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationCreator.java
@@ -19,13 +19,21 @@
package org.libreccm.web;
/**
+ * Interface for classes which create a application instance.
*
* @author Jens Pelzetter
* @param
*/
public interface ApplicationCreator {
-
- T createInstance(String primaryUrl,
- ApplicationType type);
-
+
+ /**
+ * Creates a new instance of the the application of type {@code T}.
+ *
+ * @param primaryUrl The URL fragment for the application instance.
+ * @param type The type of the application.
+ *
+ * @return
+ */
+ T createInstance(String primaryUrl, ApplicationType type);
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationIdResolver.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationIdResolver.java
index 2ca5c5a4c..c121ad1b3 100644
--- a/ccm-core/src/main/java/org/libreccm/web/ApplicationIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationIdResolver.java
@@ -29,6 +29,7 @@ import java.io.Serializable;
* @author Jens Pelzetter
*/
@RequestScoped
@Processes(CcmApplication.class)
-public class ApplicationImExporter
- extends AbstractEntityImExporter{
+public class ApplicationImExporter
+ extends AbstractEntityImExporter {
@Inject
private ApplicationRepository applicationRepository;
-
+
@Override
protected Class getEntityClass() {
-
+
return CcmApplication.class;
}
@@ -56,10 +57,8 @@ public class ApplicationImExporter
@Override
protected Set> getRequiredEntities() {
-
+
return Collections.emptySet();
}
-
-
-
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationManager.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationManager.java
index ddeea5fad..8df17aa69 100644
--- a/ccm-core/src/main/java/org/libreccm/web/ApplicationManager.java
+++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationManager.java
@@ -37,19 +37,28 @@ import javax.persistence.TypedQuery;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.transaction.Transactional;
+
import java.io.Serializable;
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.ServiceLoader;
/**
+ * Manager for application instances.
*
* @author Jens Pelzetter
*/
@ApplicationScoped
public class ApplicationManager implements Serializable {
+
private static final long serialVersionUID = -4623791386536335252L;
private static final Logger LOGGER = LogManager.getLogger(
- ApplicationManager.class);
+ ApplicationManager.class);
@Inject
private EntityManager entityManager;
@@ -59,14 +68,19 @@ public class ApplicationManager implements Serializable {
private Map applicationTypes = new HashMap<>();
+ /**
+ * Init function run by the CDI container after an instance was created.
+ * Loads all available application types into the {@link #applicationTypes}
+ * map.
+ */
@PostConstruct
private void loadApplicationTypes() {
final ServiceLoader modules = ServiceLoader.load(
- CcmModule.class);
+ CcmModule.class);
for (CcmModule module : modules) {
final Module moduleData = module.getClass().getAnnotation(
- Module.class);
+ Module.class);
final ApplicationType[] appTypes = moduleData.applicationTypes();
@@ -90,12 +104,12 @@ public class ApplicationManager implements Serializable {
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public T createInstance(
- final ApplicationType type,
- final String path,
- final Class applicationClass) throws ApplicationCreateException {
+ final ApplicationType type,
+ final String path,
+ final Class applicationClass) throws ApplicationCreateException {
@SuppressWarnings("unchecked")
final ApplicationCreator creator = CdiUtil.createCdiUtil().findBean(
- type.creator());
+ type.creator());
final T application = creator.createInstance(path, type);
entityManager.persist(application);
@@ -103,6 +117,11 @@ public class ApplicationManager implements Serializable {
return application;
}
+ /**
+ * Deletes an application instance.
+ *
+ * @param application The application instance to delete.
+ */
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
@@ -110,9 +129,16 @@ public class ApplicationManager implements Serializable {
entityManager.remove(application);
}
+ /**
+ * Retrieve an application instance by its path.
+ *
+ * @param path The path of the application instance to retrieve.
+ *
+ * @return The application instance.
+ */
public CcmApplication findApplicationByPath(final String path) {
final TypedQuery query = entityManager.createNamedQuery(
- "CcmApplication.retrieveApplicationForPath", CcmApplication.class);
+ "CcmApplication.retrieveApplicationForPath", CcmApplication.class);
query.setParameter("path", path);
final List result = query.getResultList();
if (result.isEmpty()) {
@@ -124,6 +150,15 @@ public class ApplicationManager implements Serializable {
}
}
+ /**
+ * Gets the servlet path of an application. Note: It is not required that
+ * the path is mapped directly to a servlet. The path can also point to a
+ * JAX-RS resource or other classes which process requests.
+ *
+ * @param application The application instance.
+ *
+ * @return The servlet path of the application.
+ */
public String getServletPath(final CcmApplication application) {
final String typeName = application.getApplicationType();
@@ -131,26 +166,26 @@ public class ApplicationManager implements Serializable {
if (type == null) {
throw new IllegalArgumentException(String.format(
- "Unknown application type \"%s\".", typeName));
+ "Unknown application type \"%s\".", typeName));
}
if (type.servletPath().isEmpty()) {
if (type.servlet().equals(HttpServlet.class)) {
throw new IllegalArgumentException(String.format(
- "Application type \"%s\" can no servlet path nor a serlet "
- + "definition.",
- typeName));
+ "Application type \"%s\" can no servlet path nor a serlet "
+ + "definition.",
+ typeName));
} else {
final Class extends HttpServlet> servletClass = type.servlet();
if (servletClass.isAnnotationPresent(WebServlet.class)) {
return servletClass.getAnnotation(WebServlet.class)
- .urlPatterns()[0];
+ .urlPatterns()[0];
} else {
throw new IllegalArgumentException(String.format(
- "Provided servlet for application type \"%s\" has not "
- + "@WebServlet annotation.",
- typeName));
+ "Provided servlet for application type \"%s\" has not "
+ + "@WebServlet annotation.",
+ typeName));
}
}
} else {
@@ -158,8 +193,15 @@ public class ApplicationManager implements Serializable {
}
}
+ /**
+ * The the title of an application type.
+ *
+ * @param applicationType The application type.
+ *
+ * @return The title of the application type.
+ */
public String getApplicationTypeTitle(
- final ApplicationType applicationType) {
+ final ApplicationType applicationType) {
final String descBundle;
if (Strings.isBlank(applicationType.descBundle())) {
@@ -171,7 +213,7 @@ public class ApplicationManager implements Serializable {
final ResourceBundle bundle;
try {
bundle = ResourceBundle.getBundle(
- descBundle, globalizationHelper.getNegotiatedLocale());
+ descBundle, globalizationHelper.getNegotiatedLocale());
return bundle.getString(applicationType.titleKey());
} catch (MissingResourceException ex) {
LOGGER.warn("Failed to find resource bundle '{}'.", ex);
@@ -180,8 +222,15 @@ public class ApplicationManager implements Serializable {
}
}
+ /**
+ * The the description of an application type.
+ *
+ * @param applicationType The application type.
+ *
+ * @return The description of the application type.
+ */
public String getApplicationTypeDescription(
- final ApplicationType applicationType) {
+ final ApplicationType applicationType) {
final String descBundle;
if (Strings.isBlank(applicationType.descBundle())) {
@@ -193,7 +242,7 @@ public class ApplicationManager implements Serializable {
final ResourceBundle bundle;
try {
bundle = ResourceBundle.getBundle(
- descBundle, globalizationHelper.getNegotiatedLocale());
+ descBundle, globalizationHelper.getNegotiatedLocale());
return bundle.getString(applicationType.descKey());
} catch (MissingResourceException ex) {
LOGGER.warn("Failed to find resource bundle '{}'.", ex);
@@ -203,4 +252,3 @@ public class ApplicationManager implements Serializable {
}
}
-
diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationRepository.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationRepository.java
index 0174b4436..84d03e67f 100644
--- a/ccm-core/src/main/java/org/libreccm/web/ApplicationRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationRepository.java
@@ -33,7 +33,8 @@ import java.util.Optional;
import java.util.UUID;
/**
- *
+ * Repository for applications.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java
index ef11c6a56..5c5019960 100644
--- a/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java
+++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java
@@ -29,7 +29,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
- *
+ * Descriptor for application types.
+ *
* @author Jens Pelzetter
*/
@Retention(RetentionPolicy.RUNTIME)
diff --git a/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java b/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java
index 0ec8ee1c3..0f2a45287 100644
--- a/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java
+++ b/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java
@@ -53,7 +53,8 @@ import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
- *
+ * Base class for CCM application
+ *
* @author Jens Pelzetter
*/
@Entity
diff --git a/ccm-core/src/main/java/org/libreccm/web/DefaultApplicationCreator.java b/ccm-core/src/main/java/org/libreccm/web/DefaultApplicationCreator.java
index 25d1e9e64..6bd61fa86 100644
--- a/ccm-core/src/main/java/org/libreccm/web/DefaultApplicationCreator.java
+++ b/ccm-core/src/main/java/org/libreccm/web/DefaultApplicationCreator.java
@@ -19,7 +19,9 @@
package org.libreccm.web;
/**
- *
+ * Default application creator implementation used if no specific implementation
+ * of the {@link ApplicationCreator} interface is found.
+ *
* @author Jens Pelzetter
*/
public class DefaultApplicationCreator
diff --git a/ccm-core/src/main/java/org/libreccm/web/Host.java b/ccm-core/src/main/java/org/libreccm/web/Host.java
index 7a31b4bf8..c434d1f58 100644
--- a/ccm-core/src/main/java/org/libreccm/web/Host.java
+++ b/ccm-core/src/main/java/org/libreccm/web/Host.java
@@ -18,14 +18,22 @@
*/
package org.libreccm.web;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+
/**
- *
+ * Represents the data of CCM host.
+ *
* @author Jens Pelzetter
*/
@Entity
diff --git a/ccm-core/src/main/java/org/libreccm/web/WebConstants.java b/ccm-core/src/main/java/org/libreccm/web/WebConstants.java
index 8f1901374..96d697bbe 100644
--- a/ccm-core/src/main/java/org/libreccm/web/WebConstants.java
+++ b/ccm-core/src/main/java/org/libreccm/web/WebConstants.java
@@ -19,7 +19,8 @@
package org.libreccm.web;
/**
- *
+ * Some constants for the classes in this package.
+ *
* @author Jens Pelzetter
*/
public final class WebConstants {
diff --git a/ccm-core/src/main/java/org/libreccm/web/package-info.java b/ccm-core/src/main/java/org/libreccm/web/package-info.java
new file mode 100644
index 000000000..2af17bec3
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/web/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * Several classes required to run CCM applications.
+ */
+package org.libreccm.web;
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/AbstractWorkflowException.java b/ccm-core/src/main/java/org/libreccm/workflow/AbstractWorkflowException.java
index 6dd0405d6..a7105ed57 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/AbstractWorkflowException.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/AbstractWorkflowException.java
@@ -20,7 +20,8 @@
package org.libreccm.workflow;
/**
- *
+ * Base class for exception related to workflows.
+ *
* @author Jens Pelzetter
*/
public class AbstractWorkflowException extends RuntimeException {
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskIdResolver.java b/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskIdResolver.java
index c745ea4e0..a18fbd18c 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskIdResolver.java
@@ -26,10 +26,11 @@ import javax.enterprise.context.RequestScoped;
import java.io.Serializable;
/**
- * @author Tobias Osmers
* @version created on 3/23/17
*/
@RequestScoped
+@Deprecated
public class AssignableTaskIdResolver implements Serializable,
ObjectIdResolver {
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskImExporter.java b/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskImExporter.java
index aa3e9e75c..287b63237 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskImExporter.java
@@ -30,6 +30,8 @@ import javax.inject.Inject;
import javax.transaction.Transactional;
/**
+ * Exporter/Importer for {@link AssignableTask}s.
+ *
* @author Tobias Osmers
* @author Jens Pelzetter
*
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskManager.java b/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskManager.java
index 80797e22d..973338c9f 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskManager.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/AssignableTaskManager.java
@@ -19,7 +19,13 @@
package org.libreccm.workflow;
import org.libreccm.core.CoreConstants;
-import org.libreccm.security.*;
+import org.libreccm.security.AuthorizationRequired;
+import org.libreccm.security.RequiresPrivilege;
+import org.libreccm.security.Role;
+import org.libreccm.security.RoleMembership;
+import org.libreccm.security.RoleRepository;
+import org.libreccm.security.Shiro;
+import org.libreccm.security.User;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
@@ -35,7 +41,8 @@ import java.util.UUID;
import java.util.stream.Collectors;
/**
- *
+ * Manager for {@link AssignableTask}s.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/TaskAssignmentImExporter.java b/ccm-core/src/main/java/org/libreccm/workflow/TaskAssignmentImExporter.java
index e381f0a74..bb8fb2933 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/TaskAssignmentImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/TaskAssignmentImExporter.java
@@ -31,12 +31,14 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
+ * Exporter/Importer for {@link TaskAssignment}s.
+ *
* @author Tobias Osmers
* @author Jens Pelzetter
*/
@RequestScoped
@Processes(TaskAssignment.class)
-public class TaskAssignmentMarshaller
+public class TaskAssignmentImExporter
extends AbstractEntityImExporter {
@Inject
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/TaskCommentIdResolver.java b/ccm-core/src/main/java/org/libreccm/workflow/TaskCommentIdResolver.java
index b7c7b850f..22073a48a 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/TaskCommentIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/TaskCommentIdResolver.java
@@ -28,6 +28,7 @@ import java.io.Serializable;
* @author Tobias Osmers
* @author Jens Pelzetter
*/
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/TaskCommentRepository.java b/ccm-core/src/main/java/org/libreccm/workflow/TaskCommentRepository.java
index 5ffd76b8e..2a2cb0808 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/TaskCommentRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/TaskCommentRepository.java
@@ -26,6 +26,8 @@ import javax.persistence.TypedQuery;
import java.util.Optional;
/**
+ * Repository for {@link TaskComment}s.
+ *
* @author Jens Pelzetter
*/
@@ -48,19 +49,33 @@ public class TaskDependency implements Serializable, Exportable {
private static final long serialVersionUID = -4383255770131633943L;
+ /**
+ * ID of the dependency.
+ */
@Id
@Column(name = "TASK_DEPENDENCY_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private long taskDependencyId;
+ /**
+ * UUID of the dependency.
+ */
@Column(name = "uuid", unique = true, nullable = false)
private String uuid;
+ /**
+ * The blocked tasks that can only be done after the {@link #blockingTask}
+ * has been finished.
+ */
@ManyToOne
@JoinColumn(name = "BLOCKED_TASK_ID")
@JsonIdentityReference(alwaysAsId = true)
private Task blockedTask;
+ /**
+ * The task that has the be finished be the {@link #blockedTask} can be
+ * executed.
+ */
@ManyToOne
@JoinColumn(name = "BLOCKING_TASK_ID")
@JsonIdentityReference(alwaysAsId = true)
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/TaskDependencyImExporter.java b/ccm-core/src/main/java/org/libreccm/workflow/TaskDependencyImExporter.java
index 33423d594..e66aac96b 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/TaskDependencyImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/TaskDependencyImExporter.java
@@ -31,12 +31,14 @@ import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/**
+ * Exporter/Importer for {@link TaskDependency} entities.
+ *
* @author Tobias Osmers
+ * @author Tobias Osmers
* @version created on 3/23/17
*/
+@Deprecated
@RequestScoped
public class TaskIdResolver implements Serializable, ObjectIdResolver {
private static final long serialVersionUID = 6444989953192198987L;
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/WorkflowIdResolver.java b/ccm-core/src/main/java/org/libreccm/workflow/WorkflowIdResolver.java
index e3c879ad2..ca10336d8 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/WorkflowIdResolver.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/WorkflowIdResolver.java
@@ -26,9 +26,12 @@ import javax.enterprise.context.RequestScoped;
import java.io.Serializable;
/**
+ *
+ *
* @author Tobias Osmers
* @version created on 3/23/17
*/
+@Deprecated
@RequestScoped
public class WorkflowIdResolver implements Serializable, ObjectIdResolver {
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/WorkflowImExporter.java b/ccm-core/src/main/java/org/libreccm/workflow/WorkflowImExporter.java
index ac83dd74a..bb0c24c71 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/WorkflowImExporter.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/WorkflowImExporter.java
@@ -30,7 +30,8 @@ import javax.inject.Inject;
import javax.transaction.Transactional;
/**
- *
+ * Importer/Exporter for {@link Workflow}s.
+ *
* @author Jens Pelzetter
*/
@RequestScoped
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/package-info.java b/ccm-core/src/main/java/org/libreccm/workflow/package-info.java
new file mode 100644
index 000000000..8015c1a22
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/workflow/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+/**
+ * The entities in this package are used to model workflows in CCM.
+ */
+package org.libreccm.workflow;