You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by jb...@apache.org on 2013/01/30 15:16:17 UTC
svn commit: r1440427 - in /syncope/trunk:
client/src/main/java/org/apache/syncope/client/services/proxy/
common/src/main/java/org/apache/syncope/common/services/
console/src/main/java/org/apache/syncope/console/rest/
core/src/main/java/org/apache/synco...
Author: jbernhardt
Date: Wed Jan 30 14:16:17 2013
New Revision: 1440427
URL: http://svn.apache.org/viewvc?rev=1440427&view=rev
Log:
[SYNCOPE-231]
* adding JAVA DOC for LoggerService
* changing response type for update and delete NotificationService methods to void
* Code cleanup
Modified:
syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/services/LoggerService.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/services/NotificationService.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/NotificationRestClient.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java
Modified: syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java?rev=1440427&r1=1440426&r2=1440427&view=diff
==============================================================================
--- syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java (original)
+++ syncope/trunk/client/src/main/java/org/apache/syncope/client/services/proxy/NotificationServiceProxy.java Wed Jan 30 14:16:17 2013
@@ -44,8 +44,8 @@ public class NotificationServiceProxy ex
}
@Override
- public NotificationTO delete(final Long notificationId) {
- return getRestTemplate().getForObject(baseUrl + "notification/delete/{notificationId}.json",
+ public void delete(final Long notificationId) {
+ getRestTemplate().getForObject(baseUrl + "notification/delete/{notificationId}.json",
NotificationTO.class, notificationId);
}
@@ -62,8 +62,8 @@ public class NotificationServiceProxy ex
}
@Override
- public NotificationTO update(final Long notificationId, final NotificationTO notificationTO) {
- return getRestTemplate().postForObject(baseUrl + "notification/update.json", notificationTO,
+ public void update(final Long notificationId, final NotificationTO notificationTO) {
+ getRestTemplate().postForObject(baseUrl + "notification/update.json", notificationTO,
NotificationTO.class);
}
}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/LoggerService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/LoggerService.java?rev=1440427&r1=1440426&r2=1440427&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/LoggerService.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/LoggerService.java Wed Jan 30 14:16:17 2013
@@ -32,19 +32,37 @@ import org.apache.syncope.common.types.L
@Path("logger/{type}")
public interface LoggerService {
- @GET
+ /**
+ * @param type LoggerType to be selected.
+ * @param name Logger name to be deleted.
+ */
+ @DELETE
@Path("{name}")
- LoggerTO read(@PathParam("type") LoggerType type, @PathParam("name") final String name);
+ void delete(@PathParam("type") LoggerType type, @PathParam("name") String name);
+ /**
+ * @param type LoggerType to be selected.
+ * @return List of logger with matching type.
+ */
@GET
List<LoggerTO> list(@PathParam("type") LoggerType type);
+ /**
+ * @param type LoggerType to be selected.
+ * @param name Logger name to be read.
+ * @return Returns logger with matching type and name.
+ */
+ @GET
+ @Path("{name}")
+ LoggerTO read(@PathParam("type") LoggerType type, @PathParam("name") final String name);
+
+ /**
+ * @param type LoggerType to be selected.
+ * @param name Logger name to be updated.
+ * @param logger Logger to be created or updated.
+ */
@PUT
@Path("{name}/level")
void update(@PathParam("type") LoggerType type, @PathParam("name") String name, LoggerTO logger);
- @DELETE
- @Path("{name}")
- void delete(@PathParam("type") LoggerType type, @PathParam("name") String name);
-
}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/services/NotificationService.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/services/NotificationService.java?rev=1440427&r1=1440426&r2=1440427&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/services/NotificationService.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/services/NotificationService.java Wed Jan 30 14:16:17 2013
@@ -33,21 +33,40 @@ import org.apache.syncope.common.to.Noti
@Path("notifications")
public interface NotificationService {
+ /**
+ * @param notificationTO Creates a new notification.
+ * @return Response containing URI location for created resource.
+ */
@POST
Response create(NotificationTO notificationTO);
- @GET
+ /**
+ * @param notificationId ID for notification to be deleted.
+ */
+ @DELETE
@Path("{notificationId}")
- NotificationTO read(@PathParam("notificationId") Long notificationId) throws NotFoundException;
+ void delete(@PathParam("notificationId") Long notificationId);
+ /**
+ * @return Returns list of all notifications.
+ */
@GET
List<NotificationTO> list();
- @PUT
+ /**
+ * @param notificationId ID of notification to be read.
+ * @return Notification with matching id.
+ */
+ @GET
@Path("{notificationId}")
- NotificationTO update(@PathParam("notificationId") Long notificationId, NotificationTO notificationTO);
+ NotificationTO read(@PathParam("notificationId") Long notificationId);
- @DELETE
+ /**
+ * @param notificationId ID of notification to be updated.
+ * @param notificationTO Notification to be stored.
+ */
+ @PUT
@Path("{notificationId}")
- NotificationTO delete(@PathParam("notificationId") Long notificationId);
+ void update(@PathParam("notificationId") Long notificationId, NotificationTO notificationTO);
+
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/NotificationRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/NotificationRestClient.java?rev=1440427&r1=1440426&r2=1440427&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/NotificationRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/NotificationRestClient.java Wed Jan 30 14:16:17 2013
@@ -27,7 +27,6 @@ import org.apache.syncope.common.service
import org.apache.syncope.common.to.MailTemplateTO;
import org.apache.syncope.common.to.NotificationTO;
import org.apache.syncope.common.util.CollectionWrapper;
-import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException;
import org.springframework.stereotype.Component;
@Component
@@ -35,32 +34,32 @@ public class NotificationRestClient exte
private static final long serialVersionUID = 6328933265096511690L;
- public List<NotificationTO> getAllNotifications() throws SyncopeClientCompositeErrorException {
+ public List<NotificationTO> getAllNotifications() {
return getService(NotificationService.class).list();
}
- public NotificationTO readNotification(final Long id) throws SyncopeClientCompositeErrorException {
+ public NotificationTO readNotification(final Long id) {
return getService(NotificationService.class).read(id);
}
- public void createNotification(final NotificationTO notificationTO) throws SyncopeClientCompositeErrorException {
+ public void createNotification(final NotificationTO notificationTO) {
getService(NotificationService.class).create(notificationTO);
}
- public void updateNotification(final NotificationTO notificationTO) throws SyncopeClientCompositeErrorException {
+ public void updateNotification(final NotificationTO notificationTO) {
getService(NotificationService.class).update(notificationTO.getId(), notificationTO);
}
- public void deleteNotification(final Long id) throws SyncopeClientCompositeErrorException {
+ public void deleteNotification(final Long id) {
getService(NotificationService.class).delete(id);
}
- public List<String> getMailTemplates() throws SyncopeClientCompositeErrorException {
+ public List<String> getMailTemplates() {
return CollectionWrapper.unwrapMailTemplates(new ArrayList<MailTemplateTO>(getService(
ConfigurationService.class).getMailTemplates()));
}
- public List<String> getEvents() throws SyncopeClientCompositeErrorException {
+ public List<String> getEvents() {
return getService(WorkflowService.class).getDefinedTasks("user");
}
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java?rev=1440427&r1=1440426&r2=1440427&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java Wed Jan 30 14:16:17 2013
@@ -47,7 +47,6 @@ import org.apache.syncope.core.persisten
import org.apache.syncope.core.persistence.dao.ResourceDAO;
import org.apache.syncope.core.propagation.ConnectorFactory;
import org.apache.syncope.core.propagation.SyncopeConnector;
-import org.apache.syncope.core.propagation.impl.ConnectorFacadeProxy;
import org.apache.syncope.core.rest.data.ConnInstanceDataBinder;
import org.apache.syncope.core.util.ConnBundleManager;
import org.identityconnectors.common.l10n.CurrentLocale;
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java?rev=1440427&r1=1440426&r2=1440427&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/services/NotificationServiceImpl.java Wed Jan 30 14:16:17 2013
@@ -59,13 +59,13 @@ public class NotificationServiceImpl imp
}
@Override
- public NotificationTO update(final Long notificationId, final NotificationTO notificationTO) {
- return notificationController.update(notificationTO);
+ public void update(final Long notificationId, final NotificationTO notificationTO) {
+ notificationController.update(notificationTO);
}
@Override
- public NotificationTO delete(final Long notificationId) {
- return notificationController.delete(notificationId);
+ public void delete(final Long notificationId) {
+ notificationController.delete(notificationId);
}
@Override
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java?rev=1440427&r1=1440426&r2=1440427&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/NotificationTestITCase.java Wed Jan 30 14:16:17 2013
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEqu
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import java.util.List;
@@ -98,7 +99,8 @@ public class NotificationTestITCase exte
notificationTO.setRecipients(recipients);
- NotificationTO actual = notificationService.update(notificationTO.getId(), notificationTO);
+ notificationService.update(notificationTO.getId(), notificationTO);
+ NotificationTO actual = notificationService.read(notificationTO.getId());
assertNotNull(actual);
assertEquals(actual, notificationTO);
}
@@ -110,16 +112,14 @@ public class NotificationTestITCase exte
Response response = notificationService.create(notification);
notification = getObject(response, NotificationTO.class, notificationService);
- NotificationTO deletedNotification = notificationService.delete(notification.getId());
- assertNotNull(deletedNotification);
+ notificationService.delete(notification.getId());
- SyncopeClientException exception = null;
try {
notificationService.read(notification.getId());
+ fail();
} catch (SyncopeClientCompositeErrorException e) {
- exception = e.getException(SyncopeClientExceptionType.NotFound);
+ assertNotNull(e.getException(SyncopeClientExceptionType.NotFound));
}
- assertNotNull(exception);
}
@Test