Author: jbernhardt
Date: Thu Jan 24 15:52:51 2013
New Revision: 1438055
URL: http://svn.apache.org/viewvc?rev=1438055&view=rev
Log:
[SYNCOPE-231]
* Adding JAX-B Annotations for TOs and Types
* Adding REST Header constant for IDs
Added:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/JobClassTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncActionClassTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/LoggerType.java
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AttributeTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ConnObjectTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MembershipTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTaskTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationStatusTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationTaskTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/RoleTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchedTaskTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncTaskTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskExecTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserRequestTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationMode.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationTaskExecStatus.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/ResourceOperation.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TaskType.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TraceLevel.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/UserRequestType.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/SyncopeConstants.java
Thu Jan 24 15:52:51 2013
@@ -31,4 +31,11 @@ public class SyncopeConstants {
public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ssZ";
+ /**
+ * This constant will be used to identify HTTP header key to look for
object ID assigned
+ * to an object after its creation. HTTP Response after PUT operation
should contain this
+ * key with resource id as its value.
+ */
+ public static final String REST_HEADER_ID = "org.apache.syncope.id";
+
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AbstractAttributableMod.java
Thu Jan 24 15:52:51 2013
@@ -21,13 +21,18 @@ package org.apache.syncope.common.mod;
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.XmlType;
+
import org.apache.syncope.common.AbstractBaseBean;
/**
* Abstract base class for objects that can have attributes removed, added or
updated.
- *
+ *
* Attributes can be regular attributes, derived attributes, virtual
attributes and resources.
*/
+@XmlType
public abstract class AbstractAttributableMod extends AbstractBaseBean {
private static final long serialVersionUID = 3241118574016303198L;
@@ -67,9 +72,9 @@ public abstract class AbstractAttributab
/**
* Convenience method for removing entire attribute instead removing each
value in an AttributeMod object
- *
+ *
* @param name (schema) of attribute to be removed.
- * @return true on success.
+ * @return true on success.
*/
public boolean addAttributeToBeRemoved(String attribute) {
return attributesToBeRemoved.add(attribute);
@@ -77,14 +82,16 @@ public abstract class AbstractAttributab
/**
* Convenience method for removing entire attribute instead removing each
value in an AttributeMod object
- *
+ *
* @param name (schema) of attribute to be removed.
- * @return true on success.
+ * @return true on success.
*/
public boolean removeAttributeToBeRemoved(String attribute) {
return attributesToBeRemoved.remove(attribute);
}
+ @XmlElementWrapper(name = "attributesToBeRemoved")
+ @XmlElement(name = "attribute")
public Set<String> getAttributesToBeRemoved() {
return attributesToBeRemoved;
}
@@ -94,8 +101,8 @@ public abstract class AbstractAttributab
}
/**
- * Add an attribute modification object. AttributeMod itself indicates how
the attribute should be modified.
- *
+ * Add an attribute modification object. AttributeMod itself indicates how
the attribute should be modified.
+ *
* @param attribute modification object
* @see AttributeMod
* @return true on success
@@ -105,8 +112,8 @@ public abstract class AbstractAttributab
}
/**
- * Remove an attribute modification object. AttributeMod itself indicates
how the attribute should be modified.
- *
+ * Remove an attribute modification object. AttributeMod itself indicates
how the attribute should be modified.
+ *
* @param attribute modification object
* @see AttributeMod
* @return true on success
@@ -115,6 +122,8 @@ public abstract class AbstractAttributab
return attributesToBeUpdated.remove(attribute);
}
+ @XmlElementWrapper(name = "attributesToBeUpdated")
+ @XmlElement(name = "attributeMod")
public Set<AttributeMod> getAttributesToBeUpdated() {
return attributesToBeUpdated;
}
@@ -124,8 +133,8 @@ public abstract class AbstractAttributab
}
/**
- * Add an attribute modification object. AttributeMod itself indicates how
the attribute should be modified.
- *
+ * Add an attribute modification object. AttributeMod itself indicates how
the attribute should be modified.
+ *
* @param attribute modification object
* @see AttributeMod
* @return true on success
@@ -135,8 +144,8 @@ public abstract class AbstractAttributab
}
/**
- * Add a derivedattribute. Value is calculated by its definition.
- *
+ * Add a derivedattribute. Value is calculated by its definition.
+ *
* @param derivedAttribute
* @return true on success
*/
@@ -144,6 +153,8 @@ public abstract class AbstractAttributab
return derivedAttributesToBeAdded.remove(derivedAttribute);
}
+ @XmlElementWrapper(name = "derivedAttributesToBeAdded")
+ @XmlElement(name = "attributeName")
public Set<String> getDerivedAttributesToBeAdded() {
return derivedAttributesToBeAdded;
}
@@ -161,6 +172,8 @@ public abstract class AbstractAttributab
return derivedAttributesToBeRemoved.remove(derivedAttribute);
}
+ @XmlElementWrapper(name = "derivedAttributesToBeRemoved")
+ @XmlElement(name = "attribute")
public Set<String> getDerivedAttributesToBeRemoved() {
return derivedAttributesToBeRemoved;
}
@@ -170,6 +183,8 @@ public abstract class AbstractAttributab
this.derivedAttributesToBeRemoved = derivedAttributesToBeRemoved;
}
+ @XmlElementWrapper(name = "virtualAttributesToBeRemoved")
+ @XmlElement(name = "attribute")
public Set<String> getVirtualAttributesToBeRemoved() {
return virtualAttributesToBeRemoved;
}
@@ -199,6 +214,8 @@ public abstract class AbstractAttributab
return
virtualAttributesToBeUpdated.remove(virtualAttributeToBeUpdated);
}
+ @XmlElementWrapper(name = "derivedAttributesToBeUpdated")
+ @XmlElement(name = "attribute")
public Set<AttributeMod> getVirtualAttributesToBeUpdated() {
return virtualAttributesToBeUpdated;
}
@@ -216,6 +233,8 @@ public abstract class AbstractAttributab
return resourcesToBeAdded.remove(resource);
}
+ @XmlElementWrapper(name = "resourcesToBeAdded")
+ @XmlElement(name = "resource")
public Set<String> getResourcesToBeAdded() {
return resourcesToBeAdded;
}
@@ -232,6 +251,8 @@ public abstract class AbstractAttributab
return resourcesToBeRemoved.remove(resource);
}
+ @XmlElementWrapper(name = "resourcesToBeRemoved")
+ @XmlElement(name = "resource")
public Set<String> getResourcesToBeRemoved() {
return resourcesToBeRemoved;
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/AttributeMod.java
Thu Jan 24 15:52:51 2013
@@ -20,9 +20,17 @@ package org.apache.syncope.common.mod;
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.codehaus.jackson.annotate.JsonIgnore;
import org.apache.syncope.common.AbstractBaseBean;
+@XmlRootElement
+@XmlType
public class AttributeMod extends AbstractBaseBean {
private static final long serialVersionUID = -913573979137431406L;
@@ -56,6 +64,8 @@ public class AttributeMod extends Abstra
return valuesToBeAdded.remove(value);
}
+ @XmlElementWrapper(name = "valuesToBeAdded")
+ @XmlElement(name = "value")
public List<String> getValuesToBeAdded() {
return valuesToBeAdded;
}
@@ -72,6 +82,8 @@ public class AttributeMod extends Abstra
return valuesToBeRemoved.remove(value);
}
+ @XmlElementWrapper(name = "valuesToBeRemoved")
+ @XmlElement(name = "value")
public List<String> getValuesToBeRemoved() {
return valuesToBeRemoved;
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/MembershipMod.java
Thu Jan 24 15:52:51 2013
@@ -20,8 +20,16 @@ package org.apache.syncope.common.mod;
import java.util.Collections;
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;
+
import org.codehaus.jackson.annotate.JsonIgnore;
+@XmlRootElement
+@XmlType
public class MembershipMod extends AbstractAttributableMod {
private static final long serialVersionUID = 2511869129977331525L;
@@ -46,11 +54,15 @@ public class MembershipMod extends Abstr
return false;
}
+ @XmlElementWrapper(name = "resourcesToBeAdded")
+ @XmlElement(name = "resource")
@Override
public Set<String> getResourcesToBeAdded() {
return Collections.emptySet();
}
+ @XmlElementWrapper(name = "resourcesToBeRemoved")
+ @XmlElement(name = "resource")
@Override
public Set<String> getResourcesToBeRemoved() {
return Collections.emptySet();
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/mod/UserMod.java
Thu Jan 24 15:52:51 2013
@@ -20,8 +20,16 @@ package org.apache.syncope.common.mod;
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;
+
import org.codehaus.jackson.annotate.JsonIgnore;
+@XmlRootElement(name = "userMod")
+@XmlType
public class UserMod extends AbstractAttributableMod {
private static final long serialVersionUID = 3081848906558106204L;
@@ -49,6 +57,8 @@ public class UserMod extends AbstractAtt
return membershipsToBeAdded.remove(membershipMod);
}
+ @XmlElementWrapper(name = "membershipsToBeAdded")
+ @XmlElement(name = "membership")
public Set<MembershipMod> getMembershipsToBeAdded() {
return membershipsToBeAdded;
}
@@ -81,6 +91,8 @@ public class UserMod extends AbstractAtt
return membershipsToBeRemoved.remove(membershipToBeRemoved);
}
+ @XmlElementWrapper(name = "membershipsToBeRemoved")
+ @XmlElement(name = "membership")
public Set<Long> getMembershipsToBeRemoved() {
return membershipsToBeRemoved;
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AbstractAttributableTO.java
Thu Jan 24 15:52:51 2013
@@ -25,8 +25,14 @@ import java.util.HashSet;
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;
+
import org.codehaus.jackson.annotate.JsonIgnore;
+@XmlType
public abstract class AbstractAttributableTO extends ConnObjectTO {
private static final long serialVersionUID = 4083884098736820255L;
@@ -39,7 +45,7 @@ public abstract class AbstractAttributab
private Set<String> resources;
- private List<PropagationStatusTO> propagationStatusTOs;
+ private final List<PropagationStatusTO> propagationStatusTOs;
protected AbstractAttributableTO() {
super();
@@ -100,6 +106,8 @@ public abstract class AbstractAttributab
return derivedAttributes.remove(derivedAttribute);
}
+ @XmlElementWrapper(name = "derivedAttributes")
+ @XmlElement(name = "attribute")
public List<AttributeTO> getDerivedAttributes() {
return derivedAttributes;
}
@@ -117,6 +125,8 @@ public abstract class AbstractAttributab
return virtualAttributes.remove(virtualAttribute);
}
+ @XmlElementWrapper(name = "virtualAttributes")
+ @XmlElement(name = "attribute")
public List<AttributeTO> getVirtualAttributes() {
return virtualAttributes;
}
@@ -133,6 +143,8 @@ public abstract class AbstractAttributab
return resources.remove(resource);
}
+ @XmlElementWrapper(name = "resources")
+ @XmlElement(name = "resource")
public Set<String> getResources() {
return resources;
}
@@ -160,6 +172,8 @@ public abstract class AbstractAttributab
return false;
}
+ @XmlElementWrapper(name = "propagationStatuses")
+ @XmlElement(name = "propagationStatus")
public List<PropagationStatusTO> getPropagationStatusTOs() {
return propagationStatusTOs;
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AttributeTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AttributeTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AttributeTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/AttributeTO.java
Thu Jan 24 15:52:51 2013
@@ -21,8 +21,15 @@ package org.apache.syncope.common.to;
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.AbstractBaseBean;
+@XmlRootElement(name = "attribute")
+@XmlType
public class AttributeTO extends AbstractBaseBean {
private static final long serialVersionUID = 4941691338796323623L;
@@ -89,6 +96,8 @@ public class AttributeTO extends Abstrac
/**
* @return attribute values as strings
*/
+ //@XmlElementWrapper(name = "values")
+ @XmlElement(name = "value")
public List<String> getValues() {
return values;
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ConnObjectTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ConnObjectTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ConnObjectTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/ConnObjectTO.java
Thu Jan 24 15:52:51 2013
@@ -24,9 +24,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
import org.apache.syncope.common.AbstractBaseBean;
import org.codehaus.jackson.annotate.JsonIgnore;
+@XmlRootElement(name = "connector")
+@XmlType
public class ConnObjectTO extends AbstractBaseBean {
private static final long serialVersionUID = 5139554911265442497L;
@@ -47,6 +54,8 @@ public class ConnObjectTO extends Abstra
return attributes.remove(attribute);
}
+ @XmlElementWrapper(name = "attributes")
+ @XmlElement(name = "attribute")
public List<AttributeTO> getAttributes() {
return attributes;
}
Added:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/JobClassTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/JobClassTO.java?rev=1438055&view=auto
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/JobClassTO.java
(added)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/JobClassTO.java
Thu Jan 24 15:52:51 2013
@@ -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.to;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.syncope.common.AbstractBaseBean;
+
+@XmlRootElement(name = "jobClass")
+@XmlType
+public class JobClassTO extends AbstractBaseBean {
+
+ private static final long serialVersionUID = -1953799905627918822L;
+
+ private String name;
+
+ public static JobClassTO instance(final String name) {
+ JobClassTO instance = new JobClassTO();
+ instance.setName(name);
+ return instance;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MembershipTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MembershipTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MembershipTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MembershipTO.java
Thu Jan 24 15:52:51 2013
@@ -22,6 +22,13 @@ import java.util.Collections;
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 = "membership")
+@XmlType
public class MembershipTO extends AbstractAttributableTO {
private static final long serialVersionUID = 5992828670273935861L;
@@ -57,6 +64,8 @@ public class MembershipTO extends Abstra
}
@Override
+ @XmlElementWrapper(name = "resources")
+ @XmlElement(name = "resource")
public Set<String> getResources() {
return Collections.<String>emptySet();
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTO.java
Thu Jan 24 15:52:51 2013
@@ -21,14 +21,11 @@ package org.apache.syncope.common.to;
import java.util.ArrayList;
import java.util.List;
-import javax.xml.bind.annotation.XmlRootElement;
-
import org.apache.syncope.common.AbstractBaseBean;
import org.apache.syncope.common.search.NodeCond;
import org.apache.syncope.common.types.IntMappingType;
import org.apache.syncope.common.types.TraceLevel;
-@XmlRootElement
public class NotificationTO extends AbstractBaseBean {
private static final long serialVersionUID = -6145117115632592612L;
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTaskTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTaskTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTaskTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/NotificationTaskTO.java
Thu Jan 24 15:52:51 2013
@@ -21,13 +21,20 @@ package org.apache.syncope.common.to;
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;
+
import org.apache.syncope.common.types.TraceLevel;
+@XmlRootElement(name = "notificationTask")
+@XmlType
public class NotificationTaskTO extends TaskTO {
private static final long serialVersionUID = 371671242591093846L;
- private Set<String> recipients;
+ private final Set<String> recipients = new HashSet<String>();
private String sender;
@@ -41,12 +48,8 @@ public class NotificationTaskTO extends
private TraceLevel traceLevel;
- public NotificationTaskTO() {
- super();
-
- recipients = new HashSet<String>();
- }
-
+ @XmlElementWrapper(name = "recipients")
+ @XmlElement(name = "recipient")
public Set<String> getRecipients() {
return recipients;
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationStatusTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationStatusTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationStatusTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationStatusTO.java
Thu Jan 24 15:52:51 2013
@@ -18,12 +18,17 @@
*/
package org.apache.syncope.common.to;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
import org.apache.syncope.common.AbstractBaseBean;
import org.apache.syncope.common.types.PropagationTaskExecStatus;
/**
* Single propagation status.
*/
+@XmlRootElement(name = "propagationStatus")
+@XmlType
public class PropagationStatusTO extends AbstractBaseBean {
/**
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationTaskTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationTaskTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationTaskTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/PropagationTaskTO.java
Thu Jan 24 15:52:51 2013
@@ -18,10 +18,15 @@
*/
package org.apache.syncope.common.to;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.common.types.PropagationMode;
import org.apache.syncope.common.types.ResourceOperation;
+@XmlRootElement(name = "propagationTask")
+@XmlType
public class PropagationTaskTO extends TaskTO {
private static final long serialVersionUID = 386450127003321197L;
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/RoleTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/RoleTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/RoleTO.java
(original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/RoleTO.java
Thu Jan 24 15:52:51 2013
@@ -20,8 +20,16 @@ package org.apache.syncope.common.to;
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.codehaus.jackson.annotate.JsonIgnoreProperties;
+@XmlRootElement(name = "role")
+@XmlType
@JsonIgnoreProperties({"displayName"})
public class RoleTO extends AbstractAttributableTO {
@@ -47,7 +55,7 @@ public class RoleTO extends AbstractAttr
private boolean inheritAccountPolicy;
- private List<String> entitlements;
+ private final List<String> entitlements;
private Long passwordPolicy;
@@ -130,6 +138,8 @@ public class RoleTO extends AbstractAttr
return entitlements.remove(entitlement);
}
+ @XmlElementWrapper(name = "entitlements")
+ @XmlElement(name = "entitlement")
public List<String> getEntitlements() {
return entitlements;
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchedTaskTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchedTaskTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchedTaskTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SchedTaskTO.java
Thu Jan 24 15:52:51 2013
@@ -20,6 +20,11 @@ package org.apache.syncope.common.to;
import java.util.Date;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "schedTask")
+@XmlType
public class SchedTaskTO extends TaskTO {
private static final long serialVersionUID = -5722284116974636425L;
Added:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncActionClassTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncActionClassTO.java?rev=1438055&view=auto
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncActionClassTO.java
(added)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncActionClassTO.java
Thu Jan 24 15:52:51 2013
@@ -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.to;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.syncope.common.AbstractBaseBean;
+
+@XmlRootElement(name = "syncActionClass")
+@XmlType
+public class SyncActionClassTO extends AbstractBaseBean {
+
+ private static final long serialVersionUID = -3379629287646343560L;
+
+ private String name;
+
+ public static SyncActionClassTO instance(final String name) {
+ SyncActionClassTO instance = new SyncActionClassTO();
+ instance.setName(name);
+ return instance;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncTaskTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncTaskTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncTaskTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/SyncTaskTO.java
Thu Jan 24 15:52:51 2013
@@ -18,6 +18,11 @@
*/
package org.apache.syncope.common.to;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "syncTask")
+@XmlType
public class SyncTaskTO extends SchedTaskTO {
private static final long serialVersionUID = -2143537546915809016L;
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskExecTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskExecTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskExecTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskExecTO.java
Thu Jan 24 15:52:51 2013
@@ -18,6 +18,11 @@
*/
package org.apache.syncope.common.to;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "taskExecution")
+@XmlType
public class TaskExecTO extends AbstractExecTO {
private static final long serialVersionUID = -5401795154606268973L;
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskTO.java
(original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/TaskTO.java
Thu Jan 24 15:52:51 2013
@@ -22,9 +22,16 @@ import java.util.ArrayList;
import java.util.Date;
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.AbstractBaseBean;
-public class TaskTO extends AbstractBaseBean {
+@XmlRootElement(name = "task")
+@XmlType
+public abstract class TaskTO extends AbstractBaseBean {
private static final long serialVersionUID = 386450127003321197L;
@@ -32,17 +39,11 @@ public class TaskTO extends AbstractBase
private String latestExecStatus;
- private List<TaskExecTO> executions;
-
- private Date startDate;
-
- private Date endDate;
+ private List<TaskExecTO> executions = new ArrayList<TaskExecTO>();
- public TaskTO() {
- super();
+ private Date startDate;
- executions = new ArrayList<TaskExecTO>();
- }
+ private Date endDate;
public long getId() {
return id;
@@ -68,6 +69,8 @@ public class TaskTO extends AbstractBase
return executions.remove(execution);
}
+ @XmlElementWrapper(name = "excecutions")
+ @XmlElement(name = "excecution")
public List<TaskExecTO> getExecutions() {
return executions;
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserRequestTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserRequestTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserRequestTO.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserRequestTO.java
Thu Jan 24 15:52:51 2013
@@ -18,10 +18,15 @@
*/
package org.apache.syncope.common.to;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
import org.apache.syncope.common.AbstractBaseBean;
import org.apache.syncope.common.mod.UserMod;
import org.apache.syncope.common.types.UserRequestType;
+@XmlRootElement(name = "userRequest")
+@XmlType
public class UserRequestTO extends AbstractBaseBean {
private static final long serialVersionUID = 1228351243795629329L;
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserTO.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserTO.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserTO.java
(original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/UserTO.java
Thu Jan 24 15:52:51 2013
@@ -25,10 +25,18 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.codehaus.jackson.annotate.JsonIgnore;
+@XmlRootElement(name = "user")
+@XmlType
public class UserTO extends AbstractAttributableTO {
private static final long serialVersionUID = 7791304495192615740L;
@@ -75,6 +83,8 @@ public class UserTO extends AbstractAttr
return memberships.remove(membershipTO);
}
+ @XmlElementWrapper(name = "memberships")
+ @XmlElement(name = "membership")
public List<MembershipTO> getMemberships() {
return memberships;
}
Added:
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/LoggerType.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/types/LoggerType.java?rev=1438055&view=auto
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/LoggerType.java
(added)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/LoggerType.java
Thu Jan 24 15:52:51 2013
@@ -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.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum LoggerType {
+
+ /**
+ * This type describes a common logger used to handle system and
application events.
+ */
+ NORMAL,
+
+ /**
+ * Audit logger only focus on security related events, usually logging how
did what and when.
+ * In case of a security incident audit loggers should allow an
administrator to recall all
+ * actions a certain user has done.
+ */
+ AUDIT;
+
+ public static LoggerType fromString(String value) {
+ return LoggerType.valueOf(value.toUpperCase());
+ }
+}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationMode.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationMode.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationMode.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationMode.java
Thu Jan 24 15:52:51 2013
@@ -18,6 +18,9 @@
*/
package org.apache.syncope.common.types;
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
public enum PropagationMode {
ONE_PHASE,
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationTaskExecStatus.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationTaskExecStatus.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationTaskExecStatus.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/PropagationTaskExecStatus.java
Thu Jan 24 15:52:51 2013
@@ -18,6 +18,8 @@
*/
package org.apache.syncope.common.types;
+import javax.xml.bind.annotation.XmlEnum;
+
/**
* Status of a TaskExecution.
*
@@ -28,6 +30,7 @@ package org.apache.syncope.common.types;
*
* @see TaskExecution
*/
+@XmlEnum
public enum PropagationTaskExecStatus {
CREATED,
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/ResourceOperation.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/types/ResourceOperation.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/ResourceOperation.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/ResourceOperation.java
Thu Jan 24 15:52:51 2013
@@ -18,6 +18,9 @@
*/
package org.apache.syncope.common.types;
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
public enum ResourceOperation {
CREATE,
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TaskType.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TaskType.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TaskType.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TaskType.java
Thu Jan 24 15:52:51 2013
@@ -18,6 +18,9 @@
*/
package org.apache.syncope.common.types;
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
public enum TaskType {
PROPAGATION("propagation"),
@@ -38,12 +41,12 @@ public enum TaskType {
public static TaskType fromString(String name) {
if (name != null) {
- for (TaskType t : TaskType.values()) {
- if (t.name.equalsIgnoreCase(name)) {
- return t;
+ for (TaskType t : TaskType.values()) {
+ if (t.name.equalsIgnoreCase(name)) {
+ return t;
+ }
}
- }
}
return null;
- }
+ }
}
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TraceLevel.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TraceLevel.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TraceLevel.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/TraceLevel.java
Thu Jan 24 15:52:51 2013
@@ -18,6 +18,9 @@
*/
package org.apache.syncope.common.types;
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
public enum TraceLevel {
/**
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/UserRequestType.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/types/UserRequestType.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/UserRequestType.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/types/UserRequestType.java
Thu Jan 24 15:52:51 2013
@@ -18,6 +18,9 @@
*/
package org.apache.syncope.common.types;
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
public enum UserRequestType {
CREATE,
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
(original)
+++
syncope/trunk/common/src/main/java/org/apache/syncope/common/util/CollectionWrapper.java
Thu Jan 24 15:52:51 2013
@@ -18,14 +18,20 @@
*/
package org.apache.syncope.common.util;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.syncope.common.to.EntitlementTO;
+import org.apache.syncope.common.to.JobClassTO;
+import org.apache.syncope.common.to.LoggerTO;
import org.apache.syncope.common.to.MailTemplateTO;
+import org.apache.syncope.common.to.SyncActionClassTO;
import org.apache.syncope.common.to.ValidatorTO;
+import org.apache.syncope.common.types.AuditLoggerName;
+import org.apache.syncope.common.types.SyncopeLoggerLevel;
import org.springframework.web.servlet.ModelAndView;
public final class CollectionWrapper {
@@ -108,4 +114,59 @@ public final class CollectionWrapper {
}
return respons;
}
+
+ public static List<LoggerTO> unwrapLogger(List<AuditLoggerName>
auditNames) {
+ List<LoggerTO> respons = new ArrayList<LoggerTO>();
+ for (AuditLoggerName l : auditNames) {
+ LoggerTO loggerTO = new LoggerTO();
+ loggerTO.setName(l.toLoggerName());
+ loggerTO.setLevel(SyncopeLoggerLevel.DEBUG);
+ respons.add(loggerTO);
+ }
+ return respons;
+ }
+
+ public static Set<JobClassTO> wrapJobClasses(Set<String> classes) {
+ Set<JobClassTO> respons = new HashSet<JobClassTO>();
+ for (String cl : classes) {
+ respons.add(JobClassTO.instance(cl));
+ }
+ return respons;
+ }
+
+ public static Set<SyncActionClassTO> wrapSyncActionClasses(Set<String>
classes) {
+ Set<SyncActionClassTO> respons = new HashSet<SyncActionClassTO>();
+ for (String cl : classes) {
+ respons.add(SyncActionClassTO.instance(cl));
+ }
+ return respons;
+ }
+
+ public static List<AuditLoggerName> wrapLogger(List<LoggerTO> logger) {
+ List<AuditLoggerName> respons = new ArrayList<AuditLoggerName>();
+ for (LoggerTO l : logger) {
+ try {
+ respons.add(AuditLoggerName.fromLoggerName(l.getName()));
+ } catch (Exception e) {
+ //TODO log event
+ }
+ }
+ return respons;
+ }
+
+ public static List<String> unwrapJobClasses(List<JobClassTO> jobClasses) {
+ List<String> respons = new ArrayList<String>();
+ for (JobClassTO e : jobClasses) {
+ respons.add(e.getName());
+ }
+ return respons;
+ }
+
+ public static List<String> unwrapSyncActionClasses(List<SyncActionClassTO>
actions) {
+ List<String> respons = new ArrayList<String>();
+ for (SyncActionClassTO e : actions) {
+ respons.add(e.getName());
+ }
+ return respons;
+ }
}
Modified:
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
URL:
http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java?rev=1438055&r1=1438054&r2=1438055&view=diff
==============================================================================
---
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
(original)
+++
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
Thu Jan 24 15:52:51 2013
@@ -21,8 +21,10 @@ package org.apache.syncope.core.rest;
import static org.junit.Assert.assertNotNull;
import java.net.URI;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import java.util.UUID;
import javax.sql.DataSource;
@@ -64,6 +66,7 @@ import org.apache.syncope.common.service
import org.apache.syncope.common.services.UserService;
import org.apache.syncope.common.services.WorkflowService;
import org.apache.syncope.common.to.AttributeTO;
+import org.apache.syncope.common.validation.SyncopeClientErrorHandler;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -71,6 +74,8 @@ import org.junit.runners.Parameterized.P
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.converter.HttpMessageConverter;
+import
org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestContextManager;
import org.springframework.web.client.RestTemplate;
@@ -91,14 +96,20 @@ public abstract class AbstractTest {
protected static final String ADMIN_PWD = "password";
protected boolean activatedCXF;
-
+
@Autowired
private RestTemplate restTemplate;
+ @Autowired
+ private MappingJacksonHttpMessageConverter
mappingJacksonHttpMessageConverter;
+
+ @Autowired
+ private PreemptiveAuthHttpRequestFactory httpClientFactory;
+
protected String contentType;
-
+
private TestContextManager testContextManager;
-
+
@Autowired
protected JAXRSClientFactoryBean restClientFactory;
@@ -132,11 +143,11 @@ public abstract class AbstractTest {
protected UserRequestService userRequestService;
protected PolicyService policyService;
-
+
public AbstractTest(final String contentType) {
this.contentType = contentType;
}
-
+
private void setupContext() throws Exception {
this.testContextManager = new TestContextManager(getClass());
this.testContextManager.prepareTestInstance(this);
@@ -145,17 +156,17 @@ public abstract class AbstractTest {
protected void activateCXF() {
activatedCXF = true;
}
-
+
@Before
public void setup() throws Exception {
setupContext();
if (!activatedCXF) {
- resetRestTemplate();
+ resetRestTemplate();
} else {
setupCXFServices();
}
}
-
+
// BEGIN Spring MVC Initialization
protected void setupRestTemplate(final String uid, final String pwd) {
PreemptiveAuthHttpRequestFactory requestFactory =
((PreemptiveAuthHttpRequestFactory) restTemplate
@@ -166,7 +177,12 @@ public abstract class AbstractTest {
}
protected RestTemplate anonymousRestTemplate() {
- return new RestTemplate();
+ RestTemplate template = new RestTemplate(httpClientFactory);
+ List<HttpMessageConverter<?>> converters = new
ArrayList<HttpMessageConverter<?>>();
+ converters.add(mappingJacksonHttpMessageConverter);
+ template.setMessageConverters(converters);
+ template.setErrorHandler(new SyncopeClientErrorHandler());
+ return template;
}
protected void resetRestTemplate() {
@@ -189,7 +205,7 @@ public abstract class AbstractTest {
// END Spring MVC Initialization
// BEGIN CXF Initialization
- public void setupCXFServices() throws Exception {
+ public void setupCXFServices() throws Exception {
setupContext();
restClientFactory.setUsername(ADMIN_UID);
userService = createServiceInstance(UserService.class);
@@ -215,7 +231,7 @@ public abstract class AbstractTest {
protected <T> T createServiceInstance(Class<T> serviceClass) {
return createServiceInstance(serviceClass, ADMIN_UID);
}
-
+
protected <T> T createServiceInstance(Class<T> serviceClass, String
username) {
return createServiceInstance(serviceClass, username, null);
}
@@ -249,7 +265,7 @@ public abstract class AbstractTest {
assertNotNull(location);
return restTemplate.getForEntity(location, type).getBody();
}
-
+
public static <T> T resolveObjectCXF(final URI location, final Class<T>
type, final Object serviceProxy) {
WebClient webClient =
WebClient.fromClient(WebClient.client(serviceProxy));
webClient.to(location.toString(), false);