Return-Path: X-Original-To: apmail-syncope-commits-archive@www.apache.org Delivered-To: apmail-syncope-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63CBC10E7C for ; Mon, 12 Jan 2015 16:31:41 +0000 (UTC) Received: (qmail 24189 invoked by uid 500); 12 Jan 2015 16:31:43 -0000 Delivered-To: apmail-syncope-commits-archive@syncope.apache.org Received: (qmail 24161 invoked by uid 500); 12 Jan 2015 16:31:43 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 23298 invoked by uid 99); 12 Jan 2015 16:31:42 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Jan 2015 16:31:42 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E579AA014B3; Mon, 12 Jan 2015 16:31:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ilgrosso@apache.org To: commits@syncope.apache.org Date: Mon, 12 Jan 2015 16:32:19 -0000 Message-Id: In-Reply-To: <42bacbfafc744cb28210a7389d0a3305@git.apache.org> References: <42bacbfafc744cb28210a7389d0a3305@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [40/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-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java deleted file mode 100644 index 2352130..0000000 --- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UMappingItem.java +++ /dev/null @@ -1,29 +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.api.entity.user; - -import org.apache.syncope.persistence.api.entity.Mapping; -import org.apache.syncope.persistence.api.entity.MappingItem; - -public interface UMappingItem extends MappingItem { - - @Override - Mapping getMapping(); - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttr.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttr.java deleted file mode 100644 index 59a9863..0000000 --- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttr.java +++ /dev/null @@ -1,38 +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.api.entity.user; - -import java.util.List; -import org.apache.syncope.persistence.api.entity.PlainAttr; - -public interface UPlainAttr extends PlainAttr { - - @Override - User getOwner(); - - @Override - UPlainSchema getSchema(); - - @Override - List getValues(); - - @Override - UPlainAttrUniqueValue getUniqueValue(); - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrUniqueValue.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrUniqueValue.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrUniqueValue.java deleted file mode 100644 index 078da52..0000000 --- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrUniqueValue.java +++ /dev/null @@ -1,31 +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.api.entity.user; - -import org.apache.syncope.persistence.api.entity.PlainAttrUniqueValue; - -public interface UPlainAttrUniqueValue extends PlainAttrUniqueValue { - - @Override - UPlainAttr getAttr(); - - @Override - UPlainSchema getSchema(); - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrValue.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrValue.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrValue.java deleted file mode 100644 index bab1fde..0000000 --- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainAttrValue.java +++ /dev/null @@ -1,28 +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.api.entity.user; - -import org.apache.syncope.persistence.api.entity.PlainAttrValue; - -public interface UPlainAttrValue extends PlainAttrValue { - - @Override - UPlainAttr getAttr(); - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainSchema.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainSchema.java deleted file mode 100644 index 1ec236e..0000000 --- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UPlainSchema.java +++ /dev/null @@ -1,25 +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.api.entity.user; - -import org.apache.syncope.persistence.api.entity.PlainSchema; - -public interface UPlainSchema extends PlainSchema { - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java deleted file mode 100644 index 78f6882..0000000 --- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirAttr.java +++ /dev/null @@ -1,31 +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.api.entity.user; - -import org.apache.syncope.persistence.api.entity.VirAttr; - -public interface UVirAttr extends VirAttr { - - @Override - User getOwner(); - - @Override - UVirSchema getSchema(); - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirSchema.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirSchema.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirSchema.java deleted file mode 100644 index 78575f7..0000000 --- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/UVirSchema.java +++ /dev/null @@ -1,25 +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.api.entity.user; - -import org.apache.syncope.persistence.api.entity.VirSchema; - -public interface UVirSchema extends VirSchema { - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java deleted file mode 100644 index 6eece4d..0000000 --- a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/persistence/api/entity/user/User.java +++ /dev/null @@ -1,150 +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.api.entity.user; - -import java.util.Date; -import java.util.List; -import java.util.Set; -import org.apache.syncope.common.lib.types.CipherAlgorithm; -import org.apache.syncope.persistence.api.entity.ExternalResource; -import org.apache.syncope.persistence.api.entity.Subject; -import org.apache.syncope.persistence.api.entity.membership.Membership; -import org.apache.syncope.persistence.api.entity.role.Role; - -public interface User extends Subject { - - boolean addMembership(Membership membership); - - boolean canDecodePassword(); - - boolean checkToken(String token); - - void generateToken(int tokenLength, int tokenExpireTime); - - Date getChangePwdDate(); - - CipherAlgorithm getCipherAlgorithm(); - - String getClearPassword(); - - Integer getFailedLogins(); - - Date getLastLoginDate(); - - Membership getMembership(Long syncopeRoleId); - - List getMemberships(); - - Set getOwnResources(); - - String getPassword(); - - List getPasswordHistory(); - - Set getRoleIds(); - - List getRoles(); - - String getSecurityAnswer(); - - SecurityQuestion getSecurityQuestion(); - - String getStatus(); - - String getToken(); - - Date getTokenExpireTime(); - - String getUsername(); - - String getWorkflowId(); - - boolean hasTokenExpired(); - - Boolean isSuspended(); - - void removeClearPassword(); - - boolean removeMembership(Membership membership); - - void removeToken(); - - void setChangePwdDate(Date changePwdDate); - - void setCipherAlgorithm(CipherAlgorithm cipherAlgorithm); - - void setEncodedPassword(String password, CipherAlgorithm cipherAlgoritm); - - void setFailedLogins(Integer failedLogins); - - void setLastLoginDate(Date lastLoginDate); - - void setPassword(String password, CipherAlgorithm cipherAlgoritm); - - void setSecurityAnswer(String securityAnswer); - - void setSecurityQuestion(SecurityQuestion securityQuestion); - - void setStatus(String status); - - void setSuspended(Boolean suspended); - - void setUsername(String username); - - void setWorkflowId(String workflowId); - - boolean verifyPasswordHistory(String password, int size); - - @Override - boolean addPlainAttr(UPlainAttr attr); - - @Override - boolean removePlainAttr(UPlainAttr attr); - - @Override - boolean addDerAttr(UDerAttr attr); - - @Override - boolean removeDerAttr(UDerAttr derAttr); - - @Override - boolean addVirAttr(UVirAttr attr); - - @Override - boolean removeVirAttr(UVirAttr virAttr); - - @Override - UPlainAttr getPlainAttr(String plainSchemaName); - - @Override - List getPlainAttrs(); - - @Override - UDerAttr getDerAttr(String derSchemaName); - - @Override - List getDerAttrs(); - - @Override - UVirAttr getVirAttr(String virSchemaName); - - @Override - List getVirAttrs(); - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/RoleEntitlementUtil.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/RoleEntitlementUtil.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/RoleEntitlementUtil.java new file mode 100644 index 0000000..fc9eb1a --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/RoleEntitlementUtil.java @@ -0,0 +1,88 @@ +/* + * 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.server.persistence.api; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; +import org.apache.syncope.server.persistence.api.entity.Entitlement; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Utility class for manipulating entitlements. + */ +public final class RoleEntitlementUtil { + + private static final Pattern ROLE_ENTITLEMENT_NAME_PATTERN = Pattern.compile("^ROLE_([\\d])+"); + + private static final Logger LOG = LoggerFactory.getLogger(RoleEntitlementUtil.class); + + public static String getEntitlementNameFromRoleKey(final Long roleKey) { + return "ROLE_" + roleKey; + } + + public static boolean isRoleEntitlement(final String entitlementName) { + return ROLE_ENTITLEMENT_NAME_PATTERN.matcher(entitlementName).matches(); + } + + public static Long getRoleKey(final String entitlementName) { + Long result = null; + + if (isRoleEntitlement(entitlementName)) { + try { + result = Long.valueOf(entitlementName.substring(entitlementName.indexOf('_') + 1)); + } catch (Exception e) { + LOG.error("unable to parse {} to Long", entitlementName, e); + } + } + + return result; + } + + public static Set getRoleKeys(final Set entitlements) { + Set result = new HashSet<>(); + + for (String entitlement : entitlements) { + if (isRoleEntitlement(entitlement)) { + Long roleId = getRoleKey(entitlement); + if (roleId != null) { + result.add(roleId); + } + } + } + + return result; + } + + public static Set getRoleKeys(final List entitlements) { + Set names = new HashSet<>(entitlements.size()); + for (Entitlement entitlement : entitlements) { + names.add(entitlement.getKey()); + } + return getRoleKeys(names); + } + + /** + * Private default constructor, for static-only classes. + */ + private RoleEntitlementUtil() { + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/InvalidEntityException.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/InvalidEntityException.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/InvalidEntityException.java new file mode 100644 index 0000000..c1daa31 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/InvalidEntityException.java @@ -0,0 +1,129 @@ +/* + * 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.server.persistence.api.attrvalue.validation; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import javax.validation.ConstraintViolation; +import javax.validation.ValidationException; +import org.apache.syncope.common.lib.types.EntityViolationType; + +/** + * Exception thrown when any JPA entity fails bean validation. + */ +public class InvalidEntityException extends ValidationException { + + private static final long serialVersionUID = 3249297275444409691L; + + private final String entityClassSimpleName; + + private final Map, Set> violations = new HashMap<>(); + + /** + * Constructs a singleton map of violations from given parameters. + * + * @param entityClass class of invalid entity + * @param entityViolationType type of violation found + * @param message message to be associated to the violation + */ + public InvalidEntityException(final Class entityClass, + final EntityViolationType entityViolationType, final String message) { + + super(); + + this.entityClassSimpleName = entityClass.getSimpleName(); + + entityViolationType.setMessage(message.trim()); + + this.violations.put(entityClass, EnumSet.noneOf(EntityViolationType.class)); + this.violations.get(entityClass).add(entityViolationType); + } + + /** + * Constructs a map of violations out of given ConstraintViolation set. + * + * @param entityClassSimpleName simple class name of invalid entity + * @param violations as returned by bean validation + */ + public InvalidEntityException(final String entityClassSimpleName, + final Set> violations) { + + super(); + + this.entityClassSimpleName = entityClassSimpleName; + + for (ConstraintViolation violation : violations) { + int firstComma = violation.getMessageTemplate().indexOf(';'); + + final String key = violation.getMessageTemplate().substring( + 0, firstComma > 0 ? firstComma : violation.getMessageTemplate().length()); + + final String message = violation.getMessageTemplate().substring(firstComma > 0 ? firstComma + 1 : 0); + + EntityViolationType entityViolationType; + + try { + entityViolationType = EntityViolationType.valueOf(key.trim()); + } catch (IllegalArgumentException e) { + entityViolationType = EntityViolationType.Standard; + } + + entityViolationType.setMessage(message.trim()); + + if (!this.violations.containsKey(violation.getLeafBean().getClass())) { + this.violations.put(violation.getLeafBean().getClass(), EnumSet.noneOf(EntityViolationType.class)); + } + + this.violations.get(violation.getLeafBean().getClass()).add(entityViolationType); + } + } + + public final boolean hasViolation(final EntityViolationType type) { + boolean found = false; + for (Class entity : violations.keySet()) { + if (violations.get(entity).contains(type)) { + found = true; + } + } + + return found; + } + + public String getEntityClassSimpleName() { + return entityClassSimpleName; + } + + public final Map, Set> getViolations() { + return violations; + } + + @Override + public String getMessage() { + StringBuilder sb = new StringBuilder(); + + for (Class entity : violations.keySet()) { + sb.append(entity.getSimpleName()).append(" ").append(violations.get(entity).toString()).append(", "); + } + sb.delete(sb.lastIndexOf(", "), sb.length()); + + return sb.toString(); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java new file mode 100644 index 0000000..aa0b85d --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java @@ -0,0 +1,43 @@ +/* + * 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.server.persistence.api.attrvalue.validation; + +import javax.validation.ValidationException; +import org.apache.syncope.server.persistence.api.entity.PlainAttrValue; + +public class InvalidPlainAttrValueException extends ValidationException { + + private static final long serialVersionUID = -5023202610580202148L; + + public InvalidPlainAttrValueException(final String errorMessage) { + super(errorMessage); + } + + public InvalidPlainAttrValueException(final String errorMessage, final Throwable cause) { + super(errorMessage, cause); + } + + public InvalidPlainAttrValueException(final PlainAttrValue value) { + this("Could not validate " + value.getValue()); + } + + public InvalidPlainAttrValueException(final PlainAttrValue value, Throwable cause) { + this("Could not validate " + value.getValue(), cause); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/ParsingValidationException.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/ParsingValidationException.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/ParsingValidationException.java new file mode 100644 index 0000000..44af974 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/ParsingValidationException.java @@ -0,0 +1,30 @@ +/* + * 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.server.persistence.api.attrvalue.validation; + +import javax.validation.ValidationException; + +public class ParsingValidationException extends ValidationException { + + private static final long serialVersionUID = 5669262895008285522L; + + public ParsingValidationException(final String message, final Throwable cause) { + super(message, cause); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/Validator.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/Validator.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/Validator.java new file mode 100644 index 0000000..7732fd9 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/attrvalue/validation/Validator.java @@ -0,0 +1,27 @@ +/* + * 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.server.persistence.api.attrvalue.validation; + +import org.apache.syncope.server.persistence.api.entity.PlainAttrValue; + +public interface Validator { + + void validate(String value, PlainAttrValue attrValue) + throws ParsingValidationException, InvalidPlainAttrValueException; +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/content/ContentExporter.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/content/ContentExporter.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/content/ContentExporter.java new file mode 100644 index 0000000..c5b3866 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/content/ContentExporter.java @@ -0,0 +1,28 @@ +/* + * 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.server.persistence.api.content; + +import java.io.OutputStream; +import javax.xml.transform.TransformerConfigurationException; +import org.xml.sax.SAXException; + +public interface ContentExporter { + + void export(OutputStream output, String wfTablePrefix) throws SAXException, TransformerConfigurationException; +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/content/ContentLoader.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/content/ContentLoader.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/content/ContentLoader.java new file mode 100644 index 0000000..8e351b5 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/content/ContentLoader.java @@ -0,0 +1,25 @@ +/* + * 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.server.persistence.api.content; + +public interface ContentLoader { + + void load(); + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/AttrTemplateDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/AttrTemplateDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/AttrTemplateDAO.java new file mode 100644 index 0000000..7069f94 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/AttrTemplateDAO.java @@ -0,0 +1,34 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.entity.AttrTemplate; +import org.apache.syncope.server.persistence.api.entity.Schema; + +public interface AttrTemplateDAO extends DAO, Long> { + + > T find(Long key, Class reference); + + > List findBySchemaName(String schemaName, Class reference); + + > void delete(Long key, Class reference); + + > void delete(T attrTemplate); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ConfDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ConfDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ConfDAO.java new file mode 100644 index 0000000..98b463f --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ConfDAO.java @@ -0,0 +1,35 @@ +/* + * 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.server.persistence.api.dao; + +import org.apache.syncope.server.persistence.api.entity.conf.CPlainAttr; +import org.apache.syncope.server.persistence.api.entity.conf.Conf; + +public interface ConfDAO extends DAO { + + CPlainAttr find(String key); + + CPlainAttr find(String key, String defaultValue); + + Conf get(); + + Conf save(CPlainAttr attr); + + Conf delete(String key); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ConnInstanceDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ConnInstanceDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ConnInstanceDAO.java new file mode 100644 index 0000000..73362f7 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ConnInstanceDAO.java @@ -0,0 +1,34 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.ConnInstance; + +public interface ConnInstanceDAO extends DAO { + + ConnInstance find(Long key); + + List findAll(); + + ConnInstance save(ConnInstance connector) throws InvalidEntityException; + + void delete(Long key); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DAO.java new file mode 100644 index 0000000..a32e5a6 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DAO.java @@ -0,0 +1,32 @@ +/* + * 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.server.persistence.api.dao; + +import org.apache.syncope.server.persistence.api.entity.Entity; + +public interface DAO, KEY> { + + void refresh(E entity); + + void detach(E entity); + + void flush(); + + void clear(); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DerAttrDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DerAttrDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DerAttrDAO.java new file mode 100644 index 0000000..fd3e827 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DerAttrDAO.java @@ -0,0 +1,36 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.DerAttr; + +public interface DerAttrDAO extends DAO { + + T find(Long key, Class reference); + + List findAll(Class reference); + + T save(T derAttr) throws InvalidEntityException; + + void delete(Long key, Class reference); + + void delete(T derAttr); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DerSchemaDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DerSchemaDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DerSchemaDAO.java new file mode 100644 index 0000000..be22c90 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DerSchemaDAO.java @@ -0,0 +1,38 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.AttributableUtil; +import org.apache.syncope.server.persistence.api.entity.DerAttr; +import org.apache.syncope.server.persistence.api.entity.DerSchema; + +public interface DerSchemaDAO extends DAO { + + T find(String name, Class reference); + + List findAll(Class reference); + + List findAttrs(DerSchema schema, Class reference); + + T save(T derSchema) throws InvalidEntityException; + + void delete(String name, AttributableUtil attributableUtil); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DuplicateException.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DuplicateException.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DuplicateException.java new file mode 100644 index 0000000..4d5300b --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/DuplicateException.java @@ -0,0 +1,35 @@ +/* + * 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.server.persistence.api.dao; + +/** + * Thrown when something is not found. + */ +public class DuplicateException extends RuntimeException { + + private static final long serialVersionUID = -8200698688516957508L; + + public DuplicateException(final String msg) { + super(msg); + } + + public DuplicateException(final String msg, final Exception cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/EntitlementDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/EntitlementDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/EntitlementDAO.java new file mode 100644 index 0000000..f7d9461 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/EntitlementDAO.java @@ -0,0 +1,39 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.Entitlement; +import org.apache.syncope.server.persistence.api.entity.role.Role; + +public interface EntitlementDAO extends DAO { + + Entitlement find(String key); + + List findAll(); + + Entitlement save(Entitlement entitlement) throws InvalidEntityException; + + Entitlement saveRoleEntitlement(Role role); + + void delete(String key); + + void delete(Entitlement entitlement); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ExternalResourceDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ExternalResourceDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ExternalResourceDAO.java new file mode 100644 index 0000000..2028040 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ExternalResourceDAO.java @@ -0,0 +1,47 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.common.lib.types.IntMappingType; +import org.apache.syncope.common.lib.types.PolicyType; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.ExternalResource; +import org.apache.syncope.server.persistence.api.entity.MappingItem; +import org.apache.syncope.server.persistence.api.entity.Policy; + +public interface ExternalResourceDAO extends DAO { + + ExternalResource find(String key); + + List findByPolicy(Policy policy); + + List findWithoutPolicy(PolicyType type); + + List findAll(); + + List findAllByPriority(); + + ExternalResource save(ExternalResource resource) throws InvalidEntityException; + + void deleteMapping( + String schemaName, IntMappingType intMappingType, Class reference); + + void delete(String key); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/LoggerDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/LoggerDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/LoggerDAO.java new file mode 100644 index 0000000..c558e38 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/LoggerDAO.java @@ -0,0 +1,37 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.common.lib.types.LoggerType; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.Logger; + +public interface LoggerDAO extends DAO { + + Logger find(String key); + + List findAll(LoggerType type); + + Logger save(Logger logger) throws InvalidEntityException; + + void delete(String key); + + void delete(Logger logger); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/MembershipDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/MembershipDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/MembershipDAO.java new file mode 100644 index 0000000..79201f5 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/MembershipDAO.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.membership.Membership; +import org.apache.syncope.server.persistence.api.entity.role.Role; +import org.apache.syncope.server.persistence.api.entity.user.User; + +public interface MembershipDAO extends DAO { + + Membership find(Long key); + + Membership find(User user, Role role); + + List findAll(); + + Membership save(Membership membership) throws InvalidEntityException; + + void delete(Long key); + + Membership authFetch(Long key); + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/NotFoundException.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/NotFoundException.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/NotFoundException.java new file mode 100644 index 0000000..4e8b14d --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/NotFoundException.java @@ -0,0 +1,35 @@ +/* + * 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.server.persistence.api.dao; + +/** + * Thrown when something is not found. + */ +public class NotFoundException extends RuntimeException { + + private static final long serialVersionUID = 4810651769126663581L; + + public NotFoundException(final String msg) { + super(msg); + } + + public NotFoundException(final String msg, final Exception cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/NotificationDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/NotificationDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/NotificationDAO.java new file mode 100644 index 0000000..44b4f5a --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/NotificationDAO.java @@ -0,0 +1,34 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.Notification; + +public interface NotificationDAO extends DAO { + + Notification find(Long key); + + List findAll(); + + Notification save(Notification notification) throws InvalidEntityException; + + void delete(Long key); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainAttrDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainAttrDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainAttrDAO.java new file mode 100644 index 0000000..a35c46a --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainAttrDAO.java @@ -0,0 +1,30 @@ +/* + * 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.server.persistence.api.dao; + +import org.apache.syncope.server.persistence.api.entity.PlainAttr; + +public interface PlainAttrDAO extends DAO { + + T find(Long key, Class reference); + + void delete(Long key, Class reference); + + void delete(T attr); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainAttrValueDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainAttrValueDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainAttrValueDAO.java new file mode 100644 index 0000000..c0dd825 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainAttrValueDAO.java @@ -0,0 +1,36 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.PlainAttrValue; + +public interface PlainAttrValueDAO extends DAO { + + T find(Long key, Class reference); + + List findAll(Class reference); + + T save(T attributeValue) throws InvalidEntityException; + + void delete(Long key, Class reference); + + void delete(T attributeValue); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainSchemaDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainSchemaDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainSchemaDAO.java new file mode 100644 index 0000000..3d6c9cc --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PlainSchemaDAO.java @@ -0,0 +1,38 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.AttributableUtil; +import org.apache.syncope.server.persistence.api.entity.PlainAttr; +import org.apache.syncope.server.persistence.api.entity.PlainSchema; + +public interface PlainSchemaDAO extends DAO { + + T find(String key, Class reference); + + List findAll(Class reference); + + List findAttrs(PlainSchema schema, Class reference); + + T save(T schema) throws InvalidEntityException; + + void delete(String name, AttributableUtil attributableUtil); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PolicyDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PolicyDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PolicyDAO.java new file mode 100644 index 0000000..863dad3 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/PolicyDAO.java @@ -0,0 +1,48 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.common.lib.types.PolicyType; +import org.apache.syncope.server.persistence.api.entity.AccountPolicy; +import org.apache.syncope.server.persistence.api.entity.ExternalResource; +import org.apache.syncope.server.persistence.api.entity.PasswordPolicy; +import org.apache.syncope.server.persistence.api.entity.Policy; +import org.apache.syncope.server.persistence.api.entity.SyncPolicy; + +public interface PolicyDAO extends DAO { + + T find(Long key); + + List find(PolicyType type); + + List findByResource(ExternalResource resource); + + PasswordPolicy getGlobalPasswordPolicy(); + + AccountPolicy getGlobalAccountPolicy(); + + SyncPolicy getGlobalSyncPolicy(); + + List findAll(); + + T save(T policy); + + void delete(T policy); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ReportDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ReportDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ReportDAO.java new file mode 100644 index 0000000..d4499b4 --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ReportDAO.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.dao.search.OrderByClause; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.Report; + +public interface ReportDAO extends DAO { + + Report find(Long key); + + List findAll(); + + List findAll(int page, int itemsPerPage, List orderByClauses); + + int count(); + + Report save(Report report) throws InvalidEntityException; + + void delete(Long key); + + void delete(Report report); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ReportExecDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ReportExecDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ReportExecDAO.java new file mode 100644 index 0000000..83895ba --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/ReportExecDAO.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.Report; +import org.apache.syncope.server.persistence.api.entity.ReportExec; + +public interface ReportExecDAO extends DAO { + + ReportExec find(Long key); + + ReportExec findLatestStarted(Report report); + + ReportExec findLatestEnded(Report report); + + List findAll(); + + ReportExec save(ReportExec execution) throws InvalidEntityException; + + void delete(Long key); + + void delete(ReportExec execution); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/RoleDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/RoleDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/RoleDAO.java new file mode 100644 index 0000000..778443e --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/RoleDAO.java @@ -0,0 +1,92 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import java.util.Map; +import org.apache.syncope.common.lib.types.PolicyType; +import org.apache.syncope.common.lib.types.PropagationByResource; +import org.apache.syncope.server.persistence.api.dao.search.OrderByClause; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.Entitlement; +import org.apache.syncope.server.persistence.api.entity.ExternalResource; +import org.apache.syncope.server.persistence.api.entity.Policy; +import org.apache.syncope.server.persistence.api.entity.membership.Membership; +import org.apache.syncope.server.persistence.api.entity.role.RDerAttr; +import org.apache.syncope.server.persistence.api.entity.role.RPlainAttr; +import org.apache.syncope.server.persistence.api.entity.role.RPlainAttrValue; +import org.apache.syncope.server.persistence.api.entity.role.RVirAttr; +import org.apache.syncope.server.persistence.api.entity.role.Role; + +public interface RoleDAO extends SubjectDAO { + + Role find(Long key); + + List find(String name); + + Role find(String name, Long parent); + + List findOwnedByUser(Long userId); + + List findOwnedByRole(Long roleId); + + List findByEntitlement(Entitlement entitlement); + + List findByPolicy(Policy policy); + + List findWithoutPolicy(PolicyType type); + + List findAncestors(Role role); + + List findChildren(Role role); + + List findDescendants(Role role); + + List findByDerAttrValue(String schemaName, String value); + + List findByAttrValue(String schemaName, RPlainAttrValue attrValue); + + Role findByAttrUniqueValue(String schemaName, RPlainAttrValue attrUniqueValue); + + List findByResource(ExternalResource resource); + + List findAll(); + + List findAll(int page, int itemsPerPage, List orderBy); + + List findMemberships(Role role); + + int count(); + + Role save(Role syncopeRole) throws InvalidEntityException; + + void delete(Role role); + + void delete(Long key); + + Role authFetch(Long key); + + /** + * Finds users having resources assigned exclusively because of memberships of the given role. + * + * @param roleKey role key + * @return map containing pairs with user key and operations to be performed on those resources (DELETE, typically). + */ + Map findUsersWithIndirectResources(Long roleKey); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SecurityQuestionDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SecurityQuestionDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SecurityQuestionDAO.java new file mode 100644 index 0000000..b6cad4f --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SecurityQuestionDAO.java @@ -0,0 +1,35 @@ +/* + * 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.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.server.persistence.api.entity.user.SecurityQuestion; + +public interface SecurityQuestionDAO extends DAO { + + SecurityQuestion find(Long key); + + List findAll(); + + SecurityQuestion save(SecurityQuestion securityQuestion) throws InvalidEntityException; + + void delete(Long key); + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/235f60fa/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SubjectDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SubjectDAO.java b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SubjectDAO.java new file mode 100644 index 0000000..da32c9c --- /dev/null +++ b/syncope620/server/persistence-api/src/main/java/org/apache/syncope/server/persistence/api/dao/SubjectDAO.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.server.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.server.persistence.api.entity.AttributableUtil; +import org.apache.syncope.server.persistence.api.entity.DerAttr; +import org.apache.syncope.server.persistence.api.entity.ExternalResource; +import org.apache.syncope.server.persistence.api.entity.PlainAttr; +import org.apache.syncope.server.persistence.api.entity.PlainAttrValue; +import org.apache.syncope.server.persistence.api.entity.Subject; +import org.apache.syncope.server.persistence.api.entity.VirAttr; + +public interface SubjectDAO

+ extends DAO, Long> { + + List> findByAttrValue( + String schemaName, PlainAttrValue attrValue, AttributableUtil attrUtil); + + Subject findByAttrUniqueValue( + String schemaName, PlainAttrValue attrUniqueValue, AttributableUtil attrUtil); + + List> findByDerAttrValue( + String schemaName, String value, AttributableUtil attrUtil); + + List> findByResource( + ExternalResource resource, AttributableUtil attrUtil); +}