You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2013/11/22 16:28:45 UTC
svn commit: r1544573 - in /syncope/trunk: ./
common/src/main/java/org/apache/syncope/common/to/
common/src/main/java/org/apache/syncope/common/util/
console/src/main/java/org/apache/syncope/console/commons/
console/src/main/java/org/apache/syncope/cons...
Author: ilgrosso
Date: Fri Nov 22 15:28:45 2013
New Revision: 1544573
URL: http://svn.apache.org/r1544573
Log:
[SYNCOPE-431] Merge from 1_1_X
Added:
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java
- copied, changed from r1544553, syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java
Removed:
syncope/trunk/core/src/main/java/org/apache/syncope/core/services/ControllerHandler.java
Modified:
syncope/trunk/ (props changed)
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/EventCategoryTO.java
syncope/trunk/common/src/main/java/org/apache/syncope/common/util/LoggerEventUtils.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/ActionTableCheckGroup.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractStatusModalPage.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ReportletConfModalPage.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ImagePanel.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnauthorizedRoleException.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserWorkflowController.java
syncope/trunk/core/src/main/resources/restContext.xml
Propchange: syncope/trunk/
------------------------------------------------------------------------------
Merged /syncope/branches/1_1_X:r1544078-1544553
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/to/EventCategoryTO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/EventCategoryTO.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/EventCategoryTO.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/EventCategoryTO.java Fri Nov 22 15:28:45 2013
@@ -1,28 +1,34 @@
/*
- * Copyright 2013 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * 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
*
- * 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.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.syncope.common.to;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.AbstractBaseBean;
import org.apache.syncope.common.types.AuditElements;
-@XmlRootElement(name = "user")
+@XmlRootElement(name = "eventCategory")
@XmlType
public class EventCategoryTO extends AbstractBaseBean {
@@ -34,7 +40,7 @@ public class EventCategoryTO extends Abs
private String subcategory;
- private List<String> events;
+ private final List<String> events = new ArrayList<String>();
/**
* Constructor for Type.REST event category.
@@ -74,14 +80,10 @@ public class EventCategoryTO extends Abs
this.subcategory = subcategory;
}
+ @XmlElementWrapper(name = "events")
+ @XmlElement(name = "event")
+ @JsonProperty("events")
public List<String> getEvents() {
- if (events == null) {
- events = new ArrayList<String>();
- }
return events;
}
-
- public void setEvents(final List<String> events) {
- this.events = events;
- }
}
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/util/LoggerEventUtils.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/util/LoggerEventUtils.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/util/LoggerEventUtils.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/util/LoggerEventUtils.java Fri Nov 22 15:28:45 2013
@@ -1,17 +1,20 @@
/*
- * Copyright 2013 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * 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
*
- * 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.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.syncope.common.util;
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/ActionTableCheckGroup.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/ActionTableCheckGroup.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/ActionTableCheckGroup.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/commons/ActionTableCheckGroup.java Fri Nov 22 15:28:45 2013
@@ -1,17 +1,20 @@
/*
- * Copyright 2013 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * 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
*
- * 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.
+ * 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.commons;
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractStatusModalPage.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractStatusModalPage.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractStatusModalPage.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractStatusModalPage.java Fri Nov 22 15:28:45 2013
@@ -1,17 +1,20 @@
/*
- * Copyright 2013 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * 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
*
- * 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.
+ * 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;
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ReportletConfModalPage.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ReportletConfModalPage.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ReportletConfModalPage.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/ReportletConfModalPage.java Fri Nov 22 15:28:45 2013
@@ -71,8 +71,8 @@ public class ReportletConfModalPage exte
private static final long serialVersionUID = 3910027601200382958L;
- private static final String[] EXCLUDE_PROPERTIES = new String[]{"serialVersionUID", "class", "name",
- "reportletClassName"};
+ private static final String[] EXCLUDE_PROPERTIES = new String[] { "serialVersionUID", "class", "name",
+ "reportletClassName" };
private AbstractReportletConf reportletConf;
@@ -104,30 +104,31 @@ public class ReportletConfModalPage exte
final AjaxDropDownChoicePanel<String> reportletClass = new AjaxDropDownChoicePanel<String>("reportletClass",
"reportletClass", new IModel<String>() {
- private static final long serialVersionUID = -2316468110411802130L;
+ private static final long serialVersionUID = -2316468110411802130L;
- @Override
- public String getObject() {
- return ReportletConfModalPage.this.reportletConf == null
+ @Override
+ public String getObject() {
+ return ReportletConfModalPage.this.reportletConf == null
? null
: ReportletConfModalPage.this.reportletConf.getClass().getName();
- }
+ }
- @Override
- public void setObject(final String object) {
- try {
- Class<?> reportletClass = Class.forName(object);
- ReportletConfModalPage.this.reportletConf = (AbstractReportletConf) reportletClass.newInstance();
- propertiesContainer.replace(buildPropView());
- } catch (Exception e) {
- LOG.error("Cannot find or initialize {}", object, e);
- }
- }
+ @Override
+ public void setObject(final String object) {
+ try {
+ Class<?> reportletClass = Class.forName(object);
+ ReportletConfModalPage.this.reportletConf = (AbstractReportletConf) reportletClass.
+ newInstance();
+ propertiesContainer.replace(buildPropView());
+ } catch (Exception e) {
+ LOG.error("Cannot find or initialize {}", object, e);
+ }
+ }
- @Override
- public void detach() {
- }
- });
+ @Override
+ public void detach() {
+ }
+ });
reportletClass.setStyleSheet("long_dynamicsize");
reportletClass.setChoices(reportRestClient.getReportletConfClasses());
((DropDownChoice) reportletClass.getField()).setNullValid(true);
@@ -254,15 +255,15 @@ public class ReportletConfModalPage exte
try {
field = ReportletConfModalPage.this.reportletConf.getClass().getDeclaredField(fieldName);
} catch (Exception e) {
- LOG.error("Could not find field {} in class {}", new Object[]{fieldName,
- ReportletConfModalPage.this.reportletConf.getClass(), e});
+ LOG.error("Could not find field {} in class {}",
+ fieldName, ReportletConfModalPage.this.reportletConf.getClass(), e);
}
if (field == null) {
return;
}
- BeanWrapper wrapper = PropertyAccessorFactory
- .forBeanPropertyAccess(ReportletConfModalPage.this.reportletConf);
+ BeanWrapper wrapper = PropertyAccessorFactory.
+ forBeanPropertyAccess(ReportletConfModalPage.this.reportletConf);
Panel panel;
@@ -333,7 +334,7 @@ public class ReportletConfModalPage exte
} else if (listItemType.isEnum()) {
panel = new CheckBoxMultipleChoiceFieldPanel("value", new PropertyModel(
ReportletConfModalPage.this.reportletConf, fieldName), new ListModel(Arrays
- .asList(listItemType.getEnumConstants())));
+ .asList(listItemType.getEnumConstants())));
} else {
if (((List) wrapper.getPropertyValue(fieldName)).isEmpty()) {
((List) wrapper.getPropertyValue(fieldName)).add(null);
@@ -341,7 +342,7 @@ public class ReportletConfModalPage exte
panel = new MultiValueSelectorPanel("value", new PropertyModel<List>(
ReportletConfModalPage.this.reportletConf, fieldName), buildSinglePanel(
- field.getType(), fieldName, "panel"));
+ field.getType(), fieldName, "panel"));
}
} else {
panel = buildSinglePanel(field.getType(), fieldName, "value");
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ImagePanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ImagePanel.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ImagePanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ImagePanel.java Fri Nov 22 15:28:45 2013
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.syncope.console.pages.panels;
import org.apache.wicket.Component;
@@ -5,21 +23,6 @@ import org.apache.wicket.behavior.Behavi
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.panel.Panel;
-/*
- * 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.
- */
public class ImagePanel extends Panel {
private static final long serialVersionUID = 5564818820574092960L;
@@ -33,7 +36,7 @@ public class ImagePanel extends Panel {
}
@Override
- public Component add(Behavior... behaviors) {
+ public Component add(final Behavior... behaviors) {
this.img.add(behaviors);
return this;
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/PoliciesPanel.java Fri Nov 22 15:28:45 2013
@@ -178,15 +178,13 @@ public class PoliciesPanel extends Panel
@Override
public void onClick(final AjaxRequestTarget target) {
try {
-
policyRestClient.delete(accountPolicyTO.getId(), accountPolicyTO.getClass());
info(getString(Constants.OPERATION_SUCCEEDED));
-
} catch (SyncopeClientException e) {
error(getString(Constants.OPERATION_ERROR));
- LOG.error("While deleting resource {}({})", new Object[]{accountPolicyTO.getId(),
- accountPolicyTO.getDescription()}, e);
+ LOG.error("While deleting resource {}({})",
+ accountPolicyTO.getId(), accountPolicyTO.getDescription(), e);
}
target.add(container);
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectedEventsPanel.java Fri Nov 22 15:28:45 2013
@@ -1,17 +1,20 @@
/*
- * Copyright 2013 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * 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
*
- * 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.
+ * 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;
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java Fri Nov 22 15:28:45 2013
@@ -193,7 +193,6 @@ public class SyncopeUser extends Abstrac
membership = itor.next();
if (membership.getSyncopeRole() != null && syncopeRoleId.equals(membership.getSyncopeRole().getId())) {
-
result = membership;
}
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractController.java Fri Nov 22 15:28:45 2013
@@ -24,7 +24,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
-public abstract class AbstractController<T extends AbstractBaseBean> {
+/**
+ * Superclass for all controllers.
+ *
+ * @param <T> transfer object used for input / output
+ */
+abstract class AbstractController<T extends AbstractBaseBean> {
/**
* Logger.
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/AbstractTransactionalController.java Fri Nov 22 15:28:45 2013
@@ -21,6 +21,12 @@ package org.apache.syncope.core.rest.con
import org.apache.syncope.common.AbstractBaseBean;
import org.springframework.transaction.annotation.Transactional;
-@Transactional(rollbackFor = {Throwable.class})
-public abstract class AbstractTransactionalController<T extends AbstractBaseBean> extends AbstractController<T> {
+/**
+ * Adds Spring's transactional support to <tt>AbstractController</tt>.
+ *
+ * @param <T> transfer object used for input / output
+ * @see AbstractController
+ */
+@Transactional(rollbackFor = { Throwable.class })
+abstract class AbstractTransactionalController<T extends AbstractBaseBean> extends AbstractController<T> {
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java Fri Nov 22 15:28:45 2013
@@ -65,7 +65,6 @@ public class ConfigurationController ext
@PreAuthorize("hasRole('CONFIGURATION_CREATE')")
public ConfigurationTO create(final ConfigurationTO configurationTO) {
- LOG.debug("Configuration create called with parameters {}", configurationTO);
SyncopeConf conf = binder.create(configurationTO);
conf = confDAO.save(conf);
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnectorController.java Fri Nov 22 15:28:45 2013
@@ -72,8 +72,6 @@ public class ConnectorController extends
@PreAuthorize("hasRole('CONNECTOR_CREATE')")
public ConnInstanceTO create(final ConnInstanceTO connInstanceTO) {
- LOG.debug("ConnInstance create called with configuration {}", connInstanceTO);
-
ConnInstance connInstance = binder.getConnInstance(connInstanceTO);
try {
connInstance = connInstanceDAO.save(connInstance);
@@ -89,8 +87,6 @@ public class ConnectorController extends
@PreAuthorize("hasRole('CONNECTOR_UPDATE')")
public ConnInstanceTO update(final ConnInstanceTO connInstanceTO) {
- LOG.debug("Connector update called with configuration {}", connInstanceTO);
-
ConnInstance connInstance = binder.updateConnInstance(connInstanceTO.getId(), connInstanceTO);
try {
connInstance = connInstanceDAO.save(connInstance);
@@ -273,8 +269,8 @@ public class ConnectorController extends
@PreAuthorize("hasRole('CONNECTOR_READ')")
@Transactional(readOnly = true)
public boolean check(final ConnInstanceTO connInstanceTO) {
- final Connector connector = connFactory.createConnector(binder.getConnInstance(connInstanceTO), connInstanceTO.
- getConfiguration());
+ final Connector connector = connFactory.createConnector(
+ binder.getConnInstance(connInstanceTO), connInstanceTO.getConfiguration());
boolean result;
try {
@@ -307,8 +303,6 @@ public class ConnectorController extends
@PreAuthorize("hasRole('CONNECTOR_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE")
public BulkActionRes bulk(final BulkAction bulkAction) {
- LOG.debug("Bulk '{}' called on '{}'", bulkAction.getOperation(), bulkAction.getTargets());
-
BulkActionRes res = new BulkActionRes();
if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
@@ -329,8 +323,9 @@ public class ConnectorController extends
* {@inheritDoc}
*/
@Override
- protected ConnInstanceTO resolveReference(final Method method, final Object... args) throws
- UnresolvedReferenceException {
+ protected ConnInstanceTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
Long id = null;
if (ArrayUtils.isNotEmpty(args)) {
Copied: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java (from r1544553, syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java)
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java?p2=syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java&p1=syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java&r1=1544553&r2=1544573&rev=1544573&view=diff
==============================================================================
--- syncope/branches/1_1_X/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ControllerHandler.java Fri Nov 22 15:28:45 2013
@@ -45,7 +45,7 @@ public class ControllerHandler {
@Autowired
private AuditManager auditManager;
- @Around("within(@org.springframework.stereotype.Controller *)")
+ @Around("execution(* org.apache.syncope.core.rest.controller.AbstractController+.*(..))")
public Object around(final ProceedingJoinPoint joinPoint) throws Throwable {
final Class<?> clazz = joinPoint.getTarget().getClass();
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/NotificationController.java Fri Nov 22 15:28:45 2013
@@ -66,14 +66,11 @@ public class NotificationController exte
@PreAuthorize("hasRole('NOTIFICATION_CREATE')")
public NotificationTO create(final NotificationTO notificationTO) {
- LOG.debug("Notification create called with parameter {}", notificationTO);
return binder.getNotificationTO(notificationDAO.save(binder.createNotification(notificationTO)));
}
@PreAuthorize("hasRole('NOTIFICATION_UPDATE')")
public NotificationTO update(final NotificationTO notificationTO) {
- LOG.debug("ConnNotificationtor update called with parameter {}", notificationTO);
-
Notification notification = notificationDAO.find(notificationTO.getId());
if (notification == null) {
LOG.error("Could not find notification '" + notificationTO.getId() + "'");
@@ -106,6 +103,7 @@ public class NotificationController exte
@Override
protected NotificationTO resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
+
Long id = null;
if (ArrayUtils.isNotEmpty(args)) {
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/PolicyController.java Fri Nov 22 15:28:45 2013
@@ -54,12 +54,10 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_CREATE')")
public <T extends AbstractPolicyTO> T create(final T policyTO) {
- LOG.debug("Creating policy " + policyTO);
return binder.getPolicyTO(policyDAO.save(binder.getPolicy(null, policyTO)));
}
private <T extends AbstractPolicyTO, K extends Policy> T update(final T policyTO, final K policy) {
- LOG.debug("Updating policy " + policyTO);
binder.getPolicy(policy, policyTO);
K savedPolicy = policyDAO.save(policy);
return binder.getPolicyTO(savedPolicy);
@@ -98,7 +96,6 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_LIST')")
@SuppressWarnings("unchecked")
public <T extends AbstractPolicyTO> List<T> list(final PolicyType type) {
- LOG.debug("Listing policies");
List<? extends Policy> policies = policyDAO.find(type);
@@ -112,8 +109,6 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_READ')")
public PasswordPolicyTO getGlobalPasswordPolicy() {
- LOG.debug("Reading global password policy");
-
PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
if (policy == null) {
throw new NotFoundException("No password policy found");
@@ -124,8 +119,6 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_READ')")
public AccountPolicyTO getGlobalAccountPolicy() {
- LOG.debug("Reading global account policy");
-
AccountPolicy policy = policyDAO.getGlobalAccountPolicy();
if (policy == null) {
throw new NotFoundException("No account policy found");
@@ -136,8 +129,6 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_READ')")
public SyncPolicyTO getGlobalSyncPolicy() {
- LOG.debug("Reading global sync policy");
-
SyncPolicy policy = policyDAO.getGlobalSyncPolicy();
if (policy == null) {
throw new NotFoundException("No sync policy found");
@@ -148,8 +139,6 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_READ')")
public <T extends AbstractPolicyTO> T read(final Long id) {
- LOG.debug("Reading policy with id {}", id);
-
Policy policy = policyDAO.find(id);
if (policy == null) {
throw new NotFoundException("Policy " + id + " not found");
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java Fri Nov 22 15:28:45 2013
@@ -83,8 +83,6 @@ public class ReportController extends Ab
@PreAuthorize("hasRole('REPORT_CREATE')")
public ReportTO create(final ReportTO reportTO) {
- LOG.debug("Creating report " + reportTO);
-
Report report = new Report();
binder.getReport(report, reportTO);
report = reportDAO.save(report);
@@ -104,8 +102,6 @@ public class ReportController extends Ab
@PreAuthorize("hasRole('REPORT_UPDATE')")
public ReportTO update(final ReportTO reportTO) {
- LOG.debug("Report update called with parameter {}", reportTO);
-
Report report = reportDAO.find(reportTO.getId());
if (report == null) {
throw new NotFoundException("Report " + reportTO.getId());
@@ -190,8 +186,6 @@ public class ReportController extends Ab
public void exportExecutionResult(final OutputStream os, final ReportExec reportExec,
final ReportExecExportFormat format) {
- LOG.debug("Exporting result of {} as {}", reportExec, format);
-
// streaming SAX handler from a compressed byte array stream
ByteArrayInputStream bais = new ByteArrayInputStream(reportExec.getExecResult());
ZipInputStream zis = new ZipInputStream(bais);
@@ -277,10 +271,6 @@ public class ReportController extends Ab
throw new NotFoundException("Report " + reportId);
}
- ReportExecTO result;
-
- LOG.debug("Triggering new execution of report {}", report);
-
try {
jobInstanceLoader.registerJob(report);
@@ -294,7 +284,7 @@ public class ReportController extends Ab
throw sce;
}
- result = new ReportExecTO();
+ ReportExecTO result = new ReportExecTO();
result.setReport(reportId);
result.setStartDate(new Date());
result.setStatus(ReportExecStatus.STARTED.name());
@@ -332,8 +322,9 @@ public class ReportController extends Ab
* {@inheritDoc}
*/
@Override
- protected ReportTO resolveReference(final Method method, final Object... args) throws
- UnresolvedReferenceException {
+ protected ReportTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
Long id = null;
if (ArrayUtils.isNotEmpty(args) && ("create".equals(method.getName())
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ResourceController.java Fri Nov 22 15:28:45 2013
@@ -91,8 +91,6 @@ public class ResourceController extends
@PreAuthorize("hasRole('RESOURCE_CREATE')")
public ResourceTO create(final ResourceTO resourceTO) {
- LOG.debug("Resource creation: {}", resourceTO);
-
if (StringUtils.isBlank(resourceTO.getName())) {
SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
sce.getElements().add("Resource name");
@@ -110,8 +108,6 @@ public class ResourceController extends
@PreAuthorize("hasRole('RESOURCE_UPDATE')")
public ResourceTO update(final ResourceTO resourceTO) {
- LOG.debug("Role update request: {}", resourceTO);
-
ExternalResource resource = resourceDAO.find(resourceTO.getName());
if (resource == null) {
throw new NotFoundException("Resource '" + resourceTO.getName() + "'");
@@ -251,8 +247,6 @@ public class ResourceController extends
@PreAuthorize("hasRole('RESOURCE_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE")
public BulkActionRes bulk(final BulkAction bulkAction) {
- LOG.debug("Bulk '{}' called on '{}'", bulkAction.getOperation(), bulkAction.getTargets());
-
BulkActionRes res = new BulkActionRes();
if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
@@ -273,8 +267,9 @@ public class ResourceController extends
* {@inheritDoc}
*/
@Override
- protected ResourceTO resolveReference(final Method method, final Object... args) throws
- UnresolvedReferenceException {
+ protected ResourceTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
String name = null;
if (ArrayUtils.isNotEmpty(args)) {
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/RoleController.java Fri Nov 22 15:28:45 2013
@@ -51,22 +51,21 @@ import org.apache.syncope.core.util.Attr
import org.apache.syncope.core.util.EntitlementUtil;
import org.apache.syncope.core.workflow.WorkflowResult;
import org.apache.syncope.core.workflow.role.RoleWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+/**
+ * Note that this controller does not extend AbstractTransactionalController, hence does not provide any
+ * Spring's Transactional logic at class level.
+ *
+ * @see AbstractTransactionalController
+ */
@Component
public class RoleController extends AbstractResourceAssociator<RoleTO> {
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(RoleController.class);
-
@Autowired
protected RoleDAO roleDAO;
@@ -175,7 +174,7 @@ public class RoleController extends Abst
}
@PreAuthorize("hasRole('ROLE_READ')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public List<RoleTO> search(final NodeCond searchCondition)
throws InvalidSearchConditionException {
@@ -183,12 +182,10 @@ public class RoleController extends Abst
}
@PreAuthorize("hasRole('ROLE_READ')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public List<RoleTO> search(final NodeCond searchCondition, final int page, final int size)
throws InvalidSearchConditionException {
- LOG.debug("Role search called with condition {}", searchCondition);
-
if (!searchCondition.isValid()) {
LOG.error("Invalid search condition: {}", searchCondition);
throw new InvalidSearchConditionException();
@@ -207,7 +204,7 @@ public class RoleController extends Abst
}
@PreAuthorize("hasRole('ROLE_READ')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public int searchCount(final NodeCond searchCondition)
throws InvalidSearchConditionException {
@@ -235,8 +232,6 @@ public class RoleController extends Abst
@PreAuthorize("hasRole('ROLE_CREATE')")
public RoleTO create(final RoleTO roleTO) {
- LOG.debug("Role create called with parameters {}", roleTO);
-
// Check that this operation is allowed to be performed by caller
Set<Long> allowedRoleIds = EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames());
if (roleTO.getParent() != 0 && !allowedRoleIds.contains(roleTO.getParent())) {
@@ -266,18 +261,13 @@ public class RoleController extends Abst
final RoleTO savedTO = binder.getRoleTO(created.getResult());
savedTO.getPropagationStatusTOs().addAll(propagationReporter.getStatuses());
-
- LOG.debug("About to return created role\n{}", savedTO);
-
return savedTO;
}
@PreAuthorize("hasRole('ROLE_UPDATE')")
public RoleTO update(final RoleMod roleMod) {
- LOG.debug("Role update called with {}", roleMod);
-
// Check that this operation is allowed to be performed by caller
- SyncopeRole role = binder.getRoleFromId(roleMod.getId());
+ binder.getRoleFromId(roleMod.getId());
// Attribute value transformation (if configured)
RoleMod actual = attrTransformer.transform(roleMod);
@@ -300,16 +290,11 @@ public class RoleController extends Abst
}
final RoleTO updatedTO = binder.getRoleTO(updated.getResult());
updatedTO.getPropagationStatusTOs().addAll(propagationReporter.getStatuses());
-
- LOG.debug("About to return updated role\n{}", updatedTO);
-
return updatedTO;
}
@PreAuthorize("hasRole('ROLE_DELETE')")
public RoleTO delete(final Long roleId) {
- LOG.debug("Role delete called for {}", roleId);
-
List<SyncopeRole> ownedRoles = roleDAO.findOwnedByRole(roleId);
if (!ownedRoles.isEmpty()) {
List<String> owned = new ArrayList<String>(ownedRoles.size());
@@ -347,17 +332,13 @@ public class RoleController extends Abst
rwfAdapter.delete(roleId);
- LOG.debug("Role successfully deleted: {}", roleId);
-
return roleTO;
}
@PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
@Override
public RoleTO unlink(final Long roleId, final Collection<String> resources) {
- LOG.debug("About to unlink role({}) and resources {}", roleId, resources);
-
final RoleMod roleMod = new RoleMod();
roleMod.setId(roleId);
@@ -365,19 +346,13 @@ public class RoleController extends Abst
final WorkflowResult<Long> updated = rwfAdapter.update(roleMod);
- final RoleTO updatedTO = binder.getRoleTO(updated.getResult());
-
- LOG.debug("About to return updated role\n{}", updatedTO);
-
- return updatedTO;
+ return binder.getRoleTO(updated.getResult());
}
@PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
@Override
public RoleTO unassign(final Long roleId, final Collection<String> resources) {
- LOG.debug("About to unassign role({}) and resources {}", roleId, resources);
-
final RoleMod roleMod = new RoleMod();
roleMod.setId(roleId);
roleMod.getResourcesToRemove().addAll(resources);
@@ -386,11 +361,9 @@ public class RoleController extends Abst
}
@PreAuthorize("hasRole('ROLE_UPDATE')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
@Override
public RoleTO deprovision(final Long roleId, final Collection<String> resources) {
- LOG.debug("About to deprovision role({}) from resources {}", roleId, resources);
-
final SyncopeRole role = binder.getRoleFromId(roleId);
final Set<String> noPropResourceName = role.getResourceNames();
@@ -408,9 +381,6 @@ public class RoleController extends Abst
final RoleTO updatedTO = binder.getRoleTO(role);
updatedTO.getPropagationStatusTOs().addAll(propagationReporter.getStatuses());
-
- LOG.debug("About to return updated role\n{}", updatedTO);
-
return updatedTO;
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/SchemaController.java Fri Nov 22 15:28:45 2013
@@ -274,6 +274,7 @@ public class SchemaController extends Ab
@Override
protected SchemaTO resolveReference(final Method method, final Object... args)
throws UnresolvedReferenceException {
+
String kind = null;
String name = null;
if (ArrayUtils.isNotEmpty(args)) {
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/TaskController.java Fri Nov 22 15:28:45 2013
@@ -87,8 +87,6 @@ public class TaskController extends Abst
@PreAuthorize("hasRole('TASK_CREATE')")
public <T extends SchedTaskTO> T createSchedTask(final T taskTO) {
- LOG.debug("Creating task " + taskTO);
-
TaskUtil taskUtil = TaskUtil.getInstance(taskTO);
SchedTask task = binder.createSchedTask(taskTO, taskUtil);
@@ -114,8 +112,6 @@ public class TaskController extends Abst
@PreAuthorize("hasRole('TASK_UPDATE')")
public <T extends SchedTaskTO> T updateSched(final SchedTaskTO taskTO) {
- LOG.debug("Task update called with parameter {}", taskTO);
-
SchedTask task = taskDAO.find(taskTO.getId());
if (task == null) {
throw new NotFoundException("Task " + taskTO.getId());
@@ -175,7 +171,7 @@ public class TaskController extends Abst
@PreAuthorize("hasRole('TASK_LIST')")
public Set<String> getJobClasses() {
return classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.TASKJOB);
- }
+ }
@PreAuthorize("hasRole('TASK_LIST')")
public Set<String> getSyncActionsClasses() {
@@ -189,7 +185,7 @@ public class TaskController extends Abst
throw new NotFoundException("Task " + taskId);
}
return binder.getTaskTO(task, TaskUtil.getInstance(task));
-}
+ }
@PreAuthorize("hasRole('TASK_READ')")
public TaskExecTO readExecution(final Long executionId) {
@@ -209,7 +205,6 @@ public class TaskController extends Abst
TaskUtil taskUtil = TaskUtil.getInstance(task);
TaskExecTO result = null;
- LOG.debug("Execution started for {}", task);
switch (taskUtil.getType()) {
case PROPAGATION:
final TaskExec propExec = taskExecutor.execute((PropagationTask) task);
@@ -250,7 +245,7 @@ public class TaskController extends Abst
default:
}
- LOG.debug("Execution finished for {}, {}", task, result);
+
return result;
}
@@ -332,8 +327,6 @@ public class TaskController extends Abst
+ "(#bulkAction.operation == #bulkAction.operation.EXECUTE or "
+ "#bulkAction.operation == #bulkAction.operation.DRYRUN))")
public BulkActionRes bulk(final BulkAction bulkAction) {
- LOG.debug("Bulk '{}' called on '{}'", bulkAction.getOperation(), bulkAction.getTargets());
-
BulkActionRes res = new BulkActionRes();
switch (bulkAction.getOperation()) {
@@ -382,12 +375,14 @@ public class TaskController extends Abst
* {@inheritDoc}
*/
@Override
- protected AbstractTaskTO resolveReference(final Method method, final Object... args) throws
- UnresolvedReferenceException {
+ protected AbstractTaskTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
Long id = null;
if (ArrayUtils.isNotEmpty(args)
&& !"deleteExecution".equals(method.getName()) && !"readExecution".equals(method.getName())) {
+
for (int i = 0; id == null && i < args.length; i++) {
if (args[i] instanceof Long) {
id = (Long) args[i];
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnauthorizedRoleException.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnauthorizedRoleException.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnauthorizedRoleException.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnauthorizedRoleException.java Fri Nov 22 15:28:45 2013
@@ -23,9 +23,9 @@ import java.util.Set;
public class UnauthorizedRoleException extends RuntimeException {
- private static final long serialVersionUID = 7540587364235915081L;
-
- private final Set<Long> roleIds;
+ private static final long serialVersionUID = 7540587364235915081L;
+
+ private final Set<Long> roleIds;
public UnauthorizedRoleException(final Set<Long> roleIds) {
super("Missing entitlement for role(s) " + roleIds);
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UnresolvedReferenceException.java Fri Nov 22 15:28:45 2013
@@ -1,17 +1,20 @@
/*
- * Copyright 2013 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * 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
*
- * 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.
+ * 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.core.rest.controller;
@@ -23,6 +26,7 @@ public class UnresolvedReferenceExceptio
private static final long serialVersionUID = -675489116009955632L;
public UnresolvedReferenceException() {
+ super();
}
public UnresolvedReferenceException(Throwable cause) {
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserController.java Fri Nov 22 15:28:45 2013
@@ -57,27 +57,20 @@ import org.apache.syncope.core.util.Attr
import org.apache.syncope.core.util.EntitlementUtil;
import org.apache.syncope.core.workflow.WorkflowResult;
import org.apache.syncope.core.workflow.user.UserWorkflowAdapter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
- * Note that this controller does not extend AbstractController, hence does not provide any Spring's Transactional logic
- * at class level.
+ * Note that this controller does not extend AbstractTransactionalController, hence does not provide any
+ * Spring's Transactional logic at class level.
*
- * @see AbstractController
+ * @see AbstractTransactionalController
*/
@Component
public class UserController extends AbstractResourceAssociator<UserTO> {
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(UserController.class);
-
@Autowired
protected UserDAO userDAO;
@@ -120,13 +113,13 @@ public class UserController extends Abst
}
@PreAuthorize("hasRole('USER_LIST')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public int count() {
return userDAO.count(EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames()));
}
@PreAuthorize("hasRole('USER_READ')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public int searchCount(final NodeCond searchCondition) throws InvalidSearchConditionException {
if (!searchCondition.isValid()) {
LOG.error("Invalid search condition: {}", searchCondition);
@@ -138,7 +131,7 @@ public class UserController extends Abst
}
@PreAuthorize("hasRole('USER_LIST')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public List<UserTO> list() {
List<SyncopeUser> users = userDAO.findAll(
EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames()));
@@ -152,7 +145,7 @@ public class UserController extends Abst
}
@PreAuthorize("hasRole('USER_LIST')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public List<UserTO> list(final int page, final int size) {
Set<Long> adminRoleIds = EntitlementUtil.getRoleIds(EntitlementUtil.getOwnedEntitlementNames());
@@ -173,13 +166,13 @@ public class UserController extends Abst
}
@PreAuthorize("hasRole('USER_READ')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public UserTO read(final Long userId) {
return binder.getUserTO(userId);
}
@PreAuthorize("hasRole('USER_READ')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public List<UserTO> search(final NodeCond searchCondition)
throws InvalidSearchConditionException {
@@ -187,12 +180,10 @@ public class UserController extends Abst
}
@PreAuthorize("hasRole('USER_READ')")
- @Transactional(readOnly = true, rollbackFor = {Throwable.class})
+ @Transactional(readOnly = true, rollbackFor = { Throwable.class })
public List<UserTO> search(final NodeCond searchCondition, final int page, final int size)
throws InvalidSearchConditionException {
- LOG.debug("User search called with condition {}", searchCondition);
-
if (!searchCondition.isValid()) {
LOG.error("Invalid search condition: {}", searchCondition);
throw new InvalidSearchConditionException();
@@ -222,8 +213,6 @@ public class UserController extends Abst
@PreAuthorize("hasRole('USER_CREATE')")
public UserTO create(final UserTO userTO) {
- LOG.debug("User create called with {}", userTO);
-
Set<Long> requestRoleIds = new HashSet<Long>(userTO.getMemberships().size());
for (MembershipTO membership : userTO.getMemberships()) {
requestRoleIds.add(membership.getRoleId());
@@ -260,9 +249,6 @@ public class UserController extends Abst
final UserTO savedTO = binder.getUserTO(created.getResult().getKey());
savedTO.getPropagationStatusTOs().addAll(propagationReporter.getStatuses());
-
- LOG.debug("About to return created user\n{}", savedTO);
-
return savedTO;
}
@@ -280,8 +266,6 @@ public class UserController extends Abst
@PreAuthorize("hasRole('USER_UPDATE')")
public UserTO update(final UserMod userMod) {
- LOG.debug("User update called with {}", userMod);
-
// AttributableMod transformation (if configured)
UserMod actual = attrTransformer.transform(userMod);
LOG.debug("Transformed: {}", actual);
@@ -303,9 +287,6 @@ public class UserController extends Abst
final UserTO updatedTO = binder.getUserTO(updated.getResult().getKey().getId());
updatedTO.getPropagationStatusTOs().addAll(propagationReporter.getStatuses());
-
- LOG.debug("About to return updated user\n{}", updatedTO);
-
return updatedTO;
}
@@ -332,10 +313,8 @@ public class UserController extends Abst
}
@PreAuthorize("hasRole('USER_UPDATE')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
public UserTO status(final StatusMod statusMod) {
- LOG.debug("About to mod status {}", statusMod);
-
SyncopeUser user = binder.getUserFromId(statusMod.getId());
WorkflowResult<Long> updated;
@@ -362,9 +341,6 @@ public class UserController extends Abst
final UserTO savedTO = binder.getUserTO(updated.getResult());
savedTO.getPropagationStatusTOs().addAll(propReporter.getStatuses());
-
- LOG.debug("About to return updated user\n{}", savedTO);
-
return savedTO;
}
@@ -378,8 +354,6 @@ public class UserController extends Abst
@PreAuthorize("hasRole('USER_DELETE')")
public UserTO delete(final Long userId) {
- LOG.debug("User delete called for {}", userId);
-
List<SyncopeRole> ownedRoles = roleDAO.findOwnedByUser(userId);
if (!ownedRoles.isEmpty()) {
List<String> owned = new ArrayList<String>(ownedRoles.size());
@@ -397,7 +371,6 @@ public class UserController extends Abst
// information could only be available after uwfAdapter.delete(), which
// will also effectively remove user from db, thus making virtually
// impossible by NotificationManager to fetch required user information
-
List<PropagationTask> tasks = propagationManager.getUserDeleteTaskIds(userId);
PropagationReporter propagationReporter = ApplicationContextProvider.getApplicationContext().
@@ -421,8 +394,6 @@ public class UserController extends Abst
}
deletedTO.getPropagationStatusTOs().addAll(propagationReporter.getStatuses());
- LOG.debug("User successfully deleted: {}", userId);
-
return deletedTO;
}
@@ -431,8 +402,6 @@ public class UserController extends Abst
+ "(#bulkAction.operation == #bulkAction.operation.REACTIVATE or "
+ "#bulkAction.operation == #bulkAction.operation.SUSPEND))")
public BulkActionRes bulk(final BulkAction bulkAction) {
- LOG.debug("Bulk '{}' called on '{}'", bulkAction.getOperation(), bulkAction.getTargets());
-
BulkActionRes res = new BulkActionRes();
switch (bulkAction.getOperation()) {
@@ -482,11 +451,9 @@ public class UserController extends Abst
}
@PreAuthorize("hasRole('USER_UPDATE')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
@Override
public UserTO unlink(final Long userId, final Collection<String> resources) {
- LOG.debug("About to unlink user({}) and resources {}", userId, resources);
-
final UserMod userMod = new UserMod();
userMod.setId(userId);
@@ -494,19 +461,13 @@ public class UserController extends Abst
WorkflowResult<Map.Entry<UserMod, Boolean>> updated = uwfAdapter.update(userMod);
- final UserTO updatedTO = binder.getUserTO(updated.getResult().getKey().getId());
-
- LOG.debug("About to return updated user\n{}", updatedTO);
-
- return updatedTO;
+ return binder.getUserTO(updated.getResult().getKey().getId());
}
@PreAuthorize("hasRole('USER_UPDATE')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
@Override
public UserTO unassign(final Long userId, final Collection<String> resources) {
- LOG.debug("About to unassign user({}) and resources {}", userId, resources);
-
final UserMod userMod = new UserMod();
userMod.setId(userId);
userMod.getResourcesToRemove().addAll(resources);
@@ -515,11 +476,9 @@ public class UserController extends Abst
}
@PreAuthorize("hasRole('USER_UPDATE')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
@Override
public UserTO deprovision(final Long userId, final Collection<String> resources) {
- LOG.debug("About to deprovision user({}) from resources {}", userId, resources);
-
final SyncopeUser user = binder.getUserFromId(userId);
final Set<String> noPropResourceName = user.getResourceNames();
@@ -537,9 +496,6 @@ public class UserController extends Abst
final UserTO updatedUserTO = binder.getUserTO(user);
updatedUserTO.getPropagationStatusTOs().addAll(propagationReporter.getStatuses());
-
- LOG.debug("About to return updated user\n{}", updatedUserTO);
-
return updatedUserTO;
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserWorkflowController.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserWorkflowController.java?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserWorkflowController.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/UserWorkflowController.java Fri Nov 22 15:28:45 2013
@@ -55,16 +55,13 @@ public class UserWorkflowController exte
protected UserDataBinder binder;
@PreAuthorize("hasRole('WORKFLOW_FORM_CLAIM')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
public WorkflowFormTO claimForm(final String taskId) {
- return uwfAdapter.claimForm(taskId,
- SecurityContextHolder.getContext().getAuthentication().getName());
+ return uwfAdapter.claimForm(taskId, SecurityContextHolder.getContext().getAuthentication().getName());
}
@PreAuthorize("hasRole('USER_UPDATE')")
public UserTO executeWorkflow(final UserTO userTO, final String taskId) {
- LOG.debug("About to execute {} on {}", taskId, userTO.getId());
-
WorkflowResult<Long> updated = uwfAdapter.execute(userTO, taskId);
UserMod userMod = new UserMod();
@@ -72,43 +69,37 @@ public class UserWorkflowController exte
List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<UserMod, Boolean>(userMod, null),
- updated.getPropByRes(), updated.getPerformedTasks()));
+ new AbstractMap.SimpleEntry<UserMod, Boolean>(userMod, null),
+ updated.getPropByRes(), updated.getPerformedTasks()));
taskExecutor.execute(tasks);
- final UserTO savedTO = binder.getUserTO(updated.getResult());
-
- LOG.debug("About to return updated user\n{}", savedTO);
-
- return savedTO;
+ return binder.getUserTO(updated.getResult());
}
@PreAuthorize("hasRole('WORKFLOW_FORM_READ') and hasRole('USER_READ')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
public WorkflowFormTO getFormForUser(final Long userId) {
SyncopeUser user = binder.getUserFromId(userId);
return uwfAdapter.getForm(user.getWorkflowId());
}
@PreAuthorize("hasRole('WORKFLOW_FORM_LIST')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
public List<WorkflowFormTO> getForms() {
return uwfAdapter.getForms();
}
@PreAuthorize("hasRole('WORKFLOW_FORM_READ') and hasRole('USER_READ')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
public List<WorkflowFormTO> getForms(final Long userId, final String formName) {
SyncopeUser user = binder.getUserFromId(userId);
return uwfAdapter.getForms(user.getWorkflowId(), formName);
}
@PreAuthorize("hasRole('WORKFLOW_FORM_SUBMIT')")
- @Transactional(rollbackFor = {Throwable.class})
+ @Transactional(rollbackFor = { Throwable.class })
public UserTO submitForm(final WorkflowFormTO form) {
- LOG.debug("About to process form {}", form);
-
WorkflowResult<? extends AbstractAttributableMod> updated =
uwfAdapter.submitForm(form, SecurityContextHolder.getContext().getAuthentication().getName());
@@ -119,18 +110,14 @@ public class UserWorkflowController exte
List<PropagationTask> tasks = propagationManager.getUserUpdateTaskIds(
new WorkflowResult<Map.Entry<UserMod, Boolean>>(
- new AbstractMap.SimpleEntry<UserMod, Boolean>((UserMod) updated.getResult(), Boolean.TRUE),
- updated.getPropByRes(),
- updated.getPerformedTasks()));
+ new AbstractMap.SimpleEntry<UserMod, Boolean>((UserMod) updated.getResult(), Boolean.TRUE),
+ updated.getPropByRes(),
+ updated.getPerformedTasks()));
taskExecutor.execute(tasks);
}
- final UserTO savedTO = binder.getUserTO(updated.getResult().getId());
-
- LOG.debug("About to return user after form processing\n{}", savedTO);
-
- return savedTO;
+ return binder.getUserTO(updated.getResult().getId());
}
@Override
Modified: syncope/trunk/core/src/main/resources/restContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/restContext.xml?rev=1544573&r1=1544572&r2=1544573&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/restContext.xml (original)
+++ syncope/trunk/core/src/main/resources/restContext.xml Fri Nov 22 15:28:45 2013
@@ -39,11 +39,10 @@ under the License.
<aop:aspectj-autoproxy/>
<context:component-scan base-package="org.apache.syncope.core.rest.controller"/>
+ <bean class="org.apache.syncope.core.rest.controller.ControllerHandler"/>
<!-- CXF Configuration - BEGIN -->
- <context:component-scan base-package="org.apache.syncope.core.services"/>
-
- <bean id="controllerHandler" name="controllerHandler" class="org.apache.syncope.core.services.ControllerHandler" />
+ <context:component-scan base-package="org.apache.syncope.core.services"/>
<bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
<property name="namespacePrefixes">