[CCM][FEATURE]
- adds import functionalities for core's ResourceType, CcmApplication, Domain and DomainOwnership - optimizes imports in some core packages git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4987 8810af33-2d31-482b-a856-94f89814c4dfccm-docs
parent
15ff6e8f86
commit
e3e30cdffe
|
|
@ -18,32 +18,18 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
|
import org.libreccm.security.Relation;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
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.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
||||||
import org.libreccm.security.Relation;
|
|
||||||
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Association class describing the association between a category and an
|
* Association class describing the association between a category and an
|
||||||
* object. Instances of these class should not created manually. The methods
|
* object. Instances of these class should not created manually. The methods
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,8 @@ public class CategorizationIdGenerator extends ObjectIdGenerator<String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IdKey key(Object key) {
|
public IdKey key(Object key) {
|
||||||
if (key == null) {
|
if (key == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
return new IdKey(Categorization.class, Categorization.class, key);
|
return new IdKey(Categorization.class, Categorization.class, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,22 +28,7 @@ import org.libreccm.l10n.LocalizedString;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
import org.libreccm.security.RecursivePermissions;
|
import org.libreccm.security.RecursivePermissions;
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Embedded;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.JoinTable;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.NamedEntityGraphs;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerator;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdResolver;
|
import com.fasterxml.jackson.annotation.ObjectIdResolver;
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
|
||||||
* @version created on 3/23/17
|
* @version created on 3/23/17
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
import static org.libreccm.categorization.CategorizationConstants.*;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
@ -29,19 +27,16 @@ import org.libreccm.security.PermissionChecker;
|
||||||
import org.libreccm.security.RequiresPrivilege;
|
import org.libreccm.security.RequiresPrivilege;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.StringJoiner;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.libreccm.categorization.CategorizationConstants.PRIVILEGE_MANAGE_CATEGORY;
|
||||||
|
import static org.libreccm.categorization.CategorizationConstants.PRIVILEGE_MANAGE_CATEGORY_OBJECTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code CategoryManager} provides several helper methods for managing
|
* The {@code CategoryManager} provides several helper methods for managing
|
||||||
|
|
|
||||||
|
|
@ -18,44 +18,28 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
import static org.libreccm.categorization.CategorizationConstants.*;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
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.NotBlank;
|
||||||
import org.hibernate.validator.constraints.URL;
|
import org.hibernate.validator.constraints.URL;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
import org.libreccm.portation.Portable;
|
||||||
import org.libreccm.security.RecursivePermissions;
|
import org.libreccm.security.RecursivePermissions;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import javax.persistence.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
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.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.NamedEntityGraphs;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.NamedSubgraph;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.Temporal;
|
|
||||||
import javax.persistence.TemporalType;
|
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.libreccm.categorization.CategorizationConstants.CAT_XML_NS;
|
||||||
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A domain is collection of categories designed a specific purpose. This entity
|
* A domain is collection of categories designed a specific purpose. This entity
|
||||||
|
|
@ -77,6 +61,8 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
query = "SELECT d FROM Domain d WHERE d.domainKey = :key"),
|
query = "SELECT d FROM Domain d WHERE d.domainKey = :key"),
|
||||||
@NamedQuery(name = "Domain.findByUri",
|
@NamedQuery(name = "Domain.findByUri",
|
||||||
query = "SELECT d FROM Domain d WHERE d.uri = :uri"),
|
query = "SELECT d FROM Domain d WHERE d.uri = :uri"),
|
||||||
|
@NamedQuery(name = "Domain.findByUuid",
|
||||||
|
query = "SELECT d FROM Domain d WHERE d.uuid = :uuid"),
|
||||||
@NamedQuery(name = "Domain.findAll",
|
@NamedQuery(name = "Domain.findAll",
|
||||||
query = "SELECT d FROM Domain d ORDER BY d.domainKey"),
|
query = "SELECT d FROM Domain d ORDER BY d.domainKey"),
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
|
|
@ -110,7 +96,10 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@XmlRootElement(name = "domain", namespace = CAT_XML_NS)
|
@XmlRootElement(name = "domain", namespace = CAT_XML_NS)
|
||||||
public class Domain extends CcmObject implements Serializable {
|
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||||
|
resolver = DomainIdResolver.class,
|
||||||
|
property = "uuid")
|
||||||
|
public class Domain extends CcmObject implements Serializable, Portable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4012590760598188732L;
|
private static final long serialVersionUID = 4012590760598188732L;
|
||||||
|
|
||||||
|
|
@ -192,6 +181,7 @@ public class Domain extends CcmObject implements Serializable {
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "ROOT_CATEGORY_ID")
|
@JoinColumn(name = "ROOT_CATEGORY_ID")
|
||||||
@XmlElement(name = "root", namespace = CAT_XML_NS)
|
@XmlElement(name = "root", namespace = CAT_XML_NS)
|
||||||
|
@JsonIdentityReference(alwaysAsId = true)
|
||||||
private Category root;
|
private Category root;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -199,6 +189,7 @@ public class Domain extends CcmObject implements Serializable {
|
||||||
*/
|
*/
|
||||||
@OneToMany(mappedBy = "domain")
|
@OneToMany(mappedBy = "domain")
|
||||||
@XmlElementWrapper(name = "owners", namespace = CAT_XML_NS)
|
@XmlElementWrapper(name = "owners", namespace = CAT_XML_NS)
|
||||||
|
@JsonIgnore
|
||||||
private List<DomainOwnership> owners;
|
private List<DomainOwnership> owners;
|
||||||
|
|
||||||
public Domain() {
|
public Domain() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdResolver;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/2/17
|
||||||
|
*/
|
||||||
|
public class DomainIdResolver implements ObjectIdResolver {
|
||||||
|
@Override
|
||||||
|
public void bindItem(ObjectIdGenerator.IdKey idKey, Object o) {
|
||||||
|
// According to the Jackson JavaDoc, this method can be used to keep
|
||||||
|
// track of objects directly in a resolver implementation. We don't need
|
||||||
|
// this here therefore this method is empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object resolveId(ObjectIdGenerator.IdKey id) {
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final DomainRepository domainRepository = cdiUtil
|
||||||
|
.findBean(DomainRepository.class);
|
||||||
|
|
||||||
|
return domainRepository
|
||||||
|
.findByUuid(id.key.toString())
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException(String
|
||||||
|
.format("No Domain with uuid %s in the database.",
|
||||||
|
id.key.toString())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectIdResolver newForDeserialization(Object o) {
|
||||||
|
return new DomainIdResolver();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUseFor(ObjectIdResolver resolverType) {
|
||||||
|
return resolverType instanceof DomainIdResolver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -23,14 +23,13 @@ import org.libreccm.security.RequiresPrivilege;
|
||||||
import org.libreccm.web.ApplicationRepository;
|
import org.libreccm.web.ApplicationRepository;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides several methods when managing the relations between {@link Domain}s
|
* Provides several methods when managing the relations between {@link Domain}s
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
|
import org.libreccm.portation.AbstractMarshaller;
|
||||||
|
import org.libreccm.portation.Marshals;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/22/17
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Marshals(Domain.class)
|
||||||
|
public class DomainMarshaller extends AbstractMarshaller<Domain> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DomainRepository domainRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<Domain> getObjectClass() {
|
||||||
|
return Domain.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void insertIntoDb(Domain portableObject) {
|
||||||
|
domainRepository.save(portableObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -18,23 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
import org.libreccm.portation.Portable;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Association class for the association between a {@link Domain} and a
|
* Association class for the association between a {@link Domain} and a
|
||||||
|
|
@ -52,7 +46,9 @@ import javax.persistence.Table;
|
||||||
query = "SELECT o FROM DomainOwnership o "
|
query = "SELECT o FROM DomainOwnership o "
|
||||||
+ "WHERE o.owner = :owner AND o.domain = :domain")
|
+ "WHERE o.owner = :owner AND o.domain = :domain")
|
||||||
})
|
})
|
||||||
public class DomainOwnership implements Serializable {
|
@JsonIdentityInfo(generator = DomainOwnershipIdGenerator.class,
|
||||||
|
property = "customOwnId")
|
||||||
|
public class DomainOwnership implements Serializable, Portable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 201504301305L;
|
private static final long serialVersionUID = 201504301305L;
|
||||||
|
|
||||||
|
|
@ -64,18 +60,20 @@ public class DomainOwnership implements Serializable {
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
private long ownershipId;
|
private long ownershipId;
|
||||||
|
|
||||||
/**
|
|
||||||
* The {@link CcmObject} owning the {@link Domain}.
|
|
||||||
*/
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
private CcmApplication owner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link Domain} owned by the {@link CcmObject}.
|
* The {@link Domain} owned by the {@link CcmObject}.
|
||||||
*/
|
*/
|
||||||
@ManyToOne(optional = false)
|
@ManyToOne(optional = false)
|
||||||
|
@JsonIdentityReference(alwaysAsId = true)
|
||||||
private Domain domain;
|
private Domain domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link CcmObject} owning the {@link Domain}.
|
||||||
|
*/
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JsonIdentityReference(alwaysAsId = true)
|
||||||
|
private CcmApplication owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The context for the domain mapping.
|
* The context for the domain mapping.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/10/17
|
||||||
|
*/
|
||||||
|
public class DomainOwnershipIdGenerator extends ObjectIdGenerator<String> {
|
||||||
|
@Override
|
||||||
|
public Class<?> getScope() {
|
||||||
|
return DomainOwnership.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUseFor(ObjectIdGenerator<?> objectIdGenerator) {
|
||||||
|
return objectIdGenerator instanceof DomainOwnershipIdGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectIdGenerator<String> forScope(Class<?> aClass) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectIdGenerator<String> newForSerialization(Object o) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IdKey key(Object key) {
|
||||||
|
if (key == null)
|
||||||
|
return null;
|
||||||
|
return new IdKey(DomainOwnership.class, DomainOwnership.class, key);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String generateId(Object forPojo) {
|
||||||
|
if (!(forPojo instanceof DomainOwnership)) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Only DomainOwnerships instances are supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final DomainOwnership domainOwnership = (DomainOwnership) forPojo;
|
||||||
|
|
||||||
|
return String.format("{%s}{%s}",
|
||||||
|
domainOwnership.getDomain().getDomainKey(),
|
||||||
|
domainOwnership.getOwner().getPrimaryUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
|
import org.libreccm.portation.AbstractMarshaller;
|
||||||
|
import org.libreccm.portation.Marshals;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/23/17
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Marshals(DomainOwnership.class)
|
||||||
|
public class DomainOwnershipMarshaller extends AbstractMarshaller<DomainOwnership> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DomainOwnership> getObjectClass() {
|
||||||
|
return DomainOwnership.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void insertIntoDb(DomainOwnership portableObject) {
|
||||||
|
if (portableObject.getOwnershipId() == 0) {
|
||||||
|
entityManager.persist(portableObject);
|
||||||
|
} else {
|
||||||
|
entityManager.merge(portableObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,19 +22,16 @@ import org.libreccm.core.AbstractEntityRepository;
|
||||||
import org.libreccm.security.AuthorizationRequired;
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
import org.libreccm.security.RequiresPrivilege;
|
import org.libreccm.security.RequiresPrivilege;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.persistence.EntityGraph;
|
||||||
|
import javax.persistence.NoResultException;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.persistence.EntityGraph;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.NoResultException;
|
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A repository for executing CRUD operations on {@link Domain} objects.
|
* A repository for executing CRUD operations on {@link Domain} objects.
|
||||||
*
|
*
|
||||||
|
|
@ -47,9 +44,6 @@ import javax.transaction.Transactional;
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
||||||
|
|
||||||
@Inject
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Domain> getEntityClass() {
|
public Class<Domain> getEntityClass() {
|
||||||
return Domain.class;
|
return Domain.class;
|
||||||
|
|
@ -82,12 +76,12 @@ public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
||||||
* {@code null} if there is no such {@code Domain}.
|
* {@code null} if there is no such {@code Domain}.
|
||||||
*/
|
*/
|
||||||
public Optional<Domain> findByDomainKey(final String domainKey) {
|
public Optional<Domain> findByDomainKey(final String domainKey) {
|
||||||
final TypedQuery<Domain> query = entityManager.createNamedQuery(
|
final TypedQuery<Domain> query = getEntityManager()
|
||||||
"Domain.findByKey", Domain.class);
|
.createNamedQuery("Domain.findByKey", Domain.class);
|
||||||
query.setParameter("key", domainKey);
|
query.setParameter("key", domainKey);
|
||||||
|
|
||||||
final EntityGraph<?> graph = entityManager.getEntityGraph(
|
final EntityGraph<?> graph = getEntityManager()
|
||||||
"Domain.allCategories");
|
.getEntityGraph( "Domain.allCategories");
|
||||||
query.setHint("javax.persistence.fetchgraph", graph);
|
query.setHint("javax.persistence.fetchgraph", graph);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -106,19 +100,38 @@ public class DomainRepository extends AbstractEntityRepository<Long, Domain> {
|
||||||
* if there is so such {@code Domain}.
|
* if there is so such {@code Domain}.
|
||||||
*/
|
*/
|
||||||
public Domain findByUri(final URI uri) {
|
public Domain findByUri(final URI uri) {
|
||||||
final TypedQuery<Domain> query = entityManager.createNamedQuery(
|
final TypedQuery<Domain> query = getEntityManager()
|
||||||
"Domain.findByUri", Domain.class);
|
.createNamedQuery("Domain.findByUri", Domain.class);
|
||||||
query.setParameter("uri", uri);
|
query.setParameter("uri", uri);
|
||||||
|
|
||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a {@link Domain} by its uuid.
|
||||||
|
*
|
||||||
|
* @param uuid The uuid of the item to find
|
||||||
|
*
|
||||||
|
* @return An optional either with the found item or empty
|
||||||
|
*/
|
||||||
|
public Optional<Domain> findByUuid(final String uuid) {
|
||||||
|
final TypedQuery<Domain> query = getEntityManager()
|
||||||
|
.createNamedQuery("Domain.findByUuid", Domain.class);
|
||||||
|
query.setParameter("uuid", uuid);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Optional.of(query.getSingleResult());
|
||||||
|
} catch (NoResultException ex) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Domain> search(final String term) {
|
public List<Domain> search(final String term) {
|
||||||
final TypedQuery<Domain> query = entityManager.createNamedQuery(
|
final TypedQuery<Domain> query = getEntityManager()
|
||||||
"Domain.search", Domain.class);
|
.createNamedQuery("Domain.search", Domain.class);
|
||||||
query.setParameter("term", term);
|
query.setParameter("term", term);
|
||||||
final EntityGraph<?> graph = entityManager.getEntityGraph(
|
final EntityGraph<?> graph = getEntityManager()
|
||||||
"Domain.withOwners");
|
.getEntityGraph("Domain.withOwners");
|
||||||
query.setHint("javax.persistence.fetchgraph", graph);
|
query.setHint("javax.persistence.fetchgraph", graph);
|
||||||
|
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
import static org.libreccm.categorization.CategorizationConstants.*;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlNs;
|
import javax.xml.bind.annotation.XmlNs;
|
||||||
import javax.xml.bind.annotation.XmlSchema;
|
import javax.xml.bind.annotation.XmlSchema;
|
||||||
|
|
||||||
|
import static org.libreccm.categorization.CategorizationConstants.CAT_XML_NS;
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,6 @@ package org.libreccm.core;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityGraph;
|
import javax.persistence.EntityGraph;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
@ -35,6 +29,7 @@ import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base class providing common method needed by every repository.
|
* A base class providing common method needed by every repository.
|
||||||
|
|
|
||||||
|
|
@ -18,36 +18,27 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
import com.arsdigita.ui.admin.applications.AdminApplicationCreator;
|
|
||||||
import com.arsdigita.ui.admin.AdminServlet;
|
import com.arsdigita.ui.admin.AdminServlet;
|
||||||
import com.arsdigita.ui.admin.AdminUiConstants;
|
import com.arsdigita.ui.admin.AdminUiConstants;
|
||||||
|
import com.arsdigita.ui.admin.applications.AdminApplicationCreator;
|
||||||
import com.arsdigita.ui.admin.applications.AdminApplicationSetup;
|
import com.arsdigita.ui.admin.applications.AdminApplicationSetup;
|
||||||
import com.arsdigita.ui.login.LoginApplicationCreator;
|
import com.arsdigita.ui.login.LoginApplicationCreator;
|
||||||
import com.arsdigita.ui.login.LoginServlet;
|
|
||||||
import com.arsdigita.ui.login.LoginApplicationSetup;
|
import com.arsdigita.ui.login.LoginApplicationSetup;
|
||||||
import com.arsdigita.ui.login.LoginConstants;
|
import com.arsdigita.ui.login.LoginConstants;
|
||||||
|
import com.arsdigita.ui.login.LoginServlet;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.libreccm.admin.ui.AdminJsfApplicationCreator;
|
import org.libreccm.admin.ui.AdminJsfApplicationCreator;
|
||||||
import org.libreccm.admin.ui.AdminJsfApplicationSetup;
|
import org.libreccm.admin.ui.AdminJsfApplicationSetup;
|
||||||
|
import org.libreccm.modules.*;
|
||||||
import org.libreccm.modules.CcmModule;
|
|
||||||
import org.libreccm.modules.InitEvent;
|
|
||||||
import org.libreccm.modules.InstallEvent;
|
|
||||||
import org.libreccm.modules.Module;
|
|
||||||
import org.libreccm.modules.ShutdownEvent;
|
|
||||||
import org.libreccm.modules.UnInstallEvent;
|
|
||||||
import org.libreccm.security.SystemUsersSetup;
|
import org.libreccm.security.SystemUsersSetup;
|
||||||
|
|
||||||
import org.libreccm.web.ApplicationType;
|
import org.libreccm.web.ApplicationType;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
|
||||||
|
|
@ -29,17 +29,7 @@ import org.libreccm.categorization.Category;
|
||||||
import org.libreccm.categorization.CategoryManager;
|
import org.libreccm.categorization.CategoryManager;
|
||||||
import org.libreccm.security.Permission;
|
import org.libreccm.security.Permission;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Inheritance;
|
|
||||||
import javax.persistence.InheritanceType;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,17 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Email;
|
import org.hibernate.validator.constraints.Email;
|
||||||
import org.hibernate.validator.constraints.NotBlank;
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An embeddable entity for storing email addresses.
|
* An embeddable entity for storing email addresses.
|
||||||
|
|
|
||||||
|
|
@ -18,29 +18,18 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
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.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
import org.libreccm.web.CcmApplication;
|
import org.libreccm.web.CcmApplication;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
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;
|
|
||||||
import javax.persistence.Temporal;
|
|
||||||
import javax.persistence.TemporalType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code Resource} class is a base class for several other classes, for
|
* The {@code Resource} class is a base class for several other classes, for
|
||||||
|
|
@ -58,6 +47,13 @@ import javax.persistence.TemporalType;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "RESOURCES", schema = DB_SCHEMA)
|
@Table(name = "RESOURCES", schema = DB_SCHEMA)
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name = "Resource.findByUuid",
|
||||||
|
query = "SELECT r FROM Resource r WHERE r.uuid = :uuid"),
|
||||||
|
})
|
||||||
|
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||||
|
resolver = ResourceIdResolver.class,
|
||||||
|
property = "uuid")
|
||||||
public class Resource extends CcmObject implements Serializable {
|
public class Resource extends CcmObject implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7345482620613842781L;
|
private static final long serialVersionUID = 7345482620613842781L;
|
||||||
|
|
@ -87,6 +83,7 @@ public class Resource extends CcmObject implements Serializable {
|
||||||
private LocalizedString description;
|
private LocalizedString description;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JsonIdentityReference(alwaysAsId = true)
|
||||||
private ResourceType resourceType;
|
private ResourceType resourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -100,6 +97,7 @@ public class Resource extends CcmObject implements Serializable {
|
||||||
* The child resources of this resource.
|
* The child resources of this resource.
|
||||||
*/
|
*/
|
||||||
@OneToMany(mappedBy = "parent")
|
@OneToMany(mappedBy = "parent")
|
||||||
|
@JsonIgnore
|
||||||
private List<Resource> childs;
|
private List<Resource> childs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -107,6 +105,7 @@ public class Resource extends CcmObject implements Serializable {
|
||||||
* the property will be null.
|
* the property will be null.
|
||||||
*/
|
*/
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@JsonIdentityReference(alwaysAsId = true)
|
||||||
private Resource parent;
|
private Resource parent;
|
||||||
|
|
||||||
public Resource() {
|
public Resource() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdResolver;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/10/17
|
||||||
|
*/
|
||||||
|
public class ResourceIdResolver implements ObjectIdResolver {
|
||||||
|
@Override
|
||||||
|
public void bindItem(ObjectIdGenerator.IdKey idKey, Object o) {
|
||||||
|
// According to the Jackson JavaDoc, this method can be used to keep
|
||||||
|
// track of objects directly in a resolver implementation. We don't need
|
||||||
|
// this here therefore this method is empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object resolveId(ObjectIdGenerator.IdKey id) {
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final ResourceRepository resourceRepository = cdiUtil.findBean
|
||||||
|
(ResourceRepository.class);
|
||||||
|
|
||||||
|
return resourceRepository
|
||||||
|
.findByUuid(id.key.toString())
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException(String
|
||||||
|
.format("No Resource with uuid %s in the database.",
|
||||||
|
id.key.toString())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectIdResolver newForDeserialization(Object o) {
|
||||||
|
return new ResourceIdResolver();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUseFor(ObjectIdResolver resolverType) {
|
||||||
|
return resolverType instanceof ResourceIdResolver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.persistence.NoResultException;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A repository for executing CRUD operations on {@link Resource} objects.
|
||||||
|
*
|
||||||
|
* Note: This repository does the permission checks when retrieving
|
||||||
|
* {@link Resource}s from the database. This is the responsibility of the
|
||||||
|
* application using the {@link Resource}.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/10/17
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class ResourceRepository extends AbstractEntityRepository<Long,
|
||||||
|
Resource> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<Resource> getEntityClass() {
|
||||||
|
return Resource.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isNew(final Resource entity) {
|
||||||
|
return entity.getObjectId() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initNewEntity(final Resource resource) {
|
||||||
|
resource.setUuid(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a {@link Resource} by its uuid.
|
||||||
|
*
|
||||||
|
* @param uuid The uuid of the item to find
|
||||||
|
*
|
||||||
|
* @return An optional either with the found item or empty
|
||||||
|
*/
|
||||||
|
public Optional<Resource> findByUuid(final String uuid) {
|
||||||
|
final TypedQuery<Resource> query = getEntityManager()
|
||||||
|
.createNamedQuery("Resource.findByUuid", Resource.class);
|
||||||
|
query.setParameter("uuid", uuid);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Optional.of(query.getSingleResult());
|
||||||
|
} catch (NoResultException ex) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -18,23 +18,16 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
import org.libreccm.portation.Portable;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Embedded;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Inheritance;
|
|
||||||
import javax.persistence.InheritanceType;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.JoinTable;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import org.libreccm.l10n.LocalizedString;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a port of the old {@code ResourceType} entity.
|
* This class is a port of the old {@code ResourceType} entity.
|
||||||
|
|
@ -52,12 +45,19 @@ import org.libreccm.l10n.LocalizedString;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "RESOURCE_TYPES", schema = DB_SCHEMA)
|
@Table(name = "RESOURCE_TYPES", schema = DB_SCHEMA)
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
|
@NamedQueries({
|
||||||
|
@NamedQuery(name = "ResourceType.findByTitle",
|
||||||
|
query = "SELECT r FROM ResourceType r WHERE r.title = :title")
|
||||||
|
})
|
||||||
|
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||||
|
resolver = ResourceTypeIdResolver.class,
|
||||||
|
property = "title")
|
||||||
@SuppressWarnings({"PMD.CyclomaticComplexity",
|
@SuppressWarnings({"PMD.CyclomaticComplexity",
|
||||||
"PMD.StdCyclomaticComplexity",
|
"PMD.StdCyclomaticComplexity",
|
||||||
"PMD.ModifiedCyclomaticComplexity",
|
"PMD.ModifiedCyclomaticComplexity",
|
||||||
"PMD.NPathComplexity",
|
"PMD.NPathComplexity",
|
||||||
"PMD.LongVariable"})
|
"PMD.LongVariable"})
|
||||||
public class ResourceType implements Serializable {
|
public class ResourceType implements Serializable, Portable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4563584142251370627L;
|
private static final long serialVersionUID = 4563584142251370627L;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdResolver;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/10/17
|
||||||
|
*/
|
||||||
|
public class ResourceTypeIdResolver implements ObjectIdResolver {
|
||||||
|
@Override
|
||||||
|
public void bindItem(ObjectIdGenerator.IdKey idKey, Object o) {
|
||||||
|
// According to the Jackson JavaDoc, this method can be used to keep
|
||||||
|
// track of objects directly in a resolver implementation. We don't need
|
||||||
|
// this here therefore this method is empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object resolveId(ObjectIdGenerator.IdKey id) {
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final ResourceTypeRepository resourceTypeRepository = cdiUtil
|
||||||
|
.findBean(ResourceTypeRepository.class);
|
||||||
|
|
||||||
|
return resourceTypeRepository
|
||||||
|
.findByTitle(id.key.toString())
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException(String
|
||||||
|
.format("No ResourceType with title %s in the " +
|
||||||
|
"database.", id.key.toString())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectIdResolver newForDeserialization(Object o) {
|
||||||
|
return new ResourceTypeIdResolver();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUseFor(ObjectIdResolver resolverType) {
|
||||||
|
return resolverType instanceof ResourceTypeIdResolver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import org.libreccm.portation.AbstractMarshaller;
|
||||||
|
import org.libreccm.portation.Marshals;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/22/17
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Marshals(ResourceType.class)
|
||||||
|
public class ResourceTypeMarshaller extends AbstractMarshaller<ResourceType> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ResourceTypeRepository resourceTypeRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ResourceType> getObjectClass() {
|
||||||
|
return ResourceType.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void insertIntoDb(ResourceType portableObject) {
|
||||||
|
resourceTypeRepository.save(portableObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.persistence.NoResultException;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A repository for executing CRUD operations on {@link ResourceType} objects.
|
||||||
|
*
|
||||||
|
* Note: This repository does the permission checks when retrieving
|
||||||
|
* {@link ResourceType}s from the database. This is the responsibility of the
|
||||||
|
* application using the {@link ResourceType}.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/10/17
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
public class ResourceTypeRepository extends AbstractEntityRepository<Long,
|
||||||
|
ResourceType> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<ResourceType> getEntityClass() {
|
||||||
|
return ResourceType.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isNew(final ResourceType entity) {
|
||||||
|
return entity.getTitle() == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a {@link ResourceType} by its title.
|
||||||
|
*
|
||||||
|
* @param title The title of the item to find
|
||||||
|
*
|
||||||
|
* @return An optional either with the found item or empty
|
||||||
|
*/
|
||||||
|
public Optional<ResourceType> findByTitle(final String title) {
|
||||||
|
final TypedQuery<ResourceType> query = getEntityManager()
|
||||||
|
.createNamedQuery("ResourceType.findByTitle", ResourceType.class);
|
||||||
|
query.setParameter("title", title);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Optional.of(query.getSingleResult());
|
||||||
|
} catch (NoResultException ex) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -25,10 +25,10 @@
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlNs;
|
import javax.xml.bind.annotation.XmlNs;
|
||||||
import javax.xml.bind.annotation.XmlSchema;
|
import javax.xml.bind.annotation.XmlSchema;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,14 @@
|
||||||
package org.libreccm.l10n;
|
package org.libreccm.l10n;
|
||||||
|
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the locale which has been selected based on the available languages
|
* Provides the locale which has been selected based on the available languages
|
||||||
|
|
|
||||||
|
|
@ -18,31 +18,19 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.l10n;
|
package org.libreccm.l10n;
|
||||||
|
|
||||||
import static org.libreccm.l10n.L10NConstants.*;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.ElementCollection;
|
|
||||||
import javax.persistence.Embeddable;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.Lob;
|
|
||||||
import javax.persistence.MapKeyColumn;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
import org.hibernate.search.annotations.Field;
|
import org.hibernate.search.annotations.Field;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.libreccm.l10n.L10NConstants.L10N_XML_NS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class for localisable string properties. This class is declared as
|
* A helper class for localisable string properties. This class is declared as
|
||||||
* embeddable, so that it can be used in every other entity. The localised
|
* embeddable, so that it can be used in every other entity. The localised
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
package org.libreccm.l10n;
|
package org.libreccm.l10n;
|
||||||
|
|
||||||
import static org.libreccm.l10n.L10NConstants.*;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlNs;
|
import javax.xml.bind.annotation.XmlNs;
|
||||||
import javax.xml.bind.annotation.XmlSchema;
|
import javax.xml.bind.annotation.XmlSchema;
|
||||||
|
|
||||||
|
import static org.libreccm.l10n.L10NConstants.L10N_XML_NS;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,12 @@ import org.apache.logging.log4j.Logger;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.interceptor.AroundInvoke;
|
import javax.interceptor.AroundInvoke;
|
||||||
import javax.interceptor.Interceptor;
|
import javax.interceptor.Interceptor;
|
||||||
import javax.interceptor.InvocationContext;
|
import javax.interceptor.InvocationContext;
|
||||||
|
import java.lang.annotation.Annotation;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A CDI interceptor which can be used to secure methods of CDI beans. To use
|
* A CDI interceptor which can be used to secure methods of CDI beans. To use
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
import javax.interceptor.InterceptorBinding;
|
import javax.interceptor.InterceptorBinding;
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this annotation to secure a method by the
|
* Use this annotation to secure a method by the
|
||||||
|
|
|
||||||
|
|
@ -19,19 +19,16 @@
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
import org.apache.shiro.authc.AuthenticationException;
|
import org.apache.shiro.authc.AuthenticationException;
|
||||||
import org.apache.shiro.authz.AuthorizationInfo;
|
import org.apache.shiro.authz.AuthorizationInfo;
|
||||||
import org.apache.shiro.authz.SimpleAuthorizationInfo;
|
import org.apache.shiro.authz.SimpleAuthorizationInfo;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This bean provides several services for the {@link CcmShiroRealm}. It wraps
|
* This bean provides several services for the {@link CcmShiroRealm}. It wraps
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import com.arsdigita.mail.Mail;
|
||||||
import com.arsdigita.ui.login.LoginConstants;
|
import com.arsdigita.ui.login.LoginConstants;
|
||||||
import com.arsdigita.web.ParameterMap;
|
import com.arsdigita.web.ParameterMap;
|
||||||
import com.arsdigita.web.URL;
|
import com.arsdigita.web.URL;
|
||||||
|
|
||||||
import org.apache.commons.lang.text.StrSubstitutor;
|
import org.apache.commons.lang.text.StrSubstitutor;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
@ -33,16 +32,11 @@ import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.l10n.GlobalizationHelper;
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
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.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import static com.arsdigita.ui.login.LoginServlet.*;
|
import static com.arsdigita.ui.login.LoginServlet.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.*;
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.NamedEntityGraphs;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.NamedSubgraph;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,13 @@ package org.libreccm.security;
|
||||||
|
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager class providing methods for adding and removing members to and from
|
* Manager class providing methods for adding and removing members to and from
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
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.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,14 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
|
|
||||||
import org.libreccm.core.AbstractEntityRepository;
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
import java.util.Optional;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository for groups.
|
* Repository for groups.
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,6 @@
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.security.SecurityConfig;
|
import com.arsdigita.kernel.security.SecurityConfig;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneOffset;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.RandomStringUtils;
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
import org.apache.shiro.authc.credential.PasswordMatcher;
|
import org.apache.shiro.authc.credential.PasswordMatcher;
|
||||||
import org.apache.shiro.authc.credential.PasswordService;
|
import org.apache.shiro.authc.credential.PasswordService;
|
||||||
|
|
@ -43,8 +29,19 @@ import org.apache.shiro.crypto.hash.format.HashFormat;
|
||||||
import org.apache.shiro.crypto.hash.format.HashFormatFactory;
|
import org.apache.shiro.crypto.hash.format.HashFormatFactory;
|
||||||
import org.apache.shiro.crypto.hash.format.Shiro1CryptFormat;
|
import org.apache.shiro.crypto.hash.format.Shiro1CryptFormat;
|
||||||
import org.apache.shiro.util.ByteSource;
|
import org.apache.shiro.util.ByteSource;
|
||||||
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages the generation and delation of {@link OneTimeAuthToken}s.
|
* This class manages the generation and delation of {@link OneTimeAuthToken}s.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,26 +18,12 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
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;
|
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code OneTimeAuthToken} is used as a one time authentication mechanism
|
* The {@code OneTimeAuthToken} is used as a one time authentication mechanism
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,6 @@ import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneOffset;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.ejb.Singleton;
|
import javax.ejb.Singleton;
|
||||||
|
|
@ -36,6 +32,9 @@ import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This EJB uses the {@link TimerService} to run a cleanup task periodically to
|
* This EJB uses the {@link TimerService} to run a cleanup task periodically to
|
||||||
|
|
|
||||||
|
|
@ -22,24 +22,10 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Inheritance;
|
|
||||||
import javax.persistence.InheritanceType;
|
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.NamedEntityGraphs;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
|
||||||
|
|
@ -26,19 +26,7 @@ import org.hibernate.search.annotations.IndexedEmbedded;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
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.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.Temporal;
|
|
||||||
import javax.persistence.TemporalType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
|
||||||
|
|
@ -18,25 +18,20 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.apache.shiro.authz.AuthorizationException;
|
import org.apache.shiro.authz.AuthorizationException;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.ACCESS_DENIED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An utility class for checking permissions. Uses the current {@link Subject}
|
* An utility class for checking permissions. Uses the current {@link Subject}
|
||||||
|
|
|
||||||
|
|
@ -20,29 +20,25 @@ package org.libreccm.security;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.Query;
|
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
|
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.core.CcmObjectRepository;
|
import org.libreccm.core.CcmObjectRepository;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.core.UnexpectedErrorException;
|
import org.libreccm.core.UnexpectedErrorException;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.Query;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager class for granting and revoking permissions.
|
* Manager class for granting and revoking permissions.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,13 @@
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import com.arsdigita.ui.login.UserNewForm;
|
import com.arsdigita.ui.login.UserNewForm;
|
||||||
|
|
||||||
import org.apache.logging.log4j.util.Strings;
|
import org.apache.logging.log4j.util.Strings;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,7 @@ package org.libreccm.security;
|
||||||
|
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.*;
|
||||||
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}
|
* This annotation is used together with the {@link AuthorizationRequired}
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.*;
|
||||||
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}
|
* This annotation is used together with the {@link AuthorizationRequired}
|
||||||
|
|
|
||||||
|
|
@ -27,35 +27,10 @@ import org.libreccm.l10n.LocalizedString;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
import org.libreccm.workflow.TaskAssignment;
|
import org.libreccm.workflow.TaskAssignment;
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Column;
|
import javax.xml.bind.annotation.*;
|
||||||
import javax.persistence.Embedded;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.JoinTable;
|
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.NamedEntityGraphs;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
|
||||||
|
|
@ -20,18 +20,17 @@ package org.libreccm.security;
|
||||||
|
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager for roles providing methods for assigning the role the {@link Party}
|
* Manager for roles providing methods for assigning the role the {@link Party}
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
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.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,15 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
|
|
||||||
import org.libreccm.core.AbstractEntityRepository;
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
import org.libreccm.core.CcmObject;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.libreccm.cdi.utils.CdiUtil;
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.ACCESS_DENIED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper class used by the secured collections provided by this package.
|
* A helper class used by the secured collections provided by this package.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import org.libreccm.core.CcmObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A decorator for {@link List}s of {@link CcmObject}s which checks if the
|
* A decorator for {@link List}s of {@link CcmObject}s which checks if the
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import java.util.ListIterator;
|
|
||||||
|
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
|
import java.util.ListIterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A decorator for {@link ListIterator} which checks if the current subject is
|
* A decorator for {@link ListIterator} which checks if the current subject is
|
||||||
* permitted to access an object from the list the iterator iterates over before
|
* permitted to access an object from the list the iterator iterates over before
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NavigableSet;
|
import java.util.NavigableSet;
|
||||||
import org.libreccm.core.CcmObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A decorated for {@link NavigableSet} which checks if the current subject is
|
* A decorated for {@link NavigableSet} which checks if the current subject is
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A decorator for {@link Set} which checks if the current subject is permitted
|
* A decorator for {@link Set} which checks if the current subject is permitted
|
||||||
* to access the objects from the decorated set before returning them.
|
* to access the objects from the decorated set before returning them.
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import org.libreccm.core.CcmObject;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorator for {@link SortedSet} which checks if the current subject is
|
* Decorator for {@link SortedSet} which checks if the current subject is
|
||||||
* permitted to access the objects from the decorated sorted set before
|
* permitted to access the objects from the decorated sorted set before
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,6 @@
|
||||||
package org.libreccm.security;
|
package org.libreccm.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationHandler;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.Proxy;
|
|
||||||
|
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
|
||||||
import javax.enterprise.inject.Produces;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.mgt.SecurityManager;
|
import org.apache.shiro.mgt.SecurityManager;
|
||||||
import org.apache.shiro.session.Session;
|
import org.apache.shiro.session.Session;
|
||||||
|
|
@ -37,6 +26,14 @@ import org.apache.shiro.subject.PrincipalCollection;
|
||||||
import org.apache.shiro.subject.SimplePrincipalCollection;
|
import org.apache.shiro.subject.SimplePrincipalCollection;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
|
||||||
|
import javax.enterprise.context.ApplicationScoped;
|
||||||
|
import javax.enterprise.inject.Produces;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,11 @@ import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.core.EmailAddress;
|
import org.libreccm.core.EmailAddress;
|
||||||
import org.libreccm.modules.InstallEvent;
|
import org.libreccm.modules.InstallEvent;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used by {@link CcmCore#install(org.libreccm.modules.InstallEvent)} to
|
* Class used by {@link CcmCore#install(org.libreccm.modules.InstallEvent)} to
|
||||||
* create the system users.
|
* create the system users.
|
||||||
|
|
|
||||||
|
|
@ -20,42 +20,15 @@ package org.libreccm.security;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
import org.libreccm.core.EmailAddress;
|
import org.libreccm.core.EmailAddress;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import javax.persistence.*;
|
||||||
import javax.persistence.CollectionTable;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.ElementCollection;
|
|
||||||
import javax.persistence.Embedded;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.JoinTable;
|
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.NamedEntityGraphs;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.NamedSubgraph;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.*;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
import static org.libreccm.core.CoreConstants.CORE_XML_NS;
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,6 @@ package org.libreccm.security;
|
||||||
|
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
import com.arsdigita.kernel.security.SecurityConfig;
|
import com.arsdigita.kernel.security.SecurityConfig;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
import javax.validation.executable.ValidateOnExecution;
|
|
||||||
|
|
||||||
import org.apache.shiro.authc.credential.PasswordMatcher;
|
import org.apache.shiro.authc.credential.PasswordMatcher;
|
||||||
import org.apache.shiro.authc.credential.PasswordService;
|
import org.apache.shiro.authc.credential.PasswordService;
|
||||||
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
||||||
|
|
@ -41,7 +34,11 @@ import org.libreccm.configuration.ConfigurationManager;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.core.EmailAddress;
|
import org.libreccm.core.EmailAddress;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.executable.ValidateOnExecution;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides various operations for user objects.
|
* Provides various operations for user objects.
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,12 @@ package org.libreccm.security;
|
||||||
import org.libreccm.core.AbstractEntityRepository;
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.persistence.EntityGraph;
|
import javax.persistence.EntityGraph;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository for user objects.
|
* Repository for user objects.
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,11 @@ import org.libreccm.modules.InstallEvent;
|
||||||
import org.libreccm.security.ApplicationRoleSetup;
|
import org.libreccm.security.ApplicationRoleSetup;
|
||||||
import org.libreccm.security.Role;
|
import org.libreccm.security.Role;
|
||||||
|
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,6 @@ import org.libreccm.modules.Module;
|
||||||
import org.libreccm.security.AuthorizationRequired;
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
import org.libreccm.security.RequiresPrivilege;
|
import org.libreccm.security.RequiresPrivilege;
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
import javax.enterprise.context.ApplicationScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
@ -45,6 +37,7 @@ import javax.persistence.TypedQuery;
|
||||||
import javax.servlet.annotation.WebServlet;
|
import javax.servlet.annotation.WebServlet;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,12 @@ import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.security.AuthorizationRequired;
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
import org.libreccm.security.RequiresPrivilege;
|
import org.libreccm.security.RequiresPrivilege;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -88,6 +87,26 @@ public class ApplicationRepository
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a {@link CcmApplication} by its uuid.
|
||||||
|
*
|
||||||
|
* @param uuid The uuid of the item to find
|
||||||
|
*
|
||||||
|
* @return An optional either with the found item or empty
|
||||||
|
*/
|
||||||
|
public Optional<CcmApplication> findByUuid(final String uuid) {
|
||||||
|
final TypedQuery<CcmApplication> query = getEntityManager()
|
||||||
|
.createNamedQuery("CcmApplication.findByUuid",
|
||||||
|
CcmApplication.class);
|
||||||
|
query.setParameter("uuid", uuid);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Optional.of(query.getSingleResult());
|
||||||
|
} catch (NoResultException ex) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@AuthorizationRequired
|
@AuthorizationRequired
|
||||||
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,11 @@ import com.arsdigita.ui.admin.applications.AbstractAppSettingsPane;
|
||||||
import com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm;
|
import com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm;
|
||||||
import com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane;
|
import com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
import javax.servlet.annotation.WebServlet;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServlet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
|
||||||
|
|
@ -18,34 +18,27 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.web;
|
package org.libreccm.web;
|
||||||
|
|
||||||
import static org.libreccm.web.WebConstants.*;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
import org.libreccm.categorization.Domain;
|
import org.libreccm.categorization.Domain;
|
||||||
import org.libreccm.categorization.DomainManager;
|
import org.libreccm.categorization.DomainManager;
|
||||||
import org.libreccm.categorization.DomainOwnership;
|
import org.libreccm.categorization.DomainOwnership;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import org.libreccm.core.Resource;
|
import org.libreccm.core.Resource;
|
||||||
|
import org.libreccm.portation.Portable;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
import javax.persistence.Entity;
|
import static org.libreccm.web.WebConstants.WEB_XML_NS;
|
||||||
import javax.persistence.NamedAttributeNode;
|
|
||||||
import javax.persistence.NamedEntityGraph;
|
|
||||||
import javax.persistence.NamedEntityGraphs;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -59,7 +52,10 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
+ "WHERE a.primaryUrl = :path"),
|
+ "WHERE a.primaryUrl = :path"),
|
||||||
@NamedQuery(name = "CcmApplication.findByType",
|
@NamedQuery(name = "CcmApplication.findByType",
|
||||||
query = "SELECT A FROM CcmApplication a "
|
query = "SELECT A FROM CcmApplication a "
|
||||||
+ "WHERE a.applicationType = :type")
|
+ "WHERE a.applicationType = :type"),
|
||||||
|
@NamedQuery(name = "CcmApplication.findByUuid",
|
||||||
|
query = "SELECT a FROM CcmApplication a "
|
||||||
|
+ "WHERE a.uuid = :uuid")
|
||||||
})
|
})
|
||||||
@NamedEntityGraphs({
|
@NamedEntityGraphs({
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
|
|
@ -69,7 +65,10 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@XmlRootElement(name = "application", namespace = WEB_XML_NS)
|
@XmlRootElement(name = "application", namespace = WEB_XML_NS)
|
||||||
public class CcmApplication extends Resource implements Serializable {
|
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
|
||||||
|
resolver = CcmApplicationIdResolver.class,
|
||||||
|
property = "uuid")
|
||||||
|
public class CcmApplication extends Resource implements Serializable, Portable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 9205226362368890784L;
|
private static final long serialVersionUID = 9205226362368890784L;
|
||||||
|
|
||||||
|
|
@ -91,6 +90,7 @@ public class CcmApplication extends Resource implements Serializable {
|
||||||
@OneToMany(mappedBy = "owner")
|
@OneToMany(mappedBy = "owner")
|
||||||
@XmlElementWrapper(name = "domains", namespace = WEB_XML_NS)
|
@XmlElementWrapper(name = "domains", namespace = WEB_XML_NS)
|
||||||
@XmlElement(name = "domain", namespace = WEB_XML_NS)
|
@XmlElement(name = "domain", namespace = WEB_XML_NS)
|
||||||
|
@JsonIgnore
|
||||||
private List<DomainOwnership> domains;
|
private List<DomainOwnership> domains;
|
||||||
|
|
||||||
public CcmApplication() {
|
public CcmApplication() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.web;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdResolver;
|
||||||
|
import org.libreccm.cdi.utils.CdiUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/10/17
|
||||||
|
*/
|
||||||
|
public class CcmApplicationIdResolver implements ObjectIdResolver {
|
||||||
|
@Override
|
||||||
|
public void bindItem(ObjectIdGenerator.IdKey idKey, Object o) {
|
||||||
|
// According to the Jackson JavaDoc, this method can be used to keep
|
||||||
|
// track of objects directly in a resolver implementation. We don't need
|
||||||
|
// this here therefore this method is empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object resolveId(ObjectIdGenerator.IdKey id) {
|
||||||
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final ApplicationRepository applicationRepository = cdiUtil
|
||||||
|
.findBean(ApplicationRepository.class);
|
||||||
|
|
||||||
|
return applicationRepository
|
||||||
|
.findByUuid(id.key.toString())
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException(String
|
||||||
|
.format("No ccmApplications with uuid %s in the " +
|
||||||
|
"database.", id.key.toString())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectIdResolver newForDeserialization(Object o) {
|
||||||
|
return new CcmApplicationIdResolver();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUseFor(ObjectIdResolver objectIdResolver) {
|
||||||
|
return objectIdResolver instanceof CcmApplicationIdResolver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.web;
|
||||||
|
|
||||||
|
import org.libreccm.portation.AbstractMarshaller;
|
||||||
|
import org.libreccm.portation.Marshals;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
|
||||||
|
* @version created the 8/22/17
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Marshals(CcmApplication.class)
|
||||||
|
public class CcmApplicationMarshaller extends AbstractMarshaller<CcmApplication> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ApplicationRepository applicationRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<CcmApplication> getObjectClass() {
|
||||||
|
return CcmApplication.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void insertIntoDb(CcmApplication portableObject) {
|
||||||
|
applicationRepository.save(portableObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -18,18 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.web;
|
package org.libreccm.web;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
import javax.persistence.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.UniqueConstraint;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,12 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.web;
|
package org.libreccm.web;
|
||||||
|
|
||||||
import com.arsdigita.web.URL;
|
import javax.servlet.annotation.WebServlet;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
import javax.servlet.annotation.WebServlet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the path name of the location of the applications servlet/JSP.
|
* Provides the path name of the location of the applications servlet/JSP.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -24,22 +24,9 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.Temporal;
|
|
||||||
import javax.persistence.TemporalType;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,24 +19,17 @@
|
||||||
package org.libreccm.workflow;
|
package org.libreccm.workflow;
|
||||||
|
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
import org.libreccm.security.AuthorizationRequired;
|
import org.libreccm.security.*;
|
||||||
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 java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import org.libreccm.security.User;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
|
||||||
|
|
@ -26,25 +26,7 @@ import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.core.Identifiable;
|
import org.libreccm.core.Identifiable;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Embedded;
|
|
||||||
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.Inheritance;
|
|
||||||
import javax.persistence.InheritanceType;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.JoinTable;
|
|
||||||
import javax.persistence.ManyToMany;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityReference;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
import org.libreccm.security.Role;
|
import org.libreccm.security.Role;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
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.Table;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,24 +20,14 @@ package org.libreccm.workflow;
|
||||||
|
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
import org.libreccm.core.Identifiable;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
|
||||||
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.validation.constraints.NotNull;
|
|
||||||
import org.libreccm.core.Identifiable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A comment for a task. Comments are intended for other users, for example to
|
* A comment for a task. Comments are intended for other users, for example to
|
||||||
* inform them about problems etc. with the object.
|
* inform them about problems etc. with the object.
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,13 @@ import org.libreccm.security.RequiresPrivilege;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager for {@link Task}s. The logic of some of this methods has been taken
|
* Manager for {@link Task}s. The logic of some of this methods has been taken
|
||||||
|
|
|
||||||
|
|
@ -26,25 +26,7 @@ import org.libreccm.core.Identifiable;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
import org.libreccm.portation.Portable;
|
import org.libreccm.portation.Portable;
|
||||||
|
|
||||||
import javax.persistence.AssociationOverride;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Embedded;
|
|
||||||
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.Inheritance;
|
|
||||||
import javax.persistence.InheritanceType;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.JoinTable;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.NamedQueries;
|
|
||||||
import javax.persistence.NamedQuery;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@
|
||||||
package org.libreccm.workflow;
|
package org.libreccm.workflow;
|
||||||
|
|
||||||
import com.arsdigita.kernel.KernelConfig;
|
import com.arsdigita.kernel.KernelConfig;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.apache.shiro.subject.Subject;
|
||||||
import org.libreccm.configuration.ConfigurationManager;
|
import org.libreccm.configuration.ConfigurationManager;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
@ -29,19 +29,7 @@ import org.libreccm.l10n.LocalizedString;
|
||||||
import org.libreccm.security.AuthorizationRequired;
|
import org.libreccm.security.AuthorizationRequired;
|
||||||
import org.libreccm.security.RequiresPrivilege;
|
import org.libreccm.security.RequiresPrivilege;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
|
import org.libreccm.security.User;
|
||||||
import java.beans.BeanInfo;
|
|
||||||
import java.beans.IntrospectionException;
|
|
||||||
import java.beans.Introspector;
|
|
||||||
import java.beans.PropertyDescriptor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
@ -49,11 +37,13 @@ import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import java.beans.BeanInfo;
|
||||||
import org.apache.shiro.subject.Subject;
|
import java.beans.IntrospectionException;
|
||||||
import org.libreccm.security.User;
|
import java.beans.Introspector;
|
||||||
|
import java.beans.PropertyDescriptor;
|
||||||
import java.util.Optional;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager for {@link Workflow}s. The logic of some of these classes has been
|
* Manager for {@link Workflow}s. The logic of some of these classes has been
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,11 @@ package org.libreccm.workflow;
|
||||||
import org.libreccm.core.AbstractEntityRepository;
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository for {@link Workflow}s.
|
* Repository for {@link Workflow}s.
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,8 @@ package org.libreccm.workflow;
|
||||||
|
|
||||||
import org.libreccm.core.AbstractEntityRepository;
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A repository for {@link WorkflowTemplate}s.
|
* A repository for {@link WorkflowTemplate}s.
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,11 @@ import org.jboss.shrinkwrap.api.spec.WebArchive;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.libreccm.security.Group;
|
|
||||||
import org.libreccm.security.GroupRepository;
|
import org.libreccm.security.GroupRepository;
|
||||||
import org.libreccm.tests.categories.IntegrationTest;
|
import org.libreccm.tests.categories.IntegrationTest;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
|
import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -149,6 +146,11 @@ public class CoreDataImportTest {
|
||||||
|
|
||||||
|
|
||||||
Assert.assertFalse(importHelper.importCategories());
|
Assert.assertFalse(importHelper.importCategories());
|
||||||
|
Assert.assertFalse(importHelper.importCategorizations());
|
||||||
|
Assert.assertFalse(importHelper.importResourceTypes());
|
||||||
|
Assert.assertFalse(importHelper.importCcmApplications());
|
||||||
|
Assert.assertFalse(importHelper.importDomains());
|
||||||
|
Assert.assertFalse(importHelper.importDomainOwnerships());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,30 +18,13 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.portation;
|
package org.libreccm.portation;
|
||||||
|
|
||||||
import org.libreccm.categorization.Categorization;
|
import org.libreccm.categorization.*;
|
||||||
import org.libreccm.categorization.CategorizationMarshaller;
|
import org.libreccm.core.ResourceType;
|
||||||
import org.libreccm.categorization.Category;
|
import org.libreccm.core.ResourceTypeMarshaller;
|
||||||
import org.libreccm.categorization.CategoryMarshaller;
|
import org.libreccm.security.*;
|
||||||
import org.libreccm.security.Group;
|
import org.libreccm.web.CcmApplication;
|
||||||
import org.libreccm.security.GroupMarshaller;
|
import org.libreccm.web.CcmApplicationMarshaller;
|
||||||
import org.libreccm.security.GroupMembership;
|
import org.libreccm.workflow.*;
|
||||||
import org.libreccm.security.GroupMembershipMarshaller;
|
|
||||||
import org.libreccm.security.Permission;
|
|
||||||
import org.libreccm.security.PermissionMarshaller;
|
|
||||||
import org.libreccm.security.Role;
|
|
||||||
import org.libreccm.security.RoleMarshaller;
|
|
||||||
import org.libreccm.security.RoleMembership;
|
|
||||||
import org.libreccm.security.RoleMembershipMarshaller;
|
|
||||||
import org.libreccm.security.User;
|
|
||||||
import org.libreccm.security.UserMarshaller;
|
|
||||||
import org.libreccm.workflow.AssignableTask;
|
|
||||||
import org.libreccm.workflow.AssignableTaskMarshaller;
|
|
||||||
import org.libreccm.workflow.TaskAssignment;
|
|
||||||
import org.libreccm.workflow.TaskAssignmentMarshaller;
|
|
||||||
import org.libreccm.workflow.Workflow;
|
|
||||||
import org.libreccm.workflow.WorkflowMarshaller;
|
|
||||||
import org.libreccm.workflow.WorkflowTemplate;
|
|
||||||
import org.libreccm.workflow.WorkflowTemplateMarshaller;
|
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
@ -56,17 +39,11 @@ import javax.inject.Inject;
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
class ImportHelper {
|
class ImportHelper {
|
||||||
//private String repoPath = "/home/jensp/pwi/libreccm/ccm/";
|
//private String repoPath = "/home/jensp/pwi/libreccm/ccm/";
|
||||||
private String repoPath = "/home/tosmers/Svn/libreccm/";
|
private final String repoPath = "/home/tosmers/Svn/libreccm/";
|
||||||
private String projectPath = "ccm_ng/ccm-core/src/test/resources/" +
|
private final String projectPath = "ccm_ng/ccm-core/src/test/resources/" +
|
||||||
"portation/trunk-iaw-exports";
|
"portation/trunk-iaw-exports";
|
||||||
private boolean indentation = false;
|
private final boolean indentation = false;
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Marshals(Category.class)
|
|
||||||
private CategoryMarshaller categoryMarshaller;
|
|
||||||
@Inject
|
|
||||||
@Marshals(Categorization.class)
|
|
||||||
private CategorizationMarshaller categorizationMarshaller;
|
|
||||||
@Inject
|
@Inject
|
||||||
@Marshals(User.class)
|
@Marshals(User.class)
|
||||||
private UserMarshaller userMarshaller;
|
private UserMarshaller userMarshaller;
|
||||||
|
|
@ -82,6 +59,26 @@ class ImportHelper {
|
||||||
@Inject
|
@Inject
|
||||||
@Marshals(RoleMembership.class)
|
@Marshals(RoleMembership.class)
|
||||||
private RoleMembershipMarshaller roleMembershipMarshaller;
|
private RoleMembershipMarshaller roleMembershipMarshaller;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Marshals(Category.class)
|
||||||
|
private CategoryMarshaller categoryMarshaller;
|
||||||
|
@Inject
|
||||||
|
@Marshals(Categorization.class)
|
||||||
|
private CategorizationMarshaller categorizationMarshaller;
|
||||||
|
@Inject
|
||||||
|
@Marshals(ResourceType.class)
|
||||||
|
private ResourceTypeMarshaller resourceTypeMarshaller;
|
||||||
|
@Inject
|
||||||
|
@Marshals(CcmApplication.class)
|
||||||
|
private CcmApplicationMarshaller ccmApplicationMarshaller;
|
||||||
|
@Inject
|
||||||
|
@Marshals(Domain.class)
|
||||||
|
private DomainMarshaller domainMarshaller;
|
||||||
|
@Inject
|
||||||
|
@Marshals(DomainOwnership.class)
|
||||||
|
private DomainOwnershipMarshaller domainOwnershipMarshaller;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Marshals(WorkflowTemplate.class)
|
@Marshals(WorkflowTemplate.class)
|
||||||
private WorkflowTemplateMarshaller workflowTemplateMarshaller;
|
private WorkflowTemplateMarshaller workflowTemplateMarshaller;
|
||||||
|
|
@ -94,80 +91,153 @@ class ImportHelper {
|
||||||
@Inject
|
@Inject
|
||||||
@Marshals(TaskAssignment.class)
|
@Marshals(TaskAssignment.class)
|
||||||
private TaskAssignmentMarshaller taskAssignmentMarshaller;
|
private TaskAssignmentMarshaller taskAssignmentMarshaller;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Marshals(Permission.class)
|
@Marshals(Permission.class)
|
||||||
private PermissionMarshaller permissionMarshaller;
|
private PermissionMarshaller permissionMarshaller;
|
||||||
|
|
||||||
|
|
||||||
boolean importCategories() {
|
|
||||||
categoryMarshaller.prepare(Format.XML, repoPath + projectPath,
|
|
||||||
"categories.xml", indentation);
|
|
||||||
return categoryMarshaller.importFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean importCategorizations() {
|
|
||||||
categorizationMarshaller.prepare(Format.XML, repoPath + projectPath,
|
|
||||||
"categorizations.xml", indentation);
|
|
||||||
return categorizationMarshaller.importFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean importUsers() {
|
boolean importUsers() {
|
||||||
userMarshaller.prepare(Format.XML, repoPath + projectPath,
|
userMarshaller.prepare(
|
||||||
"users.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"users.xml",
|
||||||
|
indentation);
|
||||||
return userMarshaller.importFile();
|
return userMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean importGroups() {
|
boolean importGroups() {
|
||||||
groupMarshaller.prepare(Format.XML, repoPath + projectPath,
|
groupMarshaller.prepare(
|
||||||
"groups.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"groups.xml",
|
||||||
|
indentation);
|
||||||
return groupMarshaller.importFile();
|
return groupMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean importGroupMemberships() {
|
boolean importGroupMemberships() {
|
||||||
groupMembershipMarshaller.prepare(Format.XML, repoPath + projectPath,
|
groupMembershipMarshaller.prepare(
|
||||||
"groupMemberships.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"groupMemberships.xml",
|
||||||
|
indentation);
|
||||||
return groupMembershipMarshaller.importFile();
|
return groupMembershipMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean importRoles() {
|
boolean importRoles() {
|
||||||
roleMarshaller.prepare(Format.XML, repoPath + projectPath,
|
roleMarshaller.prepare(
|
||||||
"roles.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"roles.xml",
|
||||||
|
indentation);
|
||||||
return roleMarshaller.importFile();
|
return roleMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean importRoleMemberships() {
|
boolean importRoleMemberships() {
|
||||||
roleMembershipMarshaller.prepare(Format.XML, repoPath + projectPath,
|
roleMembershipMarshaller.prepare(
|
||||||
"roleMemberships.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"roleMemberships.xml",
|
||||||
|
indentation);
|
||||||
return roleMembershipMarshaller.importFile();
|
return roleMembershipMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean importCategories() {
|
||||||
|
categoryMarshaller.prepare(
|
||||||
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"categories.xml",
|
||||||
|
indentation);
|
||||||
|
return categoryMarshaller.importFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean importCategorizations() {
|
||||||
|
categorizationMarshaller.prepare(
|
||||||
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"categorizations.xml",
|
||||||
|
indentation);
|
||||||
|
return categorizationMarshaller.importFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean importResourceTypes() {
|
||||||
|
resourceTypeMarshaller.prepare(
|
||||||
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"resourceTypes.xml",
|
||||||
|
indentation);
|
||||||
|
return resourceTypeMarshaller.importFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean importCcmApplications() {
|
||||||
|
ccmApplicationMarshaller.prepare(
|
||||||
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"ccmApplications.xml",
|
||||||
|
indentation);
|
||||||
|
return ccmApplicationMarshaller.importFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean importDomains() {
|
||||||
|
domainMarshaller.prepare(
|
||||||
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"domains.xml",
|
||||||
|
indentation);
|
||||||
|
return domainMarshaller.importFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean importDomainOwnerships() {
|
||||||
|
domainOwnershipMarshaller.prepare(
|
||||||
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"domainOwnerships.xml",
|
||||||
|
indentation);
|
||||||
|
return domainOwnershipMarshaller.importFile();
|
||||||
|
}
|
||||||
|
|
||||||
boolean importWorkflowTemplates() {
|
boolean importWorkflowTemplates() {
|
||||||
workflowTemplateMarshaller.prepare(Format.XML, repoPath + projectPath,
|
workflowTemplateMarshaller.prepare(
|
||||||
"workflowTemplates.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"workflowTemplates.xml",
|
||||||
|
indentation);
|
||||||
return workflowTemplateMarshaller.importFile();
|
return workflowTemplateMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean importWorkflows() {
|
boolean importWorkflows() {
|
||||||
workflowMarshaller.prepare(Format.XML, repoPath + projectPath,
|
workflowMarshaller.prepare(
|
||||||
"workflows.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"workflows.xml",
|
||||||
|
indentation);
|
||||||
return workflowMarshaller.importFile();
|
return workflowMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean importAssignableTasks() {
|
boolean importAssignableTasks() {
|
||||||
assignableTaskMarshaller.prepare(Format.XML, repoPath + projectPath,
|
assignableTaskMarshaller.prepare(
|
||||||
"assignableTasks.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"assignableTasks.xml",
|
||||||
|
indentation);
|
||||||
return assignableTaskMarshaller.importFile();
|
return assignableTaskMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean importTaskAssignments() {
|
boolean importTaskAssignments() {
|
||||||
taskAssignmentMarshaller.prepare(Format.XML, repoPath + projectPath,
|
taskAssignmentMarshaller.prepare(
|
||||||
"taskAssignments.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"taskAssignments.xml",
|
||||||
|
indentation);
|
||||||
return taskAssignmentMarshaller.importFile();
|
return taskAssignmentMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean importPermissions() {
|
boolean importPermissions() {
|
||||||
permissionMarshaller.prepare(Format.XML, repoPath + projectPath,
|
permissionMarshaller.prepare(
|
||||||
"permissions.xml", indentation);
|
Format.XML,
|
||||||
|
repoPath + projectPath,
|
||||||
|
"permissions.xml",
|
||||||
|
indentation);
|
||||||
return permissionMarshaller.importFile();
|
return permissionMarshaller.importFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue