You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by fm...@apache.org on 2013/11/05 09:22:32 UTC

svn commit: r1538902 [2/4] - in /syncope/branches/1_1_X: client/src/main/java/org/apache/syncope/client/services/proxy/ client/src/test/java/org/apache/syncope/client/test/ common/src/main/java/org/apache/syncope/common/services/ common/src/main/java/o...

Added: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java?rev=1538902&view=auto
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java (added)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java Tue Nov  5 08:22:31 2013
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed 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.console.pages.panels;
+
+import java.util.List;
+import java.util.Set;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.ResourceModel;
+
+public class SelectedEventsPanel extends Panel {
+
+    private static final long serialVersionUID = -4832450230348213500L;
+
+    private final WebMarkupContainer selectionContainer;
+
+    private ListView<String> selectedEvents;
+
+    private final IModel<List<String>> model;
+
+    public SelectedEventsPanel(final String id, final IModel<List<String>> model) {
+        super(id);
+
+        this.model = model;
+
+        selectionContainer = new WebMarkupContainer("selectionContainer");
+        selectionContainer.setOutputMarkupId(true);
+        add(selectionContainer);
+
+        selectedEvents = new ListView<String>("selectedEvents", model.getObject()) {
+
+            private static final long serialVersionUID = 4949588177564901031L;
+
+            @Override
+            protected void populateItem(final ListItem<String> item) {
+                item.add(new Label("selectedEvent", new ResourceModel(item.getModelObject(), item.getModelObject())));
+            }
+        };
+
+        selectionContainer.add(selectedEvents);
+    }
+
+    @Override
+    public void onEvent(final IEvent<?> event) {
+        if (event.getPayload() instanceof EventSelectionChanged) {
+            final EventSelectionChanged eventSelectionChanged = (EventSelectionChanged) event.getPayload();
+
+            for (String toBeRemoved : eventSelectionChanged.getToBeRemoved()) {
+                model.getObject().remove(toBeRemoved);
+            }
+
+            for (String toBeAdded : eventSelectionChanged.getToBeAdded()) {
+                if (!model.getObject().contains(toBeAdded)) {
+                    model.getObject().add(toBeAdded);
+                }
+            }
+
+            eventSelectionChanged.getTarget().add(selectionContainer);
+        }
+    }
+
+    public static class EventSelectionChanged {
+
+        private final AjaxRequestTarget target;
+
+        private final Set<String> toBeRemoved;
+
+        private final Set<String> toBeAdded;
+
+        public EventSelectionChanged(
+                final AjaxRequestTarget target,
+                final Set<String> toBeAdded,
+                final Set<String> toBeRemoved) {
+            this.target = target;
+            this.toBeAdded = toBeAdded;
+            this.toBeRemoved = toBeRemoved;
+        }
+
+        public AjaxRequestTarget getTarget() {
+            return target;
+        }
+
+        public Set<String> getToBeRemoved() {
+            return toBeRemoved;
+        }
+
+        public Set<String> getToBeAdded() {
+            return toBeAdded;
+        }
+    }
+}

Modified: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/LoggerRestClient.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/LoggerRestClient.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/LoggerRestClient.java (original)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/rest/LoggerRestClient.java Tue Nov  5 08:22:31 2013
@@ -18,16 +18,16 @@
  */
 package org.apache.syncope.console.rest;
 
-import java.util.EnumMap;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.syncope.common.services.LoggerService;
+import org.apache.syncope.common.to.EventCategoryTO;
 import org.apache.syncope.common.to.LoggerTO;
-import org.apache.syncope.common.types.AuditElements;
-import org.apache.syncope.common.types.AuditElements.Category;
 import org.apache.syncope.common.types.AuditLoggerName;
 import org.apache.syncope.common.types.LoggerType;
 import org.apache.syncope.common.types.SyncopeLoggerLevel;
@@ -44,13 +44,11 @@ public class LoggerRestClient extends Ba
     }
 
     public List<AuditLoggerName> listAudits() {
-        List<LoggerTO> logger =  getService(LoggerService.class).list(LoggerType.AUDIT);
-
-        return CollectionWrapper.wrapLogger(logger);
+        return CollectionWrapper.wrapLogger(getService(LoggerService.class).list(LoggerType.AUDIT));
     }
 
