http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARole.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARole.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARole.java deleted file mode 100644 index 2990ad4..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/role/JPARole.java +++ /dev/null @@ -1,593 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.persistence.jpa.entity.role; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.persistence.Basic; -import javax.persistence.Cacheable; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; -import javax.validation.Valid; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import org.apache.syncope.core.persistence.api.entity.AccountPolicy; -import org.apache.syncope.core.persistence.api.entity.AttrTemplate; -import org.apache.syncope.core.persistence.api.entity.DerSchema; -import org.apache.syncope.core.persistence.api.entity.Entitlement; -import org.apache.syncope.core.persistence.api.entity.ExternalResource; -import org.apache.syncope.core.persistence.api.entity.PasswordPolicy; -import org.apache.syncope.core.persistence.api.entity.PlainSchema; -import org.apache.syncope.core.persistence.api.entity.Schema; -import org.apache.syncope.core.persistence.api.entity.VirSchema; -import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.role.RDerAttr; -import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.role.RDerSchema; -import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr; -import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.role.RVirAttr; -import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.role.RVirSchema; -import org.apache.syncope.core.persistence.api.entity.role.Role; -import org.apache.syncope.core.persistence.api.entity.user.User; -import org.apache.syncope.core.persistence.jpa.validation.entity.RoleCheck; -import org.apache.syncope.core.persistence.jpa.entity.AbstractSubject; -import org.apache.syncope.core.persistence.jpa.entity.JPAAccountPolicy; -import org.apache.syncope.core.persistence.jpa.entity.JPAEntitlement; -import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource; -import org.apache.syncope.core.persistence.jpa.entity.JPAPasswordPolicy; -import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate; -import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate; -import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate; -import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser; - -@Entity -@Table(name = JPARole.TABLE, uniqueConstraints = - @UniqueConstraint(columnNames = { "name", "parent_id" })) -@Cacheable -@RoleCheck -public class JPARole extends AbstractSubject<RPlainAttr, RDerAttr, RVirAttr> implements Role { - - private static final long serialVersionUID = -5281258853142421875L; - - public static final String TABLE = "SyncopeRole"; - - @Id - private Long id; - - @NotNull - private String name; - - @ManyToOne(optional = true) - private JPARole parent; - - @ManyToOne(optional = true) - private JPAUser userOwner; - - @ManyToOne(optional = true) - private JPARole roleOwner; - - @ManyToMany(fetch = FetchType.EAGER) - @JoinTable(joinColumns = - @JoinColumn(name = "role_id"), - inverseJoinColumns = - @JoinColumn(name = "entitlement_name")) - private Set<JPAEntitlement> entitlements; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPARPlainAttrTemplate> rAttrTemplates; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPARDerAttrTemplate> rDerAttrTemplates; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPARVirAttrTemplate> rVirAttrTemplates; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPAMPlainAttrTemplate> mAttrTemplates; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPAMDerAttrTemplate> mDerAttrTemplates; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPAMVirAttrTemplate> mVirAttrTemplates; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPARPlainAttr> plainAttrs; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPARDerAttr> derAttrs; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPARVirAttr> virAttrs; - - @Basic(optional = true) - @Min(0) - @Max(1) - private Integer inheritOwner; - - @Basic(optional = true) - @Min(0) - @Max(1) - private Integer inheritTemplates; - - @Basic(optional = true) - @Min(0) - @Max(1) - private Integer inheritPlainAttrs; - - @Basic(optional = true) - @Min(0) - @Max(1) - private Integer inheritDerAttrs; - - @Basic(optional = true) - @Min(0) - @Max(1) - private Integer inheritVirAttrs; - - @Basic(optional = true) - @Min(0) - @Max(1) - private Integer inheritPasswordPolicy; - - @Basic(optional = true) - @Min(0) - @Max(1) - private Integer inheritAccountPolicy; - - @ManyToOne(fetch = FetchType.EAGER, optional = true) - private JPAPasswordPolicy passwordPolicy; - - @ManyToOne(fetch = FetchType.EAGER, optional = true) - private JPAAccountPolicy accountPolicy; - - /** - * Provisioning external resources. - */ - @ManyToMany(fetch = FetchType.EAGER) - @JoinTable(joinColumns = - @JoinColumn(name = "role_id"), - inverseJoinColumns = - @JoinColumn(name = "resource_name")) - @Valid - private Set<JPAExternalResource> resources; - - public JPARole() { - super(); - - entitlements = new HashSet<>(); - - rAttrTemplates = new ArrayList<>(); - rDerAttrTemplates = new ArrayList<>(); - rVirAttrTemplates = new ArrayList<>(); - mAttrTemplates = new ArrayList<>(); - mDerAttrTemplates = new ArrayList<>(); - mVirAttrTemplates = new ArrayList<>(); - - plainAttrs = new ArrayList<>(); - derAttrs = new ArrayList<>(); - virAttrs = new ArrayList<>(); - - inheritOwner = getBooleanAsInteger(false); - inheritTemplates = getBooleanAsInteger(false); - inheritPlainAttrs = getBooleanAsInteger(false); - inheritDerAttrs = getBooleanAsInteger(false); - inheritVirAttrs = getBooleanAsInteger(false); - inheritPasswordPolicy = getBooleanAsInteger(false); - inheritAccountPolicy = getBooleanAsInteger(false); - - resources = new HashSet<>(); - } - - @Override - public Long getKey() { - return id; - } - - @Override - protected Set<? extends ExternalResource> internalGetResources() { - return resources; - } - - @Override - public String getName() { - return name; - } - - @Override - public void setName(final String name) { - this.name = name; - } - - @Override - public Role getParent() { - return parent; - } - - @Override - public void setParent(final Role parent) { - checkType(parent, JPARole.class); - this.parent = (JPARole) parent; - } - - @Override - public boolean isInheritOwner() { - return isBooleanAsInteger(inheritOwner); - } - - @Override - public void setInheritOwner(final boolean inheritOwner) { - this.inheritOwner = getBooleanAsInteger(inheritOwner); - } - - @Override - public User getUserOwner() { - return userOwner; - } - - @Override - public void setUserOwner(final User userOwner) { - checkType(userOwner, JPAUser.class); - this.userOwner = (JPAUser) userOwner; - } - - @Override - public JPARole getRoleOwner() { - return roleOwner; - } - - @Override - public void setRoleOwner(final Role roleOwner) { - checkType(roleOwner, JPARole.class); - this.roleOwner = (JPARole) roleOwner; - } - - @Override - public boolean addEntitlement(final Entitlement entitlement) { - checkType(entitlement, JPAEntitlement.class); - return entitlements.add((JPAEntitlement) entitlement); - } - - @Override - public boolean removeEntitlement(final Entitlement entitlement) { - checkType(entitlement, JPAEntitlement.class); - return entitlements.remove((JPAEntitlement) entitlement); - } - - @Override - public Set<? extends Entitlement> getEntitlements() { - return entitlements; - } - - @Override - public boolean isInheritTemplates() { - return isBooleanAsInteger(inheritTemplates); - } - - @Override - public void setInheritTemplates(final boolean inheritAttrTemplates) { - this.inheritTemplates = getBooleanAsInteger(inheritAttrTemplates); - } - - @Override - @SuppressWarnings("unchecked") - public <T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(final Class<T> reference) { - List<T> result = new ArrayList<>(); - - if (RPlainAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) rAttrTemplates; - } else if (RDerAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) rDerAttrTemplates; - } else if (RVirAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) rVirAttrTemplates; - } else if (MPlainAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) mAttrTemplates; - } else if (MDerAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) mDerAttrTemplates; - } else if (MVirAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) mVirAttrTemplates; - } - - return result; - } - - @Override - public <T extends AttrTemplate<K>, K extends Schema> T getAttrTemplate( - final Class<T> reference, final String schemaName) { - - T result = null; - - for (T template : findInheritedTemplates(reference)) { - if (schemaName.equals(template.getSchema().getKey())) { - result = template; - } - } - - return result; - } - - @Override - public <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(final Class<T> reference) { - final List<K> result = new ArrayList<>(); - - for (T template : findInheritedTemplates(reference)) { - result.add(template.getSchema()); - } - - return result; - } - - @Override - public <T extends AttrTemplate<K>, K extends Schema> List<T> findInheritedTemplates(final Class<T> reference) { - final List<T> result = new ArrayList<>(getAttrTemplates(reference)); - - if (isInheritTemplates() && getParent() != null) { - result.addAll(getParent().findInheritedTemplates(reference)); - } - - return result; - } - - @Override - public boolean addPlainAttr(final RPlainAttr attr) { - checkType(attr, JPARPlainAttr.class); - return plainAttrs.add((JPARPlainAttr) attr); - } - - @Override - public boolean removePlainAttr(final RPlainAttr attr) { - checkType(attr, JPARPlainAttr.class); - return plainAttrs.remove((JPARPlainAttr) attr); - } - - @Override - public List<? extends RPlainAttr> getPlainAttrs() { - return plainAttrs; - } - - @Override - public boolean addDerAttr(final RDerAttr attr) { - checkType(attr, JPARDerAttr.class); - return derAttrs.add((JPARDerAttr) attr); - } - - @Override - public boolean removeDerAttr(final RDerAttr attr) { - checkType(attr, JPARDerAttr.class); - return derAttrs.remove((JPARDerAttr) attr); - } - - @Override - public List<? extends RDerAttr> getDerAttrs() { - return derAttrs; - } - - @Override - public boolean addVirAttr(final RVirAttr attr) { - checkType(attr, JPARVirAttr.class); - return virAttrs.add((JPARVirAttr) attr); - } - - @Override - public boolean removeVirAttr(final RVirAttr attr) { - checkType(attr, JPARVirAttr.class); - return virAttrs.remove((JPARVirAttr) attr); - } - - @Override - public List<? extends RVirAttr> getVirAttrs() { - return virAttrs; - } - - @Override - public boolean isInheritPlainAttrs() { - return isBooleanAsInteger(inheritPlainAttrs); - } - - @Override - public void setInheritPlainAttrs(final boolean inheritPlainAttrs) { - this.inheritPlainAttrs = getBooleanAsInteger(inheritPlainAttrs); - } - - /** - * Get all inherited attributes from the ancestors. - * - * @return a list of inherited and only inherited attributes. - */ - @Override - public List<? extends RPlainAttr> findLastInheritedAncestorPlainAttrs() { - final Map<JPARPlainSchema, RPlainAttr> result = new HashMap<>(); - - if (!isInheritPlainAttrs()) { - return plainAttrs; - } - if (isInheritPlainAttrs() && getParent() != null) { - final Map<PlainSchema, RPlainAttr> attrMap = getPlainAttrMap(); - - // Add inherit attributes - for (RPlainAttr attr : getParent().findLastInheritedAncestorPlainAttrs()) { - if (attrMap.containsKey(attr.getSchema())) { - result.remove((JPARPlainSchema) attr.getSchema()); - } - result.put((JPARPlainSchema) attr.getSchema(), attr); - } - } - return new ArrayList<>(result.values()); - } - - @Override - public boolean isInheritDerAttrs() { - return isBooleanAsInteger(inheritDerAttrs); - } - - @Override - public void setInheritDerAttrs(final boolean inheritDerAttrs) { - this.inheritDerAttrs = getBooleanAsInteger(inheritDerAttrs); - - } - - /** - * Get all inherited derived attributes from the ancestors. - * - * @return a list of inherited and only inherited attributes. - */ - @Override - public List<? extends RDerAttr> findLastInheritedAncestorDerAttrs() { - final Map<RDerSchema, RDerAttr> result = new HashMap<>(); - - if (!isInheritDerAttrs()) { - return derAttrs; - } - if (isInheritDerAttrs() && getParent() != null) { - Map<DerSchema, RDerAttr> derAttrMap = getDerAttrMap(); - - // Add inherit derived attributes - for (RDerAttr attr : getParent().findLastInheritedAncestorDerAttrs()) { - if (derAttrMap.containsKey(attr.getSchema())) { - result.remove(attr.getSchema()); - } - result.put(attr.getSchema(), attr); - } - } - return new ArrayList<>(result.values()); - } - - @Override - public boolean isInheritVirAttrs() { - return isBooleanAsInteger(inheritVirAttrs); - } - - @Override - public void setInheritVirAttrs(final boolean inheritVirAttrs) { - this.inheritVirAttrs = getBooleanAsInteger(inheritVirAttrs); - - } - - /** - * Get all inherited virtual attributes from the ancestors. - * - * @return a list of inherited and only inherited attributes. - */ - @Override - public List<? extends RVirAttr> findLastInheritedAncestorVirAttrs() { - final Map<RVirSchema, RVirAttr> result = new HashMap<>(); - - if (!isInheritVirAttrs()) { - return virAttrs; - } - - if (isInheritVirAttrs() && getParent() != null) { - Map<VirSchema, RVirAttr> virAttrMap = getVirAttrMap(); - - // Add inherit virtual attributes - for (RVirAttr attr : getParent().findLastInheritedAncestorVirAttrs()) { - if (virAttrMap.containsKey(attr.getSchema())) { - result.remove(attr.getSchema()); - } - result.put(attr.getSchema(), attr); - } - } - return new ArrayList<>(result.values()); - } - - /** - * Get first valid password policy. - * - * @return parent password policy if isInheritPasswordPolicy is 'true' and parent is not null, local password policy - * otherwise - */ - @Override - public PasswordPolicy getPasswordPolicy() { - return isInheritPasswordPolicy() && getParent() != null - ? getParent().getPasswordPolicy() - : passwordPolicy; - } - - @Override - public void setPasswordPolicy(final PasswordPolicy passwordPolicy) { - checkType(passwordPolicy, JPAPasswordPolicy.class); - this.passwordPolicy = (JPAPasswordPolicy) passwordPolicy; - } - - @Override - public boolean isInheritPasswordPolicy() { - return isBooleanAsInteger(inheritPasswordPolicy); - } - - @Override - public void setInheritPasswordPolicy(final boolean inheritPasswordPolicy) { - this.inheritPasswordPolicy = getBooleanAsInteger(inheritPasswordPolicy); - } - - /** - * Get first valid account policy. - * - * @return parent account policy if isInheritAccountPolicy is 'true' and parent is not null, local account policy - * otherwise. - */ - @Override - public AccountPolicy getAccountPolicy() { - return isInheritAccountPolicy() && getParent() != null - ? getParent().getAccountPolicy() - : accountPolicy; - } - - @Override - public void setAccountPolicy(final AccountPolicy accountPolicy) { - checkType(accountPolicy, JPAAccountPolicy.class); - this.accountPolicy = (JPAAccountPolicy) accountPolicy; - } - - @Override - public boolean isInheritAccountPolicy() { - return isBooleanAsInteger(inheritAccountPolicy); - } - - @Override - public void setInheritAccountPolicy(boolean inheritAccountPolicy) { - this.inheritAccountPolicy = getBooleanAsInteger(inheritAccountPolicy); - } -}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java index 041e206..c627dd2 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPAPushTask.java @@ -46,7 +46,7 @@ public class JPAPushTask extends AbstractProvisioningTask implements PushTask { private String userFilter; - private String roleFilter; + private String groupFilter; /** * Default constructor. @@ -71,12 +71,12 @@ public class JPAPushTask extends AbstractProvisioningTask implements PushTask { } @Override - public String getRoleFilter() { - return roleFilter; + public String getGroupFilter() { + return groupFilter; } @Override - public void setRoleFilter(final String roleFilter) { - this.roleFilter = roleFilter; + public void setGroupFilter(final String filter) { + this.groupFilter = filter; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java index 7d142b2..b26bb0c 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/task/JPASyncTask.java @@ -31,7 +31,7 @@ import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.validation.constraints.Max; import javax.validation.constraints.Min; -import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.TaskType; import org.apache.syncope.core.persistence.api.entity.task.SyncTask; @@ -55,7 +55,7 @@ public class JPASyncTask extends AbstractProvisioningTask implements SyncTask { private String userTemplate; @Lob - private String roleTemplate; + private String groupTemplate; @Basic @Min(0) @@ -87,15 +87,15 @@ public class JPASyncTask extends AbstractProvisioningTask implements SyncTask { } @Override - public RoleTO getRoleTemplate() { + public GroupTO getGroupTemplate() { return userTemplate == null - ? new RoleTO() - : POJOHelper.deserialize(roleTemplate, RoleTO.class); + ? new GroupTO() + : POJOHelper.deserialize(groupTemplate, GroupTO.class); } @Override - public void setRoleTemplate(final RoleTO roleTemplate) { - this.roleTemplate = POJOHelper.serialize(roleTemplate); + public void setGroupTemplate(final GroupTO groupTemplate) { + this.groupTemplate = POJOHelper.serialize(groupTemplate); } @Override http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java index 8b1e798..704c3b7 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java @@ -53,7 +53,7 @@ import javax.validation.constraints.NotNull; import org.apache.syncope.common.lib.types.CipherAlgorithm; import org.apache.syncope.core.persistence.api.entity.ExternalResource; import org.apache.syncope.core.persistence.api.entity.membership.Membership; -import org.apache.syncope.core.persistence.api.entity.role.Role; +import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion; import org.apache.syncope.core.persistence.api.entity.user.UDerAttr; import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr; @@ -211,12 +211,12 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp } @Override - public Membership getMembership(final Long roleKey) { + public Membership getMembership(final Long groupKey) { Membership result = null; Membership membership; for (Iterator<? extends Membership> itor = getMemberships().iterator(); result == null && itor.hasNext();) { membership = itor.next(); - if (membership.getRole() != null && roleKey.equals(membership.getRole().getKey())) { + if (membership.getGroup() != null && groupKey.equals(membership.getGroup().getKey())) { result = membership; } } @@ -229,12 +229,12 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp } @Override - public List<Role> getRoles() { - List<Role> result = new ArrayList<>(); + public List<Group> getGroups() { + List<Group> result = new ArrayList<>(); for (Membership membership : memberships) { - if (membership.getRole() != null) { - result.add(membership.getRole()); + if (membership.getGroup() != null) { + result.add(membership.getGroup()); } } @@ -242,12 +242,12 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp } @Override - public Set<Long> getRoleKeys() { - List<Role> roles = getRoles(); + public Set<Long> getGroupKeys() { + List<Group> groups = getGroups(); - Set<Long> result = new HashSet<>(roles.size()); - for (Role role : roles) { - result.add(role.getKey()); + Set<Long> result = new HashSet<>(groups.size()); + for (Group group : groups) { + result.add(group.getKey()); } return result; @@ -257,8 +257,8 @@ public class JPAUser extends AbstractSubject<UPlainAttr, UDerAttr, UVirAttr> imp public Set<ExternalResource> getResources() { Set<ExternalResource> result = new HashSet<>(); result.addAll(super.getResources()); - for (Role role : getRoles()) { - result.addAll(role.getResources()); + for (Group group : getGroups()) { + result.addAll(group.getResources()); } return result; http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java index 2cc90f0..5737287 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/ExternalResourceValidator.java @@ -78,10 +78,10 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc final MappingItem accountId = mapping.getAccountIdItem(); if (mapping instanceof UMapping - && AttributableType.ROLE == accountId.getIntMappingType().getAttributableType()) { + && AttributableType.GROUP == accountId.getIntMappingType().getAttributableType()) { context.buildConstraintViolationWithTemplate( getTemplate(EntityViolationType.InvalidMapping, - "Role attribute as accountId is not permitted")). + "Group attribute as accountId is not permitted")). addPropertyNode("attributableType").addConstraintViolation(); return false; } @@ -137,6 +137,6 @@ public class ExternalResourceValidator extends AbstractValidator<ExternalResourc } } - return isValid(resource.getUmapping(), context) && isValid(resource.getRmapping(), context); + return isValid(resource.getUmapping(), context) && isValid(resource.getGmapping(), context); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupCheck.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupCheck.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupCheck.java new file mode 100644 index 0000000..b7bd229 --- /dev/null +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupCheck.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.persistence.jpa.validation.entity; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.validation.Constraint; +import javax.validation.Payload; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Constraint(validatedBy = GroupValidator.class) +@Documented +public @interface GroupCheck { + + String message() default "{org.apache.syncope.core.persistence.validation.group}"; + + Class<?>[] groups() default {}; + + Class<? extends Payload>[] payload() default {}; +} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupValidator.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupValidator.java new file mode 100644 index 0000000..078217f --- /dev/null +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/GroupValidator.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.persistence.jpa.validation.entity; + +import javax.validation.ConstraintValidatorContext; +import org.apache.syncope.common.lib.types.EntityViolationType; +import org.apache.syncope.core.persistence.api.entity.group.Group; + +public class GroupValidator extends AbstractValidator<GroupCheck, Group> { + + @Override + public boolean isValid(final Group object, final ConstraintValidatorContext context) { + context.disableDefaultConstraintViolation(); + + boolean isValid = true; + + if (object.getUserOwner() != null && object.getGroupOwner() != null) { + isValid = false; + + context.buildConstraintViolationWithTemplate( + getTemplate(EntityViolationType.InvalidGroupOwner, + "A group must either be owned by an user or a group, not both")). + addPropertyNode("owner").addConstraintViolation(); + } + + return isValid; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java index 6069882..ae2e3ae 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/PlainAttrValueValidator.java @@ -24,7 +24,7 @@ import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue; import org.apache.syncope.core.persistence.api.entity.PlainAttrValue; import org.apache.syncope.core.persistence.api.entity.PlainSchema; import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema; -import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema; +import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema; import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema; public class PlainAttrValueValidator extends AbstractValidator<PlainAttrValueCheck, PlainAttrValue> { @@ -78,8 +78,8 @@ public class PlainAttrValueValidator extends AbstractValidator<PlainAttrValueChe EntityViolationType violationType = attrSchema instanceof UPlainSchema ? EntityViolationType.InvalidUPlainSchema - : attrSchema instanceof RPlainSchema - ? EntityViolationType.InvalidRPlainSchema + : attrSchema instanceof GPlainSchema + ? EntityViolationType.InvalidGPlainSchema : attrSchema instanceof MPlainSchema ? EntityViolationType.InvalidMPlainSchema : EntityViolationType.InvalidCPlainSchema; http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleCheck.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleCheck.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleCheck.java deleted file mode 100644 index 04cfd63..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleCheck.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.persistence.jpa.validation.entity; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.validation.Constraint; -import javax.validation.Payload; - -@Target({ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -@Constraint(validatedBy = RoleValidator.class) -@Documented -public @interface RoleCheck { - - String message() default "{org.apache.syncope.core.persistence.validation.role}"; - - Class<?>[] groups() default {}; - - Class<? extends Payload>[] payload() default {}; -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleValidator.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleValidator.java deleted file mode 100644 index 2f46ca0..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/RoleValidator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.core.persistence.jpa.validation.entity; - -import javax.validation.ConstraintValidatorContext; -import org.apache.syncope.common.lib.types.EntityViolationType; -import org.apache.syncope.core.persistence.api.entity.role.Role; - -public class RoleValidator extends AbstractValidator<RoleCheck, Role> { - - @Override - public boolean isValid(final Role object, final ConstraintValidatorContext context) { - context.disableDefaultConstraintViolation(); - - boolean isValid = true; - - if (object.getUserOwner() != null && object.getRoleOwner() != null) { - isValid = false; - - context.buildConstraintViolationWithTemplate( - getTemplate(EntityViolationType.InvalidRoleOwner, - "A role must either be owned by an user or a role, not both")). - addPropertyNode("owner").addConstraintViolation(); - } - - return isValid; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java index 216c891..cf7e53d 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/SchemaNameValidator.java @@ -31,15 +31,15 @@ import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema; import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema; import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema; import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema; -import org.apache.syncope.core.persistence.api.entity.role.RDerSchema; -import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema; -import org.apache.syncope.core.persistence.api.entity.role.RVirSchema; +import org.apache.syncope.core.persistence.api.entity.group.GDerSchema; +import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema; +import org.apache.syncope.core.persistence.api.entity.group.GVirSchema; import org.apache.syncope.core.persistence.api.entity.user.UDerSchema; import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema; import org.apache.syncope.core.persistence.api.entity.user.UVirSchema; import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf; import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership; -import org.apache.syncope.core.persistence.jpa.entity.role.JPARole; +import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup; import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser; public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Object> { @@ -55,7 +55,7 @@ public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Obje static { initUnallowedSchemaNames(JPAUser.class, UNALLOWED_USCHEMA_NAMES); initUnallowedSchemaNames(JPAMembership.class, UNALLOWED_MSCHEMA_NAMES); - initUnallowedSchemaNames(JPARole.class, UNALLOWED_RSCHEMA_NAMES); + initUnallowedSchemaNames(JPAGroup.class, UNALLOWED_RSCHEMA_NAMES); initUnallowedSchemaNames(JPAConf.class, UNALLOWED_CSCHEMA_NAMES); } @@ -96,14 +96,14 @@ public class SchemaNameValidator extends AbstractValidator<SchemaNameCheck, Obje } else if (object instanceof MVirSchema) { schemaName = ((MVirSchema) object).getKey(); unallowedNames = UNALLOWED_MSCHEMA_NAMES; - } else if (object instanceof RPlainSchema) { - schemaName = ((RPlainSchema) object).getKey(); + } else if (object instanceof GPlainSchema) { + schemaName = ((GPlainSchema) object).getKey(); unallowedNames = UNALLOWED_RSCHEMA_NAMES; - } else if (object instanceof RDerSchema) { - schemaName = ((RDerSchema) object).getKey(); + } else if (object instanceof GDerSchema) { + schemaName = ((GDerSchema) object).getKey(); unallowedNames = UNALLOWED_RSCHEMA_NAMES; - } else if (object instanceof RVirSchema) { - schemaName = ((RVirSchema) object).getKey(); + } else if (object instanceof GVirSchema) { + schemaName = ((GVirSchema) object).getKey(); unallowedNames = UNALLOWED_RSCHEMA_NAMES; } else if (object instanceof CPlainSchema) { schemaName = ((CPlainSchema) object).getKey(); http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java index 2790a12..0b5ac42 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/UserValidator.java @@ -30,7 +30,7 @@ import org.apache.syncope.core.persistence.api.entity.AccountPolicy; import org.apache.syncope.core.persistence.api.entity.ExternalResource; import org.apache.syncope.core.persistence.api.entity.PasswordPolicy; import org.apache.syncope.core.persistence.api.entity.Policy; -import org.apache.syncope.core.persistence.api.entity.role.Role; +import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.user.User; import org.apache.syncope.core.misc.policy.AccountPolicyEnforcer; import org.apache.syncope.core.misc.policy.AccountPolicyException; @@ -153,9 +153,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> { } } - // add role policies - for (Role role : user.getRoles()) { - policy = role.getPasswordPolicy(); + // add group policies + for (Group group : user.getGroups()) { + policy = group.getPasswordPolicy(); if (policy != null) { policies.add(policy); } @@ -181,9 +181,9 @@ public class UserValidator extends AbstractValidator<UserCheck, User> { } } - // add role policies - for (Role role : user.getRoles()) { - policy = role.getAccountPolicy(); + // add group policies + for (Group group : user.getGroups()) { + policy = group.getAccountPolicy(); if (policy != null) { policies.add(policy); } http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml index a4b949d..f10b6c5 100644 --- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml +++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-oracle.xml @@ -35,7 +35,7 @@ under the License. </persistence-unit-metadata> <table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/> - <table-generator name="SEQ_RPlainAttrValue" pk-column-value="SEQ_RPlainAttrValue" initial-value="100"/> + <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/> <table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/> <table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/> @@ -48,11 +48,11 @@ under the License. </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARole"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup"> <attributes> <id name="id"> - <generated-value generator="SEQ_Role" strategy="TABLE"/> - <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/> + <generated-value generator="SEQ_Group" strategy="TABLE"/> + <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/> </id> </attributes> </entity> @@ -74,11 +74,11 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping"> <attributes> <id name="id"> - <generated-value generator="SEQ_RMapping" strategy="TABLE"/> - <table-generator name="SEQ_RMapping" pk-column-value="SEQ_RMapping" initial-value="100"/> + <generated-value generator="SEQ_GMapping" strategy="TABLE"/> + <table-generator name="SEQ_GMapping" pk-column-value="SEQ_GMapping" initial-value="100"/> </id> </attributes> </entity> @@ -90,11 +90,11 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem"> <attributes> <id name="id"> - <generated-value generator="SEQ_RMappingItem" strategy="TABLE"/> - <table-generator name="SEQ_RMappingItem" pk-column-value="SEQ_RMappingItem" initial-value="1000"/> + <generated-value generator="SEQ_GMappingItem" strategy="TABLE"/> + <table-generator name="SEQ_GMappingItem" pk-column-value="SEQ_GMappingItem" initial-value="1000"/> </id> </attributes> </entity> @@ -116,19 +116,19 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttr" strategy="TABLE"/> - <table-generator name="SEQ_RPlainAttr" pk-column-value="SEQ_RPlainAttr" initial-value="1000"/> + <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/> + <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/> </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrTemplate" strategy="TABLE"/> - <table-generator name="SEQ_RPlainAttrTemplate" pk-column-value="SEQ_RPlainAttrTemplate" initial-value="1000"/> + <generated-value generator="SEQ_GPlainAttrTemplate" strategy="TABLE"/> + <table-generator name="SEQ_GPlainAttrTemplate" pk-column-value="SEQ_GPlainAttrTemplate" initial-value="1000"/> </id> </attributes> </entity> @@ -181,14 +181,14 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/> + <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/> </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue"> <table> <unique-constraint> <column-name>booleanValue</column-name> @@ -201,7 +201,7 @@ under the License. </table> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/> + <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/> </id> </attributes> </entity> http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml index a4b949d..f10b6c5 100644 --- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml +++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm-sqlserver.xml @@ -35,7 +35,7 @@ under the License. </persistence-unit-metadata> <table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/> - <table-generator name="SEQ_RPlainAttrValue" pk-column-value="SEQ_RPlainAttrValue" initial-value="100"/> + <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/> <table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/> <table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/> @@ -48,11 +48,11 @@ under the License. </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARole"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup"> <attributes> <id name="id"> - <generated-value generator="SEQ_Role" strategy="TABLE"/> - <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/> + <generated-value generator="SEQ_Group" strategy="TABLE"/> + <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/> </id> </attributes> </entity> @@ -74,11 +74,11 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping"> <attributes> <id name="id"> - <generated-value generator="SEQ_RMapping" strategy="TABLE"/> - <table-generator name="SEQ_RMapping" pk-column-value="SEQ_RMapping" initial-value="100"/> + <generated-value generator="SEQ_GMapping" strategy="TABLE"/> + <table-generator name="SEQ_GMapping" pk-column-value="SEQ_GMapping" initial-value="100"/> </id> </attributes> </entity> @@ -90,11 +90,11 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem"> <attributes> <id name="id"> - <generated-value generator="SEQ_RMappingItem" strategy="TABLE"/> - <table-generator name="SEQ_RMappingItem" pk-column-value="SEQ_RMappingItem" initial-value="1000"/> + <generated-value generator="SEQ_GMappingItem" strategy="TABLE"/> + <table-generator name="SEQ_GMappingItem" pk-column-value="SEQ_GMappingItem" initial-value="1000"/> </id> </attributes> </entity> @@ -116,19 +116,19 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttr" strategy="TABLE"/> - <table-generator name="SEQ_RPlainAttr" pk-column-value="SEQ_RPlainAttr" initial-value="1000"/> + <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/> + <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/> </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrTemplate" strategy="TABLE"/> - <table-generator name="SEQ_RPlainAttrTemplate" pk-column-value="SEQ_RPlainAttrTemplate" initial-value="1000"/> + <generated-value generator="SEQ_GPlainAttrTemplate" strategy="TABLE"/> + <table-generator name="SEQ_GPlainAttrTemplate" pk-column-value="SEQ_GPlainAttrTemplate" initial-value="1000"/> </id> </attributes> </entity> @@ -181,14 +181,14 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/> + <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/> </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue"> <table> <unique-constraint> <column-name>booleanValue</column-name> @@ -201,7 +201,7 @@ under the License. </table> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/> + <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/> </id> </attributes> </entity> http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml index 7217d68..d0959c8 100644 --- a/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml +++ b/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml @@ -35,7 +35,7 @@ under the License. </persistence-unit-metadata> <table-generator name="SEQ_UPlainAttrValue" pk-column-value="SEQ_UPlainAttrValue" initial-value="100"/> - <table-generator name="SEQ_RPlainAttrValue" pk-column-value="SEQ_RPlainAttrValue" initial-value="100"/> + <table-generator name="SEQ_GPlainAttrValue" pk-column-value="SEQ_GPlainAttrValue" initial-value="100"/> <table-generator name="SEQ_MAttrPlainValue" pk-column-value="SEQ_MAttrPlainValue" initial-value="100"/> <table-generator name="SEQ_CAttrPlainValue" pk-column-value="SEQ_CAttrPlainValue" initial-value="100"/> @@ -48,11 +48,11 @@ under the License. </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARole"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup"> <attributes> <id name="id"> - <generated-value generator="SEQ_Role" strategy="TABLE"/> - <table-generator name="SEQ_Role" pk-column-value="SEQ_Role" initial-value="100"/> + <generated-value generator="SEQ_Group" strategy="TABLE"/> + <table-generator name="SEQ_Group" pk-column-value="SEQ_Group" initial-value="100"/> </id> </attributes> </entity> @@ -74,11 +74,11 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMapping"> <attributes> <id name="id"> - <generated-value generator="SEQ_RMapping" strategy="TABLE"/> - <table-generator name="SEQ_RMapping" pk-column-value="SEQ_RMapping" initial-value="100"/> + <generated-value generator="SEQ_GMapping" strategy="TABLE"/> + <table-generator name="SEQ_GMapping" pk-column-value="SEQ_GMapping" initial-value="100"/> </id> </attributes> </entity> @@ -90,11 +90,11 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGMappingItem"> <attributes> <id name="id"> - <generated-value generator="SEQ_RMappingItem" strategy="TABLE"/> - <table-generator name="SEQ_RMappingItem" pk-column-value="SEQ_RMappingItem" initial-value="1000"/> + <generated-value generator="SEQ_GMappingItem" strategy="TABLE"/> + <table-generator name="SEQ_GMappingItem" pk-column-value="SEQ_GMappingItem" initial-value="1000"/> </id> </attributes> </entity> @@ -116,19 +116,19 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttr"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttr" strategy="TABLE"/> - <table-generator name="SEQ_RPlainAttr" pk-column-value="SEQ_RPlainAttr" initial-value="1000"/> + <generated-value generator="SEQ_GPlainAttr" strategy="TABLE"/> + <table-generator name="SEQ_GPlainAttr" pk-column-value="SEQ_GPlainAttr" initial-value="1000"/> </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrTemplate"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrTemplate" strategy="TABLE"/> - <table-generator name="SEQ_RPlainAttrTemplate" pk-column-value="SEQ_RPlainAttrTemplate" initial-value="1000"/> + <generated-value generator="SEQ_GPlainAttrTemplate" strategy="TABLE"/> + <table-generator name="SEQ_GPlainAttrTemplate" pk-column-value="SEQ_GPlainAttrTemplate" initial-value="1000"/> </id> </attributes> </entity> @@ -193,14 +193,14 @@ under the License. </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue"> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/> + <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/> </id> </attributes> </entity> - <entity class="org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue"> + <entity class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue"> <table> <unique-constraint> <column-name>booleanValue</column-name> @@ -225,7 +225,7 @@ under the License. </table> <attributes> <id name="id"> - <generated-value generator="SEQ_RPlainAttrValue" strategy="TABLE"/> + <generated-value generator="SEQ_GPlainAttrValue" strategy="TABLE"/> </id> </attributes> </entity> http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/content.xml ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/resources/content.xml b/core/persistence-jpa/src/main/resources/content.xml index b0257b1..7630245 100644 --- a/core/persistence-jpa/src/main/resources/content.xml +++ b/core/persistence-jpa/src/main/resources/content.xml @@ -83,9 +83,9 @@ under the License. mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/> <CPlainSchema name="self.user.layout" type="String" mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/> - <CPlainSchema name="admin.role.layout" type="String" + <CPlainSchema name="admin.group.layout" type="String" mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/> - <CPlainSchema name="self.role.layout" type="String" + <CPlainSchema name="self.group.layout" type="String" mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/> <CPlainSchema name="admin.membership.layout" type="String" mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/> @@ -120,11 +120,11 @@ under the License. <Entitlement name="USER_UPDATE"/> <Entitlement name="USER_DELETE"/> <Entitlement name="USER_VIEW"/> - <Entitlement name="ROLE_LIST"/> - <Entitlement name="ROLE_CREATE"/> - <Entitlement name="ROLE_READ"/> - <Entitlement name="ROLE_UPDATE"/> - <Entitlement name="ROLE_DELETE"/> + <Entitlement name="GROUP_LIST"/> + <Entitlement name="GROUP_CREATE"/> + <Entitlement name="GROUP_READ"/> + <Entitlement name="GROUP_UPDATE"/> + <Entitlement name="GROUP_DELETE"/> <Entitlement name="RESOURCE_LIST"/> <Entitlement name="RESOURCE_CREATE"/> <Entitlement name="RESOURCE_READ"/> http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/indexes.xml ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/resources/indexes.xml b/core/persistence-jpa/src/main/resources/indexes.xml index effcb7b..abd3a76 100644 --- a/core/persistence-jpa/src/main/resources/indexes.xml +++ b/core/persistence-jpa/src/main/resources/indexes.xml @@ -31,10 +31,10 @@ under the License. <entry key="MPlainAttrValue_longvalueIndex">CREATE INDEX MAttrValue_longvalueIndex ON MPlainAttrValue(longvalue)</entry> <entry key="MPlainAttrValue_doublevalueIndex">CREATE INDEX MAttrValue_doublevalueIndex ON MPlainAttrValue(doublevalue)</entry> <entry key="MPlainAttrValue_booleanvalueIndex">CREATE INDEX MAttrValue_booleanvalueIndex ON MPlainAttrValue(booleanvalue)</entry> - <entry key="RPlainAttrValue_stringvalueIndex">CREATE INDEX RAttrValue_stringvalueIndex ON RPlainAttrValue(stringvalue)</entry> - <entry key="RPlainAttrValue_datevalueIndex">CREATE INDEX RAttrValue_datevalueIndex ON RPlainAttrValue(datevalue)</entry> - <entry key="RPlainAttrValue_longvalueIndex">CREATE INDEX RAttrValue_longvalueIndex ON RPlainAttrValue(longvalue)</entry> - <entry key="RPlainAttrValue_doublevalueIndex">CREATE INDEX RAttrValue_doublevalueIndex ON RPlainAttrValue(doublevalue)</entry> - <entry key="RPlainAttrValue_booleanvalueIndex">CREATE INDEX RAttrValue_booleanvalueIndex ON RPlainAttrValue(booleanvalue)</entry> + <entry key="GPlainAttrValue_stringvalueIndex">CREATE INDEX GAttrValue_stringvalueIndex ON GPlainAttrValue(stringvalue)</entry> + <entry key="GPlainAttrValue_datevalueIndex">CREATE INDEX GAttrValue_datevalueIndex ON GPlainAttrValue(datevalue)</entry> + <entry key="GPlainAttrValue_longvalueIndex">CREATE INDEX GAttrValue_longvalueIndex ON GPlainAttrValue(longvalue)</entry> + <entry key="GPlainAttrValue_doublevalueIndex">CREATE INDEX GAttrValue_doublevalueIndex ON GPlainAttrValue(doublevalue)</entry> + <entry key="GPlainAttrValue_booleanvalueIndex">CREATE INDEX GAttrValue_booleanvalueIndex ON GPlainAttrValue(booleanvalue)</entry> <entry key="Task_executedIndex">CREATE INDEX Task_executedIndex ON Task(executed)</entry> </properties> http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/persistence-jpa/src/main/resources/views.xml ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/resources/views.xml b/core/persistence-jpa/src/main/resources/views.xml index 2e029c8..aa0ec48 100644 --- a/core/persistence-jpa/src/main/resources/views.xml +++ b/core/persistence-jpa/src/main/resources/views.xml @@ -68,9 +68,9 @@ under the License. <entry key="user_search_membership"> CREATE VIEW user_search_membership AS - SELECT m.user_id AS subject_id, r.id AS role_id, r.name AS role_name - FROM Membership m, SyncopeRole r - WHERE m.role_id = r.id + SELECT m.user_id AS subject_id, r.id AS group_id, r.name AS group_name + FROM Membership m, SyncopeGroup r + WHERE m.group_id = r.id </entry> <entry key="user_search_resource"> CREATE VIEW user_search_resource AS @@ -78,20 +78,20 @@ under the License. SELECT st.user_id AS subject_id, st.resource_name AS resource_name FROM SyncopeUser_ExternalResource st </entry> - <entry key="user_search_role_resource"> - CREATE VIEW user_search_role_resource AS + <entry key="user_search_group_resource"> + CREATE VIEW user_search_group_resource AS SELECT m.user_id AS subject_id, st.resource_name AS resource_name - FROM Membership m, SyncopeRole r, SyncopeRole_ExternalResource st - WHERE m.role_id = r.id AND st.role_id = r.id + FROM Membership m, SyncopeGroup r, SyncopeGroup_ExternalResource st + WHERE m.group_id = r.id AND st.group_id = r.id </entry> - <entry key="role_search"> - CREATE VIEW role_search AS + <entry key="group_search"> + CREATE VIEW group_search AS - SELECT r.id as subject_id, r.* FROM SyncopeRole r + SELECT r.id as subject_id, r.* FROM SyncopeGroup r </entry> - <entry key="role_search_unique_attr"> - CREATE VIEW role_search_unique_attr AS + <entry key="group_search_unique_attr"> + CREATE VIEW group_search_unique_attr AS SELECT ra.owner_id AS subject_id, rat.schema_name AS schema_name, @@ -100,12 +100,12 @@ under the License. rav.doublevalue AS doublevalue, rav.longvalue AS longvalue, rav.stringvalue AS stringvalue - FROM RPlainAttrUniqueValue rav, RPlainAttr ra, RPlainAttrTemplate rat + FROM GPlainAttrUniqueValue rav, GPlainAttr ra, GPlainAttrTemplate rat WHERE rav.attribute_id = ra.id AND ra.template_id = rat.id </entry> - <entry key="role_search_attr"> - CREATE VIEW role_search_attr AS + <entry key="group_search_attr"> + CREATE VIEW group_search_attr AS SELECT ra.owner_id AS subject_id, rat.schema_name AS schema_name, @@ -114,36 +114,36 @@ under the License. rav.doublevalue AS doublevalue, rav.longvalue AS longvalue, rav.stringvalue AS stringvalue - FROM RPlainAttrValue rav, RPlainAttr ra, RPlainAttrTemplate rat + FROM GPlainAttrValue rav, GPlainAttr ra, GPlainAttrTemplate rat WHERE rav.attribute_id = ra.id AND ra.template_id = rat.id </entry> - <entry key="role_search_null_attr"> - CREATE VIEW role_search_null_attr AS + <entry key="group_search_null_attr"> + CREATE VIEW group_search_null_attr AS SELECT r.id AS subject_id, - RPlainSchema.name AS schema_name, + GPlainSchema.name AS schema_name, NULL AS booleanvalue, NULL AS datevalue, NULL AS doublevalue, NULL AS longvalue, NULL AS stringvalue - FROM SyncopeRole r CROSS JOIN RPlainSchema - LEFT OUTER JOIN RPlainAttr ra ON (ra.owner_id = r.id) - LEFT OUTER JOIN RPlainAttrTemplate rat ON (RPlainSchema.name = rat.schema_name AND ra.template_id = rat.id) + FROM SyncopeGroup r CROSS JOIN GPlainSchema + LEFT OUTER JOIN GPlainAttr ra ON (ra.owner_id = r.id) + LEFT OUTER JOIN GPlainAttrTemplate rat ON (GPlainSchema.name = rat.schema_name AND ra.template_id = rat.id) WHERE ra.id IS NULL </entry> - <entry key="role_search_resource"> - CREATE VIEW role_search_resource AS + <entry key="group_search_resource"> + CREATE VIEW group_search_resource AS - SELECT st.role_id AS subject_id, st.resource_name AS resource_name - FROM SyncopeRole_ExternalResource st + SELECT st.group_id AS subject_id, st.resource_name AS resource_name + FROM SyncopeGroup_ExternalResource st </entry> - <entry key="role_search_entitlements"> - CREATE VIEW role_search_entitlements AS + <entry key="group_search_entitlements"> + CREATE VIEW group_search_entitlements AS - SELECT st.role_id AS subject_id, st.entitlement_name AS entitlement_name - FROM SyncopeRole_Entitlement st + SELECT st.group_id AS subject_id, st.entitlement_name AS entitlement_name + FROM SyncopeGroup_Entitlement st </entry> </properties>
