http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java deleted file mode 100644 index 427d91b..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerAttrTemplate.java +++ /dev/null @@ -1,66 +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.group; - -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.group.GDerSchema; -import org.apache.syncope.core.persistence.api.entity.group.Group; -import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttrTemplate; - -@Entity -@Table(name = JPAGDerAttrTemplate.TABLE) -public class JPAGDerAttrTemplate extends AbstractDerAttrTemplate<GDerSchema> implements GDerAttrTemplate { - - private static final long serialVersionUID = 624868884107016649L; - - public static final String TABLE = "GDerAttrTemplate"; - - @ManyToOne - private JPAGroup owner; - - @ManyToOne - @JoinColumn(name = "schema_name") - private JPAGDerSchema schema; - - @Override - public GDerSchema getSchema() { - return schema; - } - - @Override - public void setSchema(final GDerSchema schema) { - checkType(schema, JPAGDerSchema.class); - this.schema = (JPAGDerSchema) schema; - } - - @Override - public Group getOwner() { - return owner; - } - - @Override - public void setOwner(final Group owner) { - checkType(owner, JPAGroup.class); - this.owner = (JPAGroup) owner; - } -}
http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerSchema.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerSchema.java deleted file mode 100644 index b0a41ac..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGDerSchema.java +++ /dev/null @@ -1,34 +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.group; - -import javax.persistence.Entity; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.group.GDerSchema; -import org.apache.syncope.core.persistence.jpa.entity.AbstractDerSchema; - -@Entity -@Table(name = JPAGDerSchema.TABLE) -public class JPAGDerSchema extends AbstractDerSchema implements GDerSchema { - - private static final long serialVersionUID = -6868889736207576372L; - - public static final String TABLE = "GDerSchema"; - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java deleted file mode 100644 index dd2679d..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMapping.java +++ /dev/null @@ -1,103 +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.group; - -import java.util.ArrayList; -import java.util.List; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.ExternalResource; -import org.apache.syncope.core.persistence.api.entity.group.GMapping; -import org.apache.syncope.core.persistence.api.entity.group.GMappingItem; -import org.apache.syncope.core.persistence.jpa.entity.AbstractMapping; -import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource; - -@Entity -@Table(name = JPAGMapping.TABLE) -public class JPAGMapping extends AbstractMapping<GMappingItem> implements GMapping { - - public static final String TABLE = "GMapping"; - - private static final long serialVersionUID = 4578756002867863392L; - - @Id - private Long id; - - /** - * Resource owning this mapping. - */ - @OneToOne - private JPAExternalResource resource; - - /** - * Attribute mappings. - */ - @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "mapping") - private List<JPAGMappingItem> items; - - public JPAGMapping() { - super(); - - items = new ArrayList<>(); - } - - @Override - public Long getKey() { - return id; - } - - @Override - public ExternalResource getResource() { - return resource; - } - - @Override - public void setResource(final ExternalResource resource) { - checkType(resource, JPAExternalResource.class); - this.resource = (JPAExternalResource) resource; - } - - @Override - public void setAccountIdItem(final GMappingItem item) { - checkType(item, JPAGMappingItem.class); - this.addAccountIdItem((JPAGMappingItem) item); - } - - @Override - public List<? extends GMappingItem> getItems() { - return items; - } - - @Override - public boolean addItem(final GMappingItem item) { - checkType(item, JPAGMappingItem.class); - return items.contains((JPAGMappingItem) item) || items.add((JPAGMappingItem) item); - } - - @Override - public boolean removeItem(final GMappingItem item) { - checkType(item, JPAGMappingItem.class); - return items.remove((JPAGMappingItem) item); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java deleted file mode 100644 index 2e3dd8e..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGMappingItem.java +++ /dev/null @@ -1,58 +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.group; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.Mapping; -import org.apache.syncope.core.persistence.api.entity.group.GMappingItem; -import org.apache.syncope.core.persistence.jpa.entity.AbstractMappingItem; - -@Entity -@Table(name = JPAGMappingItem.TABLE) -public class JPAGMappingItem extends AbstractMappingItem implements GMappingItem { - - public static final String TABLE = "GMappingItem"; - - private static final long serialVersionUID = -2670787666933476166L; - - @Id - private Long id; - - @ManyToOne - private JPAGMapping mapping; - - @Override - public Long getKey() { - return id; - } - - @Override - public Mapping<GMappingItem> getMapping() { - return mapping; - } - - @Override - public void setMapping(final Mapping<?> mapping) { - checkType(mapping, JPAGMapping.class); - this.mapping = (JPAGMapping) mapping; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java index e4f8f06..daafd08 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttr.java @@ -21,7 +21,6 @@ package org.apache.syncope.core.persistence.jpa.entity.group; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; -import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; @@ -30,21 +29,17 @@ import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.validation.Valid; -import org.apache.syncope.core.persistence.api.entity.Attributable; 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.group.GPlainAttr; -import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate; import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue; import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue; -import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema; import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttr; @Entity @Table(name = JPAGPlainAttr.TABLE) -public class JPAGPlainAttr extends AbstractPlainAttr implements GPlainAttr { +public class JPAGPlainAttr extends AbstractPlainAttr<Group> implements GPlainAttr { private static final long serialVersionUID = 2848159565890995780L; @@ -56,23 +51,14 @@ public class JPAGPlainAttr extends AbstractPlainAttr implements GPlainAttr { @ManyToOne(fetch = FetchType.EAGER) private JPAGroup owner; - @Column(nullable = false) - @OneToOne(cascade = CascadeType.MERGE) - private JPAGPlainAttrTemplate template; - @OneToMany(cascade = CascadeType.MERGE, orphanRemoval = true, mappedBy = "attribute") @Valid - private List<JPAGPlainAttrValue> values; + private List<JPAGPlainAttrValue> values = new ArrayList<>(); @OneToOne(cascade = CascadeType.ALL, mappedBy = "attribute") @Valid private JPAGPlainAttrUniqueValue uniqueValue; - public JPAGPlainAttr() { - super(); - values = new ArrayList<>(); - } - @Override public Long getKey() { return id; @@ -84,40 +70,19 @@ public class JPAGPlainAttr extends AbstractPlainAttr implements GPlainAttr { } @Override - public void setOwner(final Attributable<?, ?, ?> owner) { + public void setOwner(final Group owner) { checkType(owner, JPAGroup.class); this.owner = (JPAGroup) owner; } @Override - public GPlainAttrTemplate getTemplate() { - return template; - } - - @Override - public void setTemplate(final GPlainAttrTemplate template) { - checkType(template, JPAGPlainAttrTemplate.class); - this.template = (JPAGPlainAttrTemplate) template; - } - - @Override - public GPlainSchema getSchema() { - return template == null ? null : template.getSchema(); - } - - @Override - public void setSchema(final PlainSchema schema) { - LOG.warn("This is group attribute, set template to select schema"); - } - - @Override - protected boolean addValue(final PlainAttrValue attrValue) { + protected boolean addForMultiValue(final PlainAttrValue attrValue) { checkType(attrValue, JPAGPlainAttrValue.class); return values.add((JPAGPlainAttrValue) attrValue); } @Override - public boolean removeValue(final PlainAttrValue attrValue) { + public boolean remove(final PlainAttrValue attrValue) { checkType(attrValue, JPAGPlainAttrValue.class); return values.remove((JPAGPlainAttrValue) attrValue); } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java deleted file mode 100644 index 2af988e..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrTemplate.java +++ /dev/null @@ -1,75 +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.group; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema; -import org.apache.syncope.core.persistence.api.entity.group.Group; -import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrTemplate; - -@Entity -@Table(name = JPAGPlainAttrTemplate.TABLE) -public class JPAGPlainAttrTemplate extends AbstractPlainAttrTemplate<GPlainSchema> implements GPlainAttrTemplate { - - private static final long serialVersionUID = 6943917051517266268L; - - public static final String TABLE = "GPlainAttrTemplate"; - - @Id - private Long id; - - @ManyToOne - private JPAGroup owner; - - @Override - public Long getKey() { - return id; - } - - @ManyToOne - @JoinColumn(name = "schema_name") - private JPAGPlainSchema schema; - - @Override - public GPlainSchema getSchema() { - return schema; - } - - @Override - public void setSchema(final GPlainSchema schema) { - checkType(schema, JPAGPlainSchema.class); - this.schema = (JPAGPlainSchema) schema; - } - - @Override - public Group getOwner() { - return owner; - } - - @Override - public void setOwner(final Group owner) { - checkType(owner, JPAGroup.class); - this.owner = (JPAGroup) owner; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java index f361c03..3efae7c 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainAttrUniqueValue.java @@ -28,8 +28,8 @@ import org.apache.syncope.core.persistence.api.entity.PlainAttr; import org.apache.syncope.core.persistence.api.entity.PlainSchema; import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr; import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrUniqueValue; -import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema; import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue; +import org.apache.syncope.core.persistence.jpa.entity.JPAPlainSchema; @Entity @Table(name = JPAGPlainAttrUniqueValue.TABLE) @@ -47,7 +47,7 @@ public class JPAGPlainAttrUniqueValue extends AbstractPlainAttrValue implements @ManyToOne(optional = false) @JoinColumn(name = "schema_name") - private JPAGPlainSchema schema; + private JPAPlainSchema schema; @Override public Long getKey() { @@ -66,13 +66,13 @@ public class JPAGPlainAttrUniqueValue extends AbstractPlainAttrValue implements } @Override - public GPlainSchema getSchema() { + public PlainSchema getSchema() { return schema; } @Override public void setSchema(final PlainSchema schema) { - checkType(schema, JPAGPlainSchema.class); - this.schema = (JPAGPlainSchema) schema; + checkType(schema, JPAPlainSchema.class); + this.schema = (JPAPlainSchema) schema; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java deleted file mode 100644 index 684be57..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGPlainSchema.java +++ /dev/null @@ -1,36 +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.group; - -import javax.persistence.Cacheable; -import javax.persistence.Entity; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema; -import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainSchema; - -@Entity -@Table(name = JPAGPlainSchema.TABLE) -@Cacheable -public class JPAGPlainSchema extends AbstractPlainSchema implements GPlainSchema { - - private static final long serialVersionUID = -7417234690221851342L; - - public static final String TABLE = "GPlainSchema"; - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java index 95d9a37..302e056 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttr.java @@ -18,23 +18,16 @@ */ package org.apache.syncope.core.persistence.jpa.entity.group; -import javax.persistence.CascadeType; -import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.Attributable; -import org.apache.syncope.core.persistence.api.entity.VirSchema; import org.apache.syncope.core.persistence.api.entity.group.GVirAttr; -import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.group.GVirSchema; import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttr; @Entity @Table(name = JPAGVirAttr.TABLE) -public class JPAGVirAttr extends AbstractVirAttr implements GVirAttr { +public class JPAGVirAttr extends AbstractVirAttr<Group> implements GVirAttr { private static final long serialVersionUID = -1747430556914428649L; @@ -43,40 +36,15 @@ public class JPAGVirAttr extends AbstractVirAttr implements GVirAttr { @ManyToOne private JPAGroup owner; - @Column(nullable = false) - @OneToOne(cascade = CascadeType.MERGE) - private JPAGVirAttrTemplate template; - @Override public Group getOwner() { return owner; } @Override - public void setOwner(final Attributable<?, ?, ?> owner) { + public void setOwner(final Group owner) { checkType(owner, JPAGroup.class); this.owner = (JPAGroup) owner; } - @Override - public GVirAttrTemplate getTemplate() { - return template; - } - - @Override - public void setTemplate(final GVirAttrTemplate template) { - checkType(template, JPAGVirAttrTemplate.class); - this.template = (JPAGVirAttrTemplate) template; - } - - @Override - public GVirSchema getSchema() { - return template == null ? null : template.getSchema(); - } - - @Override - public void setSchema(final VirSchema schema) { - LOG.warn("This is group attribute, set template to select schema"); - } - } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java deleted file mode 100644 index 72f9fd3..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirAttrTemplate.java +++ /dev/null @@ -1,66 +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.group; - -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.group.GVirSchema; -import org.apache.syncope.core.persistence.api.entity.group.Group; -import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttrTemplate; - -@Entity -@Table(name = JPAGVirAttrTemplate.TABLE) -public class JPAGVirAttrTemplate extends AbstractVirAttrTemplate<GVirSchema> implements GVirAttrTemplate { - - private static final long serialVersionUID = 4896495904794493479L; - - public static final String TABLE = "GVirAttrTemplate"; - - @ManyToOne - private JPAGroup owner; - - @ManyToOne - @JoinColumn(name = "schema_name") - private JPAGVirSchema schema; - - @Override - public GVirSchema getSchema() { - return schema; - } - - @Override - public void setSchema(final GVirSchema schema) { - checkType(schema, JPAGVirSchema.class); - this.schema = (JPAGVirSchema) schema; - } - - @Override - public Group getOwner() { - return owner; - } - - @Override - public void setOwner(final Group group) { - checkType(group, JPAGroup.class); - this.owner = (JPAGroup) group; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java deleted file mode 100644 index 6f735a8..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGVirSchema.java +++ /dev/null @@ -1,36 +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.group; - -import javax.persistence.Cacheable; -import javax.persistence.Entity; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.group.GVirSchema; -import org.apache.syncope.core.persistence.jpa.entity.AbstractVirSchema; - -@Entity -@Table(name = JPAGVirSchema.TABLE) -@Cacheable -public class JPAGVirSchema extends AbstractVirSchema implements GVirSchema { - - private static final long serialVersionUID = -2595041749349652939L; - - public static final String TABLE = "GVirSchema"; - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java index 20e8808..06bebdb 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPAGroup.java @@ -19,9 +19,7 @@ package org.apache.syncope.core.persistence.jpa.entity.group; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import javax.persistence.Cacheable; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -39,35 +37,31 @@ import javax.validation.Valid; import javax.validation.constraints.NotNull; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; -import org.apache.commons.collections4.Transformer; -import org.apache.syncope.core.persistence.api.entity.AttrTemplate; -import org.apache.syncope.core.persistence.api.entity.DynGroupMembership; -import org.apache.syncope.core.persistence.api.entity.Schema; -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.misc.spring.ApplicationContextProvider; +import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO; +import org.apache.syncope.core.persistence.api.entity.AnyType; +import org.apache.syncope.core.persistence.api.entity.AnyTypeClass; +import org.apache.syncope.core.persistence.api.entity.anyobject.ADynGroupMembership; import org.apache.syncope.core.persistence.api.entity.group.GDerAttr; -import org.apache.syncope.core.persistence.api.entity.group.GDerAttrTemplate; import org.apache.syncope.core.persistence.api.entity.group.GPlainAttr; -import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrTemplate; import org.apache.syncope.core.persistence.api.entity.group.GVirAttr; -import org.apache.syncope.core.persistence.api.entity.group.GVirAttrTemplate; import org.apache.syncope.core.persistence.api.entity.group.Group; +import org.apache.syncope.core.persistence.api.entity.group.TypeExtension; +import org.apache.syncope.core.persistence.api.entity.user.UDynGroupMembership; import org.apache.syncope.core.persistence.api.entity.user.User; +import org.apache.syncope.core.persistence.jpa.entity.AbstractAny; +import org.apache.syncope.core.persistence.jpa.entity.JPAAnyTypeClass; +import org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAADynGroupMembership; import org.apache.syncope.core.persistence.jpa.validation.entity.GroupCheck; -import org.apache.syncope.core.persistence.jpa.entity.AbstractSubject; -import org.apache.syncope.core.persistence.jpa.entity.JPADynGroupMembership; -import org.apache.syncope.core.persistence.jpa.entity.JPAExternalResource; -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.resource.JPAExternalResource; +import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDynGroupMembership; import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser; @Entity @Table(name = JPAGroup.TABLE) @Cacheable @GroupCheck -public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> implements Group { +public class JPAGroup extends AbstractAny<GPlainAttr, GDerAttr, GVirAttr> implements Group { private static final long serialVersionUID = -5281258853142421875L; @@ -88,79 +82,59 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") @Valid - private List<JPAGPlainAttrTemplate> gAttrTemplates; + private List<JPAGPlainAttr> plainAttrs = new ArrayList<>(); @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") @Valid - private List<JPAGDerAttrTemplate> gDerAttrTemplates; + private List<JPAGDerAttr> derAttrs = new ArrayList<>(); @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") @Valid - private List<JPAGVirAttrTemplate> gVirAttrTemplates; + private List<JPAGVirAttr> virAttrs = new ArrayList<>(); - @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<JPAGPlainAttr> plainAttrs; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPAGDerAttr> derAttrs; - - @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") - @Valid - private List<JPAGVirAttr> virAttrs; - - /** - * Provisioning external resources. - */ @ManyToMany(fetch = FetchType.EAGER) @JoinTable(joinColumns = @JoinColumn(name = "group_id"), inverseJoinColumns = @JoinColumn(name = "resource_name")) @Valid - private Set<JPAExternalResource> resources; + private List<JPAExternalResource> resources = new ArrayList<>(); + + @ManyToMany(fetch = FetchType.EAGER) + @JoinTable(joinColumns = + @JoinColumn(name = "group_id"), + inverseJoinColumns = + @JoinColumn(name = "anyTypeClass_name")) + private List<JPAAnyTypeClass> auxClasses = new ArrayList<>(); @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "group") @Valid - private JPADynGroupMembership dynMembership; + private JPAADynGroupMembership aDynMembership; - public JPAGroup() { - super(); + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "group") + @Valid + private JPAUDynGroupMembership uDynMembership; - gAttrTemplates = new ArrayList<>(); - gDerAttrTemplates = new ArrayList<>(); - gVirAttrTemplates = new ArrayList<>(); - mAttrTemplates = new ArrayList<>(); - mDerAttrTemplates = new ArrayList<>(); - mVirAttrTemplates = new ArrayList<>(); + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "group") + private List<JPATypeExtension> typeExtensions = new ArrayList<>(); - plainAttrs = new ArrayList<>(); - derAttrs = new ArrayList<>(); - virAttrs = new ArrayList<>(); + @Override + public Long getKey() { + return id; + } - resources = new HashSet<>(); + @Override + public AnyType getType() { + return ApplicationContextProvider.getApplicationContext().getBean(AnyTypeDAO.class).findGroup(); } @Override - public Long getKey() { - return id; + public void setType(final AnyType type) { + // nothing to do } @Override - protected Set<JPAExternalResource> internalGetResources() { + protected List<JPAExternalResource> internalGetResources() { return resources; } @@ -197,59 +171,13 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im } @Override - @SuppressWarnings("unchecked") - public <T extends AttrTemplate<K>, K extends Schema> List<T> getAttrTemplates(final Class<T> reference) { - List<T> result = new ArrayList<>(); - - if (GPlainAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) gAttrTemplates; - } else if (GDerAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) gDerAttrTemplates; - } else if (GVirAttrTemplate.class.isAssignableFrom(reference)) { - result = (List<T>) gVirAttrTemplates; - } 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) { - - return CollectionUtils.find(getAttrTemplates(reference), new Predicate<T>() { - - @Override - public boolean evaluate(final T template) { - return schemaName.equals(template.getSchema().getKey()); - } - }); - } - - @Override - public <T extends AttrTemplate<K>, K extends Schema> List<K> getAttrTemplateSchemas(final Class<T> reference) { - return CollectionUtils.collect(getAttrTemplates(reference), new Transformer<T, K>() { - - @Override - public K transform(final T input) { - return input.getSchema(); - } - }, new ArrayList<K>()); - } - - @Override - public boolean addPlainAttr(final GPlainAttr attr) { + public boolean add(final GPlainAttr attr) { checkType(attr, JPAGPlainAttr.class); return plainAttrs.add((JPAGPlainAttr) attr); } @Override - public boolean removePlainAttr(final GPlainAttr attr) { + public boolean remove(final GPlainAttr attr) { checkType(attr, JPAGPlainAttr.class); return plainAttrs.remove((JPAGPlainAttr) attr); } @@ -260,13 +188,13 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im } @Override - public boolean addDerAttr(final GDerAttr attr) { + public boolean add(final GDerAttr attr) { checkType(attr, JPAGDerAttr.class); return derAttrs.add((JPAGDerAttr) attr); } @Override - public boolean removeDerAttr(final GDerAttr attr) { + public boolean remove(final GDerAttr attr) { checkType(attr, JPAGDerAttr.class); return derAttrs.remove((JPAGDerAttr) attr); } @@ -277,13 +205,13 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im } @Override - public boolean addVirAttr(final GVirAttr attr) { + public boolean add(final GVirAttr attr) { checkType(attr, JPAGVirAttr.class); return virAttrs.add((JPAGVirAttr) attr); } @Override - public boolean removeVirAttr(final GVirAttr attr) { + public boolean remove(final GVirAttr attr) { checkType(attr, JPAGVirAttr.class); return virAttrs.remove((JPAGVirAttr) attr); } @@ -294,14 +222,70 @@ public class JPAGroup extends AbstractSubject<GPlainAttr, GDerAttr, GVirAttr> im } @Override - public DynGroupMembership getDynMembership() { - return dynMembership; + public ADynGroupMembership getADynMembership() { + return aDynMembership; + } + + @Override + public void setADynMembership(final ADynGroupMembership aDynMembership) { + checkType(aDynMembership, JPAADynGroupMembership.class); + this.aDynMembership = (JPAADynGroupMembership) aDynMembership; + } + + @Override + public UDynGroupMembership getUDynMembership() { + return uDynMembership; + } + + @Override + public void setUDynMembership(final UDynGroupMembership uDynMembership) { + checkType(aDynMembership, JPAADynGroupMembership.class); + this.uDynMembership = (JPAUDynGroupMembership) uDynMembership; + } + + @Override + public boolean add(final AnyTypeClass auxClass) { + checkType(auxClass, JPAAnyTypeClass.class); + return this.auxClasses.add((JPAAnyTypeClass) auxClass); + } + + @Override + public boolean remove(final AnyTypeClass auxClass) { + checkType(auxClass, JPAAnyTypeClass.class); + return this.auxClasses.remove((JPAAnyTypeClass) auxClass); + } + + @Override + public List<? extends AnyTypeClass> getAuxClasses() { + return auxClasses; + } + + @Override + public boolean add(final TypeExtension typeExtension) { + checkType(typeExtension, JPATypeExtension.class); + return this.typeExtensions.add((JPATypeExtension) typeExtension); + } + + @Override + public boolean remove(final TypeExtension typeExtension) { + checkType(typeExtension, JPATypeExtension.class); + return this.typeExtensions.remove((JPATypeExtension) typeExtension); + } + + @Override + public TypeExtension getTypeExtension(final AnyType anyType) { + return CollectionUtils.find(typeExtensions, new Predicate<TypeExtension>() { + + @Override + public boolean evaluate(final TypeExtension typeExtension) { + return typeExtension.getAnyType().equals(anyType); + } + }); } @Override - public void setDynMembership(final DynGroupMembership dynMembership) { - checkType(dynMembership, JPADynGroupMembership.class); - this.dynMembership = (JPADynGroupMembership) dynMembership; + public List<? extends TypeExtension> getTypeExtensions() { + return typeExtensions; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPATypeExtension.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPATypeExtension.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPATypeExtension.java new file mode 100644 index 0000000..69fe3be --- /dev/null +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/group/JPATypeExtension.java @@ -0,0 +1,108 @@ +/* + * 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.group; + +import java.util.ArrayList; +import java.util.List; +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.Table; +import javax.persistence.UniqueConstraint; +import org.apache.syncope.core.persistence.api.entity.AnyType; +import org.apache.syncope.core.persistence.api.entity.AnyTypeClass; +import org.apache.syncope.core.persistence.api.entity.group.Group; +import org.apache.syncope.core.persistence.api.entity.group.TypeExtension; +import org.apache.syncope.core.persistence.jpa.entity.AbstractEntity; +import org.apache.syncope.core.persistence.jpa.entity.JPAAnyType; +import org.apache.syncope.core.persistence.jpa.entity.JPAAnyTypeClass; + +@Entity +@Table(name = JPATypeExtension.TABLE, uniqueConstraints = + @UniqueConstraint(columnNames = { "group_id", "anyType_name" })) +public class JPATypeExtension extends AbstractEntity<Long> implements TypeExtension { + + private static final long serialVersionUID = -8367626793791263551L; + + public static final String TABLE = "TypeExtension"; + + @Id + private Long id; + + @ManyToOne + private JPAGroup group; + + @ManyToOne + private JPAAnyType anyType; + + @ManyToMany(fetch = FetchType.EAGER) + @JoinTable(joinColumns = + @JoinColumn(name = "typeExtension_id"), + inverseJoinColumns = + @JoinColumn(name = "anyTypeClass_name")) + private List<JPAAnyTypeClass> auxClasses = new ArrayList<>(); + + @Override + public Long getKey() { + return id; + } + + @Override + public Group getGroup() { + return group; + } + + @Override + public void setGroup(final Group group) { + checkType(group, JPAGroup.class); + this.group = (JPAGroup) group; + } + + @Override + public AnyType getAnyType() { + return anyType; + } + + @Override + public void setAnyType(final AnyType anyType) { + checkType(anyType, JPAAnyType.class); + this.anyType = (JPAAnyType) anyType; + } + + @Override + public boolean add(final AnyTypeClass auxClass) { + checkType(auxClass, JPAAnyTypeClass.class); + return this.auxClasses.add((JPAAnyTypeClass) auxClass); + } + + @Override + public boolean remove(final AnyTypeClass auxClass) { + checkType(auxClass, JPAAnyTypeClass.class); + return this.auxClasses.remove((JPAAnyTypeClass) auxClass); + } + + @Override + public List<? extends AnyTypeClass> getAuxClasses() { + return auxClasses; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java deleted file mode 100644 index 698f68c..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttr.java +++ /dev/null @@ -1,82 +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.membership; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.Attributable; -import org.apache.syncope.core.persistence.api.entity.DerSchema; -import org.apache.syncope.core.persistence.api.entity.membership.MDerAttr; -import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema; -import org.apache.syncope.core.persistence.api.entity.membership.Membership; -import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttr; - -@Entity -@Table(name = JPAMDerAttr.TABLE) -public class JPAMDerAttr extends AbstractDerAttr implements MDerAttr { - - private static final long serialVersionUID = -443509121923448129L; - - public static final String TABLE = "MDerAttr"; - - @ManyToOne - private JPAMembership owner; - - @Column(nullable = false) - @OneToOne(cascade = CascadeType.MERGE) - private JPAMDerAttrTemplate template; - - @Override - public Membership getOwner() { - return owner; - } - - @Override - public void setOwner(final Attributable<?, ?, ?> owner) { - checkType(owner, JPAMembership.class); - this.owner = (JPAMembership) owner; - } - - @Override - public MDerAttrTemplate getTemplate() { - return template; - } - - @Override - public void setTemplate(final MDerAttrTemplate template) { - checkType(template, JPAMDerAttrTemplate.class); - this.template = (JPAMDerAttrTemplate) template; - } - - @Override - public MDerSchema getSchema() { - return template == null ? null : template.getSchema(); - } - - @Override - public void setSchema(final DerSchema schema) { - LOG.warn("This is membership attribute, set template to select schema"); - } - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java deleted file mode 100644 index 2139cd5..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerAttrTemplate.java +++ /dev/null @@ -1,67 +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.membership; - -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema; -import org.apache.syncope.core.persistence.api.entity.group.Group; -import org.apache.syncope.core.persistence.jpa.entity.AbstractDerAttrTemplate; -import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup; - -@Entity -@Table(name = JPAMDerAttrTemplate.TABLE) -public class JPAMDerAttrTemplate extends AbstractDerAttrTemplate<MDerSchema> implements MDerAttrTemplate { - - private static final long serialVersionUID = -4465930976210263434L; - - public static final String TABLE = "MDerAttrTemplate"; - - @ManyToOne - private JPAGroup owner; - - @ManyToOne - @JoinColumn(name = "schema_name") - private JPAMDerSchema schema; - - @Override - public MDerSchema getSchema() { - return schema; - } - - @Override - public void setSchema(final MDerSchema schema) { - checkType(schema, JPAMDerSchema.class); - this.schema = (JPAMDerSchema) schema; - } - - @Override - public Group getOwner() { - return owner; - } - - @Override - public void setOwner(final Group owner) { - checkType(owner, JPAGroup.class); - this.owner = (JPAGroup) owner; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerSchema.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerSchema.java deleted file mode 100644 index e6711d6..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMDerSchema.java +++ /dev/null @@ -1,34 +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.membership; - -import javax.persistence.Entity; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema; -import org.apache.syncope.core.persistence.jpa.entity.AbstractDerSchema; - -@Entity -@Table(name = JPAMDerSchema.TABLE) -public class JPAMDerSchema extends AbstractDerSchema implements MDerSchema { - - private static final long serialVersionUID = -4694082505732174583L; - - public static final String TABLE = "MDerSchema"; - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java deleted file mode 100644 index a6c19ff..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttr.java +++ /dev/null @@ -1,141 +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.membership; - -import java.util.ArrayList; -import java.util.List; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.validation.Valid; -import org.apache.syncope.core.persistence.api.entity.Attributable; -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.MPlainAttr; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrUniqueValue; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrValue; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema; -import org.apache.syncope.core.persistence.api.entity.membership.Membership; -import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttr; - -@Entity -@Table(name = JPAMPlainAttr.TABLE) -public class JPAMPlainAttr extends AbstractPlainAttr implements MPlainAttr { - - private static final long serialVersionUID = 3755864809152866489L; - - public static final String TABLE = "MPlainAttr"; - - @Id - private Long id; - - @ManyToOne(fetch = FetchType.EAGER) - private JPAMembership owner; - - @Column(nullable = false) - @OneToOne(cascade = CascadeType.MERGE) - private JPAMPlainAttrTemplate template; - - @OneToMany(cascade = CascadeType.MERGE, orphanRemoval = true, mappedBy = "attribute") - @Valid - private List<JPAMPlainAttrValue> values; - - @OneToOne(cascade = CascadeType.ALL, mappedBy = "attribute") - @Valid - private JPAMPlainAttrUniqueValue uniqueValue; - - public JPAMPlainAttr() { - super(); - values = new ArrayList<>(); - } - - @Override - public Long getKey() { - return id; - } - - @Override - public Membership getOwner() { - return owner; - } - - @Override - public void setOwner(final Attributable<?, ?, ?> owner) { - checkType(owner, JPAMembership.class); - this.owner = (JPAMembership) owner; - } - - @Override - public MPlainAttrTemplate getTemplate() { - return template; - } - - @Override - public void setTemplate(final MPlainAttrTemplate template) { - checkType(template, JPAMPlainAttrTemplate.class); - this.template = (JPAMPlainAttrTemplate) template; - } - - @Override - public MPlainSchema getSchema() { - return template == null ? null : template.getSchema(); - } - - @Override - public void setSchema(final PlainSchema schema) { - LOG.warn("This is membership attribute, set template to select schema"); - } - - @Override - protected boolean addValue(final PlainAttrValue attrValue) { - checkType(attrValue, JPAMPlainAttrValue.class); - return values.add((JPAMPlainAttrValue) attrValue); - } - - @Override - public boolean removeValue(final PlainAttrValue attrValue) { - checkType(attrValue, JPAMPlainAttrValue.class); - return values.remove((JPAMPlainAttrValue) attrValue); - } - - @Override - public List<? extends MPlainAttrValue> getValues() { - return values; - } - - @Override - public MPlainAttrUniqueValue getUniqueValue() { - return uniqueValue; - } - - @Override - public void setUniqueValue(final PlainAttrUniqueValue uniqueValue) { - checkType(owner, JPAMPlainAttrUniqueValue.class); - this.uniqueValue = (JPAMPlainAttrUniqueValue) uniqueValue; - } - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java deleted file mode 100644 index 7b43ec7..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrTemplate.java +++ /dev/null @@ -1,77 +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.membership; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema; -import org.apache.syncope.core.persistence.api.entity.group.Group; -import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrTemplate; -import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup; - -@Entity -@Table(name = JPAMPlainAttrTemplate.TABLE) -public class JPAMPlainAttrTemplate extends AbstractPlainAttrTemplate<MPlainSchema> implements MPlainAttrTemplate { - - private static final long serialVersionUID = -8768086609963244514L; - - public static final String TABLE = "MPlainAttrTemplate"; - - @Id - private Long id; - - @ManyToOne - private JPAGroup owner; - - @ManyToOne - @JoinColumn(name = "schema_name") - private JPAMPlainSchema schema; - - @Override - public Long getKey() { - return id; - } - - @Override - public MPlainSchema getSchema() { - return schema; - } - - @Override - public void setSchema(final MPlainSchema schema) { - checkType(schema, JPAMPlainSchema.class); - this.schema = (JPAMPlainSchema) schema; - } - - @Override - public JPAGroup getOwner() { - return owner; - } - - @Override - public void setOwner(final Group owner) { - checkType(owner, JPAGroup.class); - this.owner = (JPAGroup) owner; - } - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrUniqueValue.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrUniqueValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrUniqueValue.java deleted file mode 100644 index 3bf92ce..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrUniqueValue.java +++ /dev/null @@ -1,78 +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.membership; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.PlainAttr; -import org.apache.syncope.core.persistence.api.entity.PlainSchema; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrUniqueValue; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema; -import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue; - -@Entity -@Table(name = JPAMPlainAttrUniqueValue.TABLE) -public class JPAMPlainAttrUniqueValue extends AbstractPlainAttrValue implements MPlainAttrUniqueValue { - - private static final long serialVersionUID = 3985867531873453718L; - - public static final String TABLE = "MPlainAttrUniqueValue"; - - @Id - private Long id; - - @OneToOne(optional = false) - private JPAMPlainAttr attribute; - - @ManyToOne(optional = false) - @JoinColumn(name = "schema_name") - private JPAMPlainSchema schema; - - @Override - public Long getKey() { - return id; - } - - @Override - public MPlainAttr getAttr() { - return attribute; - } - - @Override - public void setAttr(final PlainAttr attr) { - checkType(attr, JPAMPlainAttr.class); - this.attribute = (JPAMPlainAttr) attr; - } - - @Override - public MPlainSchema getSchema() { - return schema; - } - - @Override - public void setSchema(final PlainSchema schema) { - checkType(schema, JPAMPlainSchema.class); - this.schema = (JPAMPlainSchema) schema; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrValue.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrValue.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrValue.java deleted file mode 100644 index 0327211..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainAttrValue.java +++ /dev/null @@ -1,64 +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.membership; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import javax.validation.constraints.NotNull; -import org.apache.syncope.core.persistence.api.entity.PlainAttr; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrValue; -import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue; - -@Entity -@Table(name = JPAMPlainAttrValue.TABLE) -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) -public class JPAMPlainAttrValue extends AbstractPlainAttrValue implements MPlainAttrValue { - - private static final long serialVersionUID = -7188881172631198385L; - - public static final String TABLE = "MPlainAttrValue"; - - @Id - private Long id; - - @ManyToOne - @NotNull - private JPAMPlainAttr attribute; - - @Override - public Long getKey() { - return id; - } - - @Override - public MPlainAttr getAttr() { - return attribute; - } - - @Override - public void setAttr(final PlainAttr attr) { - checkType(attr, JPAMPlainAttr.class); - this.attribute = (JPAMPlainAttr) attr; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainSchema.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainSchema.java deleted file mode 100644 index fd000d6..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMPlainSchema.java +++ /dev/null @@ -1,36 +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.membership; - -import javax.persistence.Cacheable; -import javax.persistence.Entity; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema; -import org.apache.syncope.core.persistence.jpa.entity.AbstractPlainSchema; - -@Entity -@Table(name = JPAMPlainSchema.TABLE) -@Cacheable -public class JPAMPlainSchema extends AbstractPlainSchema implements MPlainSchema { - - private static final long serialVersionUID = -8053736450044590651L; - - public static final String TABLE = "MPlainSchema"; - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java deleted file mode 100644 index ba7fe06..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttr.java +++ /dev/null @@ -1,81 +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.membership; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.Attributable; -import org.apache.syncope.core.persistence.api.entity.VirSchema; -import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr; -import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema; -import org.apache.syncope.core.persistence.api.entity.membership.Membership; -import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttr; - -@Entity -@Table(name = JPAMVirAttr.TABLE) -public class JPAMVirAttr extends AbstractVirAttr implements MVirAttr { - - private static final long serialVersionUID = 7774760571251641332L; - - public static final String TABLE = "MVirAttr"; - - @ManyToOne - private JPAMembership owner; - - @Column(nullable = false) - @OneToOne(cascade = CascadeType.MERGE) - private JPAMVirAttrTemplate template; - - @Override - public Membership getOwner() { - return owner; - } - - @Override - public void setOwner(final Attributable<?, ?, ?> owner) { - checkType(owner, JPAMembership.class); - this.owner = (JPAMembership) owner; - } - - @Override - public MVirAttrTemplate getTemplate() { - return template; - } - - @Override - public void setTemplate(final MVirAttrTemplate template) { - checkType(template, JPAMVirAttrTemplate.class); - this.template = (JPAMVirAttrTemplate) template; - } - - @Override - public MVirSchema getSchema() { - return template == null ? null : template.getSchema(); - } - - @Override - public void setSchema(final VirSchema schema) { - LOG.warn("This is membership attribute, set template to select schema"); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java deleted file mode 100644 index da84c4d..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirAttrTemplate.java +++ /dev/null @@ -1,67 +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.membership; - -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate; -import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema; -import org.apache.syncope.core.persistence.api.entity.group.Group; -import org.apache.syncope.core.persistence.jpa.entity.AbstractVirAttrTemplate; -import org.apache.syncope.core.persistence.jpa.entity.group.JPAGroup; - -@Entity -@Table(name = JPAMVirAttrTemplate.TABLE) -public class JPAMVirAttrTemplate extends AbstractVirAttrTemplate<MVirSchema> implements MVirAttrTemplate { - - private static final long serialVersionUID = 6618560912535667392L; - - public static final String TABLE = "MVirAttrTemplate"; - - @ManyToOne - private JPAGroup owner; - - @ManyToOne - @JoinColumn(name = "schema_name") - private JPAMVirSchema schema; - - @Override - public MVirSchema getSchema() { - return schema; - } - - @Override - public void setSchema(final MVirSchema schema) { - checkType(schema, JPAMVirSchema.class); - this.schema = (JPAMVirSchema) schema; - } - - @Override - public Group getOwner() { - return owner; - } - - @Override - public void setOwner(final Group group) { - checkType(group, JPAGroup.class); - this.owner = (JPAGroup) group; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirSchema.java ---------------------------------------------------------------------- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirSchema.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirSchema.java deleted file mode 100644 index 589ec6e..0000000 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/membership/JPAMVirSchema.java +++ /dev/null @@ -1,36 +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.membership; - -import javax.persistence.Cacheable; -import javax.persistence.Entity; -import javax.persistence.Table; -import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema; -import org.apache.syncope.core.persistence.jpa.entity.AbstractVirSchema; - -@Entity -@Table(name = JPAMVirSchema.TABLE) -@Cacheable -public class JPAMVirSchema extends AbstractVirSchema implements MVirSchema { - - private static final long serialVersionUID = 6255905733563668766L; - - public static final String TABLE = "MVirSchema"; - -}