-    public Map<AuditElements.Category, Set<AuditLoggerName>> listAuditsByCategory() {
-        Map<Category, Set<AuditLoggerName>> result = new EnumMap<Category, Set<AuditLoggerName>>(Category.class);
+    public Map<String, Set<AuditLoggerName>> listAuditsByCategory() {
+        Map<String, Set<AuditLoggerName>> result = new HashMap<String, Set<AuditLoggerName>>();
         for (AuditLoggerName auditLoggerName : listAudits()) {
             if (!result.containsKey(auditLoggerName.getCategory())) {
                 result.put(auditLoggerName.getCategory(), new HashSet<AuditLoggerName>());
@@ -84,4 +82,12 @@ public class LoggerRestClient extends Ba
     public void disableAudit(final AuditLoggerName auditLoggerName) {
         getService(LoggerService.class).delete(LoggerType.AUDIT, auditLoggerName.toLoggerName());
     }
+
+    public List<EventCategoryTO> listEvents() {
+        try {
+            return getService(LoggerService.class).events();
+        } catch (Exception e) {
+            return Collections.<EventCategoryTO>emptyList();
+        }
+    }
 }

Copied: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.java (from r1538202, syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.java)
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.java?p2=syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.java&p1=syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.java&r1=1538202&r2=1538902&rev=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.java (original)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.java Tue Nov  5 08:22:31 2013
@@ -18,20 +18,30 @@
  */
 package org.apache.syncope.console.wicket.extensions.markup.html.repeater.data.table;
 
-import org.apache.wicket.markup.html.form.Check;
-import org.apache.wicket.markup.html.form.CheckGroup;
+import java.util.List;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.ResourceModel;
 
-public class CheckBoxPanel<T> extends Panel {
+public class CollectionPanel extends Panel {
 
-    private static final long serialVersionUID = 4062106303929176865L;
+    private static final long serialVersionUID = -4042497356836230377L;
 
-    private final Check<T> check;
+    @SuppressWarnings("unchecked")
+    public CollectionPanel(final String id, final List values) {
+        super(id);
 
-    public CheckBoxPanel(final String componentId, final IModel<T> model, final CheckGroup<T> checkGroup) {
-        super(componentId, model);
-        this.check = new Check<T>("check", model, checkGroup);
-        add(this.check);
+        add(new ListView("collection", values) {
+
+            private static final long serialVersionUID = 4949588177564901031L;
+
+            @Override
+            protected void populateItem(final ListItem item) {
+                final String value = item.getModelObject() == null ? null : item.getModelObject().toString();
+                item.add(new Label("item", new ResourceModel(value, value)));
+            }
+        });
     }
 }

Copied: syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPropertyColumn.java (from r1538202, syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/TokenColumn.java)
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPropertyColumn.java?p2=syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPropertyColumn.java&p1=syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/TokenColumn.java&r1=1538202&r2=1538902&rev=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/TokenColumn.java (original)
+++ syncope/branches/1_1_X/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPropertyColumn.java Tue Nov  5 08:22:31 2013
@@ -18,34 +18,37 @@
  */
 package org.apache.syncope.console.wicket.extensions.markup.html.repeater.data.table;
 
-import org.apache.syncope.common.to.AbstractAttributableTO;
-import org.apache.syncope.common.to.UserTO;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
 import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
-import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
 import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.ResourceModel;
-import org.springframework.util.StringUtils;
 
-public class TokenColumn extends AbstractColumn<AbstractAttributableTO, String> {
+public class CollectionPropertyColumn<T> extends PropertyColumn<T, String> {
 
     private static final long serialVersionUID = 8077865338230121496L;
 
-    public TokenColumn(final String name) {
-        super(new ResourceModel(name, name), name);
+    public CollectionPropertyColumn(
+            final IModel<String> displayModel,
+            final String sortProperty,
+            final String propertyExpression) {
+        super(displayModel, sortProperty, propertyExpression);
     }
 
     @Override
-    public void populateItem(final Item<ICellPopulator<AbstractAttributableTO>> cellItem, final String componentId,
-            final IModel<AbstractAttributableTO> rowModel) {
-
-        if (rowModel.getObject() instanceof UserTO) {
-            if (StringUtils.hasText(((UserTO) rowModel.getObject()).getToken())) {
-                cellItem.add(new Label(componentId, new ResourceModel("tokenValued", "tokenValued")));
-            } else {
-                cellItem.add(new Label(componentId, new ResourceModel("tokenNotValued", "tokenNotValued")));
-            }
+    @SuppressWarnings("unchecked")
+    public void populateItem(
+            final Item<ICellPopulator<T>> cellItem, final String componentId, final IModel<T> rowModel) {
+
+        final Object value = getDataModel(rowModel).getObject();
+
+        if (value instanceof Collection) {
+            final List values = new ArrayList((Collection) value);
+            Collections.sort(values);
+            cellItem.add(new CollectionPanel(componentId, values));
         }
     }
 }
\ No newline at end of file

Modified: syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html (original)
+++ syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/NotificationModalPage.html Tue Nov  5 08:22:31 2013
@@ -17,6 +17,14 @@ specific language governing permissions 
 under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+  <wicket:head>
+    <style>
+      div#tabs div#events{
+        min-width: 970px;
+        overflow: hidden;
+      }
+    </style>
+  </wicket:head>
   <wicket:extend>
     <div style="margin:10px">
       <p class="ui-widget ui-corner-all ui-widget-header"><wicket:message key="title"/></p>
@@ -89,20 +97,20 @@ under the License.
 
           <div id="about">
             <span wicket:id="aboutContainer">
-           	<div class="tablerow" style="width: auto;">
-           	  <div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
-           	    <span wicket:id="checkAbout">[checkAbout]</span>
-           	  </div>
-           	  <div class="tablecolumn_label" style="width: auto;">
-           	    <label for="checkAbout"><wicket:message key="checkAbout"/></label>
-           	  </div>
-           	</div>
-               <span wicket:id="about"/>
-             </span>
+              <div class="tablerow" style="width: auto;">
+                <div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
+                  <span wicket:id="checkAbout">[checkAbout]</span>
+                </div>
+                <div class="tablecolumn_label" style="width: auto;">
+                  <label for="checkAbout"><wicket:message key="checkAbout"/></label>
+                </div>
+              </div>
+              <span wicket:id="about"/>
+            </span>
           </div>  
 
           <div id="events">
-            <span wicket:id="events"/>
+            <span wicket:id="eventSelection"/>
           </div>
 
           <div id="recipients">
@@ -115,11 +123,11 @@ under the License.
               </div>
             </div>
             <span wicket:id="recipientsContainer">
-           	<div class="tablerow" style="width: auto;">
-           	  <div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
+              <div class="tablerow" style="width: auto;">
+                <div class="tablecolumn_field" style="width: auto; padding-right: 5px;">
                   <span wicket:id="checkRecipients">[checkRecipients]</span>
                 </div>
-           	  <div class="tablecolumn_label" style="width: auto;">
+                <div class="tablecolumn_label" style="width: auto;">
                   <label for="checkRecipients"><wicket:message key="checkRecipients"/></label>
                 </div>
               </div>

Modified: syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports.html
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports.html?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports.html (original)
+++ syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports.html Tue Nov  5 08:22:31 2013
@@ -48,7 +48,7 @@ under the License.
       <div id="tabs-2">
         <span wicket:id="auditContainer">
           <form wicket:id="auditForm">
-            <div wicket:id="categoriesTabs"/>
+            <span wicket:id="events">[event builder]</span>
           </form>
         </span>
       </div>

Copied: syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/AuditEventsPanel.html (from r1536731, syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports$AuditCategoryPanel.html)
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/AuditEventsPanel.html?p2=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/AuditEventsPanel.html&p1=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports%24AuditCategoryPanel.html&r1=1536731&r2=1538902&rev=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports$AuditCategoryPanel.html (original)
+++ syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/AuditEventsPanel.html Tue Nov  5 08:22:31 2013
@@ -70,7 +70,9 @@ under the License.
         </div>
         <div style="display: table-cell">
           <div class="divtableheadercell">
-            <div class="divtableheaderlabel">Success</div>
+            <div class="divtableheaderlabel">
+              <label wicket:id="successLabel"/>
+            </div>
             <div style="display: table-cell">
               <input type="checkbox" wicket:id="successSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
             </div>
@@ -78,7 +80,9 @@ under the License.
         </div>
         <div style="display: table-cell">
           <div class="divtableheadercell">
-            <div class="divtableheaderlabel">Failure</div>
+            <div class="divtableheaderlabel">
+              <label wicket:id="failureLabel"/>
+            </div>
             <div style="display: table-cell">
               <input type="checkbox" wicket:id="failureSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
             </div>

Copied: syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/EventSelectionPanel.html (from r1536731, syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports$AuditCategoryPanel.html)
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/EventSelectionPanel.html?p2=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/EventSelectionPanel.html&p1=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports%24AuditCategoryPanel.html&r1=1536731&r2=1538902&rev=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports$AuditCategoryPanel.html (original)
+++ syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/EventSelectionPanel.html Tue Nov  5 08:22:31 2013
@@ -60,58 +60,65 @@ under the License.
         width: 105px;
         height: 20px;
       }
+
     </style>
   </wicket:head>
   <wicket:panel>
-    <div class="container">
-      <div style="display:inline-table;">
-        <div class="label">
-          &nbsp;
-        </div>
-        <div style="display: table-cell">
-          <div class="divtableheadercell">
-            <div class="divtableheaderlabel">Success</div>
-            <div style="display: table-cell">
-              <input type="checkbox" wicket:id="successSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
+    <div class="eventSelectionWidzard">
+      <div class="container">
+        <div style="display:inline-table;">
+          <div class="label">
+            &nbsp;
+          </div>
+          <div style="display: table-cell">
+            <div class="divtableheadercell">
+              <div class="divtableheaderlabel">
+                <label wicket:id="successLabel"/>
+              </div>
+              <div style="display: table-cell">
+                <input type="checkbox" wicket:id="successSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
+              </div>
             </div>
           </div>
-        </div>
-        <div style="display: table-cell">
-          <div class="divtableheadercell">
-            <div class="divtableheaderlabel">Failure</div>
-            <div style="display: table-cell">
-              <input type="checkbox" wicket:id="failureSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
+          <div style="display: table-cell">
+            <div class="divtableheadercell">
+              <div class="divtableheaderlabel">
+                <label wicket:id="failureLabel"/>
+              </div>
+              <div style="display: table-cell">
+                <input type="checkbox" wicket:id="failureSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
+              </div>
             </div>
           </div>
         </div>
       </div>
-    </div>
 
-    <div class="container">
-      <div class="label">
-        <div id="divtablerow-label" wicket:id="categoryView">
-          <div class="label">
-            <span wicket:id="subcategory">[subcategory]</span>
+      <div class="container">
+        <div class="label">
+          <div id="divtablerow-label" wicket:id="categoryView">
+            <div class="label">
+              <span wicket:id="subcategory">[subcategory]</span>
+            </div>
           </div>
         </div>
-      </div>
 
-      <div id="divtablerow-success" class="divtablecheckcolumn">
-        <span wicket:id="successGroup">
-          <div wicket:id="successView" class="divtablecheck">
-            <div class="divtableheaderlabel">&nbsp;</div>
-            <input type="checkbox" wicket:id="successCheck"/>
-          </div>
-        </span>
-      </div>
+        <div id="divtablerow-success" class="divtablecheckcolumn">
+          <span wicket:id="successGroup">
+            <div wicket:id="successView" class="divtablecheck">
+              <div class="divtableheaderlabel">&nbsp;</div>
+              <input type="checkbox" wicket:id="successCheck"/>
+            </div>
+          </span>
+        </div>
 
-      <div id="divtablerow-failure" class="divtablecheckcolumn">
-        <span wicket:id="failureGroup">
-          <div wicket:id="failureView" class="divtablecheck">
-            <div class="divtableheaderlabel">&nbsp;</div>
-            <input type="checkbox" wicket:id="failureCheck"/>
-          </div>
-        </span>
+        <div id="divtablerow-failure" class="divtablecheckcolumn">
+          <span wicket:id="failureGroup">
+            <div wicket:id="failureView" class="divtablecheck">
+              <div class="divtableheaderlabel">&nbsp;</div>
+              <input type="checkbox" wicket:id="failureCheck"/>
+            </div>
+          </span>
+        </div>
       </div>
     </div>
   </wicket:panel>

Copied: syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/LoggerCategoryPanel.html (from r1536731, syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/AbstractSearchPanel.html)
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/LoggerCategoryPanel.html?p2=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/LoggerCategoryPanel.html&p1=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/AbstractSearchPanel.html&r1=1536731&r2=1538902&rev=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/AbstractSearchPanel.html (original)
+++ syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/LoggerCategoryPanel.html Tue Nov  5 08:22:31 2013
@@ -17,62 +17,84 @@ specific language governing permissions 
 under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+  <wicket:head>
+    <style>
+
+      .events{
+        display: table-row;
+        width: 990px;
+      }
+
+      .selectedEvents{
+        border: 1px solid #DDDDDD;
+        display: inline-block;
+        height: 100px;
+        margin: 10px 10px 0 10px;
+        min-width: 585px;
+        width: 585px;
+        overflow-y: auto;
+      }
+
+      .eventSelection{
+        display: inline-table;
+        float: right;
+        width: 380px;
+        min-width: 380px;
+      }
+
+      .eventSelection div#eventElement{
+        display: table-row;
+        width:100%;
+      }
+      .eventSelection div#eventElement div#label{
+        display: table-cell;
+      }
+
+      .eventSelection div#eventElement div#value{
+        display: table-cell;
+        padding: 0 0 0 10px;
+      }
+    </style>
+  </wicket:head>
   <wicket:panel>
-    <div id="searchBox">
-      <div wicket:id="searchFeedback"></div>
-      <table border="0">
-        <thead>
-          <tr>
-            <th></th>
-            <th><wicket:message key="search_not_value"/></th>
-            <th><wicket:message key="search_filter_type"/></th>
-            <th><wicket:message key="search_filter_name"/></th>
-            <th><wicket:message key="search_type_cond"/></th>
-            <th><wicket:message key="search_filter_value"/></th>
-            <th></th>
-            <th></th>
-            <th></th>
-          </tr>
-        </thead>
-        <tbody wicket:id="searchFormContainer">
-          <tr wicket:id="searchView">
-            <td>
-              <b><span wicket:id="operationType"/></b>
-            </td>
-            <td>
-              <input type="checkbox" wicket:id="notOperator"/>
-            </td>
-            <td>
-              <select class="text ui-widget-content ui-corner-all"
-                      wicket:id="filterType"/>
-            </td>
-            <td>
-              <select class="text ui-widget-content ui-corner-all"
-                      wicket:id="filterName"/>
-            </td>
-            <td>
-              <select class="text ui-widget-content ui-corner-all"
-                      wicket:id="type"/>
-            </td>
-            <td>
-              <input type="text" class="text ui-widget-content ui-corner-all"
-                     wicket:id="filterValue"/>
-            </td>
-            <td>
-              <input type="button" class="text ui-widget-content ui-corner-all"
-                     wicket:id="addAndButton"/>
-            </td>
-            <td>
-              <input type="submit" class="text ui-widget-content ui-corner-all"
-                     wicket:id="addOrButton"/>
-            </td>        
-            <td>
-              <input type="button" class="text ui-widget-content ui-corner-all"
-                     wicket:id="dropButton"/>
-            </td>
-          </tr>
-        </tbody>
-      </table>
+
+    <div class="events">
+      <div class="selectedEvents">
+        <span wicket:id="selectedEventsPanel">[selected events panel]</span>
+      </div>
+
+      <div class="eventSelection">
+        <div wicket:id="categoryContainer" style="display: block; margin: 10px 0px 20px 0px">
+          <div id="eventElement">
+            <div id="label">
+              <label wicket:id="typeLabel"/>
+            </div>
+            <div id="value">
+              <span wicket:id="type">[type]</span>
+            </div>
+          </div>
+          <div id="eventElement">
+            <div id="label">
+              <label wicket:id="categoryLabel"/>
+            </div>
+            <div id="value">
+              <span wicket:id="category">[category]</span>
+            </div>
+          </div>
+          <div id="eventElement">
+            <div id="label">
+              <label wicket:id="subcategoryLabel"/>
+            </div>
+            <div id="value">
+              <span wicket:id="subcategory">[sub-category]</span>
+            </div>
+          </div>
+        </div>
+        <div wicket:id="eventsContainer" style="display: block">
+          <span wicket:id="eventsPanel">[events panel]</span>
+        </div>
+      </div>
     </div>
+
   </wicket:panel>
 </html>

Copied: syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/SelectedEventsPanel.html (from r1536731, syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports$AuditCategoryPanel.html)
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/SelectedEventsPanel.html?p2=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/SelectedEventsPanel.html&p1=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports%24AuditCategoryPanel.html&r1=1536731&r2=1538902&rev=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/Reports$AuditCategoryPanel.html (original)
+++ syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/pages/panels/SelectedEventsPanel.html Tue Nov  5 08:22:31 2013
@@ -19,99 +19,13 @@ under the License.
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
   <wicket:head>
     <style>
-      .container {
-        display: block;
-        width: 100%;
-      }
 
-      .label {
-        font-size: 12px;
-        vertical-align: middle;
-        font-family: Verdana,Tahoma,sans-serif;
-        display: table-cell;
-        width: 300px;
-        height: 20px;
-      }
-
-      .divtableheaderlabel {
-        font-weight: bold;
-        float: left;
-        margin-left: 5px;
-        display: table-cell;
-        width: 70px;
-      }
-
-      .divtableheadercell {
-        display: inline-table;
-        vertical-align: top;
-        text-align: right;
-        width: 105px;
-        height: 20px;
-      }
-
-      .divtablecheckcolumn {
-        display: table-cell;
-        vertical-align: top;
-        text-align: right;
-        width: 105px;
-      }
-
-      .divtablecheck {
-        width: 105px;
-        height: 20px;
-      }
     </style>
   </wicket:head>
   <wicket:panel>
-    <div class="container">
-      <div style="display:inline-table;">
-        <div class="label">
-          &nbsp;
-        </div>
-        <div style="display: table-cell">
-          <div class="divtableheadercell">
-            <div class="divtableheaderlabel">Success</div>
-            <div style="display: table-cell">
-              <input type="checkbox" wicket:id="successSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
-            </div>
-          </div>
-        </div>
-        <div style="display: table-cell">
-          <div class="divtableheadercell">
-            <div class="divtableheaderlabel">Failure</div>
-            <div style="display: table-cell">
-              <input type="checkbox" wicket:id="failureSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
-            </div>
-          </div>
-        </div>
-      </div>
-    </div>
-
-    <div class="container">
-      <div class="label">
-        <div id="divtablerow-label" wicket:id="categoryView">
-          <div class="label">
-            <span wicket:id="subcategory">[subcategory]</span>
-          </div>
-        </div>
-      </div>
-
-      <div id="divtablerow-success" class="divtablecheckcolumn">
-        <span wicket:id="successGroup">
-          <div wicket:id="successView" class="divtablecheck">
-            <div class="divtableheaderlabel">&nbsp;</div>
-            <input type="checkbox" wicket:id="successCheck"/>
-          </div>
-        </span>
-      </div>
-
-      <div id="divtablerow-failure" class="divtablecheckcolumn">
-        <span wicket:id="failureGroup">
-          <div wicket:id="failureView" class="divtablecheck">
-            <div class="divtableheaderlabel">&nbsp;</div>
-            <input type="checkbox" wicket:id="failureCheck"/>
-          </div>
-        </span>
+    <div wicket:id="selectionContainer">
+      <div wicket:id="selectedEvents">
+        <label wicket:id="selectedEvent"/>
       </div>
     </div>
   </wicket:panel>

Copied: syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.html (from r1538202, syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.html)
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.html?p2=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.html&p1=syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.html&r1=1538202&r2=1538902&rev=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CheckBoxPanel.html (original)
+++ syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/CollectionPanel.html Tue Nov  5 08:22:31 2013
@@ -18,6 +18,8 @@ under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
   <wicket:panel>
-    <input wicket:id="check" type="checkbox"/>
+    <div id="collection" wicket:id="collection">
+      <span id="item" wicket:id="item"/>
+    </div>
   </wicket:panel>
 </html>

Modified: syncope/branches/1_1_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java (original)
+++ syncope/branches/1_1_X/console/src/test/java/org/apache/syncope/console/ConfigurationTestITCase.java Tue Nov  5 08:22:31 2013
@@ -18,7 +18,6 @@
  */
 package org.apache.syncope.console;
 
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class ConfigurationTestITCase extends AbstractTest {
@@ -156,10 +155,39 @@ public class ConfigurationTestITCase ext
 
         selenium.click("//div[2]/form/div[3]/ul/li[3]/a/span");
 
-        selenium.click("//div[2]/form/div[3]/div[3]/span/span/div/div[2]/div/select/option");
-
-        selenium.click("//div[2]/form/div[3]/div[3]/span/span/div/div[2]/div[2]/div/a");
-
+        selenium.waitForCondition("selenium.isElementPresent(\""
+                + "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']"
+                + "/option[text()='PROPAGATION']\");",
+                "30000");
+        
+        selenium.select(
+                "//select[@name='eventSelection:categoryContainer:type:dropDownChoiceField']",
+                "label=PROPAGATION");
+
+        selenium.waitForCondition("selenium.isElementPresent(\""
+                + "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']"
+                + "/option[text()='role']\");",
+                "30000");
+
+        selenium.select(
+                "//select[@name='eventSelection:categoryContainer:category:dropDownChoiceField']",
+                "label=role");
+
+        selenium.waitForCondition("selenium.isElementPresent(\""
+                + "//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']"
+                + "/option[text()='resource-db-sync']\");",
+                "30000");
+
+        selenium.select(
+                "//select[@name='eventSelection:categoryContainer:subcategory:dropDownChoiceField']",
+                "label=resource-db-sync");
+
+        selenium.waitForCondition(
+                "selenium.isElementPresent(\"//input[@name='eventSelection:eventsContainer:eventsPanel:failureGroup']\");",
+                "30000");
+        
+        selenium.click("//div[@class='eventSelectionWidzard']/div[2]/div[3]/span/div/input");
+        
         selenium.click("//div[2]/form/div[3]/ul/li[4]/a/span");
 
         selenium.waitForCondition("selenium.isElementPresent("

Modified: syncope/branches/1_1_X/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java (original)
+++ syncope/branches/1_1_X/console/src/test/java/org/apache/syncope/console/ReportTestITCase.java Tue Nov  5 08:22:31 2013
@@ -65,18 +65,32 @@ public class ReportTestITCase extends Ab
         selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
 
         selenium.click("//div[@id='tabs']/ul/li[2]/a/span");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[2]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[3]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[4]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[5]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[6]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[7]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[8]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[9]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[10]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[11]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[12]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[13]/a");
-        selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[14]/a");
+        selenium.waitForCondition(
+                "selenium.isTextPresent(\"[REST]:[AuthenticationController]:[]:[getEntitlements]:[SUCCESS]\");",
+                "30000");
+
+        selenium.select(
+                "//select[@name='events:categoryContainer:type:dropDownChoiceField']",
+                "label=PROPAGATION");
+
+        selenium.waitForCondition("selenium.isElementPresent(\""
+                + "//select[@name='events:categoryContainer:category:dropDownChoiceField']/option[text()='user']\");",
+                "30000");
+
+        selenium.select(
+                "//select[@name='events:categoryContainer:category:dropDownChoiceField']",
+                "label=user");
+
+        selenium.waitForCondition("selenium.isElementPresent(\""
+                + "//select[@name='events:categoryContainer:subcategory:dropDownChoiceField']/option[text()='resource-csv']\");",
+                "30000");
+
+        selenium.select(
+                "//select[@name='events:categoryContainer:subcategory:dropDownChoiceField']",
+                "label=resource-csv");
+
+        selenium.waitForCondition(
+                "selenium.isElementPresent(\"//input[@name='events:eventsContainer:eventsPanel:successGroup']\");",
+                "30000");
     }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/audit/AuditManager.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/audit/AuditManager.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/audit/AuditManager.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/audit/AuditManager.java Tue Nov  5 08:22:31 2013
@@ -18,7 +18,8 @@
  */
 package org.apache.syncope.core.audit;
 
-import org.apache.syncope.common.types.AuditElements.Category;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.types.AuditElements;
 import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.AuditLoggerName;
 import org.slf4j.Logger;
@@ -33,16 +34,45 @@ public class AuditManager {
      */
     private static final Logger LOG = LoggerFactory.getLogger(AuditManager.class);
 
-    public void audit(final Category category, final Enum<?> subcategory, final Result result, final String message) {
-        audit(category, subcategory, result, message, null);
-    }
+    public void audit(
+            final AuditElements.EventCategoryType type,
+            final String category,
+            final String subcategory,
+            final String event,
+            final Result result,
+            final Object before,
+            final Object output,
+            final Object... input) {
+
+        final Throwable throwable;
+        final StringBuilder message = new StringBuilder();
+
+        message.append("BEFORE:\n");
+        message.append("\t").append(before == null ? "unknown" : before).append("\n");
+
+        message.append("INPUT:\n");
+
+        if (ArrayUtils.isNotEmpty(input)) {
+            for (Object obj : input) {
+                message.append("\t").append(obj == null ? null : obj.toString()).append("\n");
+            }
+        } else {
+            message.append("\t").append("none").append("\n");
+        }
 
-    public void audit(final Category category, final Enum<?> subcategory, final Result result, final String message,
-            final Throwable throwable) {
+        message.append("OUTPUT:\n");
+
+        if (output instanceof Throwable) {
+            throwable = (Throwable) output;
+            message.append("\t").append(throwable.getMessage());
+        } else {
+            throwable = null;
+            message.append("\t").append(output == null ? "none" : output.toString());
+        }
 
         AuditLoggerName auditLoggerName = null;
         try {
-            auditLoggerName = new AuditLoggerName(category, subcategory, result);
+            auditLoggerName = new AuditLoggerName(type, category, subcategory, event, result);
         } catch (IllegalArgumentException e) {
             LOG.error("Invalid audit parameters, aborting...", e);
         }
@@ -56,7 +86,7 @@ public class AuditManager {
             }
             auditMessage.append(message);
 
-            Logger logger = LoggerFactory.getLogger(auditLoggerName.toLoggerName());
+            final Logger logger = LoggerFactory.getLogger(auditLoggerName.toLoggerName());
             if (throwable == null) {
                 logger.debug(auditMessage.toString());
             } else {

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationJob.java Tue Nov  5 08:22:31 2013
@@ -24,8 +24,7 @@ import java.util.Date;
 import javax.mail.internet.MimeMessage;
 import org.apache.commons.lang.StringUtils;
 import org.apache.syncope.common.SyncopeConstants;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.NotificationSubCategory;
+import org.apache.syncope.common.types.AuditElements;
 import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.TraceLevel;
 import org.apache.syncope.core.audit.AuditManager;
@@ -199,7 +198,15 @@ public class NotificationJob implements 
                         execution.setMessage(report.toString());
                     }
 
-                    auditManager.audit(Category.notification, NotificationSubCategory.send, Result.success,
+                    auditManager.audit(
+                            AuditElements.EventCategoryType.TASK,
+                            "notification",
+                            null,
+                            "send",
+                            Result.SUCCESS,
+                            null,
+                            null,
+                            task,
                             "Successfully sent notification to " + to);
                 } catch (Exception e) {
                     LOG.error("Could not send e-mail", e);
@@ -213,7 +220,15 @@ public class NotificationJob implements 
                         execution.setMessage(exceptionWriter.toString());
                     }
 
-                    auditManager.audit(Category.notification, NotificationSubCategory.send, Result.failure,
+                    auditManager.audit(
+                            AuditElements.EventCategoryType.TASK,
+                            "notification",
+                            null,
+                            "send",
+                            Result.FAILURE,
+                            null,
+                            null,
+                            task,
                             "Could not send notification to " + to, e);
                 }
 
@@ -271,12 +286,28 @@ public class NotificationJob implements 
                     execution.getTask(), failedExecutionsCount, maxRetries);
             notificationManager.setTaskExecuted(execution.getTask().getId(), false);
 
-            auditManager.audit(Category.notification, NotificationSubCategory.retry, Result.success,
+            auditManager.audit(
+                    AuditElements.EventCategoryType.TASK,
+                    "notification",
+                    null,
+                    "retry",
+                    Result.SUCCESS,
+                    null,
+                    null,
+                    execution,
                     "Notification task " + execution.getTask().getId() + " will be retried");
         } else {
             LOG.error("Maximum number of retries reached for task {} - giving up", execution.getTask());
 
-            auditManager.audit(Category.notification, NotificationSubCategory.retry, Result.failure,
+            auditManager.audit(
+                    AuditElements.EventCategoryType.TASK,
+                    "notification",
+                    null,
+                    "retry",
+                    Result.FAILURE,
+                    null,
+                    null,
+                    execution,
                     "Giving up retries on notification task " + execution.getTask().getId());
         }
     }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/notification/NotificationManager.java Tue Nov  5 08:22:31 2013
@@ -19,16 +19,22 @@
 package org.apache.syncope.core.notification;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import org.apache.syncope.common.SyncopeConstants;
+import org.apache.syncope.common.to.RoleTO;
 import org.apache.syncope.common.to.UserTO;
 import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.AuditElements;
+import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.IntMappingType;
+import org.apache.syncope.common.util.LoggerEventUtils;
 import org.apache.syncope.core.connid.ConnObjectUtil;
+import org.apache.syncope.core.persistence.beans.AbstractAttributable;
 import org.apache.syncope.core.persistence.beans.Notification;
 import org.apache.syncope.core.persistence.beans.NotificationTask;
 import org.apache.syncope.core.persistence.beans.SyncopeConf;
@@ -42,8 +48,11 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.dao.EntitlementDAO;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
 import org.apache.syncope.core.persistence.dao.NotificationDAO;
+import org.apache.syncope.core.persistence.dao.RoleDAO;
 import org.apache.syncope.core.persistence.dao.TaskDAO;
 import org.apache.syncope.core.persistence.dao.UserDAO;
+import org.apache.syncope.core.rest.controller.RoleController;
+import org.apache.syncope.core.rest.controller.UserController;
 import org.apache.syncope.core.rest.data.UserDataBinder;
 import org.apache.syncope.core.util.AttributableUtil;
 import org.apache.syncope.core.util.EntitlementUtil;
@@ -87,6 +96,12 @@ public class NotificationManager {
     private UserDAO userDAO;
 
     /**
+     * Role DAO.
+     */
+    @Autowired
+    private RoleDAO roleDAO;
+
+    /**
      * User data binder.
      */
     @Autowired
@@ -120,11 +135,16 @@ public class NotificationManager {
      * Create a notification task.
      *
      * @param notification notification to take as model
-     * @param user the user this task is about
+     * @param attributable the user this task is about
      * @return notification task, fully populated
      */
-    private NotificationTask getNotificationTask(final Notification notification, final SyncopeUser user) {
-        connObjectUtil.retrieveVirAttrValues(user, AttributableUtil.getInstance(AttributableType.USER));
+    private NotificationTask getNotificationTask(
+            final Notification notification,
+            final AbstractAttributable attributable,
+            final Map<String, Object> model) {
+        if (attributable != null) {
+            connObjectUtil.retrieveVirAttrValues(attributable, AttributableUtil.getInstance(AttributableType.USER));
+        }
 
         final List<SyncopeUser> recipients = new ArrayList<SyncopeUser>();
 
@@ -133,8 +153,8 @@ public class NotificationManager {
                     notification.getRecipients(), AttributableUtil.getInstance(AttributableType.USER)));
         }
 
-        if (notification.isSelfAsRecipient()) {
-            recipients.add(user);
+        if (notification.isSelfAsRecipient() && attributable instanceof SyncopeUser) {
+            recipients.add((SyncopeUser) attributable);
         }
 
         final Set<String> recipientEmails = new HashSet<String>();
@@ -152,18 +172,16 @@ public class NotificationManager {
             }
         }
 
+        model.put("recipients", recipientTOs);
+        model.put("syncopeConf", this.findAllSyncopeConfs());
+        model.put("events", notification.getEvents());
+
         NotificationTask task = new NotificationTask();
         task.setTraceLevel(notification.getTraceLevel());
         task.setRecipients(recipientEmails);
         task.setSender(notification.getSender());
         task.setSubject(notification.getSubject());
 
-        final Map<String, Object> model = new HashMap<String, Object>();
-        model.put("user", userDataBinder.getUserTO(user));
-        model.put("syncopeConf", this.findAllSyncopeConfs());
-        model.put("recipients", recipientTOs);
-        model.put("events", notification.getEvents());
-
         String htmlBody;
         String textBody;
         try {
@@ -190,27 +208,60 @@ public class NotificationManager {
      * @param performedTasks set of actions performed on given user id
      * @throws NotFoundException if user contained in the workflow result cannot be found
      */
-    public void createTasks(final Long userId, final Set<String> performedTasks)
-            throws NotFoundException {
+    public void createTasks(
+            final AuditElements.EventCategoryType type,
+            final String category,
+            final String subcategory,
+            final String event,
+            final Result condition,
+            final Object before,
+            final Object output,
+            final Object... input) {
+        AttributableType attributableType = null;
+        AbstractAttributable attributable = null;
+
+        if (UserController.class.getSimpleName().equals(category)) {
+            attributableType = AttributableType.USER;
+
+            if (before instanceof UserTO) {
+                attributable = userDAO.find(((UserTO) before).getId());
+            } else if (output instanceof UserTO) {
+                attributable = userDAO.find(((UserTO) output).getId());
+            }
+        } else if (RoleController.class.getSimpleName().equals(category)) {
+            attributableType = AttributableType.ROLE;
 
-        SyncopeUser user = userDAO.find(userId);
-        if (user == null) {
-            throw new NotFoundException("User " + userId);
+            if (before instanceof RoleTO) {
+                attributable = roleDAO.find(((RoleTO) before).getId());
+            } else if (output instanceof RoleTO) {
+                attributable = roleDAO.find(((RoleTO) output).getId());
+            }
         }
 
+        LOG.info("Search notification for [{}]{}", attributableType, attributable);
+
         for (Notification notification : notificationDAO.findAll()) {
-            if (notification.getAbout() == null
-                    || searchDAO.matches(user, notification.getAbout(),
-                    AttributableUtil.getInstance(AttributableType.USER))) {
-
-                Set<String> events = new HashSet<String>(notification.getEvents());
-                events.retainAll(performedTasks);
-
-                if (events.isEmpty()) {
-                    LOG.debug("No events found about {}", user);
-                } else {
-                    LOG.debug("Creating notification task for events {} about {}", events, user);
-                    taskDAO.save(getNotificationTask(notification, user));
+            LOG.info("Notification available about {}", notification.getAbout());
+
+            final Set<String> events = new HashSet<String>(notification.getEvents());
+            events.retainAll(Collections.<String>singleton(LoggerEventUtils.buildEvent(
+                    type, category, subcategory, event, condition)));
+
+            if (events.isEmpty()) {
+                LOG.debug("No events found about {}", attributable);
+            } else {
+                if (attributableType == null || attributable == null || notification.getAbout() == null || searchDAO.
+                        matches(
+                        attributable, notification.getAbout(), AttributableUtil.getInstance(attributableType))) {
+
+                    LOG.debug("Creating notification task for events {} about {}", events, attributable);
+
+                    final Map<String, Object> model = new HashMap<String, Object>();
+                    model.put("before", before);
+                    model.put("output", output);
+                    model.put("input", input);
+
+                    taskDAO.save(getNotificationTask(notification, attributable, model));
                 }
             }
         }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/AttributableSearchDAOImpl.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/AttributableSearchDAOImpl.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/AttributableSearchDAOImpl.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/AttributableSearchDAOImpl.java Tue Nov  5 08:22:31 2013
@@ -165,18 +165,26 @@ public class AttributableSearchDAOImpl e
         // 1. get the query string from the search condition
         StringBuilder queryString = getQuery(searchCondition, parameters, attrUtil);
 
-        // 2. take into account the passed user
-        queryString.insert(0, "SELECT u.subject_id FROM (");
-        queryString.append(") u WHERE subject_id=?").append(setParameter(parameters, user.getId()));
+        final boolean res;
+        if (queryString.length() == 0) {
+            // Could be empty: got into a role search with a single membership condition ...
+            res = false;
+        } else {
+            // 2. take into account the passed user
+            queryString.insert(0, "SELECT u.subject_id FROM (");
+            queryString.append(") u WHERE subject_id=?").append(setParameter(parameters, user.getId()));
 
-        // 3. prepare the search query
-        Query query = entityManager.createNativeQuery(queryString.toString());
+            // 3. prepare the search query
+            Query query = entityManager.createNativeQuery(queryString.toString());
 
-        // 4. populate the search query with parameter values
-        fillWithParameters(query, parameters);
+            // 4. populate the search query with parameter values
+            fillWithParameters(query, parameters);
+
+            // 5. executes query
+            res = !query.getResultList().isEmpty();
+        }
 
-        // 5. executes query
-        return !query.getResultList().isEmpty();
+        return res;
     }
 
     private int setParameter(final List<Object> parameters, final Object parameter) {

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/AbstractPropagationTaskExecutor.java Tue Nov  5 08:22:31 2013
@@ -27,11 +27,15 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import org.apache.commons.lang.StringUtils;
+import org.apache.syncope.common.types.AuditElements;
+import org.apache.syncope.common.types.AuditElements.Result;
 import org.apache.syncope.common.types.MappingPurpose;
 import org.apache.syncope.common.types.PropagationMode;
 import org.apache.syncope.common.types.PropagationTaskExecStatus;
 import org.apache.syncope.common.types.TraceLevel;
+import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.connid.ConnObjectUtil;
+import org.apache.syncope.core.notification.NotificationManager;
 import org.apache.syncope.core.persistence.beans.AbstractAttributable;
 import org.apache.syncope.core.persistence.beans.ExternalResource;
 import org.apache.syncope.core.persistence.beans.PropagationTask;
@@ -94,6 +98,18 @@ public abstract class AbstractPropagatio
     @Autowired
     protected RoleDataBinder roleDataBinder;
 
+    /**
+     * Notification Manager.
+     */
+    @Autowired
+    protected NotificationManager notificationManager;
+
+    /**
+     * Audit Manager.
+     */
+    @Autowired
+    protected AuditManager auditManager;
+
     @Override
     public TaskExec execute(final PropagationTask task) {
         return execute(task, null);
@@ -284,6 +300,7 @@ public abstract class AbstractPropagatio
         ConnectorObject afterObj = null;
 
         Connector connector = null;
+        Result result;
         try {
             connector = connLoader.getConnector(task.getResource());
 
@@ -310,7 +327,9 @@ public abstract class AbstractPropagatio
                     : PropagationTaskExecStatus.SUBMITTED.name());
 
             LOG.debug("Successfully propagated to {}", task.getResource());
+            result = Result.SUCCESS;
         } catch (Exception e) {
+            result = Result.FAILURE;
             LOG.error("Exception during provision on resource " + task.getResource().getName(), e);
 
             if (e instanceof ConnectorException && e.getCause() != null) {
@@ -382,6 +401,26 @@ public abstract class AbstractPropagatio
 
         actions.after(task, execution, afterObj);
 
+        notificationManager.createTasks(
+                AuditElements.EventCategoryType.PROPAGATION,
+                task.getSubjectType().name().toLowerCase(),
+                task.getResource().getName(),
+                task.getPropagationOperation().name().toLowerCase(),
+                result,
+                beforeObj, // searching for before object is too much expensive ... 
+                new Object[] {execution, afterObj},
+                task);
+
+        auditManager.audit(
+                AuditElements.EventCategoryType.PROPAGATION,
+                task.getSubjectType().name().toLowerCase(),
+                task.getResource().getName(),
+                task.getPropagationOperation().name().toLowerCase(),
+                result,
+                beforeObj, // searching for before object is too much expensive ... 
+                new Object[] {execution, afterObj},
+                task);
+
         return execution;
     }
 

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/propagation/impl/PriorityPropagationTaskExecutor.java Tue Nov  5 08:22:31 2013
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import org.apache.syncope.common.types.AuditElements;
 import org.apache.syncope.common.types.PropagationTaskExecStatus;
 import org.apache.syncope.core.persistence.beans.PropagationTask;
 import org.apache.syncope.core.persistence.beans.TaskExec;
@@ -41,25 +42,47 @@ public class PriorityPropagationTaskExec
         final List<PropagationTask> prioritizedTasks = new ArrayList<PropagationTask>(tasks);
         Collections.sort(prioritizedTasks, new PriorityComparator());
 
-        for (PropagationTask task : prioritizedTasks) {
-            LOG.debug("Execution started for {}", task);
-
-            TaskExec execution = execute(task, reporter);
-
-            LOG.debug("Execution finished for {}, {}", task, execution);
-
-            // Propagation is interrupted as soon as the result of the
-            // communication with a primary resource is in error
-            PropagationTaskExecStatus execStatus;
-            try {
-                execStatus = PropagationTaskExecStatus.valueOf(execution.getStatus());
-            } catch (IllegalArgumentException e) {
-                LOG.error("Unexpected execution status found {}", execution.getStatus());
-                execStatus = PropagationTaskExecStatus.FAILURE;
-            }
-            if (task.getResource().isPropagationPrimary() && !execStatus.isSuccessful()) {
-                throw new PropagationException(task.getResource().getName(), execution.getMessage());
+        try {
+            for (PropagationTask task : prioritizedTasks) {
+                LOG.debug("Execution started for {}", task);
+
+                TaskExec execution = execute(task, reporter);
+
+                LOG.debug("Execution finished for {}, {}", task, execution);
+
+                // Propagation is interrupted as soon as the result of the
+                // communication with a primary resource is in error
+                PropagationTaskExecStatus execStatus;
+                try {
+                    execStatus = PropagationTaskExecStatus.valueOf(execution.getStatus());
+                } catch (IllegalArgumentException e) {
+                    LOG.error("Unexpected execution status found {}", execution.getStatus());
+                    execStatus = PropagationTaskExecStatus.FAILURE;
+                }
+                if (task.getResource().isPropagationPrimary() && !execStatus.isSuccessful()) {
+                    throw new PropagationException(task.getResource().getName(), execution.getMessage());
+                }
             }
+        } finally {
+            notificationManager.createTasks(
+                    AuditElements.EventCategoryType.PROPAGATION,
+                    null,
+                    null,
+                    null,
+                    null,
+                    reporter instanceof DefaultPropagationReporter
+                    ? ((DefaultPropagationReporter) reporter).getStatuses() : null,
+                    tasks);
+
+            auditManager.audit(
+                    AuditElements.EventCategoryType.PROPAGATION,
+                    null,
+                    null,
+                    null,
+                    null,
+                    reporter instanceof DefaultPropagationReporter
+                    ? ((DefaultPropagationReporter) reporter).getStatuses() : null,
+                    tasks);
         }
     }
 

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/quartz/AbstractTaskJob.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/quartz/AbstractTaskJob.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/quartz/AbstractTaskJob.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/quartz/AbstractTaskJob.java Tue Nov  5 08:22:31 2013
@@ -21,6 +21,10 @@ package org.apache.syncope.core.quartz;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Date;
+import org.apache.syncope.common.types.AuditElements;
+import org.apache.syncope.common.types.AuditElements.Result;
+import org.apache.syncope.core.audit.AuditManager;
+import org.apache.syncope.core.notification.NotificationManager;
 
 import org.apache.syncope.core.persistence.beans.Task;
 import org.apache.syncope.core.persistence.beans.TaskExec;
@@ -74,6 +78,18 @@ public abstract class AbstractTaskJob im
     private TaskExecDAO taskExecDAO;
 
     /**
+     * Notification manager.
+     */
+    @Autowired
+    private NotificationManager notificationManager;
+
+    /**
+     * Audit manager.
+     */
+    @Autowired
+    private AuditManager auditManager;
+
+    /**
      * Id, set by the caller, for identifying the task to be executed.
      */
     protected Long taskId;
@@ -104,12 +120,15 @@ public abstract class AbstractTaskJob im
         execution.setStartDate(new Date());
         execution.setTask(task);
 
+        Result result;
+
         try {
             execution.setMessage(doExecute(context.getMergedJobDataMap().getBoolean(DRY_RUN_JOBDETAIL_KEY)));
-
             execution.setStatus(Status.SUCCESS.name());
+            result = Result.SUCCESS;
         } catch (JobExecutionException e) {
             LOG.error("While executing task " + taskId, e);
+            result = Result.FAILURE;
 
             StringWriter exceptionWriter = new StringWriter();
             exceptionWriter.write(e.getMessage() + "\n\n");
@@ -125,6 +144,24 @@ public abstract class AbstractTaskJob im
         }
 
         task = taskDAO.save(task);
+
+        notificationManager.createTasks(
+                AuditElements.EventCategoryType.TASK,
+                task.getClass().getSimpleName(),
+                null,
+                null, // searching for before object is too much expensive ...
+                result,
+                task,
+                (Object[]) null);
+
+        auditManager.audit(
+                AuditElements.EventCategoryType.TASK,
+                task.getClass().getSimpleName(),
+                null,
+                null, // searching for before object is too much expensive ...
+                result,
+                task,
+                (Object[]) null);
     }
 
     /**

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java Tue Nov  5 08:22:31 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
+import org.apache.syncope.common.AbstractBaseBean;
 import org.apache.syncope.common.to.PropagationTaskTO;
 import org.apache.syncope.common.to.SchedTaskTO;
 import org.apache.syncope.common.to.SyncTaskTO;
@@ -34,8 +36,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.TypeMismatchException;
 import org.springframework.transaction.annotation.Transactional;
 
-@Transactional(rollbackFor = { Throwable.class })
-public abstract class AbstractController {
+public abstract class AbstractController<T extends AbstractBaseBean> {
 
     /**
      * Logger.
@@ -74,12 +75,12 @@ public abstract class AbstractController
         TaskUtil result = (task instanceof PropagationTask)
                 ? TaskUtil.PROPAGATION
                 : (task instanceof NotificationTask)
-                        ? TaskUtil.NOTIFICATION
-                        : (task instanceof SyncTask)
-                                ? TaskUtil.SYNC
-                                : (task instanceof SchedTask)
-                                        ? TaskUtil.SCHED
-                                        : null;
+                ? TaskUtil.NOTIFICATION
+                : (task instanceof SyncTask)
+                ? TaskUtil.SYNC
+                : (task instanceof SchedTask)
+                ? TaskUtil.SCHED
+                : null;
 
         if (result == null) {
             LOG.error("Task not supported: " + task.getClass().getName());
@@ -94,10 +95,10 @@ public abstract class AbstractController
         TaskUtil result = (taskTO instanceof PropagationTaskTO)
                 ? TaskUtil.PROPAGATION
                 : (taskTO instanceof SyncTaskTO)
-                        ? TaskUtil.SYNC
-                        : (taskTO instanceof SchedTaskTO)
-                                ? TaskUtil.SCHED
-                                : null;
+                ? TaskUtil.SYNC
+                : (taskTO instanceof SchedTaskTO)
+                ? TaskUtil.SCHED
+                : null;
 
         if (result == null) {
             LOG.error("Task not supported: " + taskTO.getClass().getName());
@@ -107,4 +108,24 @@ public abstract class AbstractController
 
         return result;
     }
+
+    /**
+     * Resolves stored bean (if existing) referred by the given CUD method.
+     * <br />
+     * Read-only methods will be unresolved for performance reasons.
+     *
+     * @param method method.
+     * @param args method arguments.
+     * @return referred stored bean.
+     * @throws UnresolvedReferenceException in case of failures, read-only methods and unresolved bean.
+     */
+    public T resolveBeanReference(final Method method, final Object... args) throws UnresolvedReferenceException {
+        final Transactional transactional = method.getAnnotation(Transactional.class);
+        if (transactional != null && transactional.readOnly()) {
+            throw new UnresolvedReferenceException();
+        }
+        return resolveReference(method, args);
+    }
+
+    protected abstract T resolveReference(Method method, Object... args) throws UnresolvedReferenceException;
 }

Copied: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java (from r1524721, syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java)
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java?p2=syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java&p1=syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java&r1=1524721&r2=1538902&rev=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java Tue Nov  5 08:22:31 2013
@@ -18,93 +18,9 @@
  */
 package org.apache.syncope.core.rest.controller;
 
-import org.apache.syncope.common.to.PropagationTaskTO;
-import org.apache.syncope.common.to.SchedTaskTO;
-import org.apache.syncope.common.to.SyncTaskTO;
-import org.apache.syncope.common.to.TaskTO;
-import org.apache.syncope.core.persistence.beans.NotificationTask;
-import org.apache.syncope.core.persistence.beans.PropagationTask;
-import org.apache.syncope.core.persistence.beans.SchedTask;
-import org.apache.syncope.core.persistence.beans.SyncTask;
-import org.apache.syncope.core.persistence.beans.Task;
-import org.apache.syncope.core.util.AttributableUtil;
-import org.apache.syncope.core.util.TaskUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.TypeMismatchException;
+import org.apache.syncope.common.AbstractBaseBean;
 import org.springframework.transaction.annotation.Transactional;
 
-@Transactional(rollbackFor = { Throwable.class })
-public abstract class AbstractController {
-
-    /**
-     * Logger.
-     */
-    protected static final Logger LOG = LoggerFactory.getLogger(AbstractController.class);
-
-    protected AttributableUtil getAttributableUtil(final String kind) {
-        AttributableUtil result = null;
-
-        try {
-            result = AttributableUtil.valueOf(kind.toUpperCase());
-        } catch (Exception e) {
-            LOG.error("Attributable not supported: " + kind);
-
-            throw new TypeMismatchException(kind, AttributableUtil.class, e);
-        }
-
-        return result;
-    }
-
-    protected TaskUtil getTaskUtil(final String kind) {
-        TaskUtil result = null;
-
-        try {
-            result = TaskUtil.valueOf(kind.toUpperCase());
-        } catch (Exception e) {
-            LOG.error("Task not supported: " + kind);
-
-            throw new TypeMismatchException(kind, TaskUtil.class, e);
-        }
-
-        return result;
-    }
-
-    protected TaskUtil getTaskUtil(final Task task) {
-        TaskUtil result = (task instanceof PropagationTask)
-                ? TaskUtil.PROPAGATION
-                : (task instanceof NotificationTask)
-                        ? TaskUtil.NOTIFICATION
-                        : (task instanceof SyncTask)
-                                ? TaskUtil.SYNC
-                                : (task instanceof SchedTask)
-                                        ? TaskUtil.SCHED
-                                        : null;
-
-        if (result == null) {
-            LOG.error("Task not supported: " + task.getClass().getName());
-
-            throw new TypeMismatchException(task.getClass().getName(), TaskUtil.class);
-        }
-
-        return result;
-    }
-
-    protected TaskUtil getTaskUtil(final TaskTO taskTO) {
-        TaskUtil result = (taskTO instanceof PropagationTaskTO)
-                ? TaskUtil.PROPAGATION
-                : (taskTO instanceof SyncTaskTO)
-                        ? TaskUtil.SYNC
-                        : (taskTO instanceof SchedTaskTO)
-                                ? TaskUtil.SCHED
-                                : null;
-
-        if (result == null) {
-            LOG.error("Task not supported: " + taskTO.getClass().getName());
-
-            throw new TypeMismatchException(taskTO.getClass().getName(), TaskUtil.class);
-        }
-
-        return result;
-    }
+@Transactional(rollbackFor = {Throwable.class})
+public abstract class AbstractTransactionalController<T extends AbstractBaseBean> extends AbstractController<T> {
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AuthenticationController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AuthenticationController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AuthenticationController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/AuthenticationController.java Tue Nov  5 08:22:31 2013
@@ -18,14 +18,11 @@
  */
 package org.apache.syncope.core.rest.controller;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
-
-import org.apache.syncope.common.types.AuditElements.AuthenticationSubCategory;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.Result;
-import org.apache.syncope.core.audit.AuditManager;
+import org.apache.syncope.common.to.EntitlementTO;
 import org.apache.syncope.core.persistence.beans.Entitlement;
 import org.apache.syncope.core.persistence.dao.EntitlementDAO;
 import org.apache.syncope.core.util.EntitlementUtil;
@@ -36,10 +33,7 @@ import org.springframework.web.bind.anno
 
 @Controller
 @RequestMapping("/auth")
-public class AuthenticationController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class AuthenticationController extends AbstractTransactionalController<EntitlementTO> {
 
     @Autowired
     private EntitlementDAO entitlementDAO;
@@ -57,11 +51,15 @@ public class AuthenticationController ex
 
     @RequestMapping(method = RequestMethod.GET, value = "/entitlements")
     public Set<String> getEntitlements() {
-        Set<String> result = EntitlementUtil.getOwnedEntitlementNames();
-
-        auditManager.audit(Category.authentication, AuthenticationSubCategory.getEntitlements, Result.success,
-                "Owned entitlements: " + result.toString());
+        return EntitlementUtil.getOwnedEntitlementNames();
+    }
 
-        return result;
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected EntitlementTO resolveReference(final Method method, final Object... obj)
+            throws UnresolvedReferenceException {
+        throw new UnresolvedReferenceException();
     }
 }

Modified: syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java?rev=1538902&r1=1538901&r2=1538902&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java (original)
+++ syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java Tue Nov  5 08:22:31 2013
@@ -20,6 +20,7 @@ package org.apache.syncope.core.rest.con
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -27,12 +28,9 @@ import java.util.Set;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.MediaType;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.SyncopeConstants;
 import org.apache.syncope.common.to.ConfigurationTO;
-import org.apache.syncope.common.types.AuditElements.Category;
-import org.apache.syncope.common.types.AuditElements.ConfigurationSubCategory;
-import org.apache.syncope.common.types.AuditElements.Result;
-import org.apache.syncope.core.audit.AuditManager;
 import org.apache.syncope.core.init.ImplementationClassNamesLoader;
 import org.apache.syncope.core.init.WorkflowAdapterLoader;
 import org.apache.syncope.core.persistence.beans.SyncopeConf;
@@ -56,10 +54,7 @@ import org.springframework.web.servlet.M
 
 @Controller
 @RequestMapping("/configuration")
-public class ConfigurationController extends AbstractController {
-
-    @Autowired
-    private AuditManager auditManager;
+public class ConfigurationController extends AbstractTransactionalController<ConfigurationTO> {
 
     @Autowired
     private ConfDAO confDAO;
@@ -88,9 +83,6 @@ public class ConfigurationController ext
         SyncopeConf conf = binder.create(configurationTO);
         conf = confDAO.save(conf);
 
-        auditManager.audit(Category.configuration, ConfigurationSubCategory.create, Result.success,
-                "Successfully created conf: " + conf.getKey());
-
         response.setStatus(HttpServletResponse.SC_CREATED);
 
         return binder.getConfigurationTO(conf);
@@ -102,9 +94,6 @@ public class ConfigurationController ext
         SyncopeConf conf = confDAO.find(key);
         ConfigurationTO confToDelete = binder.getConfigurationTO(conf);
         confDAO.delete(key);
-
-        auditManager.audit(Category.configuration, ConfigurationSubCategory.delete, Result.success,
-                "Successfully deleted conf: " + key);
         return confToDelete;
     }
 
@@ -118,9 +107,6 @@ public class ConfigurationController ext
             configurationTOs.add(binder.getConfigurationTO(configuration));
         }
 
-        auditManager.audit(Category.configuration, ConfigurationSubCategory.list, Result.success,
-                "Successfully listed all confs: " + configurationTOs.size());
-
         return configurationTOs;
     }
 
@@ -131,17 +117,11 @@ public class ConfigurationController ext
         try {
             SyncopeConf conf = confDAO.find(key);
             result = binder.getConfigurationTO(conf);
-
-            auditManager.audit(Category.configuration, ConfigurationSubCategory.read, Result.success,
-                    "Successfully read conf: " + key);
         } catch (MissingConfKeyException e) {
             LOG.error("Could not find configuration key '" + key + "', returning null");
 
             result = new ConfigurationTO();
             result.setKey(key);
-
-            auditManager.audit(Category.configuration, ConfigurationSubCategory.read, Result.failure,
-                    "Could not find conf: " + key);
         }
 
         return result;
@@ -152,22 +132,14 @@ public class ConfigurationController ext
     public ConfigurationTO update(@RequestBody final ConfigurationTO configurationTO) {
         SyncopeConf conf = confDAO.find(configurationTO.getKey());
         conf.setValue(configurationTO.getValue());
-
-        auditManager.audit(Category.configuration, ConfigurationSubCategory.update, Result.success,
-                "Successfully updated conf: " + conf.getKey());
-
         return binder.getConfigurationTO(conf);
     }
 
     @PreAuthorize("hasRole('CONFIGURATION_LIST')")
     @RequestMapping(method = RequestMethod.GET, value = "/validators")
     public ModelAndView getValidators() {
-        Set<String> validators = classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.VALIDATOR);
-
-        auditManager.audit(Category.configuration, ConfigurationSubCategory.getValidators, Result.success,
-                "Successfully listed all validators: " + validators.size());
-
-        return new ModelAndView().addObject(validators);
+        return new ModelAndView().addObject(
+                classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.VALIDATOR));
     }
 
     @PreAuthorize("hasRole('CONFIGURATION_LIST')")
@@ -196,9 +168,6 @@ public class ConfigurationController ext
         // Only templates available both as HTML and TEXT are considered
         htmlTemplates.retainAll(textTemplates);
 
-        auditManager.audit(Category.configuration, ConfigurationSubCategory.getMailTemplates, Result.success,
-                "Successfully listed all mail templates: " + htmlTemplates.size());
-
         return new ModelAndView().addObject(htmlTemplates);
     }
 
@@ -219,14 +188,39 @@ public class ConfigurationController ext
     public void dbExportInternal(final OutputStream os) {
         try {
             exporter.export(os, wfAdapterLoader.getTablePrefix());
-
-            auditManager.audit(Category.configuration, ConfigurationSubCategory.dbExport, Result.success,
-                    "Successfully exported database content");
             LOG.debug("Database content successfully exported");
         } catch (Exception e) {
-            auditManager.audit(Category.configuration, ConfigurationSubCategory.dbExport, Result.failure,
-                    "Could not export database content", e);
             LOG.error("While exporting database content", e);
         }
     }
-}
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ConfigurationTO resolveReference(final Method method, final Object... args)
+            throws UnresolvedReferenceException {
+        String key = null;
+
+        if (ArrayUtils.isNotEmpty(args)) {
+            for (int i = 0; key == null && i < args.length; i++) {
+                if (args[i] instanceof String) {
+                    key = (String) args[i];
+                } else if (args[i] instanceof ConfigurationTO) {
+                    key = ((ConfigurationTO) args[i]).getKey();
+                }
+            }
+        }
+
+        if (key != null) {
+            try {
+                return binder.getConfigurationTO(confDAO.find(key));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
+    }
+}
\ No newline at end of file