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 2012/03/15 11:17:24 UTC
svn commit: r1300882 [15/22] - in /incubator/syncope/trunk:
build-tools/src/main/java/org/syncope/buildtools/
client/src/main/java/org/syncope/annotation/
client/src/main/java/org/syncope/client/
client/src/main/java/org/syncope/client/http/ client/src...
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/propagation/PropagationManager.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/propagation/PropagationManager.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/propagation/PropagationManager.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/propagation/PropagationManager.java Thu Mar 15 10:17:12 2012
@@ -79,16 +79,13 @@ import org.syncope.types.TraceLevel;
/**
* Manage the data propagation to external resources.
*/
-@Transactional(rollbackFor = {
- Throwable.class
-})
+@Transactional(rollbackFor = { Throwable.class })
public class PropagationManager {
/**
* Logger.
*/
- protected static final Logger LOG =
- LoggerFactory.getLogger(PropagationManager.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(PropagationManager.class);
/**
* Connector instance loader.
@@ -138,8 +135,7 @@ public class PropagationManager {
@Autowired
private JexlUtil jexlUtil;
- private SyncopeUser getSyncopeUser(final Long userId)
- throws NotFoundException {
+ private SyncopeUser getSyncopeUser(final Long userId) throws NotFoundException {
SyncopeUser user = userDAO.find(userId);
if (user == null) {
@@ -158,11 +154,8 @@ public class PropagationManager {
* @return list of propagation tasks
* @throws NotFoundException if userId is not found
*/
- public List<PropagationTask> getCreateTaskIds(
- final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
- final String password,
- final List<AttributeTO> vAttrs)
- throws NotFoundException {
+ public List<PropagationTask> getCreateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
+ final String password, final List<AttributeTO> vAttrs) throws NotFoundException {
return getCreateTaskIds(wfResult, password, vAttrs, null);
}
@@ -177,11 +170,8 @@ public class PropagationManager {
* @return list of propagation tasks.
* @throws NotFoundException if userId is not found.
*/
- public List<PropagationTask> getCreateTaskIds(
- final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
- final String password,
- final List<AttributeTO> vAttrs,
- final Set<String> syncResourceNames)
+ public List<PropagationTask> getCreateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
+ final String password, final List<AttributeTO> vAttrs, final Set<String> syncResourceNames)
throws NotFoundException {
SyncopeUser user = getSyncopeUser(wfResult.getResult().getKey());
@@ -211,14 +201,10 @@ public class PropagationManager {
* @return list of propagation tasks
* @throws NotFoundException if userId is not found
*/
- public List<PropagationTask> getUpdateTaskIds(
- final SyncopeUser user,
- final Boolean enable,
- final Set<String> syncResourceNames)
- throws NotFoundException {
+ public List<PropagationTask> getUpdateTaskIds(final SyncopeUser user, final Boolean enable,
+ final Set<String> syncResourceNames) throws NotFoundException {
- return getUpdateTaskIds(
- user, // SyncopeUser to be updated on external resources
+ return getUpdateTaskIds(user, // SyncopeUser to be updated on external resources
null, // no propagation by resources
null, // no password
null, // no virtual attributes to be managed
@@ -234,8 +220,7 @@ public class PropagationManager {
* @return list of propagation tasks
* @throws NotFoundException if userId is not found
*/
- public List<PropagationTask> getUpdateTaskIds(
- final WorkflowResult<Map.Entry<Long, Boolean>> wfResult)
+ public List<PropagationTask> getUpdateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult)
throws NotFoundException {
return getUpdateTaskIds(wfResult, null, null, null, null);
@@ -251,11 +236,8 @@ public class PropagationManager {
* @return list of propagation tasks.
* @throws NotFoundException if userId is not found.
*/
- public List<PropagationTask> getUpdateTaskIds(
- final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
- final String password,
- final Set<String> vAttrsToBeRemoved,
- final Set<AttributeMod> vAttrsToBeUpdated)
+ public List<PropagationTask> getUpdateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
+ final String password, final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated)
throws NotFoundException {
return getUpdateTaskIds(wfResult, password, vAttrsToBeRemoved, vAttrsToBeUpdated, null);
@@ -273,41 +255,25 @@ public class PropagationManager {
* @return list of propagation tasks.
* @throws NotFoundException if userId is not found.
*/
- public List<PropagationTask> getUpdateTaskIds(
- final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
- final String password,
- final Set<String> vAttrsToBeRemoved,
- final Set<AttributeMod> vAttrsToBeUpdated,
- final Set<String> syncResourceNames)
- throws NotFoundException {
+ public List<PropagationTask> getUpdateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
+ final String password, final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated,
+ final Set<String> syncResourceNames) throws NotFoundException {
SyncopeUser user = getSyncopeUser(wfResult.getResult().getKey());
- return getUpdateTaskIds(
- user,
- wfResult.getPropByRes(),
- password,
- vAttrsToBeRemoved,
- vAttrsToBeUpdated,
- wfResult.getResult().getValue(),
- syncResourceNames);
+ return getUpdateTaskIds(user, wfResult.getPropByRes(), password, vAttrsToBeRemoved, vAttrsToBeUpdated, wfResult
+ .getResult().getValue(), syncResourceNames);
}
- private List<PropagationTask> getUpdateTaskIds(
- final SyncopeUser user,
- final PropagationByResource propByRes,
- final String password,
- final Set<String> vAttrsToBeRemoved,
- final Set<AttributeMod> vAttrsToBeUpdated,
- final Boolean enable,
- final Set<String> syncResourceNames)
- throws NotFoundException {
-
- PropagationByResource localPropByRes = userDataBinder.fillVirtual(
- user,
- vAttrsToBeRemoved == null ? Collections.EMPTY_SET : vAttrsToBeRemoved,
- vAttrsToBeUpdated == null ? Collections.EMPTY_SET : vAttrsToBeUpdated,
- AttributableUtil.getInstance(AttributableType.USER));
+ private List<PropagationTask> getUpdateTaskIds(final SyncopeUser user, final PropagationByResource propByRes,
+ final String password, final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated,
+ final Boolean enable, final Set<String> syncResourceNames) throws NotFoundException {
+
+ PropagationByResource localPropByRes = userDataBinder.fillVirtual(user, vAttrsToBeRemoved == null
+ ? Collections.EMPTY_SET
+ : vAttrsToBeRemoved, vAttrsToBeUpdated == null
+ ? Collections.EMPTY_SET
+ : vAttrsToBeUpdated, AttributableUtil.getInstance(AttributableType.USER));
if (propByRes != null && !propByRes.isEmpty()) {
localPropByRes.merge(propByRes);
@@ -333,8 +299,7 @@ public class PropagationManager {
* @return list of propagation tasks
* @throws NotFoundException if user is not found
*/
- public List<PropagationTask> getDeleteTaskIds(final Long userId)
- throws NotFoundException {
+ public List<PropagationTask> getDeleteTaskIds(final Long userId) throws NotFoundException {
return getDeleteTaskIds(userId, null);
}
@@ -349,8 +314,7 @@ public class PropagationManager {
* @return list of propagation tasks
* @throws NotFoundException if user is not found
*/
- public List<PropagationTask> getDeleteTaskIds(final Long userId,
- final String syncResourceName)
+ public List<PropagationTask> getDeleteTaskIds(final Long userId, final String syncResourceName)
throws NotFoundException {
SyncopeUser user = getSyncopeUser(userId);
@@ -373,11 +337,8 @@ public class PropagationManager {
* @return account link + prepare attributes
* @throws ClassNotFoundException if schema type for given mapping does not exists in current class loader
*/
- private Map.Entry<String, Attribute> prepareAttribute(
- final SchemaMapping mapping,
- final SyncopeUser user,
- final String password)
- throws ClassNotFoundException {
+ private Map.Entry<String, Attribute> prepareAttribute(final SchemaMapping mapping, final SyncopeUser user,
+ final String password) throws ClassNotFoundException {
final List<AbstractAttributable> attributables = new ArrayList<AbstractAttributable>();
@@ -397,25 +358,23 @@ public class PropagationManager {
default:
}
- final Entry<AbstractSchema, List<AbstractAttrValue>> entry =
- SchemaMappingUtil.getIntValues(mapping, attributables, password, schemaDAO);
+ final Entry<AbstractSchema, List<AbstractAttrValue>> entry = SchemaMappingUtil.getIntValues(mapping,
+ attributables, password, schemaDAO);
final List<AbstractAttrValue> values = entry.getValue();
final AbstractSchema schema = entry.getKey();
- final SchemaType schemaType = schema == null ? SchemaType.String : schema.getType();
+ final SchemaType schemaType = schema == null
+ ? SchemaType.String
+ : schema.getType();
final String extAttrName = SchemaMappingUtil.getExtAttrName(mapping);
- LOG.debug("Define mapping for: "
- + "\n* ExtAttrName " + extAttrName
- + "\n* is accountId " + mapping.isAccountid()
- + "\n* is password "
+ LOG.debug("Define mapping for: " + "\n* ExtAttrName " + extAttrName + "\n* is accountId "
+ + mapping.isAccountid() + "\n* is password "
+ (mapping.isPassword() || mapping.getIntMappingType().equals(IntMappingType.Password))
- + "\n* mandatory condition " + mapping.getMandatoryCondition()
- + "\n* Schema " + mapping.getIntAttrName()
- + "\n* IntMappingType " + mapping.getIntMappingType().toString()
- + "\n* ClassType " + schemaType.getClassName()
- + "\n* Values " + values);
+ + "\n* mandatory condition " + mapping.getMandatoryCondition() + "\n* Schema "
+ + mapping.getIntAttrName() + "\n* IntMappingType " + mapping.getIntMappingType().toString()
+ + "\n* ClassType " + schemaType.getClassName() + "\n* Values " + values);
List<Object> objValues = new ArrayList<Object>();
@@ -435,16 +394,15 @@ public class PropagationManager {
} else if (mapping.isPassword()) {
- res = new DefaultMapEntry(
- null, AttributeBuilder.buildPassword(objValues.iterator().next().toString().toCharArray()));
+ res = new DefaultMapEntry(null, AttributeBuilder.buildPassword(objValues.iterator().next().toString()
+ .toCharArray()));
} else {
if (schema != null && schema.isMultivalue()) {
res = new DefaultMapEntry(null, AttributeBuilder.build(extAttrName, objValues));
} else {
- res = new DefaultMapEntry(null,
- objValues.isEmpty()
+ res = new DefaultMapEntry(null, objValues.isEmpty()
? AttributeBuilder.build(extAttrName)
: AttributeBuilder.build(extAttrName, objValues.iterator().next()));
}
@@ -462,13 +420,11 @@ public class PropagationManager {
* @param resource target resource
* @return account link + prepared attributes
*/
- private Map.Entry<String, Set<Attribute>> prepareAttributes(
- final SyncopeUser user, final String password, final Boolean enable, final ExternalResource resource) {
+ private Map.Entry<String, Set<Attribute>> prepareAttributes(final SyncopeUser user, final String password,
+ final Boolean enable, final ExternalResource resource) {
- LOG.debug("Preparing resource attributes for {}"
- + " on resource {}"
- + " with attributes {}",
- new Object[]{user, resource, user.getAttributes()});
+ LOG.debug("Preparing resource attributes for {}" + " on resource {}" + " with attributes {}", new Object[] {
+ user, resource, user.getAttributes() });
Set<Attribute> attributes = new HashSet<Attribute>();
String accountId = null;
@@ -485,8 +441,8 @@ public class PropagationManager {
}
if (preparedAttribute.getValue() != null) {
- final Attribute alreadyAdded = AttributeUtil.find(
- preparedAttribute.getValue().getName(), attributes);
+ final Attribute alreadyAdded = AttributeUtil.find(preparedAttribute.getValue().getName(),
+ attributes);
if (alreadyAdded == null) {
attributes.add(preparedAttribute.getValue());
@@ -496,9 +452,7 @@ public class PropagationManager {
Set values = new HashSet(alreadyAdded.getValue());
values.addAll(preparedAttribute.getValue().getValue());
- attributes.add(AttributeBuilder.build(
- preparedAttribute.getValue().getName(),
- values));
+ attributes.add(AttributeBuilder.build(preparedAttribute.getValue().getName(), values));
}
}
@@ -514,8 +468,7 @@ public class PropagationManager {
}
// Evaluate AccountLink expression
- String evalAccountLink =
- jexlUtil.evaluate(resource.getAccountLink(), user);
+ String evalAccountLink = jexlUtil.evaluate(resource.getAccountLink(), user);
// AccountId must be propagated. It could be a simple attribute for
// the target resource or the key (depending on the accountLink)
@@ -548,10 +501,7 @@ public class PropagationManager {
* @param propByRes operation to be performed per resource
* @return list of propagation tasks created
*/
- protected List<PropagationTask> provision(
- final SyncopeUser user,
- final String password,
- final Boolean enable,
+ protected List<PropagationTask> provision(final SyncopeUser user, final String password, final Boolean enable,
final PropagationByResource propByRes) {
LOG.debug("Provisioning with user {}:\n{}", user, propByRes);
@@ -593,8 +543,7 @@ public class PropagationManager {
return tasks;
}
- public void execute(final List<PropagationTask> tasks)
- throws PropagationException {
+ public void execute(final List<PropagationTask> tasks) throws PropagationException {
execute(tasks, null);
}
@@ -605,9 +554,7 @@ public class PropagationManager {
* @throws PropagationException if propagation goes wrong: propagation is interrupted as soon as the result of the
* communication with a primary resource is in error
*/
- public void execute(
- final List<PropagationTask> tasks,
- final PropagationHandler handler)
+ public void execute(final List<PropagationTask> tasks, final PropagationHandler handler)
throws PropagationException {
for (PropagationTask task : tasks) {
@@ -621,18 +568,14 @@ public class PropagationManager {
// communication with a primary resource is in error
PropagationTaskExecStatus execStatus;
try {
- execStatus = PropagationTaskExecStatus.valueOf(
- execution.getStatus());
+ execStatus = PropagationTaskExecStatus.valueOf(execution.getStatus());
} catch (IllegalArgumentException e) {
- LOG.error("Unexpected execution status found {}",
- execution.getStatus());
+ LOG.error("Unexpected execution status found {}", execution.getStatus());
execStatus = PropagationTaskExecStatus.FAILURE;
}
- if (task.getResource().isPropagationPrimary()
- && !execStatus.isSuccessful()) {
+ if (task.getResource().isPropagationPrimary() && !execStatus.isSuccessful()) {
- throw new PropagationException(task.getResource().getName(),
- execution.getMessage());
+ throw new PropagationException(task.getResource().getName(), execution.getMessage());
}
}
}
@@ -644,38 +587,27 @@ public class PropagationManager {
* @param execution to be decide wether to store or not
* @return true if execution has to be store, false otherwise
*/
- private boolean hasToBeregistered(final PropagationTask task,
- final TaskExec execution) {
+ private boolean hasToBeregistered(final PropagationTask task, final TaskExec execution) {
boolean result;
- final boolean failed = !PropagationTaskExecStatus.valueOf(
- execution.getStatus()).isSuccessful();
+ final boolean failed = !PropagationTaskExecStatus.valueOf(execution.getStatus()).isSuccessful();
switch (task.getPropagationOperation()) {
case CREATE:
- result = (failed
- && task.getResource().getCreateTraceLevel().
- ordinal() >= TraceLevel.FAILURES.ordinal())
- || task.getResource().getCreateTraceLevel()
- == TraceLevel.ALL;
+ result = (failed && task.getResource().getCreateTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal())
+ || task.getResource().getCreateTraceLevel() == TraceLevel.ALL;
break;
case UPDATE:
- result = (failed
- && task.getResource().getUpdateTraceLevel().
- ordinal() >= TraceLevel.FAILURES.ordinal())
- || task.getResource().getUpdateTraceLevel()
- == TraceLevel.ALL;
+ result = (failed && task.getResource().getUpdateTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal())
+ || task.getResource().getUpdateTraceLevel() == TraceLevel.ALL;
break;
case DELETE:
- result = (failed
- && task.getResource().getDeleteTraceLevel().
- ordinal() >= TraceLevel.FAILURES.ordinal())
- || task.getResource().getDeleteTraceLevel()
- == TraceLevel.ALL;
+ result = (failed && task.getResource().getDeleteTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal())
+ || task.getResource().getDeleteTraceLevel() == TraceLevel.ALL;
break;
default:
@@ -702,8 +634,7 @@ public class PropagationManager {
* @param handler propagation handler.
* @return TaskExecution.
*/
- public TaskExec execute(
- final PropagationTask task, final PropagationHandler handler) {
+ public TaskExec execute(final PropagationTask task, final PropagationHandler handler) {
final Date startDate = new Date();
TaskExec execution = new TaskExec();
@@ -718,17 +649,13 @@ public class PropagationManager {
ConnectorObject after = null;
try {
- final ConnInstance connInstance =
- task.getResource().getConnector();
+ final ConnInstance connInstance = task.getResource().getConnector();
- final ConnectorFacadeProxy connector =
- connLoader.getConnector(task.getResource());
+ final ConnectorFacadeProxy connector = connLoader.getConnector(task.getResource());
if (connector == null) {
- final String msg = String.format(
- "Connector instance bean for resource %s and "
- + "connInstance %s not found",
- task.getResource(), connInstance);
+ final String msg = String.format("Connector instance bean for resource %s and "
+ + "connInstance %s not found", task.getResource(), connInstance);
throw new NoSuchBeanDefinitionException(msg);
}
@@ -741,21 +668,17 @@ public class PropagationManager {
case CREATE:
case UPDATE:
// set of attributes to be propagated
- final Set<Attribute> attributes =
- new HashSet<Attribute>(task.getAttributes());
+ final Set<Attribute> attributes = new HashSet<Attribute>(task.getAttributes());
if (before != null) {
// 1. check if rename is really required
- final Name newName = (Name) AttributeUtil.find(
- Name.NAME, attributes);
+ final Name newName = (Name) AttributeUtil.find(Name.NAME, attributes);
LOG.debug("Rename required with value {}", newName);
- if (newName != null
- && newName.equals(before.getName())
- && !before.getUid().getUidValue().equals(
- newName.getNameValue())) {
+ if (newName != null && newName.equals(before.getName())
+ && !before.getUid().getUidValue().equals(newName.getNameValue())) {
LOG.debug("Remote object name unchanged");
attributes.remove(newName);
@@ -764,59 +687,41 @@ public class PropagationManager {
LOG.debug("Attributes to be replaced {}", attributes);
// 2. update with a new "normalized" attribute set
- connector.update(
- task.getPropagationMode(),
- ObjectClass.ACCOUNT,
- before.getUid(),
- attributes,
- null,
- propagationAttempted);
+ connector.update(task.getPropagationMode(), ObjectClass.ACCOUNT, before.getUid(),
+ attributes, null, propagationAttempted);
} else {
// 1. get accountId
final String accountId = task.getAccountId();
// 2. get name
- final Name name = (Name) AttributeUtil.find(
- Name.NAME, attributes);
+ final Name name = (Name) AttributeUtil.find(Name.NAME, attributes);
// 3. check if:
// * accountId is not blank;
// * accountId is not equal to Name.
if (StringUtils.hasText(accountId)
- && (name == null
- || !accountId.equals(name.getNameValue()))) {
+ && (name == null || !accountId.equals(name.getNameValue()))) {
// 3.a retrieve uid
- final Uid uid = (Uid) AttributeUtil.find(
- Uid.NAME, attributes);
+ final Uid uid = (Uid) AttributeUtil.find(Uid.NAME, attributes);
// 3.b add Uid if not provided
if (uid == null) {
- attributes.add(AttributeBuilder.build(
- Uid.NAME,
- Collections.singleton(accountId)));
+ attributes.add(AttributeBuilder.build(Uid.NAME, Collections.singleton(accountId)));
}
}
// 4. provision entry
- connector.create(
- task.getPropagationMode(),
- ObjectClass.ACCOUNT,
- attributes,
- null,
+ connector.create(task.getPropagationMode(), ObjectClass.ACCOUNT, attributes, null,
propagationAttempted);
}
break;
case DELETE:
if (before == null) {
- LOG.debug("{} not found on external resource:"
- + " ignoring delete", task.getAccountId());
+ LOG.debug("{} not found on external resource:" + " ignoring delete", task.getAccountId());
} else {
- connector.delete(task.getPropagationMode(),
- ObjectClass.ACCOUNT,
- before.getUid(),
- null,
+ connector.delete(task.getPropagationMode(), ObjectClass.ACCOUNT, before.getUid(), null,
propagationAttempted);
}
break;
@@ -824,8 +729,7 @@ public class PropagationManager {
default:
}
- execution.setStatus(
- task.getPropagationMode() == PropagationMode.ONE_PHASE
+ execution.setStatus(task.getPropagationMode() == PropagationMode.ONE_PHASE
? PropagationTaskExecStatus.SUCCESS.name()
: PropagationTaskExecStatus.SUBMITTED.name());
@@ -840,8 +744,7 @@ public class PropagationManager {
}
} catch (Throwable t) {
- LOG.error("Exception during provision on resource "
- + task.getResource().getName(), t);
+ LOG.error("Exception during provision on resource " + task.getResource().getName(), t);
if (t instanceof ConnectorException && t.getCause() != null) {
taskExecutionMessage = t.getCause().getMessage();
@@ -853,16 +756,14 @@ public class PropagationManager {
}
try {
- execution.setStatus(
- task.getPropagationMode() == PropagationMode.ONE_PHASE
+ execution.setStatus(task.getPropagationMode() == PropagationMode.ONE_PHASE
? PropagationTaskExecStatus.FAILURE.name()
: PropagationTaskExecStatus.UNSUBMITTED.name());
} catch (Throwable wft) {
LOG.error("While executing KO action on {}", execution, wft);
}
- propagationAttempted.add(
- task.getPropagationOperation().name().toLowerCase());
+ propagationAttempted.add(task.getPropagationOperation().name().toLowerCase());
} finally {
LOG.debug("Update execution for {}", task);
@@ -885,11 +786,8 @@ public class PropagationManager {
}
if (handler != null) {
- handler.handle(
- task.getResource().getName(),
- PropagationTaskExecStatus.valueOf(execution.getStatus()),
- before,
- after);
+ handler.handle(task.getResource().getName(), PropagationTaskExecStatus.valueOf(execution.getStatus()),
+ before, after);
}
return execution;
@@ -903,20 +801,14 @@ public class PropagationManager {
* @param latest 'FALSE' to retrieve object using old accountId if not null.
* @return remote connector object.
*/
- private ConnectorObject getRemoteObject(
- final ConnectorFacadeProxy connector,
- final PropagationTask task,
+ private ConnectorObject getRemoteObject(final ConnectorFacadeProxy connector, final PropagationTask task,
final boolean latest) {
try {
- return connector.getObject(
- task.getPropagationMode(),
- task.getPropagationOperation(),
- ObjectClass.ACCOUNT,
+ return connector.getObject(task.getPropagationMode(), task.getPropagationOperation(), ObjectClass.ACCOUNT,
new Uid(latest || task.getOldAccountId() == null
- ? task.getAccountId()
- : task.getOldAccountId()),
- connector.getOperationOptions(task.getResource()));
+ ? task.getAccountId()
+ : task.getOldAccountId()), connector.getOperationOptions(task.getResource()));
} catch (RuntimeException ignore) {
LOG.debug("Resolving username", ignore);
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/propagation/package-info.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/propagation/package-info.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/propagation/package-info.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/propagation/package-info.java Thu Mar 15 10:17:12 2012
@@ -17,3 +17,4 @@
* under the License.
*/
package org.syncope.core.propagation;
+
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/AbstractReportlet.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/AbstractReportlet.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/AbstractReportlet.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/AbstractReportlet.java Thu Mar 15 10:17:12 2012
@@ -34,8 +34,7 @@ public abstract class AbstractReportlet<
/**
* Logger.
*/
- protected static final Logger LOG =
- LoggerFactory.getLogger(AbstractReportlet.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractReportlet.class);
protected static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() {
@@ -56,13 +55,11 @@ public abstract class AbstractReportlet<
this.conf = conf;
}
- protected abstract void doExtract(ContentHandler handler)
- throws SAXException, ReportException;
+ protected abstract void doExtract(ContentHandler handler) throws SAXException, ReportException;
@Override
@Transactional(readOnly = true)
- public void extract(final ContentHandler handler)
- throws SAXException, ReportException {
+ public void extract(final ContentHandler handler) throws SAXException, ReportException {
if (conf == null) {
throw new ReportException(new IllegalArgumentException("No configuration provided"));
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/Reportlet.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/Reportlet.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/Reportlet.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/Reportlet.java Thu Mar 15 10:17:12 2012
@@ -43,6 +43,5 @@ public interface Reportlet<T extends Rep
* @throws SAXException if ther is any problem in SAX handling
* @throws ReportException if anything goes wrong
*/
- void extract(ContentHandler handler)
- throws SAXException, ReportException;
+ void extract(ContentHandler handler) throws SAXException, ReportException;
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java Thu Mar 15 10:17:12 2012
@@ -24,7 +24,7 @@ import java.lang.annotation.RetentionPol
import java.lang.annotation.Target;
import org.syncope.client.report.ReportletConf;
-@Target({ElementType.TYPE})
+@Target( { ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface ReportletConfClass {
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java Thu Mar 15 10:17:12 2012
@@ -27,8 +27,7 @@ import org.xml.sax.SAXException;
public class StaticReportlet extends AbstractReportlet<StaticReportletConf> {
@Override
- public void doExtract(final ContentHandler handler)
- throws SAXException, ReportException {
+ public void doExtract(final ContentHandler handler) throws SAXException, ReportException {
if (StringUtils.hasText(conf.getStringField())) {
handler.startElement("", "", "string", null);
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/UserReportlet.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/UserReportlet.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/UserReportlet.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/UserReportlet.java Thu Mar 15 10:17:12 2012
@@ -78,14 +78,12 @@ public class UserReportlet extends Abstr
: searchDAO.count(adminRoleIds, conf.getMatchingCond());
}
- private void doExtractResources(final ContentHandler handler,
- final AbstractAttributableTO attributableTO)
+ private void doExtractResources(final ContentHandler handler, final AbstractAttributableTO attributableTO)
throws SAXException {
if (attributableTO.getResources().isEmpty()) {
- LOG.debug("No resources found for {}[{}]",
- attributableTO.getClass().getSimpleName(),
- attributableTO.getId());
+ LOG.debug("No resources found for {}[{}]", attributableTO.getClass().getSimpleName(), attributableTO
+ .getId());
} else {
AttributesImpl atts = new AttributesImpl();
handler.startElement("", "", "resources", null);
@@ -102,11 +100,8 @@ public class UserReportlet extends Abstr
}
}
- private void doExtractAttributes(final ContentHandler handler,
- final AbstractAttributableTO attributableTO,
- final Collection<String> attrs,
- final Collection<String> derAttrs,
- final Collection<String> virAttrs)
+ private void doExtractAttributes(final ContentHandler handler, final AbstractAttributableTO attributableTO,
+ final Collection<String> attrs, final Collection<String> derAttrs, final Collection<String> virAttrs)
throws SAXException {
AttributesImpl atts = new AttributesImpl();
@@ -123,15 +118,12 @@ public class UserReportlet extends Abstr
if (attrMap.containsKey(attrName)) {
for (String value : attrMap.get(attrName).getValues()) {
handler.startElement("", "", "value", null);
- handler.characters(
- value.toCharArray(), 0, value.length());
+ handler.characters(value.toCharArray(), 0, value.length());
handler.endElement("", "", "value");
}
} else {
- LOG.debug("{} not found for {}[{}]", new Object[]{
- attrName,
- attributableTO.getClass().getSimpleName(),
- attributableTO.getId()});
+ LOG.debug("{} not found for {}[{}]", new Object[] { attrName,
+ attributableTO.getClass().getSimpleName(), attributableTO.getId() });
}
handler.endElement("", "", "attribute");
@@ -140,8 +132,7 @@ public class UserReportlet extends Abstr
}
if (!derAttrs.isEmpty()) {
- Map<String, AttributeTO> derAttrMap =
- attributableTO.getDerivedAttributeMap();
+ Map<String, AttributeTO> derAttrMap = attributableTO.getDerivedAttributeMap();
handler.startElement("", "", "derivedAttributes", null);
for (String attrName : derAttrs) {
@@ -153,15 +144,12 @@ public class UserReportlet extends Abstr
if (derAttrMap.containsKey(attrName)) {
for (String value : derAttrMap.get(attrName).getValues()) {
handler.startElement("", "", "value", null);
- handler.characters(
- value.toCharArray(), 0, value.length());
+ handler.characters(value.toCharArray(), 0, value.length());
handler.endElement("", "", "value");
}
} else {
- LOG.debug("{} not found for {}[{}]", new Object[]{
- attrName,
- attributableTO.getClass().getSimpleName(),
- attributableTO.getId()});
+ LOG.debug("{} not found for {}[{}]", new Object[] { attrName,
+ attributableTO.getClass().getSimpleName(), attributableTO.getId() });
}
handler.endElement("", "", "derivedAttribute");
@@ -170,8 +158,7 @@ public class UserReportlet extends Abstr
}
if (!virAttrs.isEmpty()) {
- Map<String, AttributeTO> virAttrMap =
- attributableTO.getVirtualAttributeMap();
+ Map<String, AttributeTO> virAttrMap = attributableTO.getVirtualAttributeMap();
handler.startElement("", "", "virtualAttributes", null);
for (String attrName : virAttrs) {
@@ -183,15 +170,12 @@ public class UserReportlet extends Abstr
if (virAttrMap.containsKey(attrName)) {
for (String value : virAttrMap.get(attrName).getValues()) {
handler.startElement("", "", "value", null);
- handler.characters(
- value.toCharArray(), 0, value.length());
+ handler.characters(value.toCharArray(), 0, value.length());
handler.endElement("", "", "value");
}
} else {
- LOG.debug("{} not found for {}[{}]", new Object[]{
- attrName,
- attributableTO.getClass().getSimpleName(),
- attributableTO.getId()});
+ LOG.debug("{} not found for {}[{}]", new Object[] { attrName,
+ attributableTO.getClass().getSimpleName(), attributableTO.getId() });
}
handler.endElement("", "", "virtualAttribute");
@@ -233,19 +217,22 @@ public class UserReportlet extends Abstr
case creationDate:
type = XSD_DATETIME;
- value = user.getCreationDate() == null ? ""
+ value = user.getCreationDate() == null
+ ? ""
: DATE_FORMAT.get().format(user.getCreationDate());
break;
case lastLoginDate:
type = XSD_DATETIME;
- value = user.getLastLoginDate() == null ? ""
+ value = user.getLastLoginDate() == null
+ ? ""
: DATE_FORMAT.get().format(user.getLastLoginDate());
break;
case changePwdDate:
type = XSD_DATETIME;
- value = user.getChangePwdDate() == null ? ""
+ value = user.getChangePwdDate() == null
+ ? ""
: DATE_FORMAT.get().format(user.getChangePwdDate());
break;
@@ -286,20 +273,16 @@ public class UserReportlet extends Abstr
atts.addAttribute("", "", "roleName", XSD_STRING, String.valueOf(memb.getRoleName()));
handler.startElement("", "", "membership", atts);
- doExtractAttributes(handler, memb,
- memb.getAttributeMap().keySet(),
- memb.getDerivedAttributeMap().keySet(),
- memb.getVirtualAttributeMap().keySet());
+ doExtractAttributes(handler, memb, memb.getAttributeMap().keySet(), memb.getDerivedAttributeMap()
+ .keySet(), memb.getVirtualAttributeMap().keySet());
if (conf.getFeatures().contains(Feature.resources)) {
Membership actualMemb = user.getMembership(memb.getRoleId());
if (actualMemb == null) {
- LOG.warn("Unexpected: cannot find membership for role {} for user {}",
- memb.getRoleId(), user);
+ LOG.warn("Unexpected: cannot find membership for role {} for user {}", memb.getRoleId(),
+ user);
} else {
- doExtractResources(handler,
- roleDataBinder.getRoleTO(
- actualMemb.getSyncopeRole()));
+ doExtractResources(handler, roleDataBinder.getRoleTO(actualMemb.getSyncopeRole()));
}
}
@@ -318,8 +301,7 @@ public class UserReportlet extends Abstr
}
@Override
- protected void doExtract(final ContentHandler handler)
- throws SAXException, ReportException {
+ protected void doExtract(final ContentHandler handler) throws SAXException, ReportException {
for (int i = 1; i <= (count() / PAGE_SIZE) + 1; i++) {
doExtract(handler, getPagedUsers(i));
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/AbstractController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/AbstractController.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/AbstractController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/AbstractController.java Thu Mar 15 10:17:12 2012
@@ -34,16 +34,13 @@ import org.syncope.core.persistence.bean
import org.syncope.core.util.AttributableUtil;
import org.syncope.core.util.TaskUtil;
-@Transactional(rollbackFor = {
- Throwable.class
-})
+@Transactional(rollbackFor = { Throwable.class })
public abstract class AbstractController {
/**
* Logger.
*/
- protected static final Logger LOG =
- LoggerFactory.getLogger(AbstractController.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractController.class);
protected AttributableUtil getAttributableUtil(final String kind) {
AttributableUtil result = null;
@@ -77,18 +74,17 @@ 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());
- throw new TypeMismatchException(task.getClass().getName(),
- TaskUtil.class);
+ throw new TypeMismatchException(task.getClass().getName(), TaskUtil.class);
}
return result;
@@ -98,16 +94,15 @@ 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());
- throw new TypeMismatchException(taskTO.getClass().getName(),
- TaskUtil.class);
+ throw new TypeMismatchException(taskTO.getClass().getName(), TaskUtil.class);
}
return result;
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/AuthenticationController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/AuthenticationController.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/AuthenticationController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/AuthenticationController.java Thu Mar 15 10:17:12 2012
@@ -43,8 +43,7 @@ public class AuthenticationController ex
@Autowired
private EntitlementDAO entitlementDAO;
- @RequestMapping(method = RequestMethod.GET,
- value = "/allentitlements")
+ @RequestMapping(method = RequestMethod.GET, value = "/allentitlements")
public List<String> listEntitlements() {
List<Entitlement> entitlements = entitlementDAO.findAll();
List<String> result = new ArrayList<String>(entitlements.size());
@@ -55,8 +54,7 @@ public class AuthenticationController ex
return result;
}
- @RequestMapping(method = RequestMethod.GET,
- value = "/entitlements")
+ @RequestMapping(method = RequestMethod.GET, value = "/entitlements")
public Set<String> getEntitlements() {
Set<String> result = EntitlementUtil.getOwnedEntitlementNames();
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ConfigurationController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ConfigurationController.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ConfigurationController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ConfigurationController.java Thu Mar 15 10:17:12 2012
@@ -73,8 +73,7 @@ public class ConfigurationController ext
@PreAuthorize("hasRole('CONFIGURATION_CREATE')")
@RequestMapping(method = RequestMethod.POST, value = "/create")
- public ConfigurationTO create(final HttpServletResponse response,
- @RequestBody final ConfigurationTO configurationTO) {
+ public ConfigurationTO create(final HttpServletResponse response, @RequestBody final ConfigurationTO configurationTO) {
LOG.debug("Configuration create called with parameters {}", configurationTO);
@@ -91,8 +90,7 @@ public class ConfigurationController ext
@PreAuthorize("hasRole('CONFIGURATION_DELETE')")
@RequestMapping(method = RequestMethod.DELETE, value = "/delete/{key}")
- public void delete(@PathVariable("key") final String key)
- throws MissingConfKeyException {
+ public void delete(@PathVariable("key") final String key) throws MissingConfKeyException {
confDAO.find(key);
confDAO.delete(key);
@@ -118,8 +116,7 @@ public class ConfigurationController ext
}
@PreAuthorize("hasRole('CONFIGURATION_READ')")
- @RequestMapping(method = RequestMethod.GET,
- value = "/read/{key}")
+ @RequestMapping(method = RequestMethod.GET, value = "/read/{key}")
public ConfigurationTO read(final HttpServletResponse response, @PathVariable("key") final String key)
throws MissingConfKeyException {
@@ -144,10 +141,8 @@ public class ConfigurationController ext
}
@PreAuthorize("hasRole('CONFIGURATION_UPDATE')")
- @RequestMapping(method = RequestMethod.POST,
- value = "/update")
- public ConfigurationTO update(final HttpServletResponse response,
- @RequestBody final ConfigurationTO configurationTO)
+ @RequestMapping(method = RequestMethod.POST, value = "/update")
+ public ConfigurationTO update(final HttpServletResponse response, @RequestBody final ConfigurationTO configurationTO)
throws MissingConfKeyException {
SyncopeConf conf = confDAO.find(configurationTO.getKey());
@@ -166,14 +161,14 @@ public class ConfigurationController ext
Set<String> validators = new HashSet<String>();
try {
- for (Resource resource : resResolver.getResources(
- "classpath:org/syncope/core/persistence/validation/attrvalue/*.class")) {
+ for (Resource resource : resResolver
+ .getResources("classpath:org/syncope/core/persistence/validation/attrvalue/*.class")) {
ClassMetadata metadata = cachingMetadataReaderFactory.getMetadataReader(resource).getClassMetadata();
try {
- Set<Class> interfaces = ClassUtils.getAllInterfacesForClassAsSet(
- ClassUtils.forName(metadata.getClassName(), ClassUtils.getDefaultClassLoader()));
+ Set<Class> interfaces = ClassUtils.getAllInterfacesForClassAsSet(ClassUtils.forName(metadata
+ .getClassName(), ClassUtils.getDefaultClassLoader()));
if (interfaces.contains(Validator.class) && !metadata.isAbstract()) {
validators.add(metadata.getClassName());
@@ -203,13 +198,11 @@ public class ConfigurationController ext
String template = resource.getURL().toExternalForm();
if (template.endsWith(".html.vm")) {
- htmlTemplates.add(template.substring(
- template.indexOf("mailTemplates/") + 14,
- template.indexOf(".html.vm")));
+ htmlTemplates.add(template.substring(template.indexOf("mailTemplates/") + 14, template
+ .indexOf(".html.vm")));
} else if (template.endsWith(".txt.vm")) {
- textTemplates.add(template.substring(
- template.indexOf("mailTemplates/") + 14,
- template.indexOf(".txt.vm")));
+ textTemplates.add(template.substring(template.indexOf("mailTemplates/") + 14, template
+ .indexOf(".txt.vm")));
} else {
LOG.warn("Unexpected template found: {}, ignoring...", template);
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ConnInstanceController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ConnInstanceController.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ConnInstanceController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ConnInstanceController.java Thu Mar 15 10:17:12 2012
@@ -89,8 +89,7 @@ public class ConnInstanceController exte
@PreAuthorize("hasRole('CONNECTOR_CREATE')")
@RequestMapping(method = RequestMethod.POST, value = "/create")
- public ConnInstanceTO create(final HttpServletResponse response,
- @RequestBody final ConnInstanceTO connectorTO)
+ public ConnInstanceTO create(final HttpServletResponse response, @RequestBody final ConnInstanceTO connectorTO)
throws SyncopeClientCompositeErrorException, NotFoundException {
LOG.debug("ConnInstance create called with configuration {}", connectorTO);
@@ -105,11 +104,10 @@ public class ConnInstanceController exte
auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
"Could not create connector instance: " + connectorTO.getDisplayName());
- SyncopeClientCompositeErrorException scce =
- new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
+ SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
- SyncopeClientException invalidConnInstance =
- new SyncopeClientException(SyncopeClientExceptionType.InvalidConnInstance);
+ SyncopeClientException invalidConnInstance = new SyncopeClientException(
+ SyncopeClientExceptionType.InvalidConnInstance);
invalidConnInstance.addElement(t.getMessage());
scce.addException(invalidConnInstance);
@@ -137,11 +135,10 @@ public class ConnInstanceController exte
auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
"Could not update connector instance: " + connectorTO.getDisplayName());
- SyncopeClientCompositeErrorException scce =
- new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
+ SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
- SyncopeClientException invalidConnInstance =
- new SyncopeClientException(SyncopeClientExceptionType.InvalidConnInstance);
+ SyncopeClientException invalidConnInstance = new SyncopeClientException(
+ SyncopeClientExceptionType.InvalidConnInstance);
invalidConnInstance.addElement(t.getMessage());
scce.addException(invalidConnInstance);
@@ -153,8 +150,7 @@ public class ConnInstanceController exte
@PreAuthorize("hasRole('CONNECTOR_DELETE')")
@RequestMapping(method = RequestMethod.DELETE, value = "/delete/{connectorId}")
- public void delete(@PathVariable("connectorId") Long connectorId)
- throws NotFoundException {
+ public void delete(@PathVariable("connectorId") Long connectorId) throws NotFoundException {
ConnInstance connInstance = connInstanceDAO.find(connectorId);
if (connInstance == null) {
@@ -162,11 +158,10 @@ public class ConnInstanceController exte
}
if (!connInstance.getResources().isEmpty()) {
- SyncopeClientCompositeErrorException scce =
- new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
+ SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
- SyncopeClientException invalidConnInstance =
- new SyncopeClientException(SyncopeClientExceptionType.ExistingResource);
+ SyncopeClientException invalidConnInstance = new SyncopeClientException(
+ SyncopeClientExceptionType.ExistingResource);
for (ExternalResource resource : connInstance.getResources()) {
invalidConnInstance.addElement(resource.getName());
}
@@ -211,8 +206,7 @@ public class ConnInstanceController exte
@PreAuthorize("hasRole('CONNECTOR_READ')")
@RequestMapping(method = RequestMethod.GET, value = "/read/{connectorId}")
@Transactional(readOnly = true)
- public ConnInstanceTO read(@PathVariable("connectorId") Long connectorId)
- throws NotFoundException {
+ public ConnInstanceTO read(@PathVariable("connectorId") Long connectorId) throws NotFoundException {
ConnInstance connInstance = connInstanceDAO.find(connectorId);
if (connInstance == null) {
@@ -257,10 +251,8 @@ public class ConnInstanceController exte
ConnectorKey key = bundle.getConnectorKey();
- LOG.debug("\nBundle name: {}"
- + "\nBundle version: {}"
- + "\nBundle class: {}",
- new Object[]{key.getBundleName(), key.getBundleVersion(), key.getConnectorName()});
+ LOG.debug("\nBundle name: {}" + "\nBundle version: {}" + "\nBundle class: {}", new Object[] {
+ key.getBundleName(), key.getBundleVersion(), key.getConnectorName() });
connectorBundleTO.setBundleName(key.getBundleName());
connectorBundleTO.setConnectorName(key.getConnectorName());
@@ -320,8 +312,8 @@ public class ConnInstanceController exte
}
// consider the possibility to receive overridden properties only
- final Set<ConnConfProperty> conf =
- mergeConnConfProperties(connectorTO.getConfiguration(), connInstance.getConfiguration());
+ final Set<ConnConfProperty> conf = mergeConnConfProperties(connectorTO.getConfiguration(), connInstance
+ .getConfiguration());
// We cannot use Spring bean because this method could be used during
// resource definition or modification: bean couldn't exist or bean
@@ -329,14 +321,14 @@ public class ConnInstanceController exte
// This is the reason why we should take a "not mature" connector
// facade proxy to ask for schema names.
- final List<String> result = new ArrayList<String>(
- connLoader.createConnectorBean(connInstance, conf).getSchema(showall));
+ final List<String> result = new ArrayList<String>(connLoader.createConnectorBean(connInstance, conf).getSchema(
+ showall));
Collections.sort(result);
auditManager.audit(Category.connector, ConnectorSubCategory.getSchemaNames, Result.success,
- "Successfully listed all schema names (" + result.size()
- + ") for connector " + connInstance.getDisplayName());
+ "Successfully listed all schema names (" + result.size() + ") for connector "
+ + connInstance.getDisplayName());
return result;
}
@@ -355,8 +347,8 @@ public class ConnInstanceController exte
List<ConnConfProperty> result = new ArrayList<ConnConfProperty>(connInstance.getConfiguration());
auditManager.audit(Category.connector, ConnectorSubCategory.getConfigurationProperties, Result.success,
- "Successfully listed all conf properties (" + result.size()
- + ") for connector " + connInstance.getDisplayName());
+ "Successfully listed all conf properties (" + result.size() + ") for connector "
+ + connInstance.getDisplayName());
return result;
}
@@ -367,8 +359,8 @@ public class ConnInstanceController exte
public ModelAndView check(final HttpServletResponse response, @RequestBody final ConnInstanceTO connectorTO)
throws SyncopeClientCompositeErrorException, NotFoundException {
- final ConnectorFacadeProxy connector =
- new ConnectorFacadeProxy(binder.getConnInstance(connectorTO), bundleManager);
+ final ConnectorFacadeProxy connector = new ConnectorFacadeProxy(binder.getConnInstance(connectorTO),
+ bundleManager);
boolean result;
try {
@@ -395,8 +387,7 @@ public class ConnInstanceController exte
* @param secondary secondary set.
* @return merged set.
*/
- private Set<ConnConfProperty> mergeConnConfProperties(
- final Set<ConnConfProperty> primary,
+ private Set<ConnConfProperty> mergeConnConfProperties(final Set<ConnConfProperty> primary,
final Set<ConnConfProperty> secondary) {
final Set<ConnConfProperty> conf = new HashSet<ConnConfProperty>();
@@ -426,8 +417,7 @@ public class ConnInstanceController exte
@PreAuthorize("hasRole('CONNECTOR_READ')")
@RequestMapping(method = RequestMethod.GET, value = "/{resourceName}/connectorBean")
@Transactional(readOnly = true)
- public ConnInstanceTO readConnectorBean(@PathVariable("resourceName") String resourceName)
- throws NotFoundException {
+ public ConnInstanceTO readConnectorBean(@PathVariable("resourceName") String resourceName) throws NotFoundException {
ExternalResource resource = resourceDAO.find(resourceName);
if (resource == null) {
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/DerivedSchemaController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/DerivedSchemaController.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/DerivedSchemaController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/DerivedSchemaController.java Thu Mar 15 10:17:12 2012
@@ -46,16 +46,13 @@ public class DerivedSchemaController ext
private DerivedSchemaDataBinder derivedSchemaDataBinder;
@PreAuthorize("hasRole('SCHEMA_CREATE')")
- @RequestMapping(method = RequestMethod.POST,
- value = "/{kind}/create")
+ @RequestMapping(method = RequestMethod.POST, value = "/{kind}/create")
public DerivedSchemaTO create(final HttpServletResponse response,
- @RequestBody final DerivedSchemaTO derivedSchemaTO,
- @PathVariable("kind") final String kind)
+ @RequestBody final DerivedSchemaTO derivedSchemaTO, @PathVariable("kind") final String kind)
throws SyncopeClientCompositeErrorException {
- AbstractDerSchema derivedSchema =
- derivedSchemaDataBinder.create(derivedSchemaTO,
- getAttributableUtil(kind).newDerivedSchema());
+ AbstractDerSchema derivedSchema = derivedSchemaDataBinder.create(derivedSchemaTO, getAttributableUtil(kind)
+ .newDerivedSchema());
derivedSchema = derivedSchemaDAO.save(derivedSchema);
@@ -64,58 +61,44 @@ public class DerivedSchemaController ext
}
@PreAuthorize("hasRole('SCHEMA_DELETE')")
- @RequestMapping(method = RequestMethod.DELETE,
- value = "/{kind}/delete/{schema}")
- public void delete(HttpServletResponse response,
- @PathVariable("kind") final String kind,
- @PathVariable("schema") final String derivedSchemaName)
- throws NotFoundException {
+ @RequestMapping(method = RequestMethod.DELETE, value = "/{kind}/delete/{schema}")
+ public void delete(HttpServletResponse response, @PathVariable("kind") final String kind,
+ @PathVariable("schema") final String derivedSchemaName) throws NotFoundException {
Class reference = getAttributableUtil(kind).derivedSchemaClass();
- AbstractDerSchema derivedSchema =
- derivedSchemaDAO.find(derivedSchemaName, reference);
+ AbstractDerSchema derivedSchema = derivedSchemaDAO.find(derivedSchemaName, reference);
if (derivedSchema == null) {
- LOG.error("Could not find derived schema '"
- + derivedSchemaName + "'");
+ LOG.error("Could not find derived schema '" + derivedSchemaName + "'");
throw new NotFoundException(derivedSchemaName);
} else {
- derivedSchemaDAO.delete(
- derivedSchemaName, getAttributableUtil(kind));
+ derivedSchemaDAO.delete(derivedSchemaName, getAttributableUtil(kind));
}
}
- @RequestMapping(method = RequestMethod.GET,
- value = "/{kind}/list")
+ @RequestMapping(method = RequestMethod.GET, value = "/{kind}/list")
public List<DerivedSchemaTO> list(@PathVariable("kind") final String kind) {
Class reference = getAttributableUtil(kind).derivedSchemaClass();
- List<AbstractDerSchema> derivedAttributeSchemas =
- derivedSchemaDAO.findAll(reference);
+ List<AbstractDerSchema> derivedAttributeSchemas = derivedSchemaDAO.findAll(reference);
- List<DerivedSchemaTO> derivedSchemaTOs =
- new ArrayList<DerivedSchemaTO>(derivedAttributeSchemas.size());
+ List<DerivedSchemaTO> derivedSchemaTOs = new ArrayList<DerivedSchemaTO>(derivedAttributeSchemas.size());
for (AbstractDerSchema derivedSchema : derivedAttributeSchemas) {
- derivedSchemaTOs.add(derivedSchemaDataBinder.getDerivedSchemaTO(
- derivedSchema));
+ derivedSchemaTOs.add(derivedSchemaDataBinder.getDerivedSchemaTO(derivedSchema));
}
return derivedSchemaTOs;
}
@PreAuthorize("hasRole('SCHEMA_READ')")
- @RequestMapping(method = RequestMethod.GET,
- value = "/{kind}/read/{derivedSchema}")
+ @RequestMapping(method = RequestMethod.GET, value = "/{kind}/read/{derivedSchema}")
public DerivedSchemaTO read(@PathVariable("kind") final String kind,
- @PathVariable("derivedSchema") final String derivedSchemaName)
- throws NotFoundException {
+ @PathVariable("derivedSchema") final String derivedSchemaName) throws NotFoundException {
Class reference = getAttributableUtil(kind).derivedSchemaClass();
- AbstractDerSchema derivedSchema =
- derivedSchemaDAO.find(derivedSchemaName, reference);
+ AbstractDerSchema derivedSchema = derivedSchemaDAO.find(derivedSchemaName, reference);
if (derivedSchema == null) {
- LOG.error("Could not find derived schema '"
- + derivedSchemaName + "'");
+ LOG.error("Could not find derived schema '" + derivedSchemaName + "'");
throw new NotFoundException(derivedSchemaName);
}
@@ -123,24 +106,18 @@ public class DerivedSchemaController ext
}
@PreAuthorize("hasRole('SCHEMA_UPDATE')")
- @RequestMapping(method = RequestMethod.POST,
- value = "/{kind}/update")
- public DerivedSchemaTO update(
- @RequestBody final DerivedSchemaTO derivedSchemaTO,
- @PathVariable("kind") final String kind)
- throws SyncopeClientCompositeErrorException, NotFoundException {
+ @RequestMapping(method = RequestMethod.POST, value = "/{kind}/update")
+ public DerivedSchemaTO update(@RequestBody final DerivedSchemaTO derivedSchemaTO,
+ @PathVariable("kind") final String kind) throws SyncopeClientCompositeErrorException, NotFoundException {
Class reference = getAttributableUtil(kind).derivedSchemaClass();
- AbstractDerSchema derivedSchema =
- derivedSchemaDAO.find(derivedSchemaTO.getName(), reference);
+ AbstractDerSchema derivedSchema = derivedSchemaDAO.find(derivedSchemaTO.getName(), reference);
if (derivedSchema == null) {
- LOG.error("Could not find derived schema '"
- + derivedSchemaTO.getName() + "'");
+ LOG.error("Could not find derived schema '" + derivedSchemaTO.getName() + "'");
throw new NotFoundException(derivedSchemaTO.getName());
}
- derivedSchema = derivedSchemaDataBinder.update(derivedSchemaTO,
- derivedSchema);
+ derivedSchema = derivedSchemaDataBinder.update(derivedSchemaTO, derivedSchema);
derivedSchema = derivedSchemaDAO.save(derivedSchema);
return derivedSchemaDataBinder.getDerivedSchemaTO(derivedSchema);
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java Thu Mar 15 10:17:12 2012
@@ -65,8 +65,8 @@ public class LoggerController extends Ab
result.add(loggerTO);
}
- auditManager.audit(Category.logger, LoggerSubCategory.list, Result.success,
- "Successfully listed all loggers (" + type + "): " + result.size());
+ auditManager.audit(Category.logger, LoggerSubCategory.list, Result.success, "Successfully listed all loggers ("
+ + type + "): " + result.size());
return result;
}
@@ -102,7 +102,8 @@ public class LoggerController extends Ab
syncopeLogger = new SyncopeLogger();
syncopeLogger.setName(name);
syncopeLogger.setType(name.startsWith(SyncopeLoggerType.AUDIT.getPrefix())
- ? SyncopeLoggerType.AUDIT : SyncopeLoggerType.LOG);
+ ? SyncopeLoggerType.AUDIT
+ : SyncopeLoggerType.LOG);
}
if (expectedType != syncopeLogger.getType()) {
@@ -119,8 +120,8 @@ public class LoggerController extends Ab
LoggerTO result = new LoggerTO();
BeanUtils.copyProperties(syncopeLogger, result);
- auditManager.audit(Category.logger, LoggerSubCategory.setLevel, Result.success,
- String.format("Successfully set level %s to logger %s (%s)", level, name, expectedType));
+ auditManager.audit(Category.logger, LoggerSubCategory.setLevel, Result.success, String.format(
+ "Successfully set level %s to logger %s (%s)", level, name, expectedType));
return result;
}
@@ -137,8 +138,7 @@ public class LoggerController extends Ab
return setLevel(name, level, SyncopeLoggerType.AUDIT);
}
- private void delete(final String name, final SyncopeLoggerType expectedType)
- throws NotFoundException {
+ private void delete(final String name, final SyncopeLoggerType expectedType) throws NotFoundException {
SyncopeLogger syncopeLogger = loggerDAO.find(name);
if (syncopeLogger == null) {
@@ -155,22 +155,20 @@ public class LoggerController extends Ab
Logger logger = lc.getLogger(name);
logger.setLevel(Level.OFF);
- auditManager.audit(Category.logger, LoggerSubCategory.setLevel, Result.success,
- String.format("Successfully deleted logger %s (%s)", name, expectedType));
+ auditManager.audit(Category.logger, LoggerSubCategory.setLevel, Result.success, String.format(
+ "Successfully deleted logger %s (%s)", name, expectedType));
}
@PreAuthorize("hasRole('LOG_DELETE')")
@RequestMapping(method = RequestMethod.DELETE, value = "/log/delete/{name}")
- public void deleteLog(@PathVariable("name") final String name)
- throws NotFoundException {
+ public void deleteLog(@PathVariable("name") final String name) throws NotFoundException {
delete(name, SyncopeLoggerType.LOG);
}
@PreAuthorize("hasRole('AUDIT_DELETE')")
@RequestMapping(method = RequestMethod.DELETE, value = "/audit/delete/{name}")
- public void deleteAudit(@PathVariable("name") final String name)
- throws NotFoundException {
+ public void deleteAudit(@PathVariable("name") final String name) throws NotFoundException {
delete(name, SyncopeLoggerType.AUDIT);
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/NotificationController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/NotificationController.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/NotificationController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/NotificationController.java Thu Mar 15 10:17:12 2012
@@ -45,11 +45,8 @@ public class NotificationController exte
private NotificationDataBinder binder;
@PreAuthorize("hasRole('NOTIFICATION_READ')")
- @RequestMapping(method = RequestMethod.GET,
- value = "/read/{notificationId}")
- public NotificationTO read(
- @PathVariable("notificationId") Long notificationId)
- throws NotFoundException {
+ @RequestMapping(method = RequestMethod.GET, value = "/read/{notificationId}")
+ public NotificationTO read(@PathVariable("notificationId") Long notificationId) throws NotFoundException {
Notification notification = notificationDAO.find(notificationId);
if (notification == null) {
@@ -62,15 +59,12 @@ public class NotificationController exte
}
@PreAuthorize("hasRole('NOTIFICATION_LIST')")
- @RequestMapping(method = RequestMethod.GET,
- value = "/list")
- public List<NotificationTO> list()
- throws NotFoundException {
+ @RequestMapping(method = RequestMethod.GET, value = "/list")
+ public List<NotificationTO> list() throws NotFoundException {
List<Notification> notifications = notificationDAO.findAll();
- List<NotificationTO> notificationTOs =
- new ArrayList<NotificationTO>();
+ List<NotificationTO> notificationTOs = new ArrayList<NotificationTO>();
for (Notification notification : notifications) {
notificationTOs.add(binder.getNotificationTO(notification));
}
@@ -79,14 +73,11 @@ public class NotificationController exte
}
@PreAuthorize("hasRole('NOTIFICATION_CREATE')")
- @RequestMapping(method = RequestMethod.POST,
- value = "/create")
- public NotificationTO create(final HttpServletResponse response,
- @RequestBody final NotificationTO notificationTO)
+ @RequestMapping(method = RequestMethod.POST, value = "/create")
+ public NotificationTO create(final HttpServletResponse response, @RequestBody final NotificationTO notificationTO)
throws NotFoundException {
- LOG.debug("Notification create called with parameter {}",
- notificationTO);
+ LOG.debug("Notification create called with parameter {}", notificationTO);
Notification notification = binder.createNotification(notificationTO);
notification = notificationDAO.save(notification);
@@ -96,20 +87,14 @@ public class NotificationController exte
}
@PreAuthorize("hasRole('NOTIFICATION_UPDATE')")
- @RequestMapping(method = RequestMethod.POST,
- value = "/update")
- public NotificationTO update(
- @RequestBody final NotificationTO notificationTO)
- throws NotFoundException {
+ @RequestMapping(method = RequestMethod.POST, value = "/update")
+ public NotificationTO update(@RequestBody final NotificationTO notificationTO) throws NotFoundException {
- LOG.debug("ConnNotificationtor update called with parameter {}",
- notificationTO);
+ LOG.debug("ConnNotificationtor update called with parameter {}", notificationTO);
- Notification notification =
- notificationDAO.find(notificationTO.getId());
+ Notification notification = notificationDAO.find(notificationTO.getId());
if (notification == null) {
- LOG.error("Could not find notification '"
- + notificationTO.getId() + "'");
+ LOG.error("Could not find notification '" + notificationTO.getId() + "'");
throw new NotFoundException(String.valueOf(notificationTO.getId()));
}
@@ -121,11 +106,8 @@ public class NotificationController exte
}
@PreAuthorize("hasRole('CONNECTOR_DELETE')")
- @RequestMapping(method = RequestMethod.DELETE,
- value = "/delete/{notificationId}")
- public void delete(
- @PathVariable("notificationId") final Long notificationId)
- throws NotFoundException {
+ @RequestMapping(method = RequestMethod.DELETE, value = "/delete/{notificationId}")
+ public void delete(@PathVariable("notificationId") final Long notificationId) throws NotFoundException {
Notification notification = notificationDAO.find(notificationId);
if (notification == null) {
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/PolicyController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/PolicyController.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/PolicyController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/PolicyController.java Thu Mar 15 10:17:12 2012
@@ -54,8 +54,7 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_CREATE')")
@RequestMapping(method = RequestMethod.POST, value = "/password/create")
- public PasswordPolicyTO create(final HttpServletResponse response,
- final @RequestBody PasswordPolicyTO policyTO)
+ public PasswordPolicyTO create(final HttpServletResponse response, final @RequestBody PasswordPolicyTO policyTO)
throws SyncopeClientCompositeErrorException {
LOG.debug("Creating policy " + policyTO);
@@ -67,8 +66,7 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_CREATE')")
@RequestMapping(method = RequestMethod.POST, value = "/account/create")
- public AccountPolicyTO create(final HttpServletResponse response,
- final @RequestBody AccountPolicyTO policyTO)
+ public AccountPolicyTO create(final HttpServletResponse response, final @RequestBody AccountPolicyTO policyTO)
throws SyncopeClientCompositeErrorException {
LOG.debug("Creating policy " + policyTO);
@@ -80,8 +78,7 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_CREATE')")
@RequestMapping(method = RequestMethod.POST, value = "/sync/create")
- public SyncPolicyTO create(final HttpServletResponse response,
- final @RequestBody SyncPolicyTO policyTO)
+ public SyncPolicyTO create(final HttpServletResponse response, final @RequestBody SyncPolicyTO policyTO)
throws SyncopeClientCompositeErrorException {
LOG.debug("Creating policy " + policyTO);
@@ -91,8 +88,7 @@ public class PolicyController extends Ab
return binder.getPolicyTO(policyDAO.save(policy));
}
- private <T extends PolicyTO, K extends Policy> T update(
- T policyTO, K policy) {
+ private <T extends PolicyTO, K extends Policy> T update(T policyTO, K policy) {
LOG.debug("Updating policy " + policyTO);
@@ -104,14 +100,12 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_UPDATE')")
@RequestMapping(method = RequestMethod.POST, value = "/password/update")
- public PasswordPolicyTO update(final HttpServletResponse response,
- final @RequestBody PasswordPolicyTO policyTO)
+ public PasswordPolicyTO update(final HttpServletResponse response, final @RequestBody PasswordPolicyTO policyTO)
throws NotFoundException {
Policy policy = policyDAO.find(policyTO.getId());
if (policy == null || !(policy instanceof PasswordPolicy)) {
- throw new NotFoundException(
- "PasswordPolicy with id " + policyTO.getId());
+ throw new NotFoundException("PasswordPolicy with id " + policyTO.getId());
}
return update(policyTO, policy);
@@ -119,14 +113,12 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_UPDATE')")
@RequestMapping(method = RequestMethod.POST, value = "/account/update")
- public AccountPolicyTO update(final HttpServletResponse response,
- final @RequestBody AccountPolicyTO policyTO)
+ public AccountPolicyTO update(final HttpServletResponse response, final @RequestBody AccountPolicyTO policyTO)
throws NotFoundException, SyncopeClientCompositeErrorException {
Policy policy = policyDAO.find(policyTO.getId());
if (policy == null || !(policy instanceof AccountPolicy)) {
- throw new NotFoundException(
- "AccountPolicy with id " + policyTO.getId());
+ throw new NotFoundException("AccountPolicy with id " + policyTO.getId());
}
return update(policyTO, policy);
@@ -134,14 +126,12 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_UPDATE')")
@RequestMapping(method = RequestMethod.POST, value = "/sync/update")
- public SyncPolicyTO update(final HttpServletResponse response,
- final @RequestBody SyncPolicyTO policyTO)
+ public SyncPolicyTO update(final HttpServletResponse response, final @RequestBody SyncPolicyTO policyTO)
throws NotFoundException, SyncopeClientCompositeErrorException {
Policy policy = policyDAO.find(policyTO.getId());
if (policy == null || !(policy instanceof SyncPolicy)) {
- throw new NotFoundException(
- "SyncPolicy with id " + policyTO.getId());
+ throw new NotFoundException("SyncPolicy with id " + policyTO.getId());
}
return update(policyTO, policy);
@@ -149,13 +139,10 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_LIST')")
@RequestMapping(method = RequestMethod.GET, value = "/{kind}/list")
- public List<PolicyTO> listByType(
- final HttpServletResponse response,
- @PathVariable("kind") final String kind) {
+ public List<PolicyTO> listByType(final HttpServletResponse response, @PathVariable("kind") final String kind) {
LOG.debug("Listing policies");
- List<? extends Policy> policies =
- policyDAO.find(PolicyType.valueOf(kind.toUpperCase()));
+ List<? extends Policy> policies = policyDAO.find(PolicyType.valueOf(kind.toUpperCase()));
final List<PolicyTO> policyTOs = new ArrayList<PolicyTO>();
for (Policy policy : policies) {
@@ -167,9 +154,7 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_READ')")
@RequestMapping(method = RequestMethod.GET, value = "/password/global/read")
- public PasswordPolicyTO getGlobalPasswordPolicy(
- final HttpServletResponse response)
- throws NotFoundException {
+ public PasswordPolicyTO getGlobalPasswordPolicy(final HttpServletResponse response) throws NotFoundException {
LOG.debug("Reading global password policy");
@@ -183,9 +168,7 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_READ')")
@RequestMapping(method = RequestMethod.GET, value = "/account/global/read")
- public AccountPolicyTO getGlobalAccountPolicy(
- final HttpServletResponse response)
- throws NotFoundException {
+ public AccountPolicyTO getGlobalAccountPolicy(final HttpServletResponse response) throws NotFoundException {
LOG.debug("Reading global account policy");
@@ -199,9 +182,7 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_READ')")
@RequestMapping(method = RequestMethod.GET, value = "/sync/global/read")
- public SyncPolicyTO getGlobalSyncPolicy(
- final HttpServletResponse response)
- throws NotFoundException {
+ public SyncPolicyTO getGlobalSyncPolicy(final HttpServletResponse response) throws NotFoundException {
LOG.debug("Reading global sync policy");
@@ -215,9 +196,7 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_READ')")
@RequestMapping(method = RequestMethod.GET, value = "/read/{id}")
- public PolicyTO read(
- final HttpServletResponse response,
- @PathVariable("id") final Long id)
+ public PolicyTO read(final HttpServletResponse response, @PathVariable("id") final Long id)
throws NotFoundException {
LOG.debug("Reading policy with id {}", id);
@@ -232,10 +211,7 @@ public class PolicyController extends Ab
@PreAuthorize("hasRole('POLICY_DELETE')")
@RequestMapping(method = RequestMethod.DELETE, value = "/delete/{id}")
- public void delete(
- final HttpServletResponse response,
- @PathVariable("id") final Long id)
- throws NotFoundException {
+ public void delete(final HttpServletResponse response, @PathVariable("id") final Long id) throws NotFoundException {
LOG.debug("Delete policy");
policyDAO.delete(id);