http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java new file mode 100644 index 0000000..6d2eb1b --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyObjectTO.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.to; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "anyObject") +@XmlType +public class AnyObjectTO extends AnyTO { + + private static final long serialVersionUID = 8841697496476959639L; + +}
http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java new file mode 100644 index 0000000..bac9947 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java @@ -0,0 +1,180 @@ +/* + * 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.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlType; + +@XmlType +public abstract class AnyTO extends ConnObjectTO { + + private static final long serialVersionUID = -754311920679872084L; + + private long key; + + private String type; + + private String realm; + + private String status; + + private final Set<AttrTO> derAttrs = new LinkedHashSet<>(); + + private final Set<AttrTO> virAttrs = new LinkedHashSet<>(); + + private final Set<String> resources = new HashSet<>(); + + private final List<PropagationStatus> propagationStatusTOs = new ArrayList<>(); + + private final List<RelationshipTO> relationships = new ArrayList<>(); + + private final List<MembershipTO> memberships = new ArrayList<>(); + + private final List<Long> dynGroups = new ArrayList<>(); + + public long getKey() { + return key; + } + + public void setKey(final long key) { + this.key = key; + } + + public String getType() { + return type; + } + + public void setType(final String type) { + this.type = type; + } + + public String getRealm() { + return realm; + } + + public void setRealm(final String realm) { + this.realm = realm; + } + + public String getStatus() { + return status; + } + + public void setStatus(final String status) { + this.status = status; + } + + @XmlElementWrapper(name = "derAttrs") + @XmlElement(name = "attribute") + @JsonProperty("derAttrs") + public Set<AttrTO> getDerAttrs() { + return derAttrs; + } + + @JsonIgnore + public Map<String, AttrTO> getDerAttrMap() { + Map<String, AttrTO> result = new HashMap<>(derAttrs.size()); + for (AttrTO attributeTO : derAttrs) { + result.put(attributeTO.getSchema(), attributeTO); + } + + return Collections.unmodifiableMap(result); + } + + @XmlElementWrapper(name = "virAttrs") + @XmlElement(name = "attribute") + @JsonProperty("virAttrs") + public Set<AttrTO> getVirAttrs() { + return virAttrs; + } + + @JsonIgnore + public Map<String, AttrTO> getVirAttrMap() { + Map<String, AttrTO> result = new HashMap<>(virAttrs.size()); + for (AttrTO attributeTO : virAttrs) { + result.put(attributeTO.getSchema(), attributeTO); + } + + return Collections.unmodifiableMap(result); + } + + @XmlElementWrapper(name = "resources") + @XmlElement(name = "resource") + @JsonProperty("resources") + public Set<String> getResources() { + return resources; + } + + @XmlElementWrapper(name = "propagationStatuses") + @XmlElement(name = "propagationStatus") + @JsonProperty("propagationStatuses") + public List<PropagationStatus> getPropagationStatusTOs() { + return propagationStatusTOs; + } + + @XmlElementWrapper(name = "relationships") + @XmlElement(name = "relationship") + @JsonProperty("relationships") + public List<RelationshipTO> getRelationships() { + return relationships; + } + + @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.getRightKey(), membership); + } + result = Collections.unmodifiableMap(result); + } + + return result; + } + + @XmlElementWrapper(name = "dynGroups") + @XmlElement(name = "role") + @JsonProperty("dynGroups") + public List<Long> getDynGroups() { + return dynGroups; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java index 4856a48..77e1af2 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ConfTO.java @@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlType; @XmlRootElement(name = "conf") @XmlType -public class ConfTO extends AbstractAttributableTO { +public class ConfTO extends AnyTO { private static final long serialVersionUID = -3825039700228595590L; http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java index da0bd2b..873b15d 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/GroupTO.java @@ -19,19 +19,13 @@ package org.apache.syncope.common.lib.to; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -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 = "group") @XmlType @JsonIgnoreProperties({ "displayName" }) -public class GroupTO extends AbstractSubjectTO { +public class GroupTO extends AnyTO { private static final long serialVersionUID = -7785920258290147542L; @@ -41,19 +35,9 @@ public class GroupTO extends AbstractSubjectTO { private Long groupOwner; - private final List<String> gPlainAttrTemplates = new ArrayList<>(); - - private final List<String> gDerAttrTemplates = new ArrayList<>(); - - private final List<String> gVirAttrTemplates = new ArrayList<>(); - - private final List<String> mPlainAttrTemplates = new ArrayList<>(); + private String aDynMembershipCond; - private final List<String> mDerAttrTemplates = new ArrayList<>(); - - private final List<String> mVirAttrTemplates = new ArrayList<>(); - - private String dynMembershipCond; + private String uDynMembershipCond; public String getName() { return name; @@ -79,54 +63,20 @@ public class GroupTO extends AbstractSubjectTO { this.groupOwner = groupOwner; } - @XmlElementWrapper(name = "gPlainAttrTemplates") - @XmlElement(name = "gPlainAttrTemplate") - @JsonProperty("gPlainAttrTemplates") - public List<String> getGPlainAttrTemplates() { - return gPlainAttrTemplates; - } - - @XmlElementWrapper(name = "gDerAttrTemplates") - @XmlElement(name = "gDerAttrTemplate") - @JsonProperty("gDerAttrTemplates") - public List<String> getGDerAttrTemplates() { - return gDerAttrTemplates; - } - - @XmlElementWrapper(name = "gVirAttrTemplates") - @XmlElement(name = "gVirAttrTemplate") - @JsonProperty("gVirAttrTemplates") - public List<String> getGVirAttrTemplates() { - return gVirAttrTemplates; - } - - @XmlElementWrapper(name = "mPlainAttrTemplates") - @XmlElement(name = "mPlainAttrTemplate") - @JsonProperty("mPlainAttrTemplates") - public List<String> getMPlainAttrTemplates() { - return mPlainAttrTemplates; - } - - @XmlElementWrapper(name = "mDerAttrTemplates") - @XmlElement(name = "mDerAttrTemplate") - @JsonProperty("mDerAttrTemplates") - public List<String> getMDerAttrTemplates() { - return mDerAttrTemplates; + public String getADynMembershipCond() { + return aDynMembershipCond; } - @XmlElementWrapper(name = "mVirAttrTemplates") - @XmlElement(name = "mVirAttrTemplate") - @JsonProperty("mVirAttrTemplates") - public List<String> getMVirAttrTemplates() { - return mVirAttrTemplates; + public void setADynMembershipCond(final String aDynMembershipCond) { + this.aDynMembershipCond = aDynMembershipCond; } - public String getDynMembershipCond() { - return dynMembershipCond; + public String getUDynMembershipCond() { + return uDynMembershipCond; } - public void setDynMembershipCond(final String dynMembershipCond) { - this.dynMembershipCond = dynMembershipCond; + public void setUDynMembershipCond(final String uDynMembershipCond) { + this.uDynMembershipCond = uDynMembershipCond; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java index 7d81cd8..cf5dc71 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MappingTO.java @@ -36,19 +36,19 @@ public class MappingTO extends AbstractBaseBean { private static final long serialVersionUID = 8447688036282611118L; - private String accountLink; + private String connObjectLink; private final List<MappingItemTO> items = new ArrayList<>(); - public String getAccountLink() { - return accountLink; + public String getConnObjectLink() { + return connObjectLink; } - public void setAccountLink(final String accountLink) { - this.accountLink = accountLink; + public void setConnObjectLink(final String connObjectLink) { + this.connObjectLink = connObjectLink; } - public MappingItemTO getAccountIdItem() { + public MappingItemTO getConnObjectKeyItem() { return CollectionUtils.find(getItems(), new Predicate<MappingItemTO>() { @Override @@ -58,48 +58,28 @@ public class MappingTO extends AbstractBaseBean { }); } - protected boolean addAccountIdItem(final MappingItemTO accountIdItem) { - if (IntMappingType.UserVirtualSchema == accountIdItem.getIntMappingType() - || IntMappingType.GroupVirtualSchema == accountIdItem.getIntMappingType() - || IntMappingType.MembershipVirtualSchema == accountIdItem.getIntMappingType() - || IntMappingType.Password == accountIdItem.getIntMappingType()) { + protected boolean addConnObjectKeyItem(final MappingItemTO connObjectItem) { + if (IntMappingType.UserVirtualSchema == connObjectItem.getIntMappingType() + || IntMappingType.GroupVirtualSchema == connObjectItem.getIntMappingType() + || IntMappingType.AnyVirtualSchema == connObjectItem.getIntMappingType() + || IntMappingType.Password == connObjectItem.getIntMappingType()) { throw new IllegalArgumentException("Virtual attributes cannot be set as accountId"); } - if (IntMappingType.Password == accountIdItem.getIntMappingType()) { + if (IntMappingType.Password == connObjectItem.getIntMappingType()) { throw new IllegalArgumentException("Password attributes cannot be set as accountId"); } - accountIdItem.setExtAttrName(accountIdItem.getExtAttrName()); - accountIdItem.setAccountid(true); + connObjectItem.setExtAttrName(connObjectItem.getExtAttrName()); + connObjectItem.setAccountid(true); - return this.addItem(accountIdItem); + return this.add(connObjectItem); } - public boolean setAccountIdItem(final MappingItemTO accountIdItem) { - return accountIdItem == null - ? removeItem(getAccountIdItem()) - : addAccountIdItem(accountIdItem); - } - - public MappingItemTO getPasswordItem() { - return CollectionUtils.find(getItems(), new Predicate<MappingItemTO>() { - - @Override - public boolean evaluate(final MappingItemTO item) { - return item.isPassword(); - } - }); - } - - public boolean setPasswordItem(final MappingItemTO passwordItem) { - if (passwordItem == null) { - return this.removeItem(getPasswordItem()); - } else { - passwordItem.setExtAttrName(null); - passwordItem.setPassword(true); - return addItem(passwordItem); - } + public boolean setConnObjectKeyItem(final MappingItemTO connObjectKeyItem) { + return connObjectKeyItem == null + ? remove(getConnObjectKeyItem()) + : addConnObjectKeyItem(connObjectKeyItem); } @XmlElementWrapper(name = "items") @@ -109,11 +89,11 @@ public class MappingTO extends AbstractBaseBean { return items; } - public boolean addItem(final MappingItemTO item) { + public boolean add(final MappingItemTO item) { return item == null ? false : this.items.contains(item) || this.items.add(item); } - public boolean removeItem(final MappingItemTO item) { + public boolean remove(final MappingItemTO item) { return this.items.remove(item); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/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 2d2c7fa..5c435e4 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 @@ -23,20 +23,15 @@ import javax.xml.bind.annotation.XmlType; @XmlRootElement(name = "membership") @XmlType -public class MembershipTO extends AbstractAttributableTO { +public class MembershipTO extends RelationshipTO { private static final long serialVersionUID = 5992828670273935861L; - private long groupKey; - private String groupName; - public long getGroupKey() { - return groupKey; - } - - public void setGroupKey(final long groupId) { - this.groupKey = groupId; + @Override + public String getRightType() { + return "group"; } public String getGroupName() { http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java index d56d2ea..662a465 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/NotificationTO.java @@ -20,7 +20,9 @@ package org.apache.syncope.common.lib.to; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.ArrayList; +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; @@ -39,9 +41,7 @@ public class NotificationTO extends AbstractBaseBean { private final List<String> events = new ArrayList<>(); - private String userAbout; - - private String groupAbout; + private final Map<String, String> abouts = new HashMap<>(); private String recipients; @@ -63,20 +63,8 @@ public class NotificationTO extends AbstractBaseBean { private boolean active; - public String getUserAbout() { - return userAbout; - } - - public void setUserAbout(final String userAbout) { - this.userAbout = userAbout; - } - - public String getGroupAbout() { - return groupAbout; - } - - public void setGroupAbout(final String groupAbout) { - this.groupAbout = groupAbout; + public Map<String, String> getAbouts() { + return abouts; } @XmlElementWrapper(name = "events") http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java index 7c6ec08..0ebfb70 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PropagationTaskTO.java @@ -20,9 +20,9 @@ package org.apache.syncope.common.lib.to; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.PropagationMode; import org.apache.syncope.common.lib.types.ResourceOperation; -import org.apache.syncope.common.lib.types.SubjectType; @XmlRootElement(name = "propagationTask") @XmlType @@ -34,9 +34,9 @@ public class PropagationTaskTO extends AbstractTaskTO { private ResourceOperation propagationOperation; - private String accountId; + private String connObjectKey; - private String oldAccountId; + private String oldConnObjectKey; private String xmlAttributes; @@ -44,24 +44,24 @@ public class PropagationTaskTO extends AbstractTaskTO { private String objectClassName; - private SubjectType subjectType; + private AnyTypeKind anyTypeKind; - private Long subjectId; + private Long anyKey; - public String getAccountId() { - return accountId; + public String getConnObjectKey() { + return connObjectKey; } - public void setAccountId(final String accountId) { - this.accountId = accountId; + public void setConnObjectKey(final String connObjectKey) { + this.connObjectKey = connObjectKey; } - public String getOldAccountId() { - return oldAccountId; + public String getOldConnObjectKey() { + return oldConnObjectKey; } - public void setOldAccountId(final String oldAccountId) { - this.oldAccountId = oldAccountId; + public void setOldConnObjectKey(final String oldConnObjectKey) { + this.oldConnObjectKey = oldConnObjectKey; } public PropagationMode getPropagationMode() { @@ -85,7 +85,6 @@ public class PropagationTaskTO extends AbstractTaskTO { } public void setPropagationOperation(final ResourceOperation propagationOperation) { - this.propagationOperation = propagationOperation; } @@ -105,19 +104,19 @@ public class PropagationTaskTO extends AbstractTaskTO { this.objectClassName = objectClassName; } - public SubjectType getSubjectType() { - return subjectType; + public AnyTypeKind getAnyTypeKind() { + return anyTypeKind; } - public void setSubjectType(final SubjectType subjectType) { - this.subjectType = subjectType; + public void setAnyTypeKind(final AnyTypeKind anyTypeKind) { + this.anyTypeKind = anyTypeKind; } - public Long getSubjectId() { - return subjectId; + public Long getAnyKey() { + return anyKey; } - public void setSubjectId(final Long subjectId) { - this.subjectId = subjectId; + public void setAnyKey(final Long anyKey) { + this.anyKey = anyKey; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisionTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisionTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisionTO.java new file mode 100644 index 0000000..c4ff740 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisionTO.java @@ -0,0 +1,77 @@ +/* + * 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 org.apache.syncope.common.lib.AbstractBaseBean; + +public class ProvisionTO extends AbstractBaseBean { + + private static final long serialVersionUID = 8298910216218007927L; + + private long key; + + private String anyType; + + private String objectClass; + + private String syncToken; + + private MappingTO mapping; + + public long getKey() { + return key; + } + + public void setKey(final long key) { + this.key = key; + } + + public String getAnyType() { + return anyType; + } + + public void setAnyType(final String anyType) { + this.anyType = anyType; + } + + public String getObjectClass() { + return objectClass; + } + + public void setObjectClass(final String objectClass) { + this.objectClass = objectClass; + } + + public String getSyncToken() { + return syncToken; + } + + public void setSyncToken(final String syncToken) { + this.syncToken = syncToken; + } + + public MappingTO getMapping() { + return mapping; + } + + public void setMapping(final MappingTO mapping) { + this.mapping = mapping; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java index 8ddf044..e1839af 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PushTaskTO.java @@ -18,6 +18,8 @@ */ 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; @@ -27,23 +29,10 @@ public class PushTaskTO extends AbstractProvisioningTaskTO { private static final long serialVersionUID = -2143537546915809018L; - private String userFilter; + private final Map<String, String> filters = new HashMap<>(); - private String groupFilter; - - public String getUserFilter() { - return userFilter; - } - - public void setUserFilter(final String filter) { - this.userFilter = filter; + public Map<String, String> getFilters() { + return filters; } - public String getGroupFilter() { - return groupFilter; - } - - public void setGroupFilter(final String filter) { - this.groupFilter = filter; - } } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java new file mode 100644 index 0000000..2585b2b --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/RelationshipTO.java @@ -0,0 +1,81 @@ +/* + * 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; +import org.apache.syncope.common.lib.AbstractBaseBean; + +@XmlRootElement(name = "relationship") +@XmlType +public class RelationshipTO extends AbstractBaseBean { + + private static final long serialVersionUID = 360672942026613929L; + + private long key; + + private String leftType; + + private long leftKey; + + private String rightType; + + private long rightKey; + + public long getKey() { + return key; + } + + public void setKey(final long key) { + this.key = key; + } + + public String getLeftType() { + return leftType; + } + + public void setLeftType(final String leftType) { + this.leftType = leftType; + } + + public long getLeftKey() { + return leftKey; + } + + public void setLeftKey(final long leftKey) { + this.leftKey = leftKey; + } + + public String getRightType() { + return rightType; + } + + public void setRightType(final String rightType) { + this.rightType = rightType; + } + + public long getRightKey() { + return rightKey; + } + + public void setRightKey(final long rightKey) { + this.rightKey = rightKey; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java index 43f5ff0..fb97113 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java @@ -18,6 +18,7 @@ */ 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.HashSet; @@ -27,6 +28,8 @@ 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; +import org.apache.commons.collections4.Predicate; import org.apache.syncope.common.lib.types.ConnConfProperty; import org.apache.syncope.common.lib.types.PropagationMode; import org.apache.syncope.common.lib.types.TraceLevel; @@ -52,9 +55,7 @@ public class ResourceTO extends AbstractAnnotatedBean { */ private String connectorDisplayName; - private MappingTO umapping; - - private MappingTO gmapping; + private final List<ProvisionTO> provisions = new ArrayList<>(); private boolean propagationPrimary; @@ -132,22 +133,6 @@ public class ResourceTO extends AbstractAnnotatedBean { this.connectorDisplayName = connectorDisplayName; } - public MappingTO getUmapping() { - return umapping; - } - - public void setUmapping(final MappingTO umapping) { - this.umapping = umapping; - } - - public MappingTO getGmapping() { - return gmapping; - } - - public void setGmapping(final MappingTO gmapping) { - this.gmapping = gmapping; - } - public boolean isPropagationPrimary() { return propagationPrimary; } @@ -228,6 +213,24 @@ public class ResourceTO extends AbstractAnnotatedBean { this.syncPolicy = syncPolicy; } + @JsonIgnore + public ProvisionTO getProvision(final String anyType) { + return CollectionUtils.find(provisions, new Predicate<ProvisionTO>() { + + @Override + public boolean evaluate(final ProvisionTO provisionTO) { + return anyType != null && anyType.equals(provisionTO.getAnyType()); + } + }); + } + + @XmlElementWrapper(name = "provisions") + @XmlElement(name = "provision") + @JsonProperty("provisions") + public List<ProvisionTO> getProvisions() { + return provisions; + } + @XmlElementWrapper(name = "connConfProperties") @XmlElement(name = "property") @JsonProperty("connConfProperties") @@ -243,22 +246,6 @@ public class ResourceTO extends AbstractAnnotatedBean { this.syncTraceLevel = syncTraceLevel; } - public String getUsyncToken() { - return usyncToken; - } - - public void setUsyncToken(final String syncToken) { - this.usyncToken = syncToken; - } - - public String getRsyncToken() { - return rsyncToken; - } - - public void setRsyncToken(final String syncToken) { - this.rsyncToken = syncToken; - } - @XmlElementWrapper(name = "propagationActionsClassNames") @XmlElement(name = "propagationActionsClassName") @JsonProperty("propagationActionsClassNames") http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java index e62ffe4..4974505 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncTaskTO.java @@ -18,6 +18,8 @@ */ 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; @@ -29,9 +31,7 @@ public class SyncTaskTO extends AbstractProvisioningTaskTO { private String destinationRealm; - private UserTO userTemplate; - - private GroupTO groupTemplate; + private final Map<String, AnyTO> templates = new HashMap<>(); private boolean fullReconciliation; @@ -43,20 +43,8 @@ public class SyncTaskTO extends AbstractProvisioningTaskTO { this.destinationRealm = destinationRealm; } - public UserTO getUserTemplate() { - return userTemplate; - } - - public void setUserTemplate(final UserTO userTemplate) { - this.userTemplate = userTemplate; - } - - public GroupTO getGroupTemplate() { - return groupTemplate; - } - - public void setGroupTemplate(final GroupTO groupTemplate) { - this.groupTemplate = groupTemplate; + public Map<String, AnyTO> getTemplates() { + return templates; } public boolean isFullReconciliation() { http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/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 index 03dda04..243a79f 100644 --- 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 @@ -43,12 +43,16 @@ public class SyncopeTO extends AbstractBaseBean { private final List<String> connIdLocations = new ArrayList<>(); - private String attributableTransformer; + private String anyTransformer; + + private String anyObjectWorkflowAdapter; private String userWorkflowAdapter; private String groupWorkflowAdapter; + private String anyObjectProvisioningManager; + private String userProvisioningManager; private String groupProvisioningManager; @@ -96,8 +100,12 @@ public class SyncopeTO extends AbstractBaseBean { return connIdLocations; } - public String getAttributableTransformer() { - return attributableTransformer; + public String getAnyTransformer() { + return anyTransformer; + } + + public String getAnyObjectWorkflowAdapter() { + return anyObjectWorkflowAdapter; } public String getUserWorkflowAdapter() { @@ -108,6 +116,10 @@ public class SyncopeTO extends AbstractBaseBean { return groupWorkflowAdapter; } + public String getAnyObjectProvisioningManager() { + return anyObjectProvisioningManager; + } + public String getUserProvisioningManager() { return userProvisioningManager; } @@ -199,8 +211,12 @@ public class SyncopeTO extends AbstractBaseBean { this.pwdResetRequiringSecurityQuestions = pwdResetRequiringSecurityQuestions; } - public void setAttributableTransformer(final String attributableTransformer) { - this.attributableTransformer = attributableTransformer; + public void setAnyTransformer(final String anyTransformer) { + this.anyTransformer = anyTransformer; + } + + public void setAnyObjectWorkflowAdapter(final String anyObjectWorkflowAdapter) { + this.anyObjectWorkflowAdapter = anyObjectWorkflowAdapter; } public void setUserWorkflowAdapter(final String userWorkflowAdapter) { @@ -211,6 +227,10 @@ public class SyncopeTO extends AbstractBaseBean { this.groupWorkflowAdapter = groupWorkflowAdapter; } + public void setAnyObjectProvisioningManager(final String anyObjectProvisioningManager) { + this.anyObjectProvisioningManager = anyObjectProvisioningManager; + } + public void setUserProvisioningManager(final String userProvisioningManager) { this.userProvisioningManager = userProvisioningManager; } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/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 index 2feeffe..5de7b01 100644 --- 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 @@ -18,15 +18,11 @@ */ 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; @@ -36,7 +32,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; @XmlRootElement(name = "user") @XmlType -public class UserTO extends AbstractSubjectTO { +public class UserTO extends AnyTO { private static final long serialVersionUID = 7791304495192615740L; @@ -46,12 +42,6 @@ public class UserTO extends AbstractSubjectTO { private final List<Long> dynRoles = new ArrayList<>(); - private final List<MembershipTO> memberships = new ArrayList<>(); - - private final List<Long> dynGroups = new ArrayList<>(); - - private String status; - private String token; private Date tokenExpireTime; @@ -90,45 +80,6 @@ public class UserTO extends AbstractSubjectTO { return dynRoles; } - @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.getGroupKey(), membership); - } - result = Collections.unmodifiableMap(result); - } - - return result; - } - - @XmlElementWrapper(name = "dynGroups") - @XmlElement(name = "role") - @JsonProperty("dynGroups") - public List<Long> getDynGroups() { - return dynGroups; - } - - public String getStatus() { - return status; - } - - public void setStatus(final String status) { - this.status = status; - } - public String getToken() { return token; } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java new file mode 100644 index 0000000..c7b4e47 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.types; + +import javax.xml.bind.annotation.XmlEnum; + +@XmlEnum +public enum AnyTypeKind { + + USER, + GROUP, + ANY_OBJECT; + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/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 deleted file mode 100644 index fab34f0..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AttributableType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.types; - -import javax.xml.bind.annotation.XmlEnum; - -@XmlEnum -public enum AttributableType { - - USER, - GROUP, - MEMBERSHIP, - CONFIGURATION; - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java index a149d6c..81caa77 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/Entitlement.java @@ -80,6 +80,18 @@ public final class Entitlement { public static final String GROUP_DELETE = "GROUP_DELETE"; + public static final String ANY_OBJECT_SEARCH = "ANY_OBJECT_SEARCH"; + + public static final String ANY_OBJECT_LIST = "ANY_OBJECT_LIST"; + + public static final String ANY_OBJECT_CREATE = "ANY_OBJECT_CREATE"; + + public static final String ANY_OBJECT_READ = "ANY_OBJECT_READ"; + + public static final String ANY_OBJECT_UPDATE = "ANY_OBJECT_UPDATE"; + + public static final String ANY_OBJECT_DELETE = "ANY_OBJECT_DELETE"; + public static final String RESOURCE_LIST = "RESOURCE_LIST"; public static final String RESOURCE_CREATE = "RESOURCE_CREATE"; http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/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 index c02913f..2192bd5 100644 --- 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 @@ -27,20 +27,13 @@ public enum EntityViolationType { 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"), - InvalidGPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.gPlainSchema"), - InvalidGDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.gDerSchema"), - InvalidGVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.gVirSchema"), InvalidRealm("org.apache.syncope.core.persistence.validation.realm"), InvalidReport("org.apache.syncope.core.persistence.validation.report"), InvalidResource("org.apache.syncope.core.persistence.validation.externalresource"), @@ -51,9 +44,9 @@ public enum EntityViolationType { 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"), + InvalidPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.plainSchema"), + InvalidDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.derSchema"), + InvalidVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.virSchema"), 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"); http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/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 index c329d72..1b50f43 100644 --- 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 @@ -35,71 +35,71 @@ public enum IntMappingType { // ------------------------- // 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), + UserPlainSchema(AnyTypeKind.USER), + UserDerivedSchema(AnyTypeKind.USER), + UserVirtualSchema(AnyTypeKind.USER), + UserId(AnyTypeKind.USER), + Username(AnyTypeKind.USER), + Password(AnyTypeKind.USER), // ------------------------- // Group attribute types (the same in GroupMappingType) // ------------------------- - GroupPlainSchema(AttributableType.GROUP), - GroupDerivedSchema(AttributableType.GROUP), - GroupVirtualSchema(AttributableType.GROUP), - GroupId(AttributableType.GROUP), - GroupName(AttributableType.GROUP), - GroupOwnerSchema(AttributableType.GROUP), + GroupPlainSchema(AnyTypeKind.GROUP), + GroupDerivedSchema(AnyTypeKind.GROUP), + GroupVirtualSchema(AnyTypeKind.GROUP), + GroupId(AnyTypeKind.GROUP), + GroupName(AnyTypeKind.GROUP), + GroupOwnerSchema(AnyTypeKind.GROUP), // ------------------------- - // Membership attribute types (the same in MembershipMappingType) + // Any attribute types (the same in AnyMappingType) // ------------------------- - MembershipPlainSchema(AttributableType.MEMBERSHIP), - MembershipDerivedSchema(AttributableType.MEMBERSHIP), - MembershipVirtualSchema(AttributableType.MEMBERSHIP), - MembershipId(AttributableType.MEMBERSHIP); + AnyPlainSchema(AnyTypeKind.ANY_OBJECT), + AnyDerivedSchema(AnyTypeKind.ANY_OBJECT), + AnyVirtualSchema(AnyTypeKind.ANY_OBJECT), + AnyId(AnyTypeKind.ANY_OBJECT); - private final AttributableType attributableType; + private final AnyTypeKind anyTypeKind; - private IntMappingType(final AttributableType attributableType) { - this.attributableType = attributableType; + private IntMappingType(final AnyTypeKind anyTypeKind) { + this.anyTypeKind = anyTypeKind; } - public AttributableType getAttributableType() { - return attributableType; + public AnyTypeKind getAnyTypeKind() { + return anyTypeKind; } /** - * Get attribute types for a certain attributable type. + * Get attribute types for a certain any object type. * - * @param attributableType attributable type + * @param anyTypeKind any object 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 AnyTypeKind anyTypeKind, final Collection<IntMappingType> toBeFiltered) { - final Set<IntMappingType> res = getAttributeTypes(attributableType); + final Set<IntMappingType> res = getAttributeTypes(anyTypeKind); res.removeAll(toBeFiltered); return res; } /** - * Get attribute types for a certain attributable type. + * Get attribute types for a certain any object type. * - * @param attributableType attributable type + * @param anyTypeKind any object type * @return set of attribute types. */ - public static Set<IntMappingType> getAttributeTypes(final AttributableType attributableType) { + public static Set<IntMappingType> getAttributeTypes(final AnyTypeKind anyTypeKind) { EnumSet<?> enumset; - switch (attributableType) { + switch (anyTypeKind) { case GROUP: enumset = EnumSet.allOf(GroupMappingType.class); break; - case MEMBERSHIP: - enumset = EnumSet.allOf(MembershipMappingType.class); + case ANY_OBJECT: + enumset = EnumSet.allOf(AnyMappingType.class); break; case USER: @@ -119,18 +119,18 @@ public enum IntMappingType { public static Set<IntMappingType> getEmbedded() { return EnumSet.of(IntMappingType.UserId, IntMappingType.Username, IntMappingType.Password, IntMappingType.GroupId, IntMappingType.GroupName, IntMappingType.GroupOwnerSchema, - IntMappingType.MembershipId); + IntMappingType.AnyId); } /** - * Check if attribute type belongs to the specified attributable type set. + * Check if attribute type belongs to the specified any object type set. * - * @param attributableType attributable type. + * @param anyTypeKind any object type. * @param type attribute type. - * @return true if attribute type belongs to the specified attributable type set. + * @return true if attribute type belongs to the specified any object type set. */ - public static boolean contains(final AttributableType attributableType, final String type) { - switch (attributableType) { + public static boolean contains(final AnyTypeKind anyTypeKind, final String type) { + switch (anyTypeKind) { case GROUP: for (GroupMappingType c : GroupMappingType.values()) { if (c.name().equals(type)) { @@ -139,8 +139,8 @@ public enum IntMappingType { } break; - case MEMBERSHIP: - for (MembershipMappingType c : MembershipMappingType.values()) { + case ANY_OBJECT: + for (AnyMappingType c : AnyMappingType.values()) { if (c.name().equals(type)) { return true; } @@ -188,14 +188,14 @@ public enum IntMappingType { } /** - * Membership attribute types. + * Any attribute types. */ - private enum MembershipMappingType { + private enum AnyMappingType { - MembershipPlainSchema, - MembershipDerivedSchema, - MembershipVirtualSchema, - MembershipId; + AnyPlainSchema, + AnyDerivedSchema, + AnyVirtualSchema, + AnyId; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java deleted file mode 100644 index 538f19a..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java +++ /dev/null @@ -1,34 +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.types; - -import javax.xml.bind.annotation.XmlEnum; - -@XmlEnum -public enum SubjectType { - - USER, - GROUP; - - public AttributableType asAttributableType() { - return this == USER - ? AttributableType.USER - : AttributableType.GROUP; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java index a904209..34f95dd 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java @@ -24,31 +24,15 @@ 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.ClassList; -import org.apache.syncope.common.lib.annotation.SchemaList; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.Predicate; @XmlType public class SyncPolicySpec implements PolicySpec { private static final long serialVersionUID = -3144027171719498127L; - /** - * User attributes and fields for matching during synchronization. - */ - @SchemaList(extended = true) - private final List<String> uAltSearchSchemas = new ArrayList<>(); - - @ClassList - private String userJavaRule; - - /** - * Group attributes and fields for matching during synchronization. - */ - @SchemaList(extended = true) - private final List<String> gAltSearchSchemas = new ArrayList<>(); - - @ClassList - private String groupJavaRule; + private final List<SyncPolicySpecItem> items = new ArrayList<>(); /** * Conflict resolution action. @@ -65,33 +49,20 @@ public class SyncPolicySpec implements PolicySpec { this.conflictResolutionAction = conflictResolutionAction; } - @XmlElementWrapper(name = "userAltSearchSchemas") - @XmlElement(name = "userAltSearchSchema") - @JsonProperty("userAltSearchSchemas") - public List<String> getuAltSearchSchemas() { - return uAltSearchSchemas; - } - - @XmlElementWrapper(name = "groupAltSearchSchemas") - @XmlElement(name = "groupAltSearchSchema") - @JsonProperty("groupAltSearchSchemas") - public List<String> getrAltSearchSchemas() { - return gAltSearchSchemas; - } - - public String getGroupJavaRule() { - return groupJavaRule; - } - - public void setGroupJavaRule(final String groupJavaRule) { - this.groupJavaRule = groupJavaRule; - } + public SyncPolicySpecItem getItem(final String anyTypeKey) { + return CollectionUtils.find(items, new Predicate<SyncPolicySpecItem>() { - public String getUserJavaRule() { - return userJavaRule; + @Override + public boolean evaluate(final SyncPolicySpecItem item) { + return anyTypeKey != null && anyTypeKey.equals(item.getAnyTypeKey()); + } + }); } - public void setUserJavaRule(final String userJavaRule) { - this.userJavaRule = userJavaRule; + @XmlElementWrapper(name = "items") + @XmlElement(name = "item") + @JsonProperty("items") + public List<SyncPolicySpecItem> getItems() { + return items; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpecItem.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpecItem.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpecItem.java new file mode 100644 index 0000000..4acb61b --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpecItem.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.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.AbstractBaseBean; +import org.apache.syncope.common.lib.annotation.ClassList; +import org.apache.syncope.common.lib.annotation.SchemaList; + +@XmlType +public class SyncPolicySpecItem extends AbstractBaseBean { + + private static final long serialVersionUID = 692466729711976485L; + + private String anyTypeKey; + + @SchemaList(extended = true) + private final List<String> altSearchSchemas = new ArrayList<>(); + + @ClassList + private String javaRule; + + public String getAnyTypeKey() { + return anyTypeKey; + } + + public void setAnyTypeKey(final String anyTypeKey) { + this.anyTypeKey = anyTypeKey; + } + + public String getJavaRule() { + return javaRule; + } + + public void setJavaRule(final String javaRule) { + this.javaRule = javaRule; + } + + @XmlElementWrapper(name = "altSearchSchemas") + @XmlElement(name = "altSearchSchema") + @JsonProperty("altSearchSchemas") + public List<String> getAltSearchSchemas() { + return altSearchSchemas; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AnyKey.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AnyKey.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AnyKey.java new file mode 100644 index 0000000..6db8870 --- /dev/null +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AnyKey.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.lib.wrap; + +public class AnyKey extends AbstractWrappable<Long> { + + private static final long serialVersionUID = -8664228651057889297L; + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/SubjectKey.java ---------------------------------------------------------------------- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/SubjectKey.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/SubjectKey.java deleted file mode 100644 index 930cf35..0000000 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/SubjectKey.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.common.lib.wrap; - -public class SubjectKey extends AbstractWrappable<Long> { - - private static final long serialVersionUID = -8664228651057889297L; - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java new file mode 100644 index 0000000..e4fdf04 --- /dev/null +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnyListQuery.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.common.rest.api.beans; + +import java.util.List; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.MatrixParam; +import org.apache.syncope.common.lib.SyncopeConstants; + +public class AnyListQuery extends ListQuery { + + private static final long serialVersionUID = -5197167078435619636L; + + private List<String> realms; + + public List<String> getRealms() { + return realms; + } + + @DefaultValue(SyncopeConstants.ROOT_REALM) + @MatrixParam("realm") + public void setRealms(final List<String> realms) { + this.realms = realms; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.java new file mode 100644 index 0000000..3e0a516 --- /dev/null +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AnySearchQuery.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.rest.api.beans; + +import javax.ws.rs.QueryParam; +import org.apache.syncope.common.rest.api.service.JAXRSService; + +public class AnySearchQuery extends AnyListQuery { + + private static final long serialVersionUID = -6736562952418964707L; + + private String fiql; + + public String getFiql() { + return fiql; + } + + @QueryParam(JAXRSService.PARAM_FIQL) + public void setFiql(final String fiql) { + this.fiql = fiql; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/SubjectListQuery.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/SubjectListQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/SubjectListQuery.java deleted file mode 100644 index 47ff005..0000000 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/SubjectListQuery.java +++ /dev/null @@ -1,41 +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.rest.api.beans; - -import java.util.List; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.MatrixParam; -import org.apache.syncope.common.lib.SyncopeConstants; - -public class SubjectListQuery extends ListQuery { - - private static final long serialVersionUID = -5197167078435619636L; - - private List<String> realms; - - public List<String> getRealms() { - return realms; - } - - @DefaultValue(SyncopeConstants.ROOT_REALM) - @MatrixParam("realm") - public void setRealms(final List<String> realms) { - this.realms = realms; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/SubjectSearchQuery.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/SubjectSearchQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/SubjectSearchQuery.java deleted file mode 100644 index d7f7344..0000000 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/SubjectSearchQuery.java +++ /dev/null @@ -1,39 +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.rest.api.beans; - -import javax.ws.rs.QueryParam; -import org.apache.syncope.common.rest.api.service.JAXRSService; - -public class SubjectSearchQuery extends SubjectListQuery { - - private static final long serialVersionUID = -6736562952418964707L; - - private String fiql; - - public String getFiql() { - return fiql; - } - - @QueryParam(JAXRSService.PARAM_FIQL) - public void setFiql(final String fiql) { - this.fiql = fiql; - } - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java index b612a6e..635be02 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/GroupService.java @@ -41,8 +41,8 @@ import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.types.ResourceAssociationActionType; import org.apache.syncope.common.lib.types.ResourceDeassociationActionType; import org.apache.syncope.common.lib.wrap.ResourceName; -import org.apache.syncope.common.rest.api.beans.SubjectListQuery; -import org.apache.syncope.common.rest.api.beans.SubjectSearchQuery; +import org.apache.syncope.common.rest.api.beans.AnyListQuery; +import org.apache.syncope.common.rest.api.beans.AnySearchQuery; /** * REST operations for groups. @@ -85,7 +85,7 @@ public interface GroupService extends JAXRSService { */ @GET @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<GroupTO> list(@BeanParam SubjectListQuery listQuery); + PagedResult<GroupTO> list(@BeanParam AnyListQuery listQuery); /** * Returns a paged list of groups matching the given query. @@ -96,7 +96,7 @@ public interface GroupService extends JAXRSService { @GET @Path("search") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<GroupTO> search(@BeanParam SubjectSearchQuery searchQuery); + PagedResult<GroupTO> search(@BeanParam AnySearchQuery searchQuery); /** * Creates a new group. http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java index 06b6b32..48ba21a 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java @@ -38,8 +38,7 @@ import org.apache.syncope.common.lib.to.BulkActionResult; import org.apache.syncope.common.lib.to.ConnObjectTO; import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.syncope.common.lib.types.ResourceDeassociationActionType; -import org.apache.syncope.common.lib.types.SubjectType; -import org.apache.syncope.common.lib.wrap.SubjectKey; +import org.apache.syncope.common.lib.wrap.AnyKey; /** * REST operations for external resources. @@ -51,15 +50,15 @@ public interface ResourceService extends JAXRSService { * Returns connector object from the external resource, for the given type and key. * * @param resourceKey Name of resource to read connector object from - * @param type user /group - * @param key user key / group key + * @param anyTypeKey any object type + * @param key any object key * @return connector object from the external resource, for the given type and key */ @GET - @Path("{resourceKey}/{type}/{key}") + @Path("{resourceKey}/{anyTypeKey}/{key}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - ConnObjectTO getConnectorObject(@NotNull @PathParam("resourceKey") String resourceKey, - @NotNull @PathParam("type") SubjectType type, @NotNull @PathParam("key") Long key); + ConnObjectTO readConnObject(@NotNull @PathParam("resourceKey") String resourceKey, + @NotNull @PathParam("anyTypeKey") String anyTypeKey, @NotNull @PathParam("key") Long key); /** * Returns the resource with matching name. @@ -117,7 +116,7 @@ public interface ResourceService extends JAXRSService { void delete(@NotNull @PathParam("resourceKey") String resourceKey); /** - * Checks wether the connection to resource could be established. + * Checks whether the connection to resource could be established. * * @param resourceTO resource to be checked * @return true if connection to resource could be established @@ -128,12 +127,12 @@ public interface ResourceService extends JAXRSService { boolean check(@NotNull ResourceTO resourceTO); /** - * De-associate users or groups (depending on the provided subject type) from the given resource. + * De-associate any objects from the given resource. * * @param resourceKey name of resource - * @param subjectType subject type (user or group) + * @param anyTypeKey any object kind * @param type resource de-association action type - * @param subjectKeys users or groups against which the bulk action will be performed + * @param keys any object keys against which the bulk action will be performed * @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt> */ @Descriptions({ @@ -141,12 +140,12 @@ public interface ResourceService extends JAXRSService { value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>") }) @POST - @Path("{resourceKey}/bulkDeassociation/{subjType}/{type}") + @Path("{resourceKey}/bulkDeassociation/{anyTypeKey}/{type}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) BulkActionResult bulkDeassociation(@NotNull @PathParam("resourceKey") String resourceKey, - @NotNull @PathParam("subjType") SubjectType subjectType, - @NotNull @PathParam("type") ResourceDeassociationActionType type, @NotNull List<SubjectKey> subjectKeys); + @NotNull @PathParam("anyTypeKey") String anyTypeKey, + @NotNull @PathParam("type") ResourceDeassociationActionType type, @NotNull List<AnyKey> keys); /** * Executes the provided bulk action. http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java index d3f850b..4ffb3f6 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java @@ -34,7 +34,6 @@ import org.apache.cxf.jaxrs.model.wadl.Description; import org.apache.cxf.jaxrs.model.wadl.Descriptions; import org.apache.cxf.jaxrs.model.wadl.DocTarget; import org.apache.syncope.common.lib.to.AbstractSchemaTO; -import org.apache.syncope.common.lib.types.AttributableType; import org.apache.syncope.common.lib.types.SchemaType; /** @@ -47,36 +46,32 @@ public interface SchemaService extends JAXRSService { * Returns schema matching the given kind, type and name. * * @param <T> actual SchemaTO - * @param attrType kind for schemas to be read - * @param schemaType type for schemas to be read + * @param type type for schemas to be read * @param schemaKey name of schema to be read * @return schema matching the given kind, type and name */ @GET @Path("{key}") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractSchemaTO> T read(@NotNull @PathParam("kind") AttributableType attrType, - @NotNull @PathParam("type") SchemaType schemaType, @NotNull @PathParam("key") String schemaKey); + <T extends AbstractSchemaTO> T read( + @NotNull @PathParam("type") SchemaType type, @NotNull @PathParam("key") String schemaKey); /** * Returns a list of schemas with matching kind and type. * * @param <T> actual SchemaTO - * @param attrType kind for schemas to be listed - * @param schemaType type for schemas to be listed + * @param type type for schemas to be listed * @return list of schemas with matching kind and type */ @GET @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractSchemaTO> List<T> list( - @NotNull @PathParam("kind") AttributableType attrType, @NotNull @PathParam("type") SchemaType schemaType); + <T extends AbstractSchemaTO> List<T> list(@NotNull @PathParam("type") SchemaType type); /** * Creates a new schema. * * @param <T> actual SchemaTO - * @param attrType kind for schema to be created - * @param schemaType type for schema to be created + * @param type type for schema to be created * @param schemaTO schema to be created * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created schema */ @@ -85,35 +80,33 @@ public interface SchemaService extends JAXRSService { }) @POST @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractSchemaTO> Response create(@NotNull @PathParam("kind") AttributableType attrType, - @NotNull @PathParam("type") SchemaType schemaType, @NotNull T schemaTO); + <T extends AbstractSchemaTO> Response create( + @NotNull @PathParam("type") SchemaType type, @NotNull T schemaTO); /** * Updates the schema matching the given kind, type and name. * * @param <T> actual SchemaTO - * @param attrType kind for schemas to be updated - * @param schemaType type for schemas to be updated + * @param type type for schemas to be updated * @param schemaKey name of schema to be updated * @param schemaTO updated schema to be stored */ @PUT @Path("{key}") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - <T extends AbstractSchemaTO> void update(@NotNull @PathParam("kind") AttributableType attrType, - @NotNull @PathParam("type") SchemaType schemaType, + <T extends AbstractSchemaTO> void update( + @NotNull @PathParam("type") SchemaType type, @NotNull @PathParam("key") String schemaKey, @NotNull T schemaTO); /** * Deletes the schema matching the given kind, type and name. * - * @param attrType kind for schema to be deleted - * @param schemaType type for schema to be deleted + * @param type type for schema to be deleted * @param schemaKey name of schema to be deleted */ @DELETE @Path("{key}") - void delete(@NotNull @PathParam("kind") AttributableType attrType, - @NotNull @PathParam("type") SchemaType schemaType, + void delete( + @NotNull @PathParam("type") SchemaType type, @NotNull @PathParam("key") String schemaKey); } http://git-wip-us.apache.org/repos/asf/syncope/blob/081d9a04/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java ---------------------------------------------------------------------- diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java index 8c13935..9e280a5 100644 --- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java +++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserService.java @@ -46,8 +46,8 @@ import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.ResourceAssociationActionType; import org.apache.syncope.common.lib.types.ResourceDeassociationActionType; import org.apache.syncope.common.lib.wrap.ResourceName; -import org.apache.syncope.common.rest.api.beans.SubjectListQuery; -import org.apache.syncope.common.rest.api.beans.SubjectSearchQuery; +import org.apache.syncope.common.rest.api.beans.AnyListQuery; +import org.apache.syncope.common.rest.api.beans.AnySearchQuery; /** * REST operations for users. @@ -102,7 +102,7 @@ public interface UserService extends JAXRSService { */ @GET @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<UserTO> list(@BeanParam SubjectListQuery listQuery); + PagedResult<UserTO> list(@BeanParam AnyListQuery listQuery); /** * Returns a paged list of users matching the given query. @@ -113,7 +113,7 @@ public interface UserService extends JAXRSService { @GET @Path("search") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - PagedResult<UserTO> search(@BeanParam SubjectSearchQuery searchQuery); + PagedResult<UserTO> search(@BeanParam AnySearchQuery searchQuery); /** * Creates a new user.
