http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/pom.xml ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/pom.xml b/syncope620/core/persistence-api/pom.xml new file mode 100644 index 0000000..48ceb63 --- /dev/null +++ b/syncope620/core/persistence-api/pom.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.syncope</groupId> + <artifactId>syncope-core</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <name>Apache Syncope Core Persistence API</name> + <description>Apache Syncope Core Persistence API</description> + <groupId>org.apache.syncope.core</groupId> + <artifactId>syncope-core-persistence-api</artifactId> + <packaging>jar</packaging> + + <properties> + <rootpom.basedir>${basedir}/../..</rootpom.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + </dependency> + + <dependency> + <groupId>net.tirasa.connid</groupId> + <artifactId>connector-framework</artifactId> + </dependency> + <dependency> + <groupId>net.tirasa.connid</groupId> + <artifactId>connector-framework-internal</artifactId> + </dependency> + <dependency> + <groupId>net.tirasa.connid</groupId> + <artifactId>slf4j-logging</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.syncope.common</groupId> + <artifactId>syncope-common-lib</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + </plugin> + </plugins> + </build> +</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/RoleEntitlementUtil.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/RoleEntitlementUtil.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/RoleEntitlementUtil.java new file mode 100644 index 0000000..f395828 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; +import org.apache.syncope.core.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<Long> getRoleKeys(final Set<String> entitlements) { + Set<Long> 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<Long> getRoleKeys(final List<Entitlement> entitlements) { + Set<String> 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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/SyncopeLoader.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/SyncopeLoader.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/SyncopeLoader.java new file mode 100644 index 0000000..be0caed --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/SyncopeLoader.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.core.persistence.api; + +/** + * Marker interface for Syncope components initialization. + */ +public interface SyncopeLoader { + + /** + * @return the priority that the implementing class has in the initialization process. + */ + Integer getPriority(); + + /** + * Perform initialization operations. + */ + void load(); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidEntityException.java new file mode 100644 index 0000000..213e947 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.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<Class<?>, Set<EntityViolationType>> 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 <tt>ConstraintViolation</tt> set. + * + * @param entityClassSimpleName simple class name of invalid entity + * @param violations as returned by bean validation + */ + public InvalidEntityException(final String entityClassSimpleName, + final Set<ConstraintViolation<Object>> violations) { + + super(); + + this.entityClassSimpleName = entityClassSimpleName; + + for (ConstraintViolation<Object> 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<Class<?>, Set<EntityViolationType>> 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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/InvalidPlainAttrValueException.java new file mode 100644 index 0000000..d529973 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.attrvalue.validation; + +import javax.validation.ValidationException; +import org.apache.syncope.core.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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/ParsingValidationException.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/ParsingValidationException.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/ParsingValidationException.java new file mode 100644 index 0000000..1537da5 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/Validator.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/Validator.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/attrvalue/validation/Validator.java new file mode 100644 index 0000000..2f55132 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.attrvalue.validation; + +import org.apache.syncope.core.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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/content/ContentExporter.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/content/ContentExporter.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/content/ContentExporter.java new file mode 100644 index 0000000..67508f7 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/content/ContentExporter.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.persistence.api.content; + +import java.io.OutputStream; +import javax.xml.transform.TransformerConfigurationException; +import org.xml.sax.SAXException; + +public interface ContentExporter { + + void export(OutputStream output, String uwfPrefix, String rwfPrefix) + throws SAXException, TransformerConfigurationException; +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/content/ContentLoader.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/content/ContentLoader.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/content/ContentLoader.java new file mode 100644 index 0000000..67435fa --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.content; + +import org.apache.syncope.core.persistence.api.SyncopeLoader; + +public interface ContentLoader extends SyncopeLoader { + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AttrTemplateDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AttrTemplateDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/AttrTemplateDAO.java new file mode 100644 index 0000000..e4a1f15 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.entity.AttrTemplate; +import org.apache.syncope.core.persistence.api.entity.Schema; + +public interface AttrTemplateDAO<K extends Schema> extends DAO<AttrTemplate<K>, Long> { + + <T extends AttrTemplate<K>> T find(Long key, Class<T> reference); + + <T extends AttrTemplate<K>> List<Number> findBySchemaName(String schemaName, Class<T> reference); + + <T extends AttrTemplate<K>> void delete(Long key, Class<T> reference); + + <T extends AttrTemplate<K>> void delete(T attrTemplate); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConfDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConfDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConfDAO.java new file mode 100644 index 0000000..0c2e477 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr; +import org.apache.syncope.core.persistence.api.entity.conf.Conf; + +public interface ConfDAO extends DAO<Conf, Long> { + + 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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConnInstanceDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConnInstanceDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ConnInstanceDAO.java new file mode 100644 index 0000000..a263df7 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.ConnInstance; + +public interface ConnInstanceDAO extends DAO<ConnInstance, Long> { + + ConnInstance find(Long key); + + List<ConnInstance> findAll(); + + ConnInstance save(ConnInstance connector) throws InvalidEntityException; + + void delete(Long key); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DAO.java new file mode 100644 index 0000000..4452890 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import org.apache.syncope.core.persistence.api.entity.Entity; + +public interface DAO<E extends Entity<KEY>, KEY> { + + void refresh(E entity); + + void detach(E entity); + + void flush(); + + void clear(); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerAttrDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerAttrDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerAttrDAO.java new file mode 100644 index 0000000..49d6748 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.DerAttr; + +public interface DerAttrDAO extends DAO<DerAttr, Long> { + + <T extends DerAttr> T find(Long key, Class<T> reference); + + <T extends DerAttr> List<T> findAll(Class<T> reference); + + <T extends DerAttr> T save(T derAttr) throws InvalidEntityException; + + <T extends DerAttr> void delete(Long key, Class<T> reference); + + <T extends DerAttr> void delete(T derAttr); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DerSchemaDAO.java new file mode 100644 index 0000000..78a481f --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.AttributableUtil; +import org.apache.syncope.core.persistence.api.entity.DerAttr; +import org.apache.syncope.core.persistence.api.entity.DerSchema; + +public interface DerSchemaDAO extends DAO<DerSchema, String> { + + <T extends DerSchema> T find(String name, Class<T> reference); + + <T extends DerSchema> List<T> findAll(Class<T> reference); + + <T extends DerAttr> List<T> findAttrs(DerSchema schema, Class<T> reference); + + <T extends DerSchema> T save(T derSchema) throws InvalidEntityException; + + void delete(String name, AttributableUtil attributableUtil); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DuplicateException.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DuplicateException.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DuplicateException.java new file mode 100644 index 0000000..5cd1da0 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/EntitlementDAO.java new file mode 100644 index 0000000..e1ef492 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.Entitlement; +import org.apache.syncope.core.persistence.api.entity.role.Role; + +public interface EntitlementDAO extends DAO<Entitlement, String> { + + Entitlement find(String key); + + List<Entitlement> 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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ExternalResourceDAO.java new file mode 100644 index 0000000..18cb51b --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.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.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.ExternalResource; +import org.apache.syncope.core.persistence.api.entity.MappingItem; +import org.apache.syncope.core.persistence.api.entity.Policy; + +public interface ExternalResourceDAO extends DAO<ExternalResource, String> { + + ExternalResource find(String key); + + List<ExternalResource> findByPolicy(Policy policy); + + List<ExternalResource> findWithoutPolicy(PolicyType type); + + List<ExternalResource> findAll(); + + List<ExternalResource> findAllByPriority(); + + ExternalResource save(ExternalResource resource) throws InvalidEntityException; + + <T extends MappingItem> void deleteMapping( + String schemaName, IntMappingType intMappingType, Class<T> reference); + + void delete(String key); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java new file mode 100644 index 0000000..3ba7f3f --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.common.lib.types.LoggerType; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.Logger; + +public interface LoggerDAO extends DAO<Logger, String> { + + Logger find(String key); + + List<Logger> 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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MembershipDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MembershipDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/MembershipDAO.java new file mode 100644 index 0000000..62d50fe --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.membership.Membership; +import org.apache.syncope.core.persistence.api.entity.role.Role; +import org.apache.syncope.core.persistence.api.entity.user.User; + +public interface MembershipDAO extends DAO<Membership, Long> { + + Membership find(Long key); + + Membership find(User user, Role role); + + List<Membership> 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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotFoundException.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotFoundException.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotFoundException.java new file mode 100644 index 0000000..8b78503 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotificationDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotificationDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/NotificationDAO.java new file mode 100644 index 0000000..a70489c --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.Notification; + +public interface NotificationDAO extends DAO<Notification, Long> { + + Notification find(Long key); + + List<Notification> findAll(); + + Notification save(Notification notification) throws InvalidEntityException; + + void delete(Long key); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrDAO.java new file mode 100644 index 0000000..1aa5d5c --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import org.apache.syncope.core.persistence.api.entity.PlainAttr; + +public interface PlainAttrDAO extends DAO<PlainAttr, Long> { + + <T extends PlainAttr> T find(Long key, Class<T> reference); + + <T extends PlainAttr> void delete(Long key, Class<T> reference); + + <T extends PlainAttr> void delete(T attr); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrValueDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrValueDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainAttrValueDAO.java new file mode 100644 index 0000000..d20a253 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.PlainAttrValue; + +public interface PlainAttrValueDAO extends DAO<PlainAttrValue, Long> { + + <T extends PlainAttrValue> T find(Long key, Class<T> reference); + + <T extends PlainAttrValue> List<T> findAll(Class<T> reference); + + <T extends PlainAttrValue> T save(T attributeValue) throws InvalidEntityException; + + <T extends PlainAttrValue> void delete(Long key, Class<T> reference); + + <T extends PlainAttrValue> void delete(T attributeValue); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PlainSchemaDAO.java new file mode 100644 index 0000000..791ddaf --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.AttributableUtil; +import org.apache.syncope.core.persistence.api.entity.PlainAttr; +import org.apache.syncope.core.persistence.api.entity.PlainSchema; + +public interface PlainSchemaDAO extends DAO<PlainSchema, String> { + + <T extends PlainSchema> T find(String key, Class<T> reference); + + <T extends PlainSchema> List<T> findAll(Class<T> reference); + + <T extends PlainAttr> List<T> findAttrs(PlainSchema schema, Class<T> reference); + + <T extends PlainSchema> T save(T schema) throws InvalidEntityException; + + void delete(String name, AttributableUtil attributableUtil); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java new file mode 100644 index 0000000..0eefcbb --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.common.lib.types.PolicyType; +import org.apache.syncope.core.persistence.api.entity.AccountPolicy; +import org.apache.syncope.core.persistence.api.entity.ExternalResource; +import org.apache.syncope.core.persistence.api.entity.PasswordPolicy; +import org.apache.syncope.core.persistence.api.entity.Policy; +import org.apache.syncope.core.persistence.api.entity.SyncPolicy; + +public interface PolicyDAO extends DAO<Policy, Long> { + + <T extends Policy> T find(Long key); + + <T extends Policy> List<T> find(PolicyType type); + + List<AccountPolicy> findByResource(ExternalResource resource); + + PasswordPolicy getGlobalPasswordPolicy(); + + AccountPolicy getGlobalAccountPolicy(); + + SyncPolicy getGlobalSyncPolicy(); + + List<Policy> findAll(); + + <T extends Policy> T save(T policy); + + <T extends Policy> void delete(T policy); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportDAO.java new file mode 100644 index 0000000..3be0df7 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.Report; + +public interface ReportDAO extends DAO<Report, Long> { + + Report find(Long key); + + List<Report> findAll(); + + List<Report> findAll(int page, int itemsPerPage, List<OrderByClause> 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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportExecDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportExecDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/ReportExecDAO.java new file mode 100644 index 0000000..726628f --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.Report; +import org.apache.syncope.core.persistence.api.entity.ReportExec; + +public interface ReportExecDAO extends DAO<ReportExec, Long> { + + ReportExec find(Long key); + + ReportExec findLatestStarted(Report report); + + ReportExec findLatestEnded(Report report); + + List<ReportExec> 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/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/RoleDAO.java new file mode 100644 index 0000000..bad9b47 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.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.core.persistence.api.dao.search.OrderByClause; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.Entitlement; +import org.apache.syncope.core.persistence.api.entity.ExternalResource; +import org.apache.syncope.core.persistence.api.entity.Policy; +import org.apache.syncope.core.persistence.api.entity.membership.Membership; +import org.apache.syncope.core.persistence.api.entity.role.RDerAttr; +import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr; +import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue; +import org.apache.syncope.core.persistence.api.entity.role.RVirAttr; +import org.apache.syncope.core.persistence.api.entity.role.Role; + +public interface RoleDAO extends SubjectDAO<RPlainAttr, RDerAttr, RVirAttr> { + + Role find(Long key); + + List<Role> find(String name); + + Role find(String name, Long parent); + + List<Role> findOwnedByUser(Long userId); + + List<Role> findOwnedByRole(Long roleId); + + List<Role> findByEntitlement(Entitlement entitlement); + + List<Role> findByPolicy(Policy policy); + + List<Role> findWithoutPolicy(PolicyType type); + + List<Role> findAncestors(Role role); + + List<Role> findChildren(Role role); + + List<Role> findDescendants(Role role); + + List<Role> findByDerAttrValue(String schemaName, String value); + + List<Role> findByAttrValue(String schemaName, RPlainAttrValue attrValue); + + Role findByAttrUniqueValue(String schemaName, RPlainAttrValue attrUniqueValue); + + List<Role> findByResource(ExternalResource resource); + + List<Role> findAll(); + + List<Role> findAll(int page, int itemsPerPage, List<OrderByClause> orderBy); + + List<Membership> findMemberships(Role role); + + int count(); + + Role save(Role role) 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<Long, PropagationByResource> findUsersWithIndirectResources(Long roleKey); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SecurityQuestionDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SecurityQuestionDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SecurityQuestionDAO.java new file mode 100644 index 0000000..ba66a4b --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion; + +public interface SecurityQuestionDAO extends DAO<SecurityQuestion, Long> { + + SecurityQuestion find(Long key); + + List<SecurityQuestion> findAll(); + + SecurityQuestion save(SecurityQuestion securityQuestion) throws InvalidEntityException; + + void delete(Long key); + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectDAO.java new file mode 100644 index 0000000..9e909d7 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.entity.AttributableUtil; +import org.apache.syncope.core.persistence.api.entity.DerAttr; +import org.apache.syncope.core.persistence.api.entity.ExternalResource; +import org.apache.syncope.core.persistence.api.entity.PlainAttr; +import org.apache.syncope.core.persistence.api.entity.PlainAttrValue; +import org.apache.syncope.core.persistence.api.entity.Subject; +import org.apache.syncope.core.persistence.api.entity.VirAttr; + +public interface SubjectDAO<P extends PlainAttr, D extends DerAttr, V extends VirAttr> + extends DAO<Subject<P, D, V>, Long> { + + List<? extends Subject<P, D, V>> findByAttrValue( + String schemaName, PlainAttrValue attrValue, AttributableUtil attrUtil); + + Subject<P, D, V> findByAttrUniqueValue( + String schemaName, PlainAttrValue attrUniqueValue, AttributableUtil attrUtil); + + List<? extends Subject<P, D, V>> findByDerAttrValue( + String schemaName, String value, AttributableUtil attrUtil); + + List<? extends Subject<P, D, V>> findByResource( + ExternalResource resource, AttributableUtil attrUtil); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java new file mode 100644 index 0000000..08e1851 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/SubjectSearchDAO.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.persistence.api.dao; + +import java.util.List; +import java.util.Set; +import org.apache.syncope.common.lib.types.SubjectType; +import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; +import org.apache.syncope.core.persistence.api.dao.search.SearchCond; +import org.apache.syncope.core.persistence.api.entity.DerAttr; +import org.apache.syncope.core.persistence.api.entity.PlainAttr; +import org.apache.syncope.core.persistence.api.entity.Subject; +import org.apache.syncope.core.persistence.api.entity.VirAttr; + +public interface SubjectSearchDAO extends DAO<Subject<?, ?, ?>, Long> { + + /** + * @param adminRoles the set of admin roles owned by the caller + * @param searchCondition the search condition + * @param type user or role + * @return size of search result + */ + int count(Set<Long> adminRoles, SearchCond searchCondition, SubjectType type); + + /** + * @param adminRoles the set of admin roles owned by the caller + * @param searchCondition the search condition + * @param type user or role + * @param <T> user/role + * @return the list of users/roles matching the given search condition + */ + <T extends Subject<?, ?, ?>> List<T> search( + Set<Long> adminRoles, SearchCond searchCondition, SubjectType type); + + /** + * @param adminRoles the set of admin roles owned by the caller + * @param searchCondition the search condition + * @param orderBy list of ordering clauses + * @param type user or role + * @param <T> user/role + * @return the list of users/roles matching the given search condition + */ + <T extends Subject<?, ?, ?>> List<T> search( + Set<Long> adminRoles, SearchCond searchCondition, List<OrderByClause> orderBy, SubjectType type); + + /** + * @param adminRoles the set of admin roles owned by the caller + * @param searchCondition the search condition + * @param page position of the first result, start from 1 + * @param itemsPerPage number of results per page + * @param orderBy list of ordering clauses + * @param type user or role + * @param <T> user/role + * @return the list of users/roles matching the given search condition (in the given page) + */ + <T extends Subject<?, ?, ?>> List<T> search( + Set<Long> adminRoles, SearchCond searchCondition, int page, int itemsPerPage, + List<OrderByClause> orderBy, SubjectType type); + + /** + * Verify if user/role matches the given search condition. + * + * @param subject to be checked + * @param searchCondition to be verified + * @param type user or role + * @param <T> user/role + * @return true if user/role matches searchCondition + */ + <T extends Subject<?, ?, ?>> boolean matches(T subject, SearchCond searchCondition, SubjectType type); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java new file mode 100644 index 0000000..28c90a6 --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskDAO.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.common.lib.types.TaskType; +import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.ExternalResource; +import org.apache.syncope.core.persistence.api.entity.task.Task; + +public interface TaskDAO extends DAO<Task, Long> { + + Class<? extends Task> getEntityReference(TaskType type); + + <T extends Task> T find(Long key); + + <T extends Task> List<T> findToExec(TaskType type); + + <T extends Task> List<T> findAll(ExternalResource resource, TaskType type); + + <T extends Task> List<T> findAll(TaskType type); + + <T extends Task> List<T> findAll( + int page, int itemsPerPage, List<OrderByClause> orderByClauses, TaskType type); + + int count(TaskType type); + + <T extends Task> T save(T task) throws InvalidEntityException; + + void delete(Long key); + + void delete(Task task); + + void deleteAll(ExternalResource resource, TaskType type); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java new file mode 100644 index 0000000..e0f58ff --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/TaskExecDAO.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.common.lib.types.TaskType; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.task.Task; +import org.apache.syncope.core.persistence.api.entity.task.TaskExec; + +public interface TaskExecDAO extends DAO<TaskExec, Long> { + + TaskExec find(Long key); + + <T extends Task> TaskExec findLatestStarted(T task); + + <T extends Task> TaskExec findLatestEnded(T task); + + List<TaskExec> findAll(TaskType type); + + TaskExec save(TaskExec execution) throws InvalidEntityException; + + void saveAndAdd(Long taskId, TaskExec execution) throws InvalidEntityException; + + void delete(Long key); + + void delete(TaskExec execution); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java new file mode 100644 index 0000000..32d23fc --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.persistence.api.dao; + +import java.util.List; +import java.util.Set; +import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.ExternalResource; +import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion; +import org.apache.syncope.core.persistence.api.entity.user.UDerAttr; +import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr; +import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue; +import org.apache.syncope.core.persistence.api.entity.user.UVirAttr; +import org.apache.syncope.core.persistence.api.entity.user.User; + +public interface UserDAO extends SubjectDAO<UPlainAttr, UDerAttr, UVirAttr> { + + User find(Long key); + + User find(String username); + + User findByWorkflowId(String workflowId); + + User findByToken(String token); + + List<User> findBySecurityQuestion(SecurityQuestion securityQuestion); + + List<User> findByDerAttrValue(String schemaName, String value); + + List<User> findByAttrValue(String schemaName, UPlainAttrValue attrValue); + + User findByAttrUniqueValue(String schemaName, UPlainAttrValue attrUniqueValue); + + List<User> findByResource(ExternalResource resource); + + List<User> findAll(Set<Long> adminRoles, int page, int itemsPerPage); + + List<User> findAll(Set<Long> adminRoles, int page, int itemsPerPage, List<OrderByClause> orderBy); + + int count(Set<Long> adminRoles); + + User save(User user) throws InvalidEntityException; + + void delete(Long key); + + void delete(User user); + + User authFetch(Long key); + + User authFetch(String username); +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.java ---------------------------------------------------------------------- diff --git a/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.java b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.java new file mode 100644 index 0000000..2c4e1cc --- /dev/null +++ b/syncope620/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/VirAttrDAO.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.core.persistence.api.dao; + +import java.util.List; +import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException; +import org.apache.syncope.core.persistence.api.entity.VirAttr; + +public interface VirAttrDAO extends DAO<VirAttr, Long> { + + <T extends VirAttr> T find(Long key, Class<T> reference); + + <T extends VirAttr> List<T> findAll(Class<T> reference); + + <T extends VirAttr> T save(T virtualAttribute) throws InvalidEntityException; + + <T extends VirAttr> void delete(Long key, Class<T> reference); + + <T extends VirAttr> void delete(T virAttr); +}
