http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java deleted file mode 100644 index 0fbd6aa..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyMod.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.mod; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.HashSet; -import java.util.Set; -import javax.ws.rs.PathParam; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlType; -import org.apache.syncope.common.lib.AbstractBaseBean; - -@XmlType -public abstract class AnyMod extends AbstractBaseBean { - - private static final long serialVersionUID = 7366724481786360591L; - - protected long key; - - private String realm; - - protected final Set<String> auxClassesToAdd = new HashSet<>(); - - protected final Set<String> auxClassesToRemove = new HashSet<>(); - - protected final Set<AttrMod> plainAttrsToUpdate = new HashSet<>(); - - protected final Set<String> plainAttrsToRemove = new HashSet<>(); - - protected final Set<String> derAttrsToAdd = new HashSet<>(); - - protected final Set<String> derAttrsToRemove = new HashSet<>(); - - protected final Set<AttrMod> virAttrsToUpdate = new HashSet<>(); - - protected final Set<String> virAttrsToRemove = new HashSet<>(); - - protected final Set<String> resourcesToAdd = new HashSet<>(); - - protected final Set<String> resourcesToRemove = new HashSet<>(); - - public long getKey() { - return key; - } - - @PathParam("key") - public void setKey(final long key) { - this.key = key; - } - - public String getRealm() { - return realm; - } - - public void setRealm(final String realm) { - this.realm = realm; - } - - @XmlElementWrapper(name = "auxClassesToAdd") - @XmlElement(name = "class") - @JsonProperty("auxClassesToAdd") - public Set<String> getAuxClassesToAdd() { - return auxClassesToAdd; - } - - @XmlElementWrapper(name = "auxClassesToRemove") - @XmlElement(name = "class") - @JsonProperty("auxClassesToRemove") - public Set<String> getAuxClassesToRemove() { - return auxClassesToRemove; - } - - @XmlElementWrapper(name = "plainAttrsToRemove") - @XmlElement(name = "attribute") - @JsonProperty("plainAttrsToRemove") - public Set<String> getPlainAttrsToRemove() { - return plainAttrsToRemove; - } - - @XmlElementWrapper(name = "plainAttrsToUpdate") - @XmlElement(name = "attributeMod") - @JsonProperty("plainAttrsToUpdate") - public Set<AttrMod> getPlainAttrsToUpdate() { - return plainAttrsToUpdate; - } - - @XmlElementWrapper(name = "derAttrsToAdd") - @XmlElement(name = "attribute") - @JsonProperty("derAttrsToAdd") - public Set<String> getDerAttrsToAdd() { - return derAttrsToAdd; - } - - @XmlElementWrapper(name = "derAttrsToRemove") - @XmlElement(name = "attribute") - @JsonProperty("derAttrsToRemove") - public Set<String> getDerAttrsToRemove() { - return derAttrsToRemove; - } - - @XmlElementWrapper(name = "virAttrsToRemove") - @XmlElement(name = "attribute") - @JsonProperty("virAttrsToRemove") - public Set<String> getVirAttrsToRemove() { - return virAttrsToRemove; - } - - @XmlElementWrapper(name = "virAttrsToUpdate") - @XmlElement(name = "attribute") - @JsonProperty("virAttrsToUpdate") - public Set<AttrMod> getVirAttrsToUpdate() { - return virAttrsToUpdate; - } - - @XmlElementWrapper(name = "resourcesToAdd") - @XmlElement(name = "resource") - @JsonProperty("resourcesToAdd") - public Set<String> getResourcesToAdd() { - return resourcesToAdd; - } - - @XmlElementWrapper(name = "resourcesToRemove") - @XmlElement(name = "resource") - @JsonProperty("resourcesToRemove") - public Set<String> getResourcesToRemove() { - return resourcesToRemove; - } - - /** - * @return true is all backing collections are empty. - */ - @JsonIgnore - public boolean isEmpty() { - return plainAttrsToUpdate.isEmpty() && plainAttrsToRemove.isEmpty() - && derAttrsToAdd.isEmpty() && derAttrsToRemove.isEmpty() - && virAttrsToUpdate.isEmpty() && virAttrsToRemove.isEmpty() - && resourcesToAdd.isEmpty() && resourcesToRemove.isEmpty(); - } -}
http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyObjectMod.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyObjectMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyObjectMod.java deleted file mode 100644 index b51a67b..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AnyObjectMod.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.mod; - -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(name = "anyObjectMod") -@XmlType -public class AnyObjectMod extends AnyMod { - - private static final long serialVersionUID = -3474517624611170097L; - - private final List<Long> relationshipsToAdd = new ArrayList<>(); - - private final List<Long> relationshipsToRemove = new ArrayList<>(); - - private final List<Long> membershipsToAdd = new ArrayList<>(); - - private final List<Long> membershipsToRemove = new ArrayList<>(); - - @XmlElementWrapper(name = "relationshipsToAdd") - @XmlElement(name = "relationship") - @JsonProperty("relationshipsToAdd") - public List<Long> getRelationshipsToAdd() { - return relationshipsToAdd; - } - - @XmlElementWrapper(name = "urelationshipsToRemove") - @XmlElement(name = "urelationship") - @JsonProperty("urelationshipsToRemove") - public List<Long> getRelationshipsToRemove() { - return relationshipsToRemove; - } - - @XmlElementWrapper(name = "membershipsToAdd") - @XmlElement(name = "membership") - @JsonProperty("membershipsToAdd") - public List<Long> getMembershipsToAdd() { - return membershipsToAdd; - } - - @XmlElementWrapper(name = "membershipsToRemove") - @XmlElement(name = "membership") - @JsonProperty("membershipsToRemove") - public List<Long> getMembershipsToRemove() { - return membershipsToRemove; - } - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java deleted file mode 100644 index 07fe784..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/AttrMod.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.mod; - -import com.fasterxml.jackson.annotation.JsonIgnore; -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 -@XmlType -public class AttrMod extends AbstractBaseBean { - - private static final long serialVersionUID = -913573979137431406L; - - private String schema; - - private final List<String> valuesToBeAdded = new ArrayList<>(); - - private final List<String> valuesToBeRemoved = new ArrayList<>(); - - public String getSchema() { - return schema; - } - - public void setSchema(final String schema) { - this.schema = schema; - } - - @XmlElementWrapper(name = "valuesToBeAdded") - @XmlElement(name = "value") - @JsonProperty("valuesToBeAdded") - public List<String> getValuesToBeAdded() { - return valuesToBeAdded; - } - - @XmlElementWrapper(name = "valuesToBeRemoved") - @XmlElement(name = "value") - @JsonProperty("valuesToBeRemoved") - public List<String> getValuesToBeRemoved() { - return valuesToBeRemoved; - } - - @JsonIgnore - public boolean isEmpty() { - return valuesToBeAdded.isEmpty() && valuesToBeRemoved.isEmpty(); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java deleted file mode 100644 index 3c948ea..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/GroupMod.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.mod; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - -@XmlRootElement(name = "groupMod") -@XmlType -public class GroupMod extends AnyMod { - - private static final long serialVersionUID = 7455805264680210747L; - - private String name; - - private ReferenceMod userOwner; - - private ReferenceMod groupOwner; - - private String aDynMembershipCond; - - private String uDynMembershipCond; - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public ReferenceMod getUserOwner() { - return userOwner; - } - - public void setUserOwner(final ReferenceMod userOwner) { - this.userOwner = userOwner; - } - - public ReferenceMod getGroupOwner() { - return groupOwner; - } - - public void setGroupOwner(final ReferenceMod groupOwner) { - this.groupOwner = groupOwner; - } - - public String getADynMembershipCond() { - return aDynMembershipCond; - } - - public void setADynMembershipCond(final String aDynMembershipCond) { - this.aDynMembershipCond = aDynMembershipCond; - } - - public String getUDynMembershipCond() { - return uDynMembershipCond; - } - - public void setUDynMembershipCond(final String uDynMembershipCond) { - this.uDynMembershipCond = uDynMembershipCond; - } - - @JsonIgnore - @Override - public boolean isEmpty() { - return super.isEmpty() && name == null && userOwner == null && groupOwner == null - && aDynMembershipCond == null && uDynMembershipCond == null; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java deleted file mode 100644 index 25fd02d..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ReferenceMod.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.mod; - -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import org.apache.syncope.common.lib.AbstractBaseBean; - -/** - * This class is used to specify the willing to modify an external reference id. Use 'null' ReferenceMod to keep the - * current reference id; use a ReferenceMod with a null id to try to reset the reference id; use a ReferenceMod with a - * not null id to specify a new reference id. - */ -@XmlRootElement(name = "referenceMod") -@XmlType -public class ReferenceMod extends AbstractBaseBean { - - private static final long serialVersionUID = -4188817853738067677L; - - private Long key = null; - - public ReferenceMod() { - this(null); - } - - public ReferenceMod(final Long key) { - super(); - this.key = key; - } - - public Long getKey() { - return key; - } - - public void setKey(final Long key) { - this.key = key; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java deleted file mode 100644 index f894c26..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/ResourceAssociationMod.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.mod; - -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; -import org.apache.syncope.common.lib.wrap.ResourceKey; - -/** - * This class is used to specify the willing to create associations between user and external references. - * Password can be provided if required by an assign or provisioning operation. - * - * @see org.apache.syncope.common.types.ResourceAssociationActionType - */ -@XmlRootElement(name = "resourceAssociationMod") -@XmlType -public class ResourceAssociationMod extends AbstractBaseBean { - - private static final long serialVersionUID = -4188817853738067678L; - - /** - * Target external resources. - */ - private final List<ResourceKey> targetResources = new ArrayList<ResourceKey>(); - - /** - * Indicate the willing to change password on target external resources. - */ - private boolean changePwd; - - /** - * Indicate the new password to be provisioned on target external resources. - */ - private String password; - - @XmlElementWrapper(name = "resources") - @XmlElement(name = "resource") - @JsonProperty("resources") - public List<ResourceKey> getTargetResources() { - return targetResources; - } - - public boolean isChangePwd() { - return changePwd; - } - - public void setChangePwd(final boolean changePwd) { - this.changePwd = changePwd; - } - - public String getPassword() { - return password; - } - - public void setPassword(final String password) { - this.password = password; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java deleted file mode 100644 index 7f087b7..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/StatusMod.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.mod; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.ArrayList; -import java.util.List; -import javax.ws.rs.PathParam; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import org.apache.syncope.common.lib.AbstractBaseBean; - -@XmlRootElement(name = "statusMod") -@XmlType -public class StatusMod extends AbstractBaseBean { - - private static final long serialVersionUID = 3230910033784302656L; - - @XmlEnum - @XmlType(name = "statusModType") - public enum ModType { - - ACTIVATE, - SUSPEND, - REACTIVATE; - - } - - /** - * Key of user to for which status update is requested. - */ - private long key; - - private ModType type; - - /** - * Update token (if required). - */ - private String token; - - /** - * Whether update should be performed on internal storage. - */ - private boolean onSyncope = true; - - /** - * External resources for which update is needed to be propagated. - */ - private final List<String> resourceNames = new ArrayList<>(); - - public long getKey() { - return key; - } - - @PathParam("key") - public void setKey(final long key) { - this.key = key; - } - - public ModType getType() { - return type; - } - - public void setType(final ModType type) { - this.type = type; - } - - public String getToken() { - return token; - } - - public void setToken(final String token) { - this.token = token; - } - - public boolean isOnSyncope() { - return onSyncope; - } - - public void setOnSyncope(final boolean onSyncope) { - this.onSyncope = onSyncope; - } - - @XmlElementWrapper(name = "resources") - @XmlElement(name = "resource") - @JsonProperty("resources") - public List<String> getResources() { - return resourceNames; - } - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java deleted file mode 100644 index 95059fe..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/UserMod.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.mod; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -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(name = "userMod") -@XmlType -public class UserMod extends AnyMod { - - private static final long serialVersionUID = 3081848906558106204L; - - private String username; - - private String password; - - private final List<Long> relationshipsToAdd = new ArrayList<>(); - - private final List<Long> relationshipsToRemove = new ArrayList<>(); - - private final List<Long> membershipsToAdd = new ArrayList<>(); - - private final List<Long> membershipsToRemove = new ArrayList<>(); - - private final Set<Long> rolesToAdd = new HashSet<>(); - - private final Set<Long> rolesToRemove = new HashSet<>(); - - private StatusMod pwdPropRequest; - - private Long securityQuestion; - - private String securityAnswer; - - private boolean mustChangePassword; - - public String getUsername() { - return username; - } - - public void setUsername(final String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(final String password) { - this.password = password; - } - - @XmlElementWrapper(name = "relationshipsToAdd") - @XmlElement(name = "relationship") - @JsonProperty("relationshipsToAdd") - public List<Long> getRelationshipsToAdd() { - return relationshipsToAdd; - } - - @XmlElementWrapper(name = "urelationshipsToRemove") - @XmlElement(name = "urelationship") - @JsonProperty("urelationshipsToRemove") - public List<Long> getRelationshipsToRemove() { - return relationshipsToRemove; - } - - @XmlElementWrapper(name = "membershipsToAdd") - @XmlElement(name = "membership") - @JsonProperty("membershipsToAdd") - public List<Long> getMembershipsToAdd() { - return membershipsToAdd; - } - - @XmlElementWrapper(name = "membershipsToRemove") - @XmlElement(name = "membership") - @JsonProperty("membershipsToRemove") - public List<Long> getMembershipsToRemove() { - return membershipsToRemove; - } - - @XmlElementWrapper(name = "rolesToAdd") - @XmlElement(name = "role") - @JsonProperty("rolesToAdd") - public Set<Long> getRolesToAdd() { - return rolesToAdd; - } - - @XmlElementWrapper(name = "rolesToRemove") - @XmlElement(name = "role") - @JsonProperty("rolesToRemove") - public Set<Long> getRolesToRemove() { - return rolesToRemove; - } - - public StatusMod getPwdPropRequest() { - return pwdPropRequest; - } - - public void setPwdPropRequest(final StatusMod pwdPropRequest) { - this.pwdPropRequest = pwdPropRequest; - } - - 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; - } - - public boolean isMustChangePassword() { - return mustChangePassword; - } - - public void setMustChangePassword(final boolean mustChangePassword) { - this.mustChangePassword = mustChangePassword; - } - - @JsonIgnore - @Override - public boolean isEmpty() { - return super.isEmpty() - && password == null - && username == null - && pwdPropRequest == null - && securityQuestion == null - && securityAnswer == null - && !mustChangePassword; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/mod/package-info.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/package-info.java b/common/lib/src/main/java/org/apache/syncope/common/lib/mod/package-info.java deleted file mode 100644 index 866b275..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/mod/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -@XmlSchema(namespace = SyncopeConstants.NAMESPACE) -package org.apache.syncope.common.lib.mod; - -import javax.xml.bind.annotation.XmlSchema; -import org.apache.syncope.common.lib.SyncopeConstants; http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatch.java new file mode 100644 index 0000000..bb881a7 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatch.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.patch; + +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.AbstractBaseBean; +import org.apache.syncope.common.lib.types.PatchOperation; + +@XmlType +@XmlSeeAlso({ AbstractPatchItem.class, AttrPatch.class, MembershipPatch.class, RelationshipPatch.class }) +public abstract class AbstractPatch extends AbstractBaseBean { + + private static final long serialVersionUID = -4729181508529829580L; + + protected abstract static class Builder<P extends AbstractPatch, B extends Builder<P, B>> { + + protected P instance; + + protected abstract P newInstance(); + + protected P getInstance() { + if (instance == null) { + instance = newInstance(); + } + return instance; + } + + @SuppressWarnings("unchecked") + public B operation(final PatchOperation operation) { + getInstance().setOperation(operation); + return (B) this; + } + + public P build() { + if (getInstance().getOperation() == null) { + instance.setOperation(PatchOperation.ADD_REPLACE); + } + return getInstance(); + } + } + + private PatchOperation operation; + + public PatchOperation getOperation() { + return operation; + } + + public void setOperation(final PatchOperation operation) { + this.operation = operation; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java new file mode 100644 index 0000000..ee86a88 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractPatchItem.java @@ -0,0 +1,50 @@ +/* + * 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.patch; + +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +@XmlType +@XmlSeeAlso({ AbstractReplacePatchItem.class, LongPatchItem.class, StringPatchItem.class }) +public abstract class AbstractPatchItem<T> extends AbstractPatch { + + private static final long serialVersionUID = -8889326446009942028L; + + protected abstract static class Builder<T, P extends AbstractPatchItem<T>, B extends Builder<T, P, B>> + extends AbstractPatch.Builder<P, B> { + + @SuppressWarnings("unchecked") + public B value(final T value) { + getInstance().setValue(value); + return (B) this; + } + } + + private T value; + + public T getValue() { + return value; + } + + public void setValue(final T value) { + this.value = value; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractReplacePatchItem.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractReplacePatchItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractReplacePatchItem.java new file mode 100644 index 0000000..e8f17f4 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AbstractReplacePatchItem.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.common.lib.patch; + +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.types.PatchOperation; + +/** + * When a field of this type from {@link AnyPatch}, {@link AnyObjectPatch}, {@link GroupPatch} or {@link UserPatch} is + * {@code null}, no change will be performed; otherwise the result from {@link #getValue()} will replace the current + * value of the related field. + * + * @param <T> {@code String}, {@code Long} or {@code Boolean} + */ +@XmlType +@XmlSeeAlso({ BooleanReplacePatchItem.class, LongReplacePatchItem.class, StringReplacePatchItem.class }) +public abstract class AbstractReplacePatchItem<T> extends AbstractPatchItem<T> { + + private static final long serialVersionUID = 2027599764019829563L; + + public AbstractReplacePatchItem() { + super(); + super.setOperation(PatchOperation.ADD_REPLACE); + } + + @Override + public void setOperation(final PatchOperation operation) { + // fixed + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java new file mode 100644 index 0000000..e473e06 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyObjectPatch.java @@ -0,0 +1,58 @@ +/* + * 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.patch; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashSet; +import java.util.Set; +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(name = "anyObjectPatch") +@XmlType +public class AnyObjectPatch extends AnyPatch { + + private static final long serialVersionUID = -1644118942622556097L; + + private final Set<RelationshipPatch> relationships = new HashSet<>(); + + private final Set<MembershipPatch> memberships = new HashSet<>(); + + @XmlElementWrapper(name = "relationships") + @XmlElement(name = "relationship") + @JsonProperty("relationships") + public Set<RelationshipPatch> getRelationships() { + return relationships; + } + + @XmlElementWrapper(name = "memberships") + @XmlElement(name = "membership") + @JsonProperty("memberships") + public Set<MembershipPatch> getMemberships() { + return memberships; + } + + @Override + public boolean isEmpty() { + return super.isEmpty() && relationships.isEmpty() && memberships.isEmpty(); + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java new file mode 100644 index 0000000..e4b9e87 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java @@ -0,0 +1,110 @@ +/* + * 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.patch; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashSet; +import java.util.Set; +import javax.ws.rs.PathParam; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.AbstractBaseBean; + +@XmlType +public abstract class AnyPatch extends AbstractBaseBean { + + private static final long serialVersionUID = -7445489774552440544L; + + private long key; + + private StringReplacePatchItem realm; + + private final Set<StringPatchItem> auxClasses = new HashSet<>(); + + private final Set<AttrPatch> plainAttrs = new HashSet<>(); + + private final Set<AttrPatch> derAttrs = new HashSet<>(); + + private final Set<AttrPatch> virAttrs = new HashSet<>(); + + private final Set<StringPatchItem> resources = new HashSet<>(); + + public long getKey() { + return key; + } + + @PathParam("key") + public void setKey(final long key) { + this.key = key; + } + + public StringReplacePatchItem getRealm() { + return realm; + } + + public void setRealm(final StringReplacePatchItem realm) { + this.realm = realm; + } + + @XmlElementWrapper(name = "auxClasses") + @XmlElement(name = "auxClass") + @JsonProperty("auxClasses") + public Set<StringPatchItem> getAuxClasses() { + return auxClasses; + } + + @XmlElementWrapper(name = "plainAttrs") + @XmlElement(name = "attribute") + @JsonProperty("plainAttrs") + public Set<AttrPatch> getPlainAttrs() { + return plainAttrs; + } + + @XmlElementWrapper(name = "derAttrs") + @XmlElement(name = "attribute") + @JsonProperty("derAttrs") + public Set<AttrPatch> getDerAttrs() { + return derAttrs; + } + + @XmlElementWrapper(name = "virAttrs") + @XmlElement(name = "attribute") + @JsonProperty("virAttrs") + public Set<AttrPatch> getVirAttrs() { + return virAttrs; + } + + @XmlElementWrapper(name = "resources") + @XmlElement(name = "resource") + @JsonProperty("resources") + public Set<StringPatchItem> getResources() { + return resources; + } + + /** + * @return true if no actual changes are defined + */ + @JsonIgnore + public boolean isEmpty() { + return realm == null && auxClasses.isEmpty() && plainAttrs.isEmpty() && derAttrs.isEmpty() + && virAttrs.isEmpty() && resources.isEmpty(); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AssociationPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AssociationPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AssociationPatch.java new file mode 100644 index 0000000..009b30d --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AssociationPatch.java @@ -0,0 +1,53 @@ +/* + * 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.patch; + +import javax.ws.rs.PathParam; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.types.ResourceAssociationAction; + +@XmlRootElement(name = "associationPatch") +@XmlType +public class AssociationPatch extends PasswordPatch { + + private static final long serialVersionUID = 6295778399633883767L; + + private long key; + + private ResourceAssociationAction action; + + public long getKey() { + return key; + } + + @PathParam("key") + public void setKey(final long key) { + this.key = key; + } + + public ResourceAssociationAction getAction() { + return action; + } + + @PathParam("action") + public void setAction(final ResourceAssociationAction action) { + this.action = action; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttrPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttrPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttrPatch.java new file mode 100644 index 0000000..f41a054 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttrPatch.java @@ -0,0 +1,60 @@ +/* + * 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.patch; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.to.AttrTO; + +@XmlRootElement(name = "attrPatch") +@XmlType +public class AttrPatch extends AbstractPatch { + + private static final long serialVersionUID = 6881634224246176673L; + + public static class Builder extends AbstractPatch.Builder<AttrPatch, Builder> { + + @Override + protected AttrPatch newInstance() { + return new AttrPatch(); + } + + public Builder attrTO(final AttrTO attrTO) { + getInstance().setAttrTO(attrTO); + return this; + } + + } + + private AttrTO attrTO; + + public AttrTO getAttrTO() { + return attrTO; + } + + public void setAttrTO(final AttrTO attrTO) { + this.attrTO = attrTO; + } + + @JsonIgnore + public boolean isEmpty() { + return attrTO == null || attrTO.getValues().isEmpty(); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/BooleanReplacePatchItem.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/BooleanReplacePatchItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/BooleanReplacePatchItem.java new file mode 100644 index 0000000..9cf1097 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/BooleanReplacePatchItem.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.patch; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "booleanReplacePatchItem") +@XmlType +public class BooleanReplacePatchItem extends AbstractReplacePatchItem<Boolean> { + + private static final long serialVersionUID = 4013349284181583101L; + + public static class Builder extends AbstractReplacePatchItem.Builder<Boolean, BooleanReplacePatchItem, Builder> { + + @Override + protected BooleanReplacePatchItem newInstance() { + return new BooleanReplacePatchItem(); + } + + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/DeassociationPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/DeassociationPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/DeassociationPatch.java new file mode 100644 index 0000000..1067753 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/DeassociationPatch.java @@ -0,0 +1,67 @@ +/* + * 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.patch; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.List; +import javax.ws.rs.PathParam; +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; +import org.apache.syncope.common.lib.types.ResourceDeassociationAction; + +@XmlRootElement(name = "deassociationPatch") +@XmlType +public class DeassociationPatch extends AbstractBaseBean { + + private static final long serialVersionUID = 6295778399633883767L; + + private long key; + + private ResourceDeassociationAction action; + + private final List<String> resources = new ArrayList<>(); + + public long getKey() { + return key; + } + + @PathParam("key") + public void setKey(final long key) { + this.key = key; + } + + public ResourceDeassociationAction getAction() { + return action; + } + + public void setAction(final ResourceDeassociationAction action) { + this.action = action; + } + + @XmlElementWrapper(name = "resources") + @XmlElement(name = "resource") + @JsonProperty("resources") + public List<String> getResources() { + return resources; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java new file mode 100644 index 0000000..310c3d1 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/GroupPatch.java @@ -0,0 +1,87 @@ +/* + * 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.patch; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "groupPatch") +@XmlType +public class GroupPatch extends AnyPatch { + + private static final long serialVersionUID = -460284378124440077L; + + private StringReplacePatchItem name; + + private LongReplacePatchItem userOwner; + + private LongReplacePatchItem groupOwner; + + private StringReplacePatchItem adynMembershipCond; + + private StringReplacePatchItem udynMembershipCond; + + public StringReplacePatchItem getName() { + return name; + } + + public void setName(final StringReplacePatchItem name) { + this.name = name; + } + + public LongReplacePatchItem getUserOwner() { + return userOwner; + } + + public void setUserOwner(final LongReplacePatchItem userOwner) { + this.userOwner = userOwner; + } + + public LongReplacePatchItem getGroupOwner() { + return groupOwner; + } + + public void setGroupOwner(final LongReplacePatchItem groupOwner) { + this.groupOwner = groupOwner; + } + + public StringReplacePatchItem getADynMembershipCond() { + return adynMembershipCond; + } + + public void setADynMembershipCond(final StringReplacePatchItem adynMembershipCond) { + this.adynMembershipCond = adynMembershipCond; + } + + public StringReplacePatchItem getUDynMembershipCond() { + return udynMembershipCond; + } + + public void setUDynMembershipCond(final StringReplacePatchItem udynMembershipCond) { + this.udynMembershipCond = udynMembershipCond; + } + + @Override + public boolean isEmpty() { + return super.isEmpty() + && name == null && userOwner == null && groupOwner == null + && adynMembershipCond == null && udynMembershipCond == null; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/LongPatchItem.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/LongPatchItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/LongPatchItem.java new file mode 100644 index 0000000..96c6050 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/LongPatchItem.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.patch; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "stringPatchItem") +@XmlType +public class LongPatchItem extends AbstractPatchItem<Long> { + + private static final long serialVersionUID = 7308597905137875993L; + + public static class Builder extends AbstractPatchItem.Builder<Long, LongPatchItem, Builder> { + + @Override + protected LongPatchItem newInstance() { + return new LongPatchItem(); + } + + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/LongReplacePatchItem.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/LongReplacePatchItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/LongReplacePatchItem.java new file mode 100644 index 0000000..85b0878 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/LongReplacePatchItem.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.common.lib.patch; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "longReplacePatchItem") +@XmlType +public class LongReplacePatchItem extends AbstractReplacePatchItem<Long> { + + private static final long serialVersionUID = -2468696387745469136L; + + public static class Builder extends AbstractReplacePatchItem.Builder<Long, LongReplacePatchItem, Builder> { + + @Override + protected LongReplacePatchItem newInstance() { + return new LongReplacePatchItem(); + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.java new file mode 100644 index 0000000..b29a6de --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.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.patch; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.to.MembershipTO; + +@XmlRootElement(name = "membershipPatch") +@XmlType +public class MembershipPatch extends AbstractPatch { + + private static final long serialVersionUID = -6783121761221554433L; + + public static class Builder extends AbstractPatch.Builder<MembershipPatch, Builder> { + + @Override + protected MembershipPatch newInstance() { + return new MembershipPatch(); + } + + public Builder membershipTO(final MembershipTO membershipTO) { + getInstance().setMembershipTO(membershipTO); + return this; + } + } + + private MembershipTO membershipTO; + + public MembershipTO getMembershipTO() { + return membershipTO; + } + + public void setMembershipTO(final MembershipTO membershipTO) { + this.membershipTO = membershipTO; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java new file mode 100644 index 0000000..1149d2d --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/PasswordPatch.java @@ -0,0 +1,97 @@ +/* + * 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.patch; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Collection; +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.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; +import org.apache.commons.collections4.CollectionUtils; + +@XmlRootElement(name = "passwordPatch") +@XmlType +@XmlSeeAlso({ AssociationPatch.class, StatusPatch.class }) +public class PasswordPatch extends StringReplacePatchItem { + + private static final long serialVersionUID = 961023537479513071L; + + public static class Builder extends AbstractReplacePatchItem.Builder<String, PasswordPatch, Builder> { + + @Override + protected PasswordPatch newInstance() { + return new PasswordPatch(); + } + + public Builder onSyncope(final boolean onSyncope) { + getInstance().setOnSyncope(onSyncope); + return this; + } + + public Builder resource(final String resource) { + if (resource != null) { + getInstance().getResources().add(resource); + } + return this; + } + + public Builder values(final String... resources) { + CollectionUtils.addAll(getInstance().getResources(), resources); + return this; + } + + public Builder resources(final Collection<String> resources) { + if (resources != null) { + getInstance().getResources().addAll(resources); + } + return this; + } + + } + + /** + * Whether update should be performed on internal storage. + */ + private boolean onSyncope = true; + + /** + * External resources for which update is needed to be propagated. + */ + private final List<String> resources = new ArrayList<>(); + + public boolean isOnSyncope() { + return onSyncope; + } + + public void setOnSyncope(final boolean onSyncope) { + this.onSyncope = onSyncope; + } + + @XmlElementWrapper(name = "resources") + @XmlElement(name = "resource") + @JsonProperty("resources") + public List<String> getResources() { + return resources; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/RelationshipPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/RelationshipPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/RelationshipPatch.java new file mode 100644 index 0000000..f7925e9 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/RelationshipPatch.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.patch; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.to.RelationshipTO; + +@XmlRootElement(name = "relationshipPatch") +@XmlType +public class RelationshipPatch extends AbstractPatch { + + private static final long serialVersionUID = 1314175521205206511L; + + public static class Builder extends AbstractPatch.Builder<RelationshipPatch, Builder> { + + @Override + protected RelationshipPatch newInstance() { + return new RelationshipPatch(); + } + + public Builder relationshipTO(final RelationshipTO relationshipTO) { + getInstance().setRelationshipTO(relationshipTO); + return this; + } + } + + private RelationshipTO relationshipTO; + + public RelationshipTO getRelationshipTO() { + return relationshipTO; + } + + public void setRelationshipTO(final RelationshipTO relationshipTO) { + this.relationshipTO = relationshipTO; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StatusPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StatusPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StatusPatch.java new file mode 100644 index 0000000..be299b1 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StatusPatch.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.patch; + +import javax.ws.rs.PathParam; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.types.StatusPatchType; + +@XmlRootElement(name = "statusPatch") +@XmlType +public class StatusPatch extends PasswordPatch { + + private static final long serialVersionUID = 99309988426922612L; + + /** + * Key of user to for which status update is requested. + */ + private long key; + + private StatusPatchType type; + + /** + * Update token (if required). + */ + private String token; + + public long getKey() { + return key; + } + + @PathParam("key") + public void setKey(final long key) { + this.key = key; + } + + public StatusPatchType getType() { + return type; + } + + public void setType(final StatusPatchType type) { + this.type = type; + } + + public String getToken() { + return token; + } + + public void setToken(final String token) { + this.token = token; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StringPatchItem.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StringPatchItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StringPatchItem.java new file mode 100644 index 0000000..d9aacf8 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StringPatchItem.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.patch; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "stringPatchItem") +@XmlType +public class StringPatchItem extends AbstractPatchItem<String> { + + private static final long serialVersionUID = -4956965404796800689L; + + public static class Builder extends AbstractPatchItem.Builder<String, StringPatchItem, Builder> { + + @Override + protected StringPatchItem newInstance() { + return new StringPatchItem(); + } + + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StringReplacePatchItem.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StringReplacePatchItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StringReplacePatchItem.java new file mode 100644 index 0000000..b924484 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/StringReplacePatchItem.java @@ -0,0 +1,40 @@ +/* + * 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.patch; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "stringReplacePatchItem") +@XmlType +@XmlSeeAlso({ PasswordPatch.class }) +public class StringReplacePatchItem extends AbstractReplacePatchItem<String> { + + private static final long serialVersionUID = -5631052324901928363L; + + public static class Builder extends AbstractReplacePatchItem.Builder<String, StringReplacePatchItem, Builder> { + + @Override + protected StringReplacePatchItem newInstance() { + return new StringReplacePatchItem(); + } + + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java new file mode 100644 index 0000000..9131abd --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/UserPatch.java @@ -0,0 +1,118 @@ +/* + * 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.patch; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashSet; +import java.util.Set; +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(name = "userPatch") +@XmlType +public class UserPatch extends AnyPatch { + + private static final long serialVersionUID = 2872795537911821448L; + + private StringReplacePatchItem username; + + private PasswordPatch password; + + private LongReplacePatchItem securityQuestion; + + private StringReplacePatchItem securityAnswer; + + private BooleanReplacePatchItem mustChangePassword; + + private final Set<RelationshipPatch> relationships = new HashSet<>(); + + private final Set<MembershipPatch> memberships = new HashSet<>(); + + private final Set<LongPatchItem> roles = new HashSet<>(); + + public StringReplacePatchItem getUsername() { + return username; + } + + public void setUsername(final StringReplacePatchItem username) { + this.username = username; + } + + public PasswordPatch getPassword() { + return password; + } + + public void setPassword(final PasswordPatch password) { + this.password = password; + } + + public LongReplacePatchItem getSecurityQuestion() { + return securityQuestion; + } + + public void setSecurityQuestion(final LongReplacePatchItem securityQuestion) { + this.securityQuestion = securityQuestion; + } + + public StringReplacePatchItem getSecurityAnswer() { + return securityAnswer; + } + + public void setSecurityAnswer(final StringReplacePatchItem securityAnswer) { + this.securityAnswer = securityAnswer; + } + + public BooleanReplacePatchItem getMustChangePassword() { + return mustChangePassword; + } + + public void setMustChangePassword(final BooleanReplacePatchItem mustChangePassword) { + this.mustChangePassword = mustChangePassword; + } + + @XmlElementWrapper(name = "relationships") + @XmlElement(name = "relationship") + @JsonProperty("relationships") + public Set<RelationshipPatch> getRelationships() { + return relationships; + } + + @XmlElementWrapper(name = "memberships") + @XmlElement(name = "membership") + @JsonProperty("memberships") + public Set<MembershipPatch> getMemberships() { + return memberships; + } + + @XmlElementWrapper(name = "roles") + @XmlElement(name = "role") + @JsonProperty("roles") + public Set<LongPatchItem> getRoles() { + return roles; + } + + @Override + public boolean isEmpty() { + return super.isEmpty() + && username == null && password == null && securityQuestion == null && securityAnswer == null + && mustChangePassword == null && relationships.isEmpty() && memberships.isEmpty() && roles.isEmpty(); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/patch/package-info.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/package-info.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/package-info.java new file mode 100644 index 0000000..426ac6d --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/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.patch; + +import javax.xml.bind.annotation.XmlSchema; +import org.apache.syncope.common.lib.SyncopeConstants; http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java index f426f8c..8ff578c 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractSchemaTO.java @@ -20,12 +20,10 @@ package org.apache.syncope.common.lib.to; import com.fasterxml.jackson.annotation.JsonTypeInfo; import javax.ws.rs.PathParam; -import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; import org.apache.syncope.common.lib.AbstractBaseBean; -@XmlRootElement(name = "abstractSchema") @XmlType @XmlSeeAlso({ PlainSchemaTO.class, DerSchemaTO.class, VirSchemaTO.class }) @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java index c3b468c..65a6b51 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java @@ -21,12 +21,14 @@ package org.apache.syncope.common.lib.to; import org.apache.syncope.common.lib.AbstractBaseBean; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import javax.ws.rs.PathParam; 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.collections4.CollectionUtils; @XmlRootElement(name = "attribute") @XmlType @@ -34,6 +36,40 @@ public class AttrTO extends AbstractBaseBean { private static final long serialVersionUID = 4941691338796323623L; + public static class Builder { + + private final AttrTO instance = new AttrTO(); + + public Builder schema(final String schema) { + instance.setSchema(schema); + return this; + } + + public Builder readonly(final boolean readonly) { + instance.setReadonly(readonly); + return this; + } + + public Builder value(final String value) { + instance.getValues().add(value); + return this; + } + + public Builder values(final String... values) { + CollectionUtils.addAll(instance.getValues(), values); + return this; + } + + public Builder values(final Collection<String> values) { + instance.getValues().addAll(values); + return this; + } + + public AttrTO build() { + return instance; + } + } + /** * Name of the schema that this attribute is referring to. */ http://git-wip-us.apache.org/repos/asf/syncope/blob/9f73fa43/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java index d535c34..aa68a23 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java @@ -28,15 +28,41 @@ public class MembershipTO extends RelationshipTO { private static final long serialVersionUID = 5992828670273935861L; + public static class Builder { + + private final MembershipTO instance = new MembershipTO(); + + public Builder left(final String leftType, final long leftKey) { + instance.setLeftType(leftType); + instance.setLeftKey(leftKey); + return this; + } + + public Builder group(final long groupKey) { + instance.setRightKey(groupKey); + return this; + } + + public Builder group(final long groupKey, final String groupName) { + instance.setRightKey(groupKey); + instance.setGroupName(groupName); + return this; + } + + public MembershipTO build() { + return instance; + } + } + private String groupName; @Override - public String getRelationshipType() { + public String getType() { return "Membership"; } @Override - public void setRelationshipType(final String relationshipType) { + public void setType(final String relationshipType) { // ignore }
