http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java new file mode 100644 index 0000000..b7d767b --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java @@ -0,0 +1,216 @@ +/* + * 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.common.lib.to; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.AbstractBaseBean; + +@XmlRootElement(name = "syncope") +@XmlType +public class SyncopeTO extends AbstractBaseBean { + + private static final long serialVersionUID = -7941853999417673827L; + + private String version; + + private boolean selfRegAllowed; + + private boolean pwdResetAllowed; + + private boolean pwdResetRequiringSecurityQuestions; + + private final List<String> connIdLocations = new ArrayList<>(); + + private String attributableTransformer; + + private String userWorkflowAdapter; + + private String roleWorkflowAdapter; + + private String userProvisioningManager; + + private String roleProvisioningManager; + + private final List<String> reportlets = new ArrayList<>(); + + private final List<String> taskJobs = new ArrayList<>(); + + private final List<String> propagationActions = new ArrayList<>(); + + private final List<String> syncActions = new ArrayList<>(); + + private final List<String> pushActions = new ArrayList<>(); + + private final List<String> syncCorrelationRules = new ArrayList<>(); + + private final List<String> pushCorrelationRules = new ArrayList<>(); + + private final List<String> validators = new ArrayList<>(); + + private final List<String> mailTemplates = new ArrayList<>(); + + public String getVersion() { + return version; + } + + public boolean isSelfRegAllowed() { + return selfRegAllowed; + } + + public boolean isPwdResetAllowed() { + return pwdResetAllowed; + } + + public boolean isPwdResetRequiringSecurityQuestions() { + return pwdResetRequiringSecurityQuestions; + } + + @XmlElementWrapper(name = "connIdLocations") + @XmlElement(name = "connIdLocation") + @JsonProperty("connIdLocations") + public List<String> getConnIdLocations() { + return connIdLocations; + } + + public String getAttributableTransformer() { + return attributableTransformer; + } + + public String getUserWorkflowAdapter() { + return userWorkflowAdapter; + } + + public String getRoleWorkflowAdapter() { + return roleWorkflowAdapter; + } + + public String getUserProvisioningManager() { + return userProvisioningManager; + } + + public String getRoleProvisioningManager() { + return roleProvisioningManager; + } + + @XmlElementWrapper(name = "reportlets") + @XmlElement(name = "reportlet") + @JsonProperty("reportlets") + public List<String> getReportlets() { + return reportlets; + } + + @XmlElementWrapper(name = "taskJobs") + @XmlElement(name = "taskJob") + @JsonProperty("taskJobs") + public List<String> getTaskJobs() { + return taskJobs; + } + + @XmlElementWrapper(name = "propagationActions") + @XmlElement(name = "propagationAction") + @JsonProperty("propagationActions") + public List<String> getPropagationActions() { + return propagationActions; + } + + @XmlElementWrapper(name = "syncActions") + @XmlElement(name = "syncAction") + @JsonProperty("syncActions") + public List<String> getSyncActions() { + return syncActions; + } + + @XmlElementWrapper(name = "pushActions") + @XmlElement(name = "pushAction") + @JsonProperty("pushActions") + public List<String> getPushActions() { + return pushActions; + } + + @XmlElementWrapper(name = "syncCorrelationRules") + @XmlElement(name = "syncCorrelationRule") + @JsonProperty("syncCorrelationRules") + public List<String> getSyncCorrelationRules() { + return syncCorrelationRules; + } + + @XmlElementWrapper(name = "pushCorrelationRules") + @XmlElement(name = "pushCorrelationRule") + @JsonProperty("pushCorrelationRules") + public List<String> getPushCorrelationRules() { + return pushCorrelationRules; + } + + @XmlElementWrapper(name = "validators") + @XmlElement(name = "validator") + @JsonProperty("validators") + public List<String> getValidators() { + return validators; + } + + @XmlElementWrapper(name = "mailTemplates") + @XmlElement(name = "mailTemplate") + @JsonProperty("mailTemplates") + public List<String> getMailTemplates() { + return mailTemplates; + } + + public void setVersion(final String version) { + this.version = version; + } + + public void setSelfRegAllowed(final boolean selfRegAllowed) { + this.selfRegAllowed = selfRegAllowed; + } + + public void setPwdResetAllowed(final boolean pwdResetAllowed) { + this.pwdResetAllowed = pwdResetAllowed; + } + + public void setPwdResetRequiringSecurityQuestions(final boolean pwdResetRequiringSecurityQuestions) { + this.pwdResetRequiringSecurityQuestions = pwdResetRequiringSecurityQuestions; + } + + public void setAttributableTransformer(final String attributableTransformer) { + this.attributableTransformer = attributableTransformer; + } + + public void setUserWorkflowAdapter(final String userWorkflowAdapter) { + this.userWorkflowAdapter = userWorkflowAdapter; + } + + public void setRoleWorkflowAdapter(final String roleWorkflowAdapter) { + this.roleWorkflowAdapter = roleWorkflowAdapter; + } + + public void setUserProvisioningManager(final String userProvisioningManager) { + this.userProvisioningManager = userProvisioningManager; + } + + public void setRoleProvisioningManager(final String roleProvisioningManager) { + this.roleProvisioningManager = roleProvisioningManager; + } + +}
http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/to/TaskExecTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/TaskExecTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/TaskExecTO.java new file mode 100644 index 0000000..467c35e --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/TaskExecTO.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.common.lib.to; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "taskExec") +@XmlType +public class TaskExecTO extends AbstractExecTO { + + private static final long serialVersionUID = -5401795154606268973L; + + private long task; + + public long getTask() { + return task; + } + + public void setTask(final long task) { + this.task = task; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java new file mode 100644 index 0000000..aceefe1 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java @@ -0,0 +1,183 @@ +/* + * 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.common.lib.to; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +@XmlRootElement(name = "user") +@XmlType +public class UserTO extends AbstractSubjectTO { + + private static final long serialVersionUID = 7791304495192615740L; + + private String password; + + private final List<MembershipTO> memberships = new ArrayList<>(); + + private String status; + + private String token; + + private Date tokenExpireTime; + + private String username; + + private Date lastLoginDate; + + private Date changePwdDate; + + private Integer failedLogins; + + private Long securityQuestion; + + private String securityAnswer; + + public String getPassword() { + return password; + } + + public void setPassword(final String password) { + this.password = password; + } + + @XmlElementWrapper(name = "memberships") + @XmlElement(name = "membership") + @JsonProperty("memberships") + public List<MembershipTO> getMemberships() { + return memberships; + } + + @JsonIgnore + public Map<Long, MembershipTO> getMembershipMap() { + Map<Long, MembershipTO> result; + + if (getMemberships() == null) { + result = Collections.emptyMap(); + } else { + result = new HashMap<>(getMemberships().size()); + for (MembershipTO membership : getMemberships()) { + result.put(membership.getRoleId(), membership); + } + result = Collections.unmodifiableMap(result); + } + + return result; + } + + public String getStatus() { + return status; + } + + public void setStatus(final String status) { + this.status = status; + } + + public String getToken() { + return token; + } + + public void setToken(final String token) { + this.token = token; + } + + public Date getTokenExpireTime() { + return tokenExpireTime == null + ? null + : new Date(tokenExpireTime.getTime()); + } + + public void setTokenExpireTime(final Date tokenExpireTime) { + if (tokenExpireTime != null) { + this.tokenExpireTime = new Date(tokenExpireTime.getTime()); + } + } + + public String getUsername() { + return username; + } + + public void setUsername(final String username) { + this.username = username; + } + + public Date getChangePwdDate() { + return changePwdDate; + } + + public Integer getFailedLogins() { + return failedLogins; + } + + public Date getLastLoginDate() { + return lastLoginDate; + } + + public void setChangePwdDate(final Date changePwdDate) { + this.changePwdDate = changePwdDate; + } + + public void setFailedLogins(final Integer failedLogins) { + this.failedLogins = failedLogins; + } + + public void setLastLoginDate(final Date lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } + + public Long getSecurityQuestion() { + return securityQuestion; + } + + public void setSecurityQuestion(final Long securityQuestion) { + this.securityQuestion = securityQuestion; + } + + public String getSecurityAnswer() { + return securityAnswer; + } + + public void setSecurityAnswer(final String securityAnswer) { + this.securityAnswer = securityAnswer; + } + + @Override + public String toString() { + return new ReflectionToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) { + + @Override + protected boolean accept(final Field f) { + return super.accept(f) && !f.getName().equals("password"); + } + }.toString(); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.java new file mode 100644 index 0000000..1a9d3bd --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/VirSchemaTO.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.common.lib.to; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "virtualSchema") +public class VirSchemaTO extends AbstractSchemaTO { + + private static final long serialVersionUID = -8198557479659701343L; + + private boolean readonly; + + public boolean isReadonly() { + return readonly; + } + + public void setReadonly(final boolean readonly) { + this.readonly = readonly; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java new file mode 100644 index 0000000..5b67c92 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormPropertyTO.java @@ -0,0 +1,119 @@ +/* + * 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.common.lib.to; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.AbstractBaseBean; +import org.apache.syncope.common.lib.types.WorkflowFormPropertyType; + +@XmlRootElement(name = "workflowFormProperty") +@XmlType +public class WorkflowFormPropertyTO extends AbstractBaseBean { + + private static final long serialVersionUID = 9139969592634304261L; + + private String id; + + private String name; + + private WorkflowFormPropertyType type; + + private String value; + + private boolean readable; + + private boolean writable; + + private boolean required; + + private String datePattern; + + private final Map<String, String> enumValues = new HashMap<>(); + + public String getId() { + return id; + } + + public void setId(final String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public boolean isReadable() { + return readable; + } + + public void setReadable(final boolean readable) { + this.readable = readable; + } + + public boolean isRequired() { + return required; + } + + public void setRequired(final boolean required) { + this.required = required; + } + + public WorkflowFormPropertyType getType() { + return type; + } + + public void setType(final WorkflowFormPropertyType type) { + this.type = type; + } + + public String getValue() { + return value; + } + + public void setValue(final String value) { + this.value = value; + } + + public boolean isWritable() { + return writable; + } + + public void setWritable(final boolean writable) { + this.writable = writable; + } + + public String getDatePattern() { + return datePattern; + } + + public void setDatePattern(final String datePattern) { + this.datePattern = datePattern; + } + + public Map<String, String> getEnumValues() { + return enumValues; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java new file mode 100644 index 0000000..90dc7c2 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/WorkflowFormTO.java @@ -0,0 +1,152 @@ +/* + * 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.common.lib.to; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.AbstractBaseBean; + +@XmlRootElement(name = "workflowForm") +@XmlType +public class WorkflowFormTO extends AbstractBaseBean { + + private static final long serialVersionUID = -7044543391316529128L; + + private long userKey; + + private String taskId; + + private String key; + + private String description; + + private Date createTime; + + private Date dueDate; + + private String owner; + + private final List<WorkflowFormPropertyTO> properties = new ArrayList<>(); + + public long getUserKey() { + return userKey; + } + + public void setUserKey(long userKey) { + this.userKey = userKey; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(final String taskId) { + this.taskId = taskId; + } + + public String getKey() { + return key; + } + + public void setKey(final String key) { + this.key = key; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(final Date createTime) { + this.createTime = createTime; + } + + public String getDescription() { + return description; + } + + public void setDescription(final String description) { + this.description = description; + } + + public Date getDueDate() { + return dueDate; + } + + public void setDueDate(final Date dueDate) { + this.dueDate = dueDate; + } + + public String getOwner() { + return owner; + } + + public void setOwner(final String owner) { + this.owner = owner; + } + + @XmlElementWrapper(name = "workflowFormProperties") + @XmlElement(name = "workflowFormProperty") + @JsonProperty("workflowFormProperties") + public List<WorkflowFormPropertyTO> getProperties() { + return properties; + } + + public boolean addProperty(final WorkflowFormPropertyTO property) { + return properties.contains(property) + ? true + : properties.add(property); + } + + public boolean removeProperty(final WorkflowFormPropertyTO property) { + return properties.remove(property); + } + + @JsonIgnore + public Map<String, WorkflowFormPropertyTO> getPropertyMap() { + Map<String, WorkflowFormPropertyTO> result = new HashMap<>(); + for (WorkflowFormPropertyTO prop : getProperties()) { + result.put(prop.getId(), prop); + } + result = Collections.unmodifiableMap(result); + + return result; + } + + @JsonIgnore + public Map<String, String> getPropertiesForSubmit() { + Map<String, String> props = new HashMap<>(); + for (WorkflowFormPropertyTO prop : getProperties()) { + if (prop.isWritable()) { + props.put(prop.getId(), prop.getValue()); + } + } + + return props; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/to/package-info.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/package-info.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/package-info.java new file mode 100644 index 0000000..b02ed8f --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ +@XmlSchema(namespace = SyncopeConstants.NAMESPACE) +package org.apache.syncope.common.lib.to; + +import javax.xml.bind.annotation.XmlSchema; +import org.apache.syncope.common.lib.SyncopeConstants; http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractCommonsLangType.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractCommonsLangType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractCommonsLangType.java new file mode 100644 index 0000000..1953010 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractCommonsLangType.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.common.lib.types; + +import java.io.Serializable; +import javax.xml.bind.annotation.XmlType; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ReflectionToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +@XmlType +public abstract class AbstractCommonsLangType implements Serializable { + + private static final long serialVersionUID = 3119542005279892164L; + + @Override + public boolean equals(final Object obj) { + return EqualsBuilder.reflectionEquals(this, obj); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + @Override + public String toString() { + return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java new file mode 100644 index 0000000..8d5a792 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java @@ -0,0 +1,188 @@ +/* + * 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.common.lib.types; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.annotation.SchemaList; + +@XmlType +public class AccountPolicySpec implements PolicySpec { + + private static final long serialVersionUID = 3259256974414758406L; + + /** + * Minimum length. + */ + private int maxLength; + + /** + * Maximum length. + */ + private int minLength; + + /** + * Pattern (regular expression) that must match. + */ + private String pattern; + + /** + * Substrings not permitted. + */ + private List<String> wordsNotPermitted; + + /** + * User attribute values not permitted. + */ + @SchemaList + private List<String> schemasNotPermitted; + + /** + * Substrings not permitted as prefix. + */ + private List<String> prefixesNotPermitted; + + /** + * Substrings not permitted as suffix. + */ + private List<String> suffixesNotPermitted; + + /** + * Specify if one or more lowercase characters are permitted. + */ + private boolean allUpperCase; + + /** + * Specify if one or more uppercase characters are permitted. + */ + private boolean allLowerCase; + + /** + * Specify if, when reached the maximum allowed number of subsequent login failures, user shall be suspended. + */ + private boolean propagateSuspension; + + /** + * Number of permitted login retries. + * 0 disabled; >0 enabled. + * If the number of subsequent failed logins will be greater then this value + * the account will be suspended (lock-out). + */ + private int permittedLoginRetries; + + public boolean isAllLowerCase() { + return allLowerCase; + } + + public void setAllLowerCase(final boolean allLowerCase) { + this.allLowerCase = allLowerCase; + } + + public boolean isAllUpperCase() { + return allUpperCase; + } + + public void setAllUpperCase(final boolean allUpperCase) { + this.allUpperCase = allUpperCase; + } + + public int getMaxLength() { + return maxLength; + } + + public void setMaxLength(final int maxLength) { + this.maxLength = maxLength; + } + + public int getMinLength() { + return minLength; + } + + public void setMinLength(final int minLength) { + this.minLength = minLength; + } + + public String getPattern() { + return pattern; + } + + public void setPattern(final String pattern) { + this.pattern = pattern; + } + + @XmlElementWrapper(name = "prefixesNotPermitted") + @XmlElement(name = "prefix") + @JsonProperty("prefixesNotPermitted") + public List<String> getPrefixesNotPermitted() { + if (prefixesNotPermitted == null) { + prefixesNotPermitted = new ArrayList<String>(); + } + return prefixesNotPermitted; + } + + @XmlElementWrapper(name = "schemasNotPermitted") + @XmlElement(name = "schema") + @JsonProperty("schemasNotPermitted") + public List<String> getSchemasNotPermitted() { + if (schemasNotPermitted == null) { + schemasNotPermitted = new ArrayList<String>(); + } + return schemasNotPermitted; + } + + @XmlElementWrapper(name = "suffixesNotPermitted") + @XmlElement(name = "suffix") + @JsonProperty("suffixesNotPermitted") + public List<String> getSuffixesNotPermitted() { + if (suffixesNotPermitted == null) { + suffixesNotPermitted = new ArrayList<String>(); + } + return suffixesNotPermitted; + } + + @XmlElementWrapper(name = "wordsNotPermitted") + @XmlElement(name = "word") + @JsonProperty("wordsNotPermitted") + public List<String> getWordsNotPermitted() { + if (wordsNotPermitted == null) { + wordsNotPermitted = new ArrayList<String>(); + } + return wordsNotPermitted; + } + + public boolean isPropagateSuspension() { + return propagateSuspension; + } + + public void setPropagateSuspension(final boolean propagateSuspension) { + this.propagateSuspension = propagateSuspension; + } + + public int getPermittedLoginRetries() { + return permittedLoginRetries; + } + + public void setPermittedLoginRetries(final int permittedLoginRetries) { + this.permittedLoginRetries = permittedLoginRetries; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java new file mode 100644 index 0000000..2fc937b --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttrSchemaType.java @@ -0,0 +1,51 @@ +/* + * 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.common.lib.types; + +import java.util.Date; +import javax.xml.bind.annotation.XmlEnum; + +@XmlEnum +public enum AttrSchemaType { + + String(String.class), + Long(Long.class), + Double(Double.class), + Boolean(Boolean.class), + Date(Date.class), + Enum(Enum.class), + Encrypted(byte[].class), + Binary(byte[].class); + + final private Class<?> type; + + AttrSchemaType(final Class<?> type) { + this.type = type; + } + + public Class<?> getType() { + return type; + } + + public boolean isConversionPatternNeeded() { + return this == AttrSchemaType.Date + || this == AttrSchemaType.Double + || this == AttrSchemaType.Long; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java new file mode 100644 index 0000000..6b989df --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java @@ -0,0 +1,31 @@ +/* + * 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.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; + +@XmlEnum +public enum AttributableType { + + USER, + ROLE, + MEMBERSHIP, + CONFIGURATION; + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java new file mode 100644 index 0000000..40ff86a --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditElements.java @@ -0,0 +1,61 @@ +/* + * 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.common.lib.types; + +import java.io.Serializable; +import javax.xml.bind.annotation.XmlEnum; +import org.apache.commons.lang3.StringUtils; + +public final class AuditElements implements Serializable { + + private static final long serialVersionUID = -4385059255522273254L; + + private AuditElements() { + } + + @XmlEnum + public enum EventCategoryType { + + REST(StringUtils.EMPTY), + TASK(StringUtils.EMPTY), + PROPAGATION("PropagationTask"), + SYNCHRONIZATION("SyncTask"), + PUSH("PushTask"), + CUSTOM(StringUtils.EMPTY); + + private final String value; + + EventCategoryType(final String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + } + + @XmlEnum + public enum Result { + + SUCCESS, + FAILURE + + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java new file mode 100644 index 0000000..d491037 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AuditLoggerName.java @@ -0,0 +1,222 @@ +/* + * 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.common.lib.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.text.ParseException; +import java.util.AbstractMap; +import java.util.Map; +import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.common.lib.AbstractBaseBean; +import org.apache.syncope.common.lib.to.EventCategoryTO; +import org.apache.syncope.common.lib.types.AuditElements.EventCategoryType; +import org.apache.syncope.common.lib.types.AuditElements.Result; + +public class AuditLoggerName extends AbstractBaseBean { + + private static final long serialVersionUID = -647989486671786839L; + + private final AuditElements.EventCategoryType type; + + private final String category; + + private final String subcategory; + + private final String event; + + private final Result result; + + @JsonCreator + public AuditLoggerName( + @JsonProperty("type") final AuditElements.EventCategoryType type, + @JsonProperty("category") final String category, + @JsonProperty("subcategory") final String subcategory, + @JsonProperty("event") final String event, + @JsonProperty("result") final Result result) + throws IllegalArgumentException { + + this.type = type == null ? AuditElements.EventCategoryType.CUSTOM : type; + this.category = category; + this.subcategory = subcategory; + this.event = event; + this.result = result == null ? Result.SUCCESS : result; + } + + public AuditElements.EventCategoryType getType() { + return type; + } + + public String getEvent() { + return event; + } + + public String getCategory() { + return category; + } + + public Result getResult() { + return result; + } + + public String getSubcategory() { + return subcategory; + } + + public String toLoggerName() { + return new StringBuilder().append(LoggerType.AUDIT.getPrefix()).append('.'). + append(buildEvent(type, category, subcategory, event, result)).toString(); + } + + @SuppressWarnings("unchecked") + public static AuditLoggerName fromLoggerName(final String loggerName) + throws IllegalArgumentException, ParseException { + + if (StringUtils.isBlank(loggerName)) { + throw new IllegalArgumentException("Null value not permitted"); + } + + if (!loggerName.startsWith(LoggerType.AUDIT.getPrefix())) { + throw new ParseException("Audit logger name must start with " + LoggerType.AUDIT.getPrefix(), 0); + } + + final Map.Entry<EventCategoryTO, Result> eventCategory = parseEventCategory( + loggerName.replaceAll(LoggerType.AUDIT.getPrefix() + ".", "")); + + return new AuditLoggerName( + eventCategory.getKey().getType(), + eventCategory.getKey().getCategory(), + eventCategory.getKey().getSubcategory(), + eventCategory.getKey().getEvents().isEmpty() + ? StringUtils.EMPTY : eventCategory.getKey().getEvents().iterator().next(), + eventCategory.getValue()); + } + + public static Map.Entry<EventCategoryTO, Result> parseEventCategory(final String event) { + final EventCategoryTO eventCategoryTO = new EventCategoryTO(); + + Result condition = null; + + if (StringUtils.isNotEmpty(event)) { + final String[] elements = event.substring(1, event.length() - 1).split("\\]:\\["); + + if (elements.length == 1) { + eventCategoryTO.setType(EventCategoryType.CUSTOM); + condition = Result.SUCCESS; + eventCategoryTO.getEvents().add(event); + } else { + EventCategoryType type; + + if (EventCategoryType.PROPAGATION.toString().equals(elements[0])) { + type = EventCategoryType.PROPAGATION; + } else if (EventCategoryType.SYNCHRONIZATION.toString().equals(elements[0])) { + type = EventCategoryType.SYNCHRONIZATION; + } else if (EventCategoryType.PUSH.toString().equals(elements[0])) { + type = EventCategoryType.PUSH; + } else { + try { + type = EventCategoryType.valueOf(elements[0]); + } catch (Exception e) { + type = EventCategoryType.CUSTOM; + } + } + + eventCategoryTO.setType(type); + + eventCategoryTO.setCategory(StringUtils.isNotEmpty(elements[1]) ? elements[1] : null); + + eventCategoryTO.setSubcategory(StringUtils.isNotEmpty(elements[2]) ? elements[2] : null); + + if (elements.length > 3 && StringUtils.isNotEmpty(elements[3])) { + eventCategoryTO.getEvents().add(elements[3]); + } + + if (elements.length > 4) { + condition = Result.valueOf(elements[4].toUpperCase()); + } + } + } + + return new AbstractMap.SimpleEntry< EventCategoryTO, Result>(eventCategoryTO, condition); + } + + /** + * Build event string with the following syntax [type]:[category]:[subcategory]:[event]:[maybe result value cond]. + * + * @param type event type. + * @param category event category. + * @param subcategory event subcategory. + * @param event event. + * @param resultValueCondition result value condition. + * @return event string. + */ + public static String buildEvent( + final AuditElements.EventCategoryType type, + final String category, + final String subcategory, + final String event, + final AuditElements.Result resultValueCondition) { + + final StringBuilder eventBuilder = new StringBuilder(); + + eventBuilder.append('['); + if (type != null) { + if (StringUtils.isNotBlank(type.toString())) { + eventBuilder.append(type.toString()); + } else { + eventBuilder.append(type.name()); + } + } + eventBuilder.append(']'); + + eventBuilder.append(":"); + + eventBuilder.append('['); + if (StringUtils.isNotBlank(category)) { + eventBuilder.append(category); + } + eventBuilder.append(']'); + + eventBuilder.append(":"); + + eventBuilder.append('['); + if (StringUtils.isNotBlank(subcategory)) { + eventBuilder.append(subcategory); + } + eventBuilder.append(']'); + + eventBuilder.append(":"); + + eventBuilder.append('['); + if (StringUtils.isNotBlank(event)) { + eventBuilder.append(event); + } + eventBuilder.append(']'); + + if (resultValueCondition != null) { + eventBuilder.append(":"); + + eventBuilder.append('['); + eventBuilder.append(resultValueCondition); + eventBuilder.append(']'); + } + + return eventBuilder.toString(); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java new file mode 100644 index 0000000..af5592e --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/CipherAlgorithm.java @@ -0,0 +1,54 @@ +/* + * 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.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; + +@XmlEnum +public enum CipherAlgorithm { + + SHA("SHA-1", false), + SHA1("SHA-1", false), + SHA256("SHA-256", false), + SHA512("SHA-512", false), + AES("AES", true), + SMD5("S-MD5", false), + SSHA("S-SHA-1", false), + SSHA1("S-SHA-1", false), + SSHA256("S-SHA-256", false), + SSHA512("S-SHA-512", false), + BCRYPT("BCRYPT", false); + + final private String algorithm; + + final private boolean invertible; + + CipherAlgorithm(final String algorithm, final boolean invertible) { + this.algorithm = algorithm; + this.invertible = invertible; + } + + public String getAlgorithm() { + return algorithm; + } + + public boolean isInvertible() { + return invertible; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java new file mode 100644 index 0000000..c55cebd --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java @@ -0,0 +1,102 @@ +/* + * 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.common.lib.types; + +import javax.ws.rs.core.Response; + +public enum ClientExceptionType { + + AssociatedResources(Response.Status.BAD_REQUEST), + Composite(Response.Status.BAD_REQUEST), + ConcurrentModification(Response.Status.PRECONDITION_FAILED), + DataIntegrityViolation(Response.Status.BAD_REQUEST), + EntityExists(Response.Status.CONFLICT), + GenericPersistence(Response.Status.BAD_REQUEST), + InvalidSecurityAnswer(Response.Status.BAD_REQUEST), + InvalidEntity(Response.Status.BAD_REQUEST), + InvalidLogger(Response.Status.BAD_REQUEST), + InvalidConnInstance(Response.Status.BAD_REQUEST), + InvalidConnIdConf(Response.Status.BAD_REQUEST), + InvalidPolicy(Response.Status.BAD_REQUEST), + InvalidConf(Response.Status.BAD_REQUEST), + InvalidRole(Response.Status.BAD_REQUEST), + InvalidReport(Response.Status.BAD_REQUEST), + InvalidReportExec(Response.Status.BAD_REQUEST), + InvalidRoles(Response.Status.BAD_REQUEST), + InvalidSchemaDefinition(Response.Status.BAD_REQUEST), + InvalidSearchExpression(Response.Status.BAD_REQUEST), + InvalidPageOrSize(Response.Status.BAD_REQUEST), + InvalidPropagationTaskExecReport(Response.Status.BAD_REQUEST), + InvalidPlainSchema(Response.Status.BAD_REQUEST), + InvalidDerSchema(Response.Status.BAD_REQUEST), + InvalidVirSchema(Response.Status.BAD_REQUEST), + InvalidSchemaMapping(Response.Status.BAD_REQUEST), + InvalidUser(Response.Status.BAD_REQUEST), + InvalidExternalResource(Response.Status.BAD_REQUEST), + InvalidNotification(Response.Status.BAD_REQUEST), + InvalidPropagationTask(Response.Status.BAD_REQUEST), + InvalidSchedTask(Response.Status.BAD_REQUEST), + InvalidSyncTask(Response.Status.BAD_REQUEST), + InvalidPushTask(Response.Status.BAD_REQUEST), + InvalidValues(Response.Status.BAD_REQUEST), + NotFound(Response.Status.NOT_FOUND), + RejectedUserCreate(Response.Status.BAD_REQUEST), + RequiredValuesMissing(Response.Status.BAD_REQUEST), + RESTValidation(Response.Status.BAD_REQUEST), + RoleOwnership(Response.Status.BAD_REQUEST), + Scheduling(Response.Status.BAD_REQUEST), + UnauthorizedRole(Response.Status.UNAUTHORIZED), + Unauthorized(Response.Status.UNAUTHORIZED), + Unknown(Response.Status.BAD_REQUEST), + Workflow(Response.Status.BAD_REQUEST); + + private final Response.Status responseStatus; + + private ClientExceptionType(final Response.Status responseStatus) { + this.responseStatus = responseStatus; + } + + public static ClientExceptionType fromHeaderValue(final String exceptionTypeHeaderValue) { + ClientExceptionType result = null; + for (ClientExceptionType type : values()) { + if (exceptionTypeHeaderValue.equals(type.getHeaderValue())) { + result = type; + } + } + + if (result == null) { + throw new IllegalArgumentException("Unexpected header value: " + exceptionTypeHeaderValue); + } + + return result; + } + + public String getHeaderValue() { + return name(); + } + + public String getInfoHeaderValue(final String value) { + return getHeaderValue() + ":" + value; + } + + public Response.Status getResponseStatus() { + return responseStatus; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConflictResolutionAction.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConflictResolutionAction.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConflictResolutionAction.java new file mode 100644 index 0000000..37308e1 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConflictResolutionAction.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.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; + +@XmlEnum +public enum ConflictResolutionAction { + + // ignore sync + IGNORE, + // sync first matcgh + FIRSTMATCH, + // sync last match + LASTMATCH, + // sync all + ALL; +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnConfPropSchema.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnConfPropSchema.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnConfPropSchema.java new file mode 100644 index 0000000..02ca7aa --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnConfPropSchema.java @@ -0,0 +1,122 @@ +/* + * 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.common.lib.types; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement +@XmlType +public class ConnConfPropSchema extends AbstractCommonsLangType implements Comparable<ConnConfPropSchema> { + + private static final long serialVersionUID = -1976365781005801296L; + + private String name; + + private String displayName; + + private String helpMessage; + + private String type; + + private boolean required; + + private int order; + + private boolean confidential; + + private final List<Object> defaultValues = new ArrayList<>(); + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public boolean isRequired() { + return required; + } + + public void setRequired(final boolean required) { + this.required = required; + } + + public String getType() { + return type; + } + + public void setType(final String type) { + this.type = type; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(final String displayName) { + this.displayName = displayName; + } + + public String getHelpMessage() { + return helpMessage; + } + + public void setHelpMessage(final String helpMessage) { + this.helpMessage = helpMessage; + } + + public int getOrder() { + return order; + } + + public void setOrder(final int order) { + this.order = order; + } + + public boolean isConfidential() { + return confidential; + } + + public void setConfidential(final boolean confidential) { + this.confidential = confidential; + } + + @XmlElementWrapper(name = "defaultValues") + @XmlElement(name = "defaultValue") + @JsonProperty("defaultValues") + public List<Object> getDefaultValues() { + return defaultValues; + } + + @Override + public int compareTo(final ConnConfPropSchema other) { + return this.getOrder() > other.getOrder() + ? 1 + : this.getOrder() < other.getOrder() + ? -1 + : 0; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnConfProperty.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnConfProperty.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnConfProperty.java new file mode 100644 index 0000000..13b37b2 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnConfProperty.java @@ -0,0 +1,69 @@ +/* + * 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.common.lib.types; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.commons.lang3.ObjectUtils; + +@XmlRootElement +@XmlType +public class ConnConfProperty extends AbstractCommonsLangType implements Comparable<ConnConfProperty> { + + private static final long serialVersionUID = -8391413960221862238L; + + private ConnConfPropSchema schema; + + private final List<Object> values = new ArrayList<>(); + + private boolean overridable; + + public ConnConfPropSchema getSchema() { + return schema; + } + + public void setSchema(final ConnConfPropSchema schema) { + this.schema = schema; + } + + @XmlElementWrapper(name = "values") + @XmlElement(name = "value") + @JsonProperty("values") + public List<Object> getValues() { + return values; + } + + public boolean isOverridable() { + return overridable; + } + + public void setOverridable(final boolean overridable) { + this.overridable = overridable; + } + + @Override + public int compareTo(final ConnConfProperty connConfProperty) { + return ObjectUtils.compare(this.getSchema(), connConfProperty.getSchema()); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnectorCapability.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnectorCapability.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnectorCapability.java new file mode 100644 index 0000000..a0e5781 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ConnectorCapability.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.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; + +/** + * Enum of all possible capabilities that a connector instance can expose. + */ +@XmlEnum +public enum ConnectorCapability { + + AUTHENTICATE, + ONE_PHASE_CREATE, + TWO_PHASES_CREATE, + ONE_PHASE_UPDATE, + TWO_PHASES_UPDATE, + ONE_PHASE_DELETE, + TWO_PHASES_DELETE, + SEARCH, + SYNC; + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java new file mode 100644 index 0000000..5a92daa --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java @@ -0,0 +1,73 @@ +/* + * 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.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; + +@XmlEnum +public enum EntityViolationType { + + Standard(""), + InvalidAccountPolicy("org.apache.syncope.core.persistence.validation.accountpolicy"), + InvalidConnInstanceLocation("org.apache.syncope.core.persistence.validation.conninstance.location"), + InvalidConnPoolConf("org.apache.syncope.core.persistence.validation.conninstance.poolConf"), + InvalidCPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.cPlainSchema"), + InvalidMapping("org.apache.syncope.core.persistence.validation.mapping"), + InvalidMPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.mPlainSchema"), + InvalidMDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.mDerSchema"), + InvalidMVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.mVirSchema"), + InvalidName("org.apache.syncope.core.persistence.validation.name"), + InvalidNotification("org.apache.syncope.core.persistence.validation.notification"), + InvalidPassword("org.apache.syncope.core.persistence.validation.user.password"), + InvalidPasswordPolicy("org.apache.syncope.core.persistence.validation.passwordpolicy"), + InvalidPolicy("org.apache.syncope.core.persistence.validation.policy"), + InvalidPropagationTask("org.apache.syncope.core.persistence.validation.propagationtask"), + InvalidRPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.rPlainSchema"), + InvalidRDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.rDerSchema"), + InvalidRVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.rVirSchema"), + InvalidReport("org.apache.syncope.core.persistence.validation.report"), + InvalidResource("org.apache.syncope.core.persistence.validation.externalresource"), + InvalidRoleOwner("org.apache.syncope.core.persistence.validation.role.owner"), + InvalidSchemaEncrypted("org.apache.syncope.core.persistence.validation.schema.encrypted"), + InvalidSchemaEnum("org.apache.syncope.core.persistence.validation.schema.enum"), + InvalidSchemaMultivalueUnique("org.apache.syncope.core.persistence.validation.schema.multivalueUnique"), + InvalidSchedTask("org.apache.syncope.core.persistence.validation.schedtask"), + InvalidSyncTask("org.apache.syncope.core.persistence.validation.synctask"), + InvalidSyncPolicy("org.apache.syncope.core.persistence.validation.syncpolicy"), + InvalidUPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.uPlainSchema"), + InvalidUDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.derSchema"), + InvalidUVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.uVirSchema"), + InvalidUsername("org.apache.syncope.core.persistence.validation.user.username"), + InvalidValueList("org.apache.syncope.core.persistence.validation.attr.valueList"), + MoreThanOneNonNull("org.apache.syncope.core.persistence.validation.attrvalue.moreThanOneNonNull"); + + private String message; + + EntityViolationType(final String message) { + this.message = message; + } + + public void setMessage(final String message) { + this.message = message; + } + + public String getMessage() { + return message; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java new file mode 100644 index 0000000..7dd60d6 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java @@ -0,0 +1,201 @@ +/* + * 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.common.lib.types; + +import java.util.Collection; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Set; + +import javax.xml.bind.annotation.XmlEnum; + +/** + * Internal attribute mapping type. + */ +@XmlEnum +public enum IntMappingType { + + // Unfortunately enum type cannot be extended ... + // ------------------------- + // User attribute types (the same in UserMappingType) + // ------------------------- + UserPlainSchema(AttributableType.USER), + UserDerivedSchema(AttributableType.USER), + UserVirtualSchema(AttributableType.USER), + UserId(AttributableType.USER), + Username(AttributableType.USER), + Password(AttributableType.USER), + // ------------------------- + // Role attribute types (the same in RoleMappingType) + // ------------------------- + RolePlainSchema(AttributableType.ROLE), + RoleDerivedSchema(AttributableType.ROLE), + RoleVirtualSchema(AttributableType.ROLE), + RoleId(AttributableType.ROLE), + RoleName(AttributableType.ROLE), + RoleOwnerSchema(AttributableType.ROLE), + // ------------------------- + // Membership attribute types (the same in MembershipMappingType) + // ------------------------- + MembershipPlainSchema(AttributableType.MEMBERSHIP), + MembershipDerivedSchema(AttributableType.MEMBERSHIP), + MembershipVirtualSchema(AttributableType.MEMBERSHIP), + MembershipId(AttributableType.MEMBERSHIP); + + private AttributableType attributableType; + + private IntMappingType(final AttributableType attributableType) { + this.attributableType = attributableType; + } + + public AttributableType getAttributableType() { + return attributableType; + } + + /** + * Get attribute types for a certain attributable type. + * + * @param attributableType attributable type + * @param toBeFiltered types to be filtered from the result. + * @return set of attribute types. + */ + public static Set<IntMappingType> getAttributeTypes( + final AttributableType attributableType, final Collection<IntMappingType> toBeFiltered) { + + final Set<IntMappingType> res = getAttributeTypes(attributableType); + res.removeAll(toBeFiltered); + + return res; + } + + /** + * Get attribute types for a certain attributable type. + * + * @param attributableType attributable type + * @return set of attribute types. + */ + public static Set<IntMappingType> getAttributeTypes(final AttributableType attributableType) { + final EnumSet<?> enumset; + + switch (attributableType) { + case ROLE: + enumset = EnumSet.allOf(RoleMappingType.class); + break; + + case MEMBERSHIP: + enumset = EnumSet.allOf(MembershipMappingType.class); + break; + + case USER: + default: + enumset = EnumSet.allOf(UserMappingType.class); + } + + final Set<IntMappingType> result = new HashSet<IntMappingType>(enumset.size()); + for (Object obj : enumset) { + result.add(IntMappingType.valueOf(obj.toString())); + } + + return result; + } + + public static Set<IntMappingType> getEmbedded() { + return EnumSet.of( + IntMappingType.UserId, IntMappingType.Username, IntMappingType.Password, + IntMappingType.RoleId, IntMappingType.RoleName, IntMappingType.RoleOwnerSchema, + IntMappingType.MembershipId); + } + + /** + * Check if attribute type belongs to the specified attributable type set. + * + * @param attributableType attributable type. + * @param type attribute type. + * @return true if attribute type belongs to the specified attributable type set. + */ + public static boolean contains(final AttributableType attributableType, final String type) { + switch (attributableType) { + case ROLE: + for (RoleMappingType c : RoleMappingType.values()) { + if (c.name().equals(type)) { + return true; + } + } + break; + + case MEMBERSHIP: + for (MembershipMappingType c : MembershipMappingType.values()) { + if (c.name().equals(type)) { + return true; + } + } + break; + + case USER: + default: + for (UserMappingType c : UserMappingType.values()) { + if (c.name().equals(type)) { + return true; + } + } + break; + } + return false; + } + + /** + * User attribute types. + */ + private enum UserMappingType { + + UserPlainSchema, + UserDerivedSchema, + UserVirtualSchema, + UserId, + Username, + Password; + + } + + /** + * Role attribute types. + */ + private enum RoleMappingType { + + RolePlainSchema, + RoleDerivedSchema, + RoleVirtualSchema, + RoleId, + RoleName, + RoleOwnerSchema; + + } + + /** + * Membership attribute types. + */ + private enum MembershipMappingType { + + MembershipPlainSchema, + MembershipDerivedSchema, + MembershipVirtualSchema, + MembershipId; + + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/LoggerLevel.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/LoggerLevel.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/LoggerLevel.java new file mode 100644 index 0000000..01f7d2e --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/LoggerLevel.java @@ -0,0 +1,49 @@ +/* + * 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.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; +import org.apache.logging.log4j.Level; + +@XmlEnum +public enum LoggerLevel { + + OFF(Level.OFF), + FATAL(Level.FATAL), + ERROR(Level.ERROR), + WARN(Level.WARN), + INFO(Level.INFO), + DEBUG(Level.DEBUG), + TRACE(Level.TRACE), + ALL(Level.ALL); + + private final Level level; + + LoggerLevel(final Level level) { + this.level = level; + } + + public Level getLevel() { + return level; + } + + public static LoggerLevel fromLevel(final Level level) { + return LoggerLevel.valueOf(level.name()); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/LoggerType.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/LoggerType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/LoggerType.java new file mode 100644 index 0000000..f77ed81 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/LoggerType.java @@ -0,0 +1,46 @@ +/* + * 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.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; + +@XmlEnum +public enum LoggerType { + + /** + * This type describes a common logger used to handle system and application events. + */ + LOG(""), + /** + * Audit logger only focus on security related events, usually logging how did what and when. + * In case of a security incident audit loggers should allow an administrator to recall all + * actions a certain user has done. + */ + AUDIT("syncope.audit"); + + private String prefix; + + LoggerType(final String prefix) { + this.prefix = prefix; + } + + public String getPrefix() { + return prefix; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/MappingPurpose.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/MappingPurpose.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/MappingPurpose.java new file mode 100644 index 0000000..dc8c23e --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/MappingPurpose.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.common.lib.types; + +public enum MappingPurpose { + + BOTH, + SYNCHRONIZATION, + PROPAGATION, + NONE + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/MatchingRule.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/MatchingRule.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/MatchingRule.java new file mode 100644 index 0000000..39764d9 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/MatchingRule.java @@ -0,0 +1,54 @@ +/* + * 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.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; + +/** + * Sync/Push task matching rule. + */ +@XmlEnum +public enum MatchingRule { + + /** + * Do not perform any action. + */ + IGNORE, + /** + * Update matching entity. + */ + UPDATE, + /** + * Delete resource entity. + */ + DEPROVISION, + /** + * Unlink resource and delete resource entity. + */ + UNASSIGN, + /** + * Just unlink resource without performing any (de-)provisioning operation. + */ + UNLINK, + /** + * Just link resource without performing any (de-)provisioning operation. + */ + LINK + +}
