You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/01/12 17:32:12 UTC
[33/52] [abbrv] [partial] syncope git commit: [SYNCOPE-620] Unit
tests all in
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAAttributableUtil.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAAttributableUtil.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAAttributableUtil.java
deleted file mode 100644
index 8b42b17..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAAttributableUtil.java
+++ /dev/null
@@ -1,879 +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.persistence.jpa.entity;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.syncope.common.lib.to.AbstractAttributableTO;
-import org.apache.syncope.common.lib.to.AbstractSubjectTO;
-import org.apache.syncope.common.lib.to.ConfTO;
-import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AttributableType;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.MappingPurpose;
-import org.apache.syncope.persistence.api.entity.AttrTemplate;
-import org.apache.syncope.persistence.api.entity.Attributable;
-import org.apache.syncope.persistence.api.entity.AttributableUtil;
-import org.apache.syncope.persistence.api.entity.DerAttr;
-import org.apache.syncope.persistence.api.entity.DerSchema;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.MappingItem;
-import org.apache.syncope.persistence.api.entity.PlainAttr;
-import org.apache.syncope.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.persistence.api.entity.PlainSchema;
-import org.apache.syncope.persistence.api.entity.VirAttr;
-import org.apache.syncope.persistence.api.entity.VirSchema;
-import org.apache.syncope.persistence.jpa.entity.conf.JPACPlainAttr;
-import org.apache.syncope.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
-import org.apache.syncope.persistence.jpa.entity.conf.JPACPlainAttrValue;
-import org.apache.syncope.persistence.jpa.entity.conf.JPACPlainSchema;
-import org.apache.syncope.persistence.jpa.entity.conf.JPAConf;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMDerAttr;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMDerSchema;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainAttr;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainAttrValue;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainSchema;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMVirAttr;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMVirSchema;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.persistence.jpa.entity.role.JPARDerAttr;
-import org.apache.syncope.persistence.jpa.entity.role.JPARDerAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.role.JPARDerSchema;
-import org.apache.syncope.persistence.jpa.entity.role.JPARMappingItem;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainAttr;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainAttrValue;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainSchema;
-import org.apache.syncope.persistence.jpa.entity.role.JPARVirAttr;
-import org.apache.syncope.persistence.jpa.entity.role.JPARVirAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.role.JPARVirSchema;
-import org.apache.syncope.persistence.jpa.entity.role.JPARole;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUDerAttr;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUDerSchema;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUMappingItem;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUPlainAttr;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUPlainAttrValue;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUPlainSchema;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUVirAttr;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUVirSchema;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUser;
-import org.apache.syncope.server.spring.BeanUtils;
-import org.identityconnectors.framework.common.objects.Uid;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings({ "unchecked", "rawtypes" })
-public class JPAAttributableUtil implements AttributableUtil {
-
- /**
- * Logger.
- */
- private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(AttributableUtil.class);
-
- private final AttributableType type;
-
- protected JPAAttributableUtil(final AttributableType type) {
- this.type = type;
- }
-
- @Override
- public AttributableType getType() {
- return type;
- }
-
- @Override
- public <T extends Attributable<?, ?, ?>> Class<T> attributableClass() {
- Class result;
-
- switch (type) {
- case ROLE:
- result = JPARole.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMembership.class;
- break;
-
- case CONFIGURATION:
- result = JPAConf.class;
- break;
-
- case USER:
- default:
- result = JPAUser.class;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainSchema> Class<T> plainSchemaClass() {
- Class result;
-
- switch (type) {
- case ROLE:
- result = JPARPlainSchema.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainSchema.class;
- break;
-
- case CONFIGURATION:
- result = JPACPlainSchema.class;
- break;
-
- case USER:
- default:
- result = JPAUPlainSchema.class;
- break;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainSchema> T newPlainSchema() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUPlainSchema();
- break;
-
- case ROLE:
- result = (T) new JPARPlainSchema();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMPlainSchema();
- break;
-
- case CONFIGURATION:
- result = (T) new JPACPlainSchema();
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttr> Class<T> plainAttrClass() {
- Class result = null;
-
- switch (type) {
- case ROLE:
- result = JPARPlainAttr.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainAttr.class;
- break;
-
- case CONFIGURATION:
- result = JPACPlainAttr.class;
- break;
-
- case USER:
- default:
- result = JPAUPlainAttr.class;
- break;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttr> T newPlainAttr() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUPlainAttr();
- break;
-
- case ROLE:
- result = (T) new JPARPlainAttr();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMPlainAttr();
- break;
-
- case CONFIGURATION:
- result = (T) new JPACPlainAttr();
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttrValue> Class<T> plainAttrValueClass() {
- Class result;
-
- switch (type) {
- case ROLE:
- result = JPARPlainAttrValue.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainAttrValue.class;
- break;
-
- case CONFIGURATION:
- result = JPACPlainAttrValue.class;
- break;
-
- case USER:
- default:
- result = JPAUPlainAttrValue.class;
- break;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttrValue> T newPlainAttrValue() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUPlainAttrValue();
- break;
-
- case ROLE:
- result = (T) new JPARPlainAttrValue();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMPlainAttrValue();
- break;
-
- case CONFIGURATION:
- result = (T) new JPACPlainAttrValue();
- break;
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass() {
- Class result;
-
- switch (type) {
- case ROLE:
- result = JPARPlainAttrUniqueValue.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainAttrUniqueValue.class;
- break;
-
- case CONFIGURATION:
- result = JPACPlainAttrUniqueValue.class;
- break;
-
- case USER:
- default:
- result = JPAUPlainAttrUniqueValue.class;
- break;
- }
-
- return result;
- }
-
- @Override
- public <T extends PlainAttrValue> T newPlainAttrUniqueValue() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUPlainAttrUniqueValue();
- break;
-
- case ROLE:
- result = (T) new JPARPlainAttrUniqueValue();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMPlainAttrUniqueValue();
- break;
-
- case CONFIGURATION:
- result = (T) new JPACPlainAttrUniqueValue();
- break;
-
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass() {
- Class result;
-
- switch (type) {
- case ROLE:
- result = JPARPlainAttrTemplate.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMPlainAttrTemplate.class;
- break;
-
- case USER:
- case CONFIGURATION:
- default:
- result = null;
- }
-
- return result;
- }
-
- @Override
- public <T extends DerSchema> Class<T> derSchemaClass() {
- Class result;
-
- switch (type) {
- case USER:
- result = JPAUDerSchema.class;
- break;
-
- case ROLE:
- result = JPARDerSchema.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMDerSchema.class;
- break;
-
- case CONFIGURATION:
- default:
- result = null;
- }
-
- return result;
- }
-
- @Override
- public <T extends DerSchema> T newDerSchema() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUDerSchema();
- break;
-
- case ROLE:
- result = (T) new JPARDerSchema();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMDerSchema();
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends DerAttr> Class<T> derAttrClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- result = JPAUDerAttr.class;
- break;
-
- case ROLE:
- result = JPARDerAttr.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMDerAttr.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends DerAttr> T newDerAttr() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUDerAttr();
- break;
-
- case ROLE:
- result = (T) new JPARDerAttr();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMDerAttr();
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- break;
-
- case ROLE:
- result = JPARDerAttrTemplate.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMDerAttrTemplate.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends VirSchema> Class<T> virSchemaClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- result = JPAUVirSchema.class;
- break;
-
- case ROLE:
- result = JPARVirSchema.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMVirSchema.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends VirSchema> T newVirSchema() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUVirSchema();
- break;
-
- case ROLE:
- result = (T) new JPARVirSchema();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMVirSchema();
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends VirAttr> Class<T> virAttrClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- result = JPAUVirAttr.class;
- break;
-
- case ROLE:
- result = JPARVirAttr.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMVirAttr.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends VirAttr> T newVirAttr() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new JPAUVirAttr();
- break;
-
- case ROLE:
- result = (T) new JPARVirAttr();
- break;
-
- case MEMBERSHIP:
- result = (T) new JPAMVirAttr();
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- break;
-
- case ROLE:
- result = JPARVirAttrTemplate.class;
- break;
-
- case MEMBERSHIP:
- result = JPAMVirAttrTemplate.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends MappingItem> T getAccountIdItem(final ExternalResource resource) {
- T result = null;
-
- if (resource != null) {
- switch (type) {
- case ROLE:
- if (resource.getRmapping() != null) {
- result = (T) resource.getRmapping().getAccountIdItem();
- }
- break;
-
- case MEMBERSHIP:
- case USER:
- if (resource.getUmapping() != null) {
- result = (T) resource.getUmapping().getAccountIdItem();
- }
- break;
-
- default:
- }
- }
-
- return result;
- }
-
- @Override
- public String getAccountLink(final ExternalResource resource) {
- String result = null;
-
- if (resource != null) {
- switch (type) {
- case USER:
- if (resource.getUmapping() != null) {
- result = resource.getUmapping().getAccountLink();
- }
- break;
-
- case ROLE:
- if (resource.getRmapping() != null) {
- result = resource.getRmapping().getAccountLink();
- }
- break;
-
- case MEMBERSHIP:
- case CONFIGURATION:
- default:
- }
- }
-
- return result;
- }
-
- @Override
- public <T extends MappingItem> List<T> getMappingItems(
- final ExternalResource resource, final MappingPurpose purpose) {
-
- List<T> items = Collections.<T>emptyList();
-
- if (resource != null) {
- switch (type) {
- case ROLE:
- if (resource.getRmapping() != null) {
- items = (List<T>) resource.getRmapping().getItems();
- }
- break;
-
- case MEMBERSHIP:
- case USER:
- if (resource.getUmapping() != null) {
- items = (List<T>) resource.getUmapping().getItems();
- }
- break;
-
- default:
- }
- }
-
- final List<T> result = new ArrayList<>();
-
- switch (purpose) {
- case SYNCHRONIZATION:
- for (T item : items) {
- if (MappingPurpose.PROPAGATION != item.getPurpose()
- && MappingPurpose.NONE != item.getPurpose()) {
-
- result.add(item);
- }
- }
- break;
-
- case PROPAGATION:
- for (T item : items) {
- if (MappingPurpose.SYNCHRONIZATION != item.getPurpose()
- && MappingPurpose.NONE != item.getPurpose()) {
-
- result.add(item);
- }
- }
- break;
-
- case BOTH:
- for (T item : items) {
- if (MappingPurpose.NONE != item.getPurpose()) {
- result.add(item);
- }
- }
- break;
-
- case NONE:
- for (T item : items) {
- if (MappingPurpose.NONE == item.getPurpose()) {
- result.add(item);
- }
- }
- break;
- default:
- LOG.error("You requested not existing purpose {}", purpose);
- }
-
- return result;
- }
-
- @Override
- public <T extends MappingItem> List<T> getUidToMappingItems(
- final ExternalResource resource, final MappingPurpose purpose) {
-
- List<T> items = getMappingItems(resource, purpose);
-
- MappingItem uidItem = type == AttributableType.USER ? new JPAUMappingItem() : new JPARMappingItem();
- BeanUtils.copyProperties(getAccountIdItem(resource), uidItem);
- uidItem.setExtAttrName(Uid.NAME);
- uidItem.setAccountid(false);
- items.add((T) uidItem);
-
- return items;
- }
-
- @Override
- public IntMappingType intMappingType() {
- IntMappingType result = null;
-
- switch (type) {
- case ROLE:
- result = IntMappingType.RoleSchema;
- break;
-
- case MEMBERSHIP:
- result = IntMappingType.MembershipSchema;
- break;
-
- case USER:
- result = IntMappingType.UserSchema;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public IntMappingType derIntMappingType() {
- IntMappingType result = null;
-
- switch (type) {
- case ROLE:
- result = IntMappingType.RoleSchema;
- break;
-
- case MEMBERSHIP:
- result = IntMappingType.MembershipSchema;
- break;
-
- case USER:
- result = IntMappingType.UserSchema;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public IntMappingType virIntMappingType() {
- IntMappingType result = null;
-
- switch (type) {
- case ROLE:
- result = IntMappingType.RoleVirtualSchema;
- break;
-
- case MEMBERSHIP:
- result = IntMappingType.MembershipVirtualSchema;
- break;
-
- case USER:
- result = IntMappingType.UserVirtualSchema;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends MappingItem> Class<T> mappingItemClass() {
- Class result = null;
-
- switch (type) {
- case USER:
- result = JPAUMappingItem.class;
- break;
-
- case ROLE:
- result = JPARMappingItem.class;
- break;
-
- case MEMBERSHIP:
- result = AbstractMappingItem.class;
- break;
-
- case CONFIGURATION:
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AbstractAttributableTO> T newAttributableTO() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new UserTO();
- break;
- case ROLE:
- result = (T) new RoleTO();
- break;
- case MEMBERSHIP:
- result = (T) new MembershipTO();
- break;
- case CONFIGURATION:
- result = (T) new ConfTO();
- break;
- default:
- }
-
- return result;
- }
-
- @Override
- public <T extends AbstractSubjectTO> T newSubjectTO() {
- T result = null;
-
- switch (type) {
- case USER:
- result = (T) new UserTO();
- break;
- case ROLE:
- result = (T) new RoleTO();
- break;
- case MEMBERSHIP:
- case CONFIGURATION:
- default:
- break;
- }
-
- return result;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAConnInstance.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAConnInstance.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAConnInstance.java
deleted file mode 100644
index 271f899..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAConnInstance.java
+++ /dev/null
@@ -1,268 +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.persistence.jpa.entity;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import javax.persistence.CascadeType;
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.apache.syncope.persistence.api.entity.ConnInstance;
-import org.apache.syncope.persistence.api.entity.ConnPoolConf;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.jpa.validation.entity.ConnInstanceCheck;
-import org.apache.syncope.server.utils.serialization.POJOHelper;
-
-@Entity
-@Table(name = JPAConnInstance.TABLE)
-@ConnInstanceCheck
-public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstance {
-
- private static final long serialVersionUID = -2294708794497208872L;
-
- public static final String TABLE = "ConnInstance";
-
- private static final int DEFAULT_TIMEOUT = 10;
-
- @Id
- private Long id;
-
- /**
- * URI identifying the local / remote ConnId location where the related connector bundle is found.
- */
- @Column(nullable = false)
- private String location;
-
- /**
- * Connector bundle class name.
- * Within a given location, the triple
- * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
- */
- @Column(nullable = false)
- private String connectorName;
-
- /**
- * Qualified name for the connector bundle.
- * Within a given location, the triple
- * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
- */
- @Column(nullable = false)
- private String bundleName;
-
- /**
- * Version of the bundle.
- * Within a given location, the triple
- * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
- */
- @Column(nullable = false)
- private String version;
-
- /**
- * The set of capabilities supported by this connector instance.
- */
- @ElementCollection(fetch = FetchType.EAGER)
- @Enumerated(EnumType.STRING)
- @Column(name = "capabilities")
- @CollectionTable(name = "ConnInstance_capabilities",
- joinColumns =
- @JoinColumn(name = "ConnInstance_id", referencedColumnName = "id"))
- private Set<ConnectorCapability> capabilities;
-
- /**
- * The main configuration for the connector instance. This is directly implemented by the Configuration bean class
- * which contains annotated ConfigurationProperties.
- *
- * @see org.identityconnectors.framework.api.ConfigurationProperty
- */
- @Lob
- private String jsonConf;
-
- @Column(unique = true)
- private String displayName;
-
- /**
- * External resources associated to the connector.
- */
- @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "connector")
- private List<JPAExternalResource> resources;
-
- /**
- * Connector request timeout. It is not applied in case of sync, full reconciliation and search.
- * DEFAULT_TIMEOUT is the default value to be used in case of unspecified timeout.
- */
- private Integer connRequestTimeout = DEFAULT_TIMEOUT;
-
- private JPAConnPoolConf poolConf;
-
- public JPAConnInstance() {
- super();
-
- capabilities = new HashSet<>();
- resources = new ArrayList<>();
- }
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- public String getLocation() {
- return location;
- }
-
- @Override
- public void setLocation(final String location) {
- this.location = location;
- }
-
- @Override
- public String getConnectorName() {
- return connectorName;
- }
-
- @Override
- public void setConnectorName(final String connectorName) {
- this.connectorName = connectorName;
- }
-
- @Override
- public String getBundleName() {
- return bundleName;
- }
-
- @Override
- public void setBundleName(final String bundleName) {
- this.bundleName = bundleName;
- }
-
- @Override
- public String getVersion() {
- return version;
- }
-
- @Override
- public void setVersion(final String version) {
- this.version = version;
- }
-
- @Override
- public Set<ConnConfProperty> getConfiguration() {
- Set<ConnConfProperty> configuration = Collections.<ConnConfProperty>emptySet();
- if (!StringUtils.isBlank(jsonConf)) {
- ConnConfProperty[] deserialized = POJOHelper.deserialize(jsonConf, ConnConfProperty[].class);
- if (ArrayUtils.isNotEmpty(deserialized)) {
- configuration = new HashSet<ConnConfProperty>(Arrays.asList(deserialized));
- }
- }
-
- return configuration;
- }
-
- @Override
- public void setConfiguration(final Set<ConnConfProperty> configuration) {
- jsonConf = POJOHelper.serialize(new HashSet<ConnConfProperty>(configuration));
- }
-
- @Override
- public String getDisplayName() {
- return displayName;
- }
-
- @Override
- public void setDisplayName(final String displayName) {
- this.displayName = displayName;
- }
-
- @Override
- public List<? extends ExternalResource> getResources() {
- return this.resources;
- }
-
- @Override
- public boolean addResource(final ExternalResource resource) {
- checkType(resource, JPAExternalResource.class);
- return this.resources.contains((JPAExternalResource) resource)
- || this.resources.add((JPAExternalResource) resource);
- }
-
- @Override
- public boolean removeResource(final ExternalResource resource) {
- checkType(resource, JPAExternalResource.class);
- return this.resources.remove((JPAExternalResource) resource);
- }
-
- @Override
- public boolean addCapability(final ConnectorCapability capabitily) {
- return capabilities.add(capabitily);
- }
-
- @Override
- public boolean removeCapability(final ConnectorCapability capabitily) {
- return capabilities.remove(capabitily);
- }
-
- @Override
- public Set<ConnectorCapability> getCapabilities() {
- return capabilities;
- }
-
- @Override
- public Integer getConnRequestTimeout() {
- // DEFAULT_TIMEOUT will be returned in case of null timeout:
- // * instances created by the content loader
- // * or with a timeout nullified explicitely
- return connRequestTimeout == null ? DEFAULT_TIMEOUT : connRequestTimeout;
- }
-
- @Override
- public void setConnRequestTimeout(final Integer timeout) {
- this.connRequestTimeout = timeout;
- }
-
- @Override
- public ConnPoolConf getPoolConf() {
- return poolConf;
- }
-
- @Override
- public void setPoolConf(final ConnPoolConf poolConf) {
- checkType(poolConf, JPAConnPoolConf.class);
- this.poolConf = (JPAConnPoolConf) poolConf;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAConnPoolConf.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAConnPoolConf.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAConnPoolConf.java
deleted file mode 100644
index a7ed759..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAConnPoolConf.java
+++ /dev/null
@@ -1,107 +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.persistence.jpa.entity;
-
-import java.io.Serializable;
-import javax.persistence.Embeddable;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.syncope.persistence.api.entity.ConnPoolConf;
-
-@Embeddable
-public class JPAConnPoolConf implements ConnPoolConf, Serializable {
-
- private static final long serialVersionUID = -34259572059178970L;
-
- private Integer maxObjects;
-
- private Integer minIdle;
-
- private Integer maxIdle;
-
- private Long maxWait;
-
- private Long minEvictableIdleTimeMillis;
-
- @Override
- public Integer getMaxObjects() {
- return maxObjects;
- }
-
- @Override
- public void setMaxObjects(final Integer maxObjects) {
- this.maxObjects = maxObjects;
- }
-
- @Override
- public Integer getMinIdle() {
- return minIdle;
- }
-
- @Override
- public void setMinIdle(final Integer minIdle) {
- this.minIdle = minIdle;
- }
-
- @Override
- public Integer getMaxIdle() {
- return maxIdle;
- }
-
- @Override
- public void setMaxIdle(final Integer maxIdle) {
- this.maxIdle = maxIdle;
- }
-
- @Override
- public Long getMaxWait() {
- return maxWait;
- }
-
- @Override
- public void setMaxWait(final Long maxWait) {
- this.maxWait = maxWait;
- }
-
- @Override
- public Long getMinEvictableIdleTimeMillis() {
- return minEvictableIdleTimeMillis;
- }
-
- @Override
- public void setMinEvictableIdleTimeMillis(final Long minEvictableIdleTimeMillis) {
- this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
- }
-
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
-
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAEntitlement.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAEntitlement.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAEntitlement.java
deleted file mode 100644
index f96f4bc..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAEntitlement.java
+++ /dev/null
@@ -1,62 +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.persistence.jpa.entity;
-
-import javax.persistence.Cacheable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import org.apache.syncope.persistence.api.entity.Entitlement;
-
-@Entity
-@Table(name = JPAEntitlement.TABLE)
-@Cacheable
-public class JPAEntitlement extends AbstractEntity<String> implements Entitlement {
-
- private static final long serialVersionUID = 8044745999246422483L;
-
- public static final String TABLE = "Entitlement";
-
- @Id
- private String name;
-
- @Column(nullable = true)
- private String description;
-
- @Override
- public String getKey() {
- return name;
- }
-
- @Override
- public void setKey(final String key) {
- this.name = key;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public void setDescription(final String description) {
- this.description = description;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAEntityFactory.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAEntityFactory.java
deleted file mode 100644
index 8e772b8..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAEntityFactory.java
+++ /dev/null
@@ -1,287 +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.persistence.jpa.entity;
-
-import org.apache.syncope.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.persistence.api.entity.ConnInstance;
-import org.apache.syncope.persistence.api.entity.ConnPoolConf;
-import org.apache.syncope.persistence.api.entity.Entitlement;
-import org.apache.syncope.persistence.api.entity.Entity;
-import org.apache.syncope.persistence.api.entity.EntityFactory;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.Notification;
-import org.apache.syncope.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.persistence.api.entity.Policy;
-import org.apache.syncope.persistence.api.entity.PushPolicy;
-import org.apache.syncope.persistence.api.entity.Report;
-import org.apache.syncope.persistence.api.entity.ReportExec;
-import org.apache.syncope.persistence.api.entity.ReportletConfInstance;
-import org.apache.syncope.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.persistence.api.entity.conf.CPlainAttr;
-import org.apache.syncope.persistence.api.entity.conf.CPlainAttrUniqueValue;
-import org.apache.syncope.persistence.api.entity.conf.CPlainAttrValue;
-import org.apache.syncope.persistence.api.entity.conf.CPlainSchema;
-import org.apache.syncope.persistence.api.entity.conf.Conf;
-import org.apache.syncope.persistence.api.entity.membership.MDerAttr;
-import org.apache.syncope.persistence.api.entity.membership.MDerAttrTemplate;
-import org.apache.syncope.persistence.api.entity.membership.MDerSchema;
-import org.apache.syncope.persistence.api.entity.membership.MPlainAttr;
-import org.apache.syncope.persistence.api.entity.membership.MPlainAttrTemplate;
-import org.apache.syncope.persistence.api.entity.membership.MPlainAttrUniqueValue;
-import org.apache.syncope.persistence.api.entity.membership.MPlainAttrValue;
-import org.apache.syncope.persistence.api.entity.membership.MPlainSchema;
-import org.apache.syncope.persistence.api.entity.membership.MVirAttr;
-import org.apache.syncope.persistence.api.entity.membership.MVirAttrTemplate;
-import org.apache.syncope.persistence.api.entity.membership.MVirSchema;
-import org.apache.syncope.persistence.api.entity.membership.Membership;
-import org.apache.syncope.persistence.api.entity.role.RDerAttr;
-import org.apache.syncope.persistence.api.entity.role.RDerAttrTemplate;
-import org.apache.syncope.persistence.api.entity.role.RDerSchema;
-import org.apache.syncope.persistence.api.entity.role.RMapping;
-import org.apache.syncope.persistence.api.entity.role.RMappingItem;
-import org.apache.syncope.persistence.api.entity.role.RPlainAttr;
-import org.apache.syncope.persistence.api.entity.role.RPlainAttrTemplate;
-import org.apache.syncope.persistence.api.entity.role.RPlainAttrUniqueValue;
-import org.apache.syncope.persistence.api.entity.role.RPlainAttrValue;
-import org.apache.syncope.persistence.api.entity.role.RPlainSchema;
-import org.apache.syncope.persistence.api.entity.role.RVirAttr;
-import org.apache.syncope.persistence.api.entity.role.RVirAttrTemplate;
-import org.apache.syncope.persistence.api.entity.role.RVirSchema;
-import org.apache.syncope.persistence.api.entity.role.Role;
-import org.apache.syncope.persistence.api.entity.task.NotificationTask;
-import org.apache.syncope.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.persistence.api.entity.task.PushTask;
-import org.apache.syncope.persistence.api.entity.task.SchedTask;
-import org.apache.syncope.persistence.api.entity.task.SyncTask;
-import org.apache.syncope.persistence.api.entity.task.TaskExec;
-import org.apache.syncope.persistence.api.entity.user.SecurityQuestion;
-import org.apache.syncope.persistence.api.entity.user.UDerAttr;
-import org.apache.syncope.persistence.api.entity.user.UDerSchema;
-import org.apache.syncope.persistence.api.entity.user.UMapping;
-import org.apache.syncope.persistence.api.entity.user.UMappingItem;
-import org.apache.syncope.persistence.api.entity.user.UPlainAttr;
-import org.apache.syncope.persistence.api.entity.user.UPlainAttrUniqueValue;
-import org.apache.syncope.persistence.api.entity.user.UPlainAttrValue;
-import org.apache.syncope.persistence.api.entity.user.UPlainSchema;
-import org.apache.syncope.persistence.api.entity.user.UVirAttr;
-import org.apache.syncope.persistence.api.entity.user.UVirSchema;
-import org.apache.syncope.persistence.api.entity.user.User;
-import org.apache.syncope.persistence.jpa.entity.conf.JPACPlainAttr;
-import org.apache.syncope.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
-import org.apache.syncope.persistence.jpa.entity.conf.JPACPlainAttrValue;
-import org.apache.syncope.persistence.jpa.entity.conf.JPACPlainSchema;
-import org.apache.syncope.persistence.jpa.entity.conf.JPAConf;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMDerAttr;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMDerSchema;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainAttr;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainAttrValue;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMPlainSchema;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMVirAttr;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMVirSchema;
-import org.apache.syncope.persistence.jpa.entity.membership.JPAMembership;
-import org.apache.syncope.persistence.jpa.entity.role.JPARDerAttr;
-import org.apache.syncope.persistence.jpa.entity.role.JPARDerAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.role.JPARDerSchema;
-import org.apache.syncope.persistence.jpa.entity.role.JPARMapping;
-import org.apache.syncope.persistence.jpa.entity.role.JPARMappingItem;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainAttr;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainAttrValue;
-import org.apache.syncope.persistence.jpa.entity.role.JPARPlainSchema;
-import org.apache.syncope.persistence.jpa.entity.role.JPARVirAttr;
-import org.apache.syncope.persistence.jpa.entity.role.JPARVirAttrTemplate;
-import org.apache.syncope.persistence.jpa.entity.role.JPARVirSchema;
-import org.apache.syncope.persistence.jpa.entity.role.JPARole;
-import org.apache.syncope.persistence.jpa.entity.task.JPANotificationTask;
-import org.apache.syncope.persistence.jpa.entity.task.JPAPropagationTask;
-import org.apache.syncope.persistence.jpa.entity.task.JPAPushTask;
-import org.apache.syncope.persistence.jpa.entity.task.JPASchedTask;
-import org.apache.syncope.persistence.jpa.entity.task.JPASyncTask;
-import org.apache.syncope.persistence.jpa.entity.task.JPATaskExec;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUDerAttr;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUDerSchema;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUMapping;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUMappingItem;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUPlainAttr;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUPlainAttrValue;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUPlainSchema;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUVirAttr;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUVirSchema;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUser;
-import org.springframework.stereotype.Component;
-
-@Component
-public class JPAEntityFactory implements EntityFactory {
-
- @SuppressWarnings("unchecked")
- @Override
- public <KEY, T extends Entity<KEY>> T newEntity(final Class<T> reference) {
- T result;
-
- if (reference.equals(User.class)) {
- result = (T) new JPAUser();
- } else if (reference.equals(Role.class)) {
- result = (T) new JPARole();
- } else if (reference.equals(Membership.class)) {
- result = (T) new JPAMembership();
- } else if (reference.equals(Conf.class)) {
- result = (T) new JPAConf();
- } else if (reference.equals(Notification.class)) {
- result = (T) new JPANotification();
- } else if (reference.equals(Entitlement.class)) {
- result = (T) new JPAEntitlement();
- } else if (reference.equals(ExternalResource.class)) {
- result = (T) new JPAExternalResource();
- } else if (reference.equals(ConnInstance.class)) {
- result = (T) new JPAConnInstance();
- } else if (reference.equals(UPlainSchema.class)) {
- result = (T) new JPAUPlainSchema();
- } else if (reference.equals(UPlainAttr.class)) {
- result = (T) new JPAUPlainAttr();
- } else if (reference.equals(UPlainAttrValue.class)) {
- result = (T) new JPAUPlainAttrValue();
- } else if (reference.equals(UPlainAttrUniqueValue.class)) {
- result = (T) new JPAUPlainAttrUniqueValue();
- } else if (reference.equals(UDerSchema.class)) {
- result = (T) new JPAUDerSchema();
- } else if (reference.equals(UDerAttr.class)) {
- result = (T) new JPAUDerAttr();
- } else if (reference.equals(UVirSchema.class)) {
- result = (T) new JPAUVirSchema();
- } else if (reference.equals(UVirAttr.class)) {
- result = (T) new JPAUVirAttr();
- } else if (reference.equals(UMapping.class)) {
- result = (T) new JPAUMapping();
- } else if (reference.equals(UMappingItem.class)) {
- result = (T) new JPAUMappingItem();
- } else if (reference.equals(RPlainSchema.class)) {
- result = (T) new JPARPlainSchema();
- } else if (reference.equals(RPlainAttr.class)) {
- result = (T) new JPARPlainAttr();
- } else if (reference.equals(RPlainAttrValue.class)) {
- result = (T) new JPARPlainAttrValue();
- } else if (reference.equals(RPlainAttrUniqueValue.class)) {
- result = (T) new JPARPlainAttrUniqueValue();
- } else if (reference.equals(RPlainAttrTemplate.class)) {
- result = (T) new JPARPlainAttrTemplate();
- } else if (reference.equals(RDerAttrTemplate.class)) {
- result = (T) new JPARDerAttrTemplate();
- } else if (reference.equals(RVirAttrTemplate.class)) {
- result = (T) new JPARVirAttrTemplate();
- } else if (reference.equals(RDerSchema.class)) {
- result = (T) new JPARDerSchema();
- } else if (reference.equals(RDerAttr.class)) {
- result = (T) new JPARDerAttr();
- } else if (reference.equals(RVirSchema.class)) {
- result = (T) new JPARVirSchema();
- } else if (reference.equals(RVirAttr.class)) {
- result = (T) new JPARVirAttr();
- } else if (reference.equals(RMapping.class)) {
- result = (T) new JPARMapping();
- } else if (reference.equals(RMappingItem.class)) {
- result = (T) new JPARMappingItem();
- } else if (reference.equals(MPlainSchema.class)) {
- result = (T) new JPAMPlainSchema();
- } else if (reference.equals(MPlainAttr.class)) {
- result = (T) new JPAMPlainAttr();
- } else if (reference.equals(MPlainAttrValue.class)) {
- result = (T) new JPAMPlainAttrValue();
- } else if (reference.equals(MPlainAttrUniqueValue.class)) {
- result = (T) new JPAMPlainAttrUniqueValue();
- } else if (reference.equals(MDerSchema.class)) {
- result = (T) new JPAMDerSchema();
- } else if (reference.equals(MDerAttr.class)) {
- result = (T) new JPAMDerAttr();
- } else if (reference.equals(MVirSchema.class)) {
- result = (T) new JPAMVirSchema();
- } else if (reference.equals(MVirAttr.class)) {
- result = (T) new JPAMVirAttr();
- } else if (reference.equals(MPlainAttrTemplate.class)) {
- result = (T) new JPAMPlainAttrTemplate();
- } else if (reference.equals(MDerAttrTemplate.class)) {
- result = (T) new JPAMDerAttrTemplate();
- } else if (reference.equals(MVirAttrTemplate.class)) {
- result = (T) new JPAMVirAttrTemplate();
- } else if (reference.equals(CPlainSchema.class)) {
- result = (T) new JPACPlainSchema();
- } else if (reference.equals(CPlainAttr.class)) {
- result = (T) new JPACPlainAttr();
- } else if (reference.equals(CPlainAttrValue.class)) {
- result = (T) new JPACPlainAttrValue();
- } else if (reference.equals(CPlainAttrUniqueValue.class)) {
- result = (T) new JPACPlainAttrUniqueValue();
- } else if (reference.equals(Report.class)) {
- result = (T) new JPAReport();
- } else if (reference.equals(ReportExec.class)) {
- result = (T) new JPAReportExec();
- } else if (reference.equals(ReportletConfInstance.class)) {
- result = (T) new JPAReportletConfInstance();
- } else if (reference.equals(NotificationTask.class)) {
- result = (T) new JPANotificationTask();
- } else if (reference.equals(PropagationTask.class)) {
- result = (T) new JPAPropagationTask();
- } else if (reference.equals(PushTask.class)) {
- result = (T) new JPAPushTask();
- } else if (reference.equals(SyncTask.class)) {
- result = (T) new JPASyncTask();
- } else if (reference.equals(SchedTask.class)) {
- result = (T) new JPASchedTask();
- } else if (reference.equals(TaskExec.class)) {
- result = (T) new JPATaskExec();
- } else if (reference.equals(SecurityQuestion.class)) {
- result = (T) new JPASecurityQuestion();
- } else {
- throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
- }
-
- return result;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T extends Policy> T newPolicy(final Class<T> reference, final boolean global) {
- T result;
-
- if (reference.equals(AccountPolicy.class)) {
- result = (T) new JPAAccountPolicy(global);
- } else if (reference.equals(PasswordPolicy.class)) {
- result = (T) new JPAPasswordPolicy(global);
- } else if (reference.equals(PushPolicy.class)) {
- result = (T) new JPAPushPolicy(global);
- } else if (reference.equals(SyncPolicy.class)) {
- result = (T) new JPASyncPolicy(global);
- } else {
- throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
- }
-
- return result;
- }
-
- @Override
- public ConnPoolConf newConnPoolConf() {
- return new JPAConnPoolConf();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAExternalResource.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAExternalResource.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAExternalResource.java
deleted file mode 100644
index 2b055bd..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAExternalResource.java
+++ /dev/null
@@ -1,426 +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.persistence.jpa.entity;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.common.lib.types.PropagationMode;
-import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.persistence.api.entity.ConnInstance;
-import org.apache.syncope.persistence.api.entity.ExternalResource;
-import org.apache.syncope.persistence.api.entity.PasswordPolicy;
-import org.apache.syncope.persistence.api.entity.SyncPolicy;
-import org.apache.syncope.persistence.api.entity.role.RMapping;
-import org.apache.syncope.persistence.api.entity.user.UMapping;
-import org.apache.syncope.persistence.jpa.validation.entity.ExternalResourceCheck;
-import org.apache.syncope.persistence.jpa.entity.role.JPARMapping;
-import org.apache.syncope.persistence.jpa.entity.user.JPAUMapping;
-import org.apache.syncope.server.utils.serialization.POJOHelper;
-import org.identityconnectors.framework.common.objects.SyncToken;
-
-/**
- * Resource for propagation and synchronization.
- */
-@Entity
-@Table(name = JPAExternalResource.TABLE)
-@ExternalResourceCheck
-public class JPAExternalResource extends AbstractAnnotatedEntity<String> implements ExternalResource {
-
- private static final long serialVersionUID = -6937712883512073278L;
-
- public static final String TABLE = "ExternalResource";
-
- /**
- * The resource identifier is the name.
- */
- @Id
- private String name;
-
- /**
- * Should this resource enforce the mandatory constraints?
- */
- @Column(nullable = false)
- @Basic
- @Min(0)
- @Max(1)
- private Integer enforceMandatoryCondition;
-
- /**
- * The resource type is identified by the associated connector.
- */
- @ManyToOne(fetch = FetchType.EAGER, cascade = { CascadeType.MERGE })
- @NotNull
- private JPAConnInstance connector;
-
- /**
- * Mapping for user objects.
- */
- @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "resource")
- private JPAUMapping umapping;
-
- /**
- * Mapping for role objects.
- */
- @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "resource")
- private JPARMapping rmapping;
-
- /**
- * Is this resource primary, for propagations?
- */
- @Column(nullable = false)
- @Basic
- @Min(0)
- @Max(1)
- private Integer propagationPrimary;
-
- /**
- * Priority index for propagation ordering.
- */
- @Column(nullable = false)
- private Integer propagationPriority;
-
- /**
- * Generate random password for propagation, if not provided?
- */
- @Column(nullable = false)
- @Basic
- @Min(0)
- @Max(1)
- private Integer randomPwdIfNotProvided;
-
- @Enumerated(EnumType.STRING)
- @Column(nullable = false)
- private PropagationMode propagationMode;
-
- @Enumerated(EnumType.STRING)
- @Column(nullable = false)
- private TraceLevel createTraceLevel;
-
- @Enumerated(EnumType.STRING)
- @Column(nullable = false)
- private TraceLevel updateTraceLevel;
-
- @Enumerated(EnumType.STRING)
- @Column(nullable = false)
- private TraceLevel deleteTraceLevel;
-
- @Enumerated(EnumType.STRING)
- @Column(nullable = false)
- private TraceLevel syncTraceLevel;
-
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
- private JPAPasswordPolicy passwordPolicy;
-
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
- private JPAAccountPolicy accountPolicy;
-
- @ManyToOne(fetch = FetchType.EAGER, optional = true)
- private JPASyncPolicy syncPolicy;
-
- /**
- * Configuration properties that are overridden from the connector instance.
- */
- @Lob
- private String jsonConf;
-
- /**
- * SyncToken for calling ConnId's sync() on users.
- */
- @Lob
- private String userializedSyncToken;
-
- /**
- * SyncToken for calling ConnId's sync() on roles.
- */
- @Lob
- private String rserializedSyncToken;
-
- /**
- * (Optional) classes for PropagationAction.
- */
- @ElementCollection(fetch = FetchType.EAGER)
- @Column(name = "action")
- @CollectionTable(name = "ExternalResource_PropActions",
- joinColumns =
- @JoinColumn(name = "ExternalResource_name", referencedColumnName = "name"))
- private List<String> propagationActionsClassNames = new ArrayList<>();
-
- /**
- * Default constructor.
- */
- public JPAExternalResource() {
- super();
-
- enforceMandatoryCondition = getBooleanAsInteger(false);
- propagationPrimary = 0;
- propagationPriority = 0;
- randomPwdIfNotProvided = 0;
- propagationMode = PropagationMode.TWO_PHASES;
-
- createTraceLevel = TraceLevel.FAILURES;
- updateTraceLevel = TraceLevel.FAILURES;
- deleteTraceLevel = TraceLevel.FAILURES;
- syncTraceLevel = TraceLevel.FAILURES;
- }
-
- @Override
- public boolean isEnforceMandatoryCondition() {
- return isBooleanAsInteger(enforceMandatoryCondition);
- }
-
- @Override
- public void setEnforceMandatoryCondition(boolean enforceMandatoryCondition) {
- this.enforceMandatoryCondition = getBooleanAsInteger(enforceMandatoryCondition);
- }
-
- @Override
- public ConnInstance getConnector() {
- return connector;
- }
-
- @Override
- public void setConnector(final ConnInstance connector) {
- checkType(connector, JPAConnInstance.class);
- this.connector = (JPAConnInstance) connector;
- }
-
- @Override
- public UMapping getUmapping() {
- return umapping;
- }
-
- @Override
- public void setUmapping(final UMapping umapping) {
- checkType(umapping, JPAUMapping.class);
- this.umapping = (JPAUMapping) umapping;
- }
-
- @Override
- public RMapping getRmapping() {
- return rmapping;
- }
-
- @Override
- public void setRmapping(final RMapping rmapping) {
- checkType(rmapping, JPARMapping.class);
- this.rmapping = (JPARMapping) rmapping;
- }
-
- @Override
- public boolean isPropagationPrimary() {
- return isBooleanAsInteger(propagationPrimary);
- }
-
- @Override
- public void setPropagationPrimary(boolean propagationPrimary) {
- this.propagationPrimary = getBooleanAsInteger(propagationPrimary);
- }
-
- @Override
- public Integer getPropagationPriority() {
- return propagationPriority;
- }
-
- @Override
- public void setPropagationPriority(Integer propagationPriority) {
- if (propagationPriority != null) {
- this.propagationPriority = propagationPriority;
- }
- }
-
- @Override
- public boolean isRandomPwdIfNotProvided() {
- return isBooleanAsInteger(randomPwdIfNotProvided);
- }
-
- @Override
- public void setRandomPwdIfNotProvided(boolean randomPwdIfNotProvided) {
- this.randomPwdIfNotProvided = getBooleanAsInteger(randomPwdIfNotProvided);
- }
-
- @Override
- public PropagationMode getPropagationMode() {
- return propagationMode;
- }
-
- @Override
- public void setPropagationMode(PropagationMode propagationMode) {
- this.propagationMode = propagationMode;
- }
-
- @Override
- public String getKey() {
- return name;
- }
-
- @Override
- public void setKey(final String name) {
- this.name = name;
- }
-
- @Override
- public TraceLevel getCreateTraceLevel() {
- return createTraceLevel;
- }
-
- @Override
- public void setCreateTraceLevel(final TraceLevel createTraceLevel) {
- this.createTraceLevel = createTraceLevel;
- }
-
- @Override
-
- public TraceLevel getDeleteTraceLevel() {
- return deleteTraceLevel;
- }
-
- @Override
- public void setDeleteTraceLevel(final TraceLevel deleteTraceLevel) {
- this.deleteTraceLevel = deleteTraceLevel;
- }
-
- @Override
- public TraceLevel getUpdateTraceLevel() {
- return updateTraceLevel;
- }
-
- @Override
- public void setUpdateTraceLevel(final TraceLevel updateTraceLevel) {
- this.updateTraceLevel = updateTraceLevel;
- }
-
- @Override
- public TraceLevel getSyncTraceLevel() {
- return syncTraceLevel;
- }
-
- @Override
- public void setSyncTraceLevel(final TraceLevel syncTraceLevel) {
- this.syncTraceLevel = syncTraceLevel;
- }
-
- @Override
- public AccountPolicy getAccountPolicy() {
- return accountPolicy;
- }
-
- @Override
- public void setAccountPolicy(final AccountPolicy accountPolicy) {
- checkType(accountPolicy, JPAAccountPolicy.class);
- this.accountPolicy = (JPAAccountPolicy) accountPolicy;
- }
-
- @Override
- public PasswordPolicy getPasswordPolicy() {
- return passwordPolicy;
- }
-
- @Override
- public void setPasswordPolicy(final PasswordPolicy passwordPolicy) {
- checkType(passwordPolicy, JPAPasswordPolicy.class);
- this.passwordPolicy = (JPAPasswordPolicy) passwordPolicy;
- }
-
- @Override
- public SyncPolicy getSyncPolicy() {
- return syncPolicy;
- }
-
- @Override
- public void setSyncPolicy(final SyncPolicy syncPolicy) {
- checkType(syncPolicy, JPASyncPolicy.class);
- this.syncPolicy = (JPASyncPolicy) syncPolicy;
- }
-
- @Override
- public Set<ConnConfProperty> getConnInstanceConfiguration() {
- return StringUtils.isBlank(jsonConf)
- ? Collections.<ConnConfProperty>emptySet()
- : new HashSet<>(Arrays.asList(POJOHelper.deserialize(jsonConf, ConnConfProperty[].class)));
- }
-
- @Override
- public void setConnInstanceConfiguration(final Set<ConnConfProperty> properties) {
- jsonConf = POJOHelper.serialize(new HashSet<>(properties));
- }
-
- @Override
- public String getSerializedUSyncToken() {
- return userializedSyncToken;
- }
-
- @Override
- public SyncToken getUsyncToken() {
- return userializedSyncToken == null
- ? null
- : POJOHelper.deserialize(userializedSyncToken, SyncToken.class);
- }
-
- @Override
- public void setUsyncToken(final SyncToken syncToken) {
- this.userializedSyncToken = syncToken == null ? null : POJOHelper.serialize(syncToken);
- }
-
- @Override
- public String getSerializedRSyncToken() {
- return rserializedSyncToken;
- }
-
- @Override
- public SyncToken getRsyncToken() {
- return rserializedSyncToken == null
- ? null
- : POJOHelper.deserialize(rserializedSyncToken, SyncToken.class);
- }
-
- @Override
- public void setRsyncToken(final SyncToken syncToken) {
- this.rserializedSyncToken = syncToken == null ? null : POJOHelper.serialize(syncToken);
- }
-
- @Override
- public List<String> getPropagationActionsClassNames() {
- return propagationActionsClassNames;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPALogger.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPALogger.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPALogger.java
deleted file mode 100644
index c20856d..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPALogger.java
+++ /dev/null
@@ -1,80 +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.persistence.jpa.entity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.apache.syncope.common.lib.types.LoggerType;
-import org.apache.syncope.persistence.api.entity.Logger;
-
-@Entity
-@Table(name = JPALogger.TABLE)
-public class JPALogger extends AbstractEntity<String> implements Logger {
-
- private static final long serialVersionUID = 943012777014416027L;
-
- public static final String TABLE = "SyncopeLogger";
-
- @Id
- @Column(name = "logName")
- private String name;
-
- @Column(name = "logLevel", nullable = false)
- @Enumerated(EnumType.STRING)
- private LoggerLevel level;
-
- @Column(name = "logType", nullable = false)
- @Enumerated(EnumType.STRING)
- private LoggerType type;
-
- @Override
- public String getKey() {
- return name;
- }
-
- @Override
- public void setKey(final String name) {
- this.name = name;
- }
-
- @Override
- public LoggerLevel getLevel() {
- return level;
- }
-
- @Override
- public void setLevel(final LoggerLevel level) {
- this.level = level;
- }
-
- @Override
- public LoggerType getType() {
- return type;
- }
-
- @Override
- public void setType(final LoggerType type) {
- this.type = type;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPANotification.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPANotification.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPANotification.java
deleted file mode 100644
index 8f93dbd..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPANotification.java
+++ /dev/null
@@ -1,262 +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.persistence.jpa.entity;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.Basic;
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Table;
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import org.apache.syncope.common.lib.types.IntMappingType;
-import org.apache.syncope.common.lib.types.TraceLevel;
-import org.apache.syncope.persistence.api.entity.Notification;
-import org.apache.syncope.persistence.jpa.validation.entity.NotificationCheck;
-
-@Entity
-@Table(name = JPANotification.TABLE)
-@NotificationCheck
-public class JPANotification extends AbstractEntity<Long> implements Notification {
-
- private static final long serialVersionUID = 3112582296912757537L;
-
- public static final String TABLE = "Notification";
-
- @Id
- private Long id;
-
- @ElementCollection(fetch = FetchType.EAGER)
- @CollectionTable(name = "Notification_events",
- joinColumns =
- @JoinColumn(name = "Notification_id", referencedColumnName = "id"))
- @Column(name = "events")
- private List<String> events;
-
- private String userAbout;
-
- private String roleAbout;
-
- private String recipients;
-
- @ElementCollection(fetch = FetchType.EAGER)
- @CollectionTable(name = "Notification_staticRecipients",
- joinColumns =
- @JoinColumn(name = "Notification_id", referencedColumnName = "id"))
- @Column(name = "staticRecipients")
- private List<String> staticRecipients;
-
- @NotNull
- @Enumerated(EnumType.STRING)
- private IntMappingType recipientAttrType;
-
- @NotNull
- private String recipientAttrName;
-
- @Column(nullable = false)
- @Basic
- @Min(0)
- @Max(1)
- private Integer selfAsRecipient;
-
- @NotNull
- private String sender;
-
- @NotNull
- private String subject;
-
- @NotNull
- private String template;
-
- @NotNull
- @Enumerated(EnumType.STRING)
- private TraceLevel traceLevel;
-
- @Column(nullable = false)
- @Basic
- @Min(0)
- @Max(1)
- private Integer active;
-
- public JPANotification() {
- events = new ArrayList<>();
- staticRecipients = new ArrayList<>();
- selfAsRecipient = getBooleanAsInteger(false);
- active = getBooleanAsInteger(true);
- traceLevel = TraceLevel.ALL;
- }
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- public String getUserAbout() {
- return userAbout;
- }
-
- @Override
- public void setUserAbout(final String userAbout) {
- this.userAbout = userAbout;
- }
-
- @Override
- public String getRoleAbout() {
- return roleAbout;
- }
-
- @Override
- public void setRoleAbout(final String roleAbout) {
- this.roleAbout = roleAbout;
- }
-
- @Override
- public String getRecipients() {
- return recipients;
- }
-
- @Override
- public void setRecipients(final String recipients) {
- this.recipients = recipients;
- }
-
- @Override
- public String getRecipientAttrName() {
- return recipientAttrName;
- }
-
- @Override
- public void setRecipientAttrName(final String recipientAttrName) {
- this.recipientAttrName = recipientAttrName;
- }
-
- @Override
- public IntMappingType getRecipientAttrType() {
- return recipientAttrType;
- }
-
- @Override
-
- public void setRecipientAttrType(final IntMappingType recipientAttrType) {
- this.recipientAttrType = recipientAttrType;
- }
-
- @Override
- public List<String> getEvents() {
- return events;
- }
-
- @Override
- public boolean addEvent(final String event) {
- return event != null && !events.contains(event) && events.add(event);
- }
-
- @Override
- public boolean removeEvent(final String event) {
- return event != null && events.remove(event);
- }
-
- @Override
- public List<String> getStaticRecipients() {
- return staticRecipients;
- }
-
- @Override
- public boolean addStaticRecipient(final String staticRecipient) {
- return staticRecipient != null && !staticRecipients.contains(staticRecipient)
- && staticRecipients.add(staticRecipient);
- }
-
- @Override
- public boolean removeStaticRecipient(final String staticRecipient) {
- return staticRecipient != null && staticRecipients.remove(staticRecipient);
- }
-
- @Override
- public boolean isSelfAsRecipient() {
- return isBooleanAsInteger(selfAsRecipient);
- }
-
- @Override
- public void setSelfAsRecipient(final boolean selfAsRecipient) {
- this.selfAsRecipient = getBooleanAsInteger(selfAsRecipient);
- }
-
- @Override
- public String getSender() {
- return sender;
- }
-
- @Override
- public void setSender(final String sender) {
- this.sender = sender;
- }
-
- @Override
- public String getSubject() {
- return subject;
- }
-
- @Override
-
- public void setSubject(final String subject) {
- this.subject = subject;
- }
-
- @Override
- public String getTemplate() {
- return template;
- }
-
- @Override
- public void setTemplate(final String template) {
- this.template = template;
- }
-
- @Override
- public TraceLevel getTraceLevel() {
- return traceLevel;
- }
-
- @Override
- public void setTraceLevel(final TraceLevel traceLevel) {
- this.traceLevel = traceLevel;
- }
-
- @Override
- public boolean isActive() {
- return isBooleanAsInteger(active);
- }
-
- @Override
- public void setActive(final boolean active) {
- this.active = getBooleanAsInteger(active);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPasswordPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPasswordPolicy.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPasswordPolicy.java
deleted file mode 100644
index b81e948..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPasswordPolicy.java
+++ /dev/null
@@ -1,43 +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.persistence.jpa.entity;
-
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.persistence.api.entity.PasswordPolicy;
-
-@Entity
-@DiscriminatorValue("PasswordPolicy")
-public class JPAPasswordPolicy extends JPAPolicy implements PasswordPolicy {
-
- private static final long serialVersionUID = 9138550910385232849L;
-
- public JPAPasswordPolicy() {
- this(false);
- }
-
- public JPAPasswordPolicy(final boolean global) {
- super();
-
- this.type = global
- ? PolicyType.GLOBAL_PASSWORD
- : PolicyType.PASSWORD;
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPolicy.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPolicy.java
deleted file mode 100644
index af0ab0a..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPolicy.java
+++ /dev/null
@@ -1,90 +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.persistence.jpa.entity;
-
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-import org.apache.syncope.common.lib.types.PolicySpec;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.persistence.api.entity.Policy;
-import org.apache.syncope.persistence.jpa.validation.entity.PolicyCheck;
-import org.apache.syncope.server.utils.serialization.POJOHelper;
-
-@Entity
-@Table(name = JPAPolicy.TABLE)
-@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
-@DiscriminatorColumn(name = "DTYPE")
-@PolicyCheck
-public abstract class JPAPolicy extends AbstractEntity<Long> implements Policy {
-
- private static final long serialVersionUID = -5844833125843247458L;
-
- public static final String TABLE = "Policy";
-
- @Id
- private Long id;
-
- @NotNull
- private String description;
-
- @NotNull
- @Enumerated(EnumType.STRING)
- protected PolicyType type;
-
- @Lob
- private String specification;
-
- @Override
- public Long getKey() {
- return id;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public void setDescription(final String description) {
- this.description = description;
- }
-
- @Override
- public PolicyType getType() {
- return type;
- }
-
- @Override
- public <T extends PolicySpec> T getSpecification(final Class<T> reference) {
- return POJOHelper.deserialize(specification, reference);
- }
-
- @Override
- public void setSpecification(final PolicySpec policy) {
- this.specification = POJOHelper.serialize(policy);
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPushPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPushPolicy.java b/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPushPolicy.java
deleted file mode 100644
index b221330..0000000
--- a/syncope620/server/persistence-jpa/src/main/java/org/apache/syncope/persistence/jpa/entity/JPAPushPolicy.java
+++ /dev/null
@@ -1,42 +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.persistence.jpa.entity;
-
-import javax.persistence.Entity;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.persistence.api.entity.PushPolicy;
-
-@Entity
-public class JPAPushPolicy extends JPAPolicy implements PushPolicy {
-
- private static final long serialVersionUID = -5875589156893921113L;
-
- public JPAPushPolicy() {
- this(false);
- }
-
- public JPAPushPolicy(final boolean global) {
- super();
-
- this.type = global
- ? PolicyType.GLOBAL_PUSH
- : PolicyType.PUSH;
- }
-
-}