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 [19/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/util/JexlUtil.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/JexlUtil.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/JexlUtil.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/JexlUtil.java Thu Mar 15 10:17:12 2012
@@ -62,17 +62,14 @@ public class JexlUtil {
return result;
}
- public String evaluate(final String expression,
- final JexlContext jexlContext) {
+ public String evaluate(final String expression, final JexlContext jexlContext) {
String result = "";
- if (expression != null
- && !expression.isEmpty() && jexlContext != null) {
+ if (expression != null && !expression.isEmpty() && jexlContext != null) {
try {
- Expression jexlExpression =
- jexlEngine.createExpression(expression);
+ Expression jexlExpression = jexlEngine.createExpression(expression);
Object evaluated = jexlExpression.evaluate(jexlContext);
if (evaluated != null) {
result = evaluated.toString();
@@ -88,64 +85,53 @@ public class JexlUtil {
return result;
}
- public String evaluate(final String expression,
- final AbstractAttributable attributable) {
+ public String evaluate(final String expression, final AbstractAttributable attributable) {
final JexlContext jexlContext = new MapContext();
if (attributable instanceof SyncopeUser) {
SyncopeUser user = (SyncopeUser) attributable;
- jexlContext.set("username",
- user.getUsername() != null
+ jexlContext.set("username", user.getUsername() != null
? user.getUsername()
: "");
- jexlContext.set("creationDate",
- user.getCreationDate() != null
+ jexlContext.set("creationDate", user.getCreationDate() != null
? user.getDateFormatter().format(user.getCreationDate())
: "");
- jexlContext.set("lastLoginDate",
- user.getLastLoginDate() != null
+ jexlContext.set("lastLoginDate", user.getLastLoginDate() != null
? user.getDateFormatter().format(user.getLastLoginDate())
: "");
- jexlContext.set("failedLogins",
- user.getFailedLogins() != null
+ jexlContext.set("failedLogins", user.getFailedLogins() != null
? user.getFailedLogins()
: "");
- jexlContext.set("changePwdDate",
- user.getChangePwdDate() != null
+ jexlContext.set("changePwdDate", user.getChangePwdDate() != null
? user.getDateFormatter().format(user.getChangePwdDate())
: "");
}
- addAttrsToContext(
- attributable.getAttributes(),
- jexlContext);
-
- addDerAttrsToContext(
- attributable.getDerivedAttributes(),
- attributable.getAttributes(),
- jexlContext);
+ addAttrsToContext(attributable.getAttributes(), jexlContext);
+
+ addDerAttrsToContext(attributable.getDerivedAttributes(), attributable.getAttributes(), jexlContext);
// Evaluate expression using the context prepared before
return evaluate(expression, jexlContext);
}
- public JexlContext addAttrsToContext(
- final Collection<? extends AbstractAttr> attributes,
+ public JexlContext addAttrsToContext(final Collection<? extends AbstractAttr> attributes,
final JexlContext jexlContext) {
JexlContext context = jexlContext == null
- ? new MapContext() : jexlContext;
+ ? new MapContext()
+ : jexlContext;
for (AbstractAttr attribute : attributes) {
List<String> attributeValues = attribute.getValuesAsStrings();
String expressionValue = attributeValues.isEmpty()
- ? "" : attributeValues.get(0);
+ ? ""
+ : attributeValues.get(0);
LOG.debug("Add attribute {} with value {}",
- new Object[]{attribute.getSchema().getName(),
- expressionValue});
+ new Object[] { attribute.getSchema().getName(), expressionValue });
context.set(attribute.getSchema().getName(), expressionValue);
}
@@ -153,13 +139,12 @@ public class JexlUtil {
return context;
}
- public JexlContext addDerAttrsToContext(
- final Collection<? extends AbstractDerAttr> derAttributes,
- final Collection<? extends AbstractAttr> attributes,
- final JexlContext jexlContext) {
+ public JexlContext addDerAttrsToContext(final Collection<? extends AbstractDerAttr> derAttributes,
+ final Collection<? extends AbstractAttr> attributes, final JexlContext jexlContext) {
JexlContext context = jexlContext == null
- ? new MapContext() : jexlContext;
+ ? new MapContext()
+ : jexlContext;
for (AbstractDerAttr attribute : derAttributes) {
String expressionValue = attribute.getValue(attributes);
@@ -167,31 +152,26 @@ public class JexlUtil {
expressionValue = "";
}
- LOG.debug("Add derived attribute {} with value {}",
- new Object[]{attribute.getDerivedSchema().getName(),
- expressionValue});
+ LOG.debug("Add derived attribute {} with value {}", new Object[] { attribute.getDerivedSchema().getName(),
+ expressionValue });
- context.set(
- attribute.getDerivedSchema().getName(), expressionValue);
+ context.set(attribute.getDerivedSchema().getName(), expressionValue);
}
return context;
}
- public String evaluate(final String expression,
- final AbstractAttributableTO attributableTO) {
+ public String evaluate(final String expression, final AbstractAttributableTO attributableTO) {
final JexlContext context = new MapContext();
if (attributableTO instanceof UserTO) {
UserTO user = (UserTO) attributableTO;
- context.set("username",
- user.getUsername() != null
+ context.set("username", user.getUsername() != null
? user.getUsername()
: "");
- context.set("password",
- user.getPassword() != null
+ context.set("password", user.getPassword() != null
? user.getPassword()
: "");
}
@@ -199,30 +179,30 @@ public class JexlUtil {
for (AttributeTO attribute : attributableTO.getAttributes()) {
List<String> attributeValues = attribute.getValues();
String expressionValue = attributeValues.isEmpty()
- ? "" : attributeValues.get(0);
+ ? ""
+ : attributeValues.get(0);
- LOG.debug("Add attribute {} with value {}",
- new Object[]{attribute.getSchema(), expressionValue});
+ LOG.debug("Add attribute {} with value {}", new Object[] { attribute.getSchema(), expressionValue });
context.set(attribute.getSchema(), expressionValue);
}
for (AttributeTO attribute : attributableTO.getDerivedAttributes()) {
List<String> attributeValues = attribute.getValues();
String expressionValue = attributeValues.isEmpty()
- ? "" : attributeValues.get(0);
+ ? ""
+ : attributeValues.get(0);
- LOG.debug("Add attribute {} with value {}",
- new Object[]{attribute.getSchema(), expressionValue});
+ LOG.debug("Add attribute {} with value {}", new Object[] { attribute.getSchema(), expressionValue });
context.set(attribute.getSchema(), expressionValue);
}
for (AttributeTO attribute : attributableTO.getVirtualAttributes()) {
List<String> attributeValues = attribute.getValues();
String expressionValue = attributeValues.isEmpty()
- ? "" : attributeValues.get(0);
+ ? ""
+ : attributeValues.get(0);
- LOG.debug("Add attribute {} with value {}",
- new Object[]{attribute.getSchema(), expressionValue});
+ LOG.debug("Add attribute {} with value {}", new Object[] { attribute.getSchema(), expressionValue });
context.set(attribute.getSchema(), expressionValue);
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/SchemaMappingUtil.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/SchemaMappingUtil.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/SchemaMappingUtil.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/SchemaMappingUtil.java Thu Mar 15 10:17:12 2012
@@ -94,8 +94,8 @@ public class SchemaMappingUtil {
return name;
}
- public static Set<SchemaMapping> getMappings(
- final Collection<SchemaMapping> mappings, final String intAttrName, final IntMappingType type) {
+ public static Set<SchemaMapping> getMappings(final Collection<SchemaMapping> mappings, final String intAttrName,
+ final IntMappingType type) {
final Set<SchemaMapping> result = new HashSet<SchemaMapping>();
@@ -122,7 +122,9 @@ public class SchemaMappingUtil {
}
public static String getIntAttrName(final SchemaMapping mapping, final IntMappingType type) {
- return type == mapping.getIntMappingType() ? getIntAttrName(mapping) : null;
+ return type == mapping.getIntMappingType()
+ ? getIntAttrName(mapping)
+ : null;
}
/**
@@ -133,11 +135,8 @@ public class SchemaMappingUtil {
* @param password password.
* @return schema and attribute values.
*/
- public static Map.Entry<AbstractSchema, List<AbstractAttrValue>> getIntValues(
- final SchemaMapping mapping,
- final List<AbstractAttributable> attributables,
- final String password,
- final SchemaDAO schemaDAO) {
+ public static Map.Entry<AbstractSchema, List<AbstractAttrValue>> getIntValues(final SchemaMapping mapping,
+ final List<AbstractAttributable> attributables, final String password, final SchemaDAO schemaDAO) {
LOG.debug("Get attributes for '{}' and mapping type '{}'", attributables, mapping.getIntMappingType());
@@ -149,23 +148,21 @@ public class SchemaMappingUtil {
case UserSchema:
case RoleSchema:
case MembershipSchema:
- schema = schemaDAO.find(
- mapping.getIntAttrName(),
- SchemaMappingUtil.getIntMappingTypeClass(mapping.getIntMappingType()));
+ schema = schemaDAO.find(mapping.getIntAttrName(), SchemaMappingUtil.getIntMappingTypeClass(mapping
+ .getIntMappingType()));
for (AbstractAttributable attributable : attributables) {
final UAttr attr = attributable.getAttribute(mapping.getIntAttrName());
if (attr != null && attr.getValues() != null) {
values.addAll(schema.isUniqueConstraint()
- ? Collections.singletonList(attr.getUniqueValue()) : attr.getValues());
+ ? Collections.singletonList(attr.getUniqueValue())
+ : attr.getValues());
}
- LOG.debug("Retrieved attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- new Object[]{attr, mapping.getIntAttrName(), mapping.getIntMappingType(), values});
+ LOG.debug("Retrieved attribute {}" + "\n* IntAttrName {}" + "\n* IntMappingType {}"
+ + "\n* Attribute values {}", new Object[] { attr, mapping.getIntAttrName(),
+ mapping.getIntMappingType(), values });
}
break;
@@ -185,11 +182,9 @@ public class SchemaMappingUtil {
}
}
- LOG.debug("Retrieved virtual attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- new Object[]{virAttr, mapping.getIntAttrName(), mapping.getIntMappingType(), values});
+ LOG.debug("Retrieved virtual attribute {}" + "\n* IntAttrName {}" + "\n* IntMappingType {}"
+ + "\n* Attribute values {}", new Object[] { virAttr, mapping.getIntAttrName(),
+ mapping.getIntMappingType(), values });
}
break;
@@ -197,22 +192,17 @@ public class SchemaMappingUtil {
case RoleDerivedSchema:
case MembershipDerivedSchema:
for (AbstractAttributable attributable : attributables) {
- AbstractDerAttr derAttr = attributable.getDerivedAttribute(
- mapping.getIntAttrName());
+ AbstractDerAttr derAttr = attributable.getDerivedAttribute(mapping.getIntAttrName());
if (derAttr != null) {
AbstractAttrValue attrValue = new UAttrValue();
- attrValue.setStringValue(
- derAttr.getValue(attributable.getAttributes()));
+ attrValue.setStringValue(derAttr.getValue(attributable.getAttributes()));
values.add(attrValue);
}
- LOG.debug("Retrieved attribute {}"
- + "\n* IntAttrName {}"
- + "\n* IntMappingType {}"
- + "\n* Attribute values {}",
- new Object[]{derAttr, mapping.getIntAttrName(),
- mapping.getIntMappingType(), values});
+ LOG.debug("Retrieved attribute {}" + "\n* IntAttrName {}" + "\n* IntMappingType {}"
+ + "\n* Attribute values {}", new Object[] { derAttr, mapping.getIntAttrName(),
+ mapping.getIntMappingType(), values });
}
break;
@@ -250,13 +240,12 @@ public class SchemaMappingUtil {
return new DefaultMapEntry(schema, values);
}
- public static List<String> getIntValueAsStrings(
- final AbstractAttributable attributable, final SchemaMapping mapping) {
+ public static List<String> getIntValueAsStrings(final AbstractAttributable attributable, final SchemaMapping mapping) {
return getIntValueAsStrings(attributable, mapping, null);
}
- public static List<String> getIntValueAsStrings(
- final AbstractAttributable attributable, final SchemaMapping mapping, String clearPassword) {
+ public static List<String> getIntValueAsStrings(final AbstractAttributable attributable,
+ final SchemaMapping mapping, String clearPassword) {
List<String> value = new ArrayList<String>();
@@ -376,10 +365,12 @@ public class SchemaMappingUtil {
* @param mappings collection of SchemaMapping.
* @return accountId internal value.
*/
- public static final String getAccountIdValue(
- final AbstractAttributable attributable, final Collection<SchemaMapping> mappings) {
+ public static final String getAccountIdValue(final AbstractAttributable attributable,
+ final Collection<SchemaMapping> mappings) {
final List<String> values = getIntValueAsStrings(attributable, getAccountIdMapping(mappings));
- return values == null || values.isEmpty() ? null : values.get(0);
+ return values == null || values.isEmpty()
+ ? null
+ : values.get(0);
}
/**
@@ -391,7 +382,9 @@ public class SchemaMappingUtil {
*/
public static final String getAccountIdValue(final AbstractAttributable attributable, final SchemaMapping mapping) {
final List<String> values = getIntValueAsStrings(attributable, mapping);
- return values == null || values.isEmpty() ? null : values.get(0);
+ return values == null || values.isEmpty()
+ ? null
+ : values.get(0);
}
public static class SchemaMappingsWrapper {
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/SpringPersistenceUnitPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/SpringPersistenceUnitPostProcessor.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/SpringPersistenceUnitPostProcessor.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/SpringPersistenceUnitPostProcessor.java Thu Mar 15 10:17:12 2012
@@ -34,8 +34,7 @@ import org.springframework.orm.jpa.persi
* Add to JPA persistence context all beans labeled as @Entity from given location. This is needed only when using
* LocalContainerEntityManagerFactoryBean with non-standard persistence.xml (currently JBoss-only).
*/
-public class SpringPersistenceUnitPostProcessor
- implements PersistenceUnitPostProcessor {
+public class SpringPersistenceUnitPostProcessor implements PersistenceUnitPostProcessor {
/**
* Logger.
@@ -48,12 +47,13 @@ public class SpringPersistenceUnitPostPr
private String[] locations;
public void setLocations(final String[] locations) {
- this.locations = locations == null ? new String[0] : locations.clone();
+ this.locations = locations == null
+ ? new String[0]
+ : locations.clone();
}
@Override
- public void postProcessPersistenceUnitInfo(
- final MutablePersistenceUnitInfo mpui) {
+ public void postProcessPersistenceUnitInfo(final MutablePersistenceUnitInfo mpui) {
if (locations.length == 0) {
LOG.warn("No locations provided");
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/multiparent/MultiParentNode.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/multiparent/MultiParentNode.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/multiparent/MultiParentNode.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/multiparent/MultiParentNode.java Thu Mar 15 10:17:12 2012
@@ -79,13 +79,11 @@ public class MultiParentNode<T> {
}
}
- public void addChild(final MultiParentNode<T> child)
- throws CycleInMultiParentTreeException {
+ public void addChild(final MultiParentNode<T> child) throws CycleInMultiParentTreeException {
if (child != null) {
if (MultiParentNodeOp.findInTree(child, getObject()) != null) {
- throw new CycleInMultiParentTreeException(
- "This node is descendant of given child node");
+ throw new CycleInMultiParentTreeException("This node is descendant of given child node");
}
children.add(child);
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/multiparent/MultiParentNodeOp.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/multiparent/MultiParentNodeOp.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/multiparent/MultiParentNodeOp.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/util/multiparent/MultiParentNodeOp.java Thu Mar 15 10:17:12 2012
@@ -25,8 +25,7 @@ public class MultiParentNodeOp {
private MultiParentNodeOp() {
}
- public static <T> MultiParentNode<T> findInTree(
- final MultiParentNode<T> parent, final T object) {
+ public static <T> MultiParentNode<T> findInTree(final MultiParentNode<T> parent, final T object) {
if (parent.getObject().equals(object)) {
return parent;
@@ -42,8 +41,7 @@ public class MultiParentNodeOp {
return null;
}
- public static <T> void traverseTree(final MultiParentNode<T> parent,
- final List<T> objects) {
+ public static <T> void traverseTree(final MultiParentNode<T> parent, final List<T> objects) {
for (MultiParentNode<T> child : parent.getChildren()) {
traverseTree(child, objects);
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/AbstractUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/AbstractUserWorkflowAdapter.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/AbstractUserWorkflowAdapter.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/AbstractUserWorkflowAdapter.java Thu Mar 15 10:17:12 2012
@@ -30,9 +30,7 @@ import org.syncope.core.persistence.dao.
import org.syncope.core.rest.controller.UnauthorizedRoleException;
import org.syncope.core.rest.data.UserDataBinder;
-@Transactional(rollbackFor = {
- Throwable.class
-})
+@Transactional(rollbackFor = { Throwable.class })
public abstract class AbstractUserWorkflowAdapter implements UserWorkflowAdapter {
@Autowired
@@ -48,9 +46,7 @@ public abstract class AbstractUserWorkfl
return create(userTO, false);
}
- protected abstract WorkflowResult<Long> doActivate(
- SyncopeUser user, String token)
- throws WorkflowException;
+ protected abstract WorkflowResult<Long> doActivate(SyncopeUser user, String token) throws WorkflowException;
@Override
public WorkflowResult<Long> activate(final Long userId, final String token)
@@ -69,20 +65,17 @@ public abstract class AbstractUserWorkfl
return doUpdate(dataBinder.getUserFromId(userMod.getId()), userMod);
}
- protected abstract WorkflowResult<Long> doSuspend(SyncopeUser user)
- throws WorkflowException;
+ protected abstract WorkflowResult<Long> doSuspend(SyncopeUser user) throws WorkflowException;
@Override
public WorkflowResult<Long> suspend(final Long userId)
- throws UnauthorizedRoleException, NotFoundException,
- WorkflowException {
+ throws UnauthorizedRoleException, NotFoundException, WorkflowException {
return suspend(dataBinder.getUserFromId(userId));
}
@Override
- public WorkflowResult<Long> suspend(final SyncopeUser user)
- throws UnauthorizedRoleException, WorkflowException {
+ public WorkflowResult<Long> suspend(final SyncopeUser user) throws UnauthorizedRoleException, WorkflowException {
// set suspended flag
user.setSuspended(Boolean.TRUE);
@@ -90,13 +83,11 @@ public abstract class AbstractUserWorkfl
return doSuspend(user);
}
- protected abstract WorkflowResult<Long> doReactivate(SyncopeUser user)
- throws WorkflowException;
+ protected abstract WorkflowResult<Long> doReactivate(SyncopeUser user) throws WorkflowException;
@Override
public WorkflowResult<Long> reactivate(final Long userId)
- throws UnauthorizedRoleException, NotFoundException,
- WorkflowException {
+ throws UnauthorizedRoleException, NotFoundException, WorkflowException {
final SyncopeUser user = dataBinder.getUserFromId(userId);
@@ -109,13 +100,10 @@ public abstract class AbstractUserWorkfl
return doReactivate(user);
}
- protected abstract void doDelete(SyncopeUser user)
- throws WorkflowException;
+ protected abstract void doDelete(SyncopeUser user) throws WorkflowException;
@Override
- public void delete(final Long userId)
- throws UnauthorizedRoleException, NotFoundException,
- WorkflowException {
+ public void delete(final Long userId) throws UnauthorizedRoleException, NotFoundException, WorkflowException {
doDelete(dataBinder.getUserFromId(userId));
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/ActivitiUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/ActivitiUserWorkflowAdapter.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/ActivitiUserWorkflowAdapter.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/ActivitiUserWorkflowAdapter.java Thu Mar 15 10:17:12 2012
@@ -85,7 +85,7 @@ public class ActivitiUserWorkflowAdapter
*/
private static final Logger LOG = LoggerFactory.getLogger(ActivitiUserWorkflowAdapter.class);
- private static final String[] PROPERTY_IGNORE_PROPS = {"type"};
+ private static final String[] PROPERTY_IGNORE_PROPS = { "type" };
public static final String WF_PROCESS_ID = "userWorkflow";
@@ -159,8 +159,8 @@ public class ActivitiUserWorkflowAdapter
private Set<String> getPerformedTasks(final SyncopeUser user) {
Set<String> result = new HashSet<String>();
- List<HistoricActivityInstance> tasks =
- historyService.createHistoricActivityInstanceQuery().executionId(user.getWorkflowId()).list();
+ List<HistoricActivityInstance> tasks = historyService.createHistoricActivityInstanceQuery().executionId(
+ user.getWorkflowId()).list();
for (HistoricActivityInstance task : tasks) {
result.add(task.getActivityId());
}
@@ -169,9 +169,7 @@ public class ActivitiUserWorkflowAdapter
}
private String encrypt(final String clear) {
- byte[] encryptedBytes = EncryptorFactory.getInstance().
- getDefaultEncryptor().encrypt(
- clear.getBytes());
+ byte[] encryptedBytes = EncryptorFactory.getInstance().getDefaultEncryptor().encrypt(clear.getBytes());
char[] encryptedChars = SecurityUtil.bytesToChars(encryptedBytes);
return new String(encryptedChars);
@@ -179,27 +177,21 @@ public class ActivitiUserWorkflowAdapter
private String decrypt(final String crypted) {
char[] encryptedChars = crypted.toCharArray();
- byte[] encryptedBytes = EncryptorFactory.getInstance().
- getDefaultEncryptor().decrypt(
+ byte[] encryptedBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt(
SecurityUtil.charsToBytes(encryptedChars));
return new String(encryptedBytes);
}
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(
- final UserTO userTO,
- final boolean disablePwdPolicyCheck)
+ public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck)
throws WorkflowException {
return create(userTO, disablePwdPolicyCheck, null);
}
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(
- final UserTO userTO,
- final boolean disablePwdPolicyCheck,
- final Boolean enabled)
- throws WorkflowException {
+ public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
+ final Boolean enabled) throws WorkflowException {
final Map<String, Object> variables = new HashMap<String, Object>();
variables.put(USER_TO, userTO);
@@ -212,8 +204,8 @@ public class ActivitiUserWorkflowAdapter
throw new WorkflowException(e);
}
- SyncopeUser user =
- (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(), SYNCOPE_USER);
+ SyncopeUser user = (SyncopeUser) runtimeService.getVariable(processInstance.getProcessInstanceId(),
+ SYNCOPE_USER);
// this will make SyncopeUserValidator not to consider
// password policies at all
@@ -224,8 +216,8 @@ public class ActivitiUserWorkflowAdapter
updateStatus(user);
user = userDAO.save(user);
- Boolean propagateEnable =
- (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(), PROPAGATE_ENABLE);
+ Boolean propagateEnable = (Boolean) runtimeService.getVariable(processInstance.getProcessInstanceId(),
+ PROPAGATE_ENABLE);
if (propagateEnable == null) {
propagateEnable = enabled;
@@ -241,17 +233,16 @@ public class ActivitiUserWorkflowAdapter
propByRes = null;
if (StringUtils.isNotBlank(userTO.getPassword())) {
- runtimeService.setVariable(
- processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO.getPassword()));
+ runtimeService.setVariable(processInstance.getProcessInstanceId(), ENCRYPTED_PWD, encrypt(userTO
+ .getPassword()));
}
}
- return new WorkflowResult<Map.Entry<Long, Boolean>>(
- new DefaultMapEntry(user.getId(), propagateEnable), propByRes, getPerformedTasks(user));
+ return new WorkflowResult<Map.Entry<Long, Boolean>>(new DefaultMapEntry(user.getId(), propagateEnable),
+ propByRes, getPerformedTasks(user));
}
- private Set<String> doExecuteTask(
- final SyncopeUser user, final String task, final Map<String, Object> moreVariables)
+ private Set<String> doExecuteTask(final SyncopeUser user, final String task, final Map<String, Object> moreVariables)
throws WorkflowException {
Set<String> preTasks = getPerformedTasks(user);
@@ -286,12 +277,9 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- protected WorkflowResult<Long> doActivate(final SyncopeUser user,
- final String token)
- throws WorkflowException {
+ protected WorkflowResult<Long> doActivate(final SyncopeUser user, final String token) throws WorkflowException {
- Set<String> performedTasks = doExecuteTask(user, "activate",
- Collections.singletonMap(TOKEN, (Object) token));
+ Set<String> performedTasks = doExecuteTask(user, "activate", Collections.singletonMap(TOKEN, (Object) token));
updateStatus(user);
SyncopeUser updated = userDAO.save(user);
@@ -299,8 +287,7 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- protected WorkflowResult<Map.Entry<Long, Boolean>> doUpdate(
- final SyncopeUser user, final UserMod userMod)
+ protected WorkflowResult<Map.Entry<Long, Boolean>> doUpdate(final SyncopeUser user, final UserMod userMod)
throws WorkflowException {
Set<String> task = doExecuteTask(user, "update", Collections.singletonMap(USER_MOD, (Object) userMod));
@@ -308,8 +295,8 @@ public class ActivitiUserWorkflowAdapter
updateStatus(user);
SyncopeUser updated = userDAO.save(user);
- PropagationByResource propByRes =
- (PropagationByResource) runtimeService.getVariable(user.getWorkflowId(), PROP_BY_RESOURCE);
+ PropagationByResource propByRes = (PropagationByResource) runtimeService.getVariable(user.getWorkflowId(),
+ PROP_BY_RESOURCE);
// save resources to be propagated and password for later -
// after form submission - propagation
@@ -319,14 +306,13 @@ public class ActivitiUserWorkflowAdapter
Boolean propagateEnable = (Boolean) runtimeService.getVariable(user.getWorkflowId(), PROPAGATE_ENABLE);
- return new WorkflowResult<Map.Entry<Long, Boolean>>(
- new DefaultMapEntry(updated.getId(), propagateEnable), propByRes, task);
+ return new WorkflowResult<Map.Entry<Long, Boolean>>(new DefaultMapEntry(updated.getId(), propagateEnable),
+ propByRes, task);
}
@Override
- @Transactional(rollbackFor = {Throwable.class})
- protected WorkflowResult<Long> doSuspend(final SyncopeUser user)
- throws WorkflowException {
+ @Transactional(rollbackFor = { Throwable.class })
+ protected WorkflowResult<Long> doSuspend(final SyncopeUser user) throws WorkflowException {
Set<String> performedTasks = doExecuteTask(user, "suspend", null);
updateStatus(user);
@@ -336,8 +322,7 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- protected WorkflowResult<Long> doReactivate(final SyncopeUser user)
- throws WorkflowException {
+ protected WorkflowResult<Long> doReactivate(final SyncopeUser user) throws WorkflowException {
Set<String> performedTasks = doExecuteTask(user, "reactivate", null);
updateStatus(user);
@@ -348,18 +333,15 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- protected void doDelete(final SyncopeUser user)
- throws WorkflowException {
+ protected void doDelete(final SyncopeUser user) throws WorkflowException {
doExecuteTask(user, "delete", null);
userDAO.delete(user);
}
@Override
- public WorkflowResult<Long> execute(final UserTO userTO,
- final String taskId)
- throws UnauthorizedRoleException, NotFoundException,
- WorkflowException {
+ public WorkflowResult<Long> execute(final UserTO userTO, final String taskId)
+ throws UnauthorizedRoleException, NotFoundException, WorkflowException {
SyncopeUser user = dataBinder.getUserFromId(userTO.getId());
@@ -374,21 +356,17 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- public WorkflowDefinitionTO getDefinition()
- throws WorkflowException {
+ public WorkflowDefinitionTO getDefinition() throws WorkflowException {
ProcessDefinition procDef;
try {
- procDef = repositoryService.createProcessDefinitionQuery().
- processDefinitionKey(
- ActivitiUserWorkflowAdapter.WF_PROCESS_ID).latestVersion().
- singleResult();
+ procDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey(
+ ActivitiUserWorkflowAdapter.WF_PROCESS_ID).latestVersion().singleResult();
} catch (ActivitiException e) {
throw new WorkflowException(e);
}
- InputStream procDefIS = repositoryService.getResourceAsStream(
- procDef.getDeploymentId(), WF_PROCESS_RESOURCE);
+ InputStream procDefIS = repositoryService.getResourceAsStream(procDef.getDeploymentId(), WF_PROCESS_RESOURCE);
Reader reader = null;
Writer writer = new StringWriter();
try {
@@ -400,8 +378,7 @@ public class ActivitiUserWorkflowAdapter
writer.write(buffer, 0, n);
}
} catch (IOException e) {
- LOG.error("While reading workflow definition {}",
- procDef.getKey(), e);
+ LOG.error("While reading workflow definition {}", procDef.getKey(), e);
} finally {
try {
if (reader != null) {
@@ -411,8 +388,7 @@ public class ActivitiUserWorkflowAdapter
procDefIS.close();
}
} catch (IOException ioe) {
- LOG.error("While closing input stream for {}",
- procDef.getKey(), ioe);
+ LOG.error("While closing input stream for {}", procDef.getKey(), ioe);
}
}
@@ -424,60 +400,47 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- public void updateDefinition(
- final WorkflowDefinitionTO definition)
- throws NotFoundException, WorkflowException {
+ public void updateDefinition(final WorkflowDefinitionTO definition) throws NotFoundException, WorkflowException {
- if (!ActivitiUserWorkflowAdapter.WF_PROCESS_ID.equals(
- definition.getId())) {
+ if (!ActivitiUserWorkflowAdapter.WF_PROCESS_ID.equals(definition.getId())) {
- throw new NotFoundException("Workflow process id "
- + definition.getId());
+ throw new NotFoundException("Workflow process id " + definition.getId());
}
try {
- repositoryService.createDeployment().addInputStream(
- ActivitiUserWorkflowAdapter.WF_PROCESS_RESOURCE,
- new ByteArrayInputStream(
- definition.getXmlDefinition().getBytes())).deploy();
+ repositoryService.createDeployment().addInputStream(ActivitiUserWorkflowAdapter.WF_PROCESS_RESOURCE,
+ new ByteArrayInputStream(definition.getXmlDefinition().getBytes())).deploy();
} catch (ActivitiException e) {
throw new WorkflowException(e);
}
}
@Override
- public List<String> getDefinedTasks()
- throws WorkflowException {
+ public List<String> getDefinedTasks() throws WorkflowException {
List<String> result = new ArrayList<String>();
ProcessDefinition procDef;
try {
- procDef = repositoryService.createProcessDefinitionQuery().
- processDefinitionKey(
- ActivitiUserWorkflowAdapter.WF_PROCESS_ID).latestVersion().
- singleResult();
+ procDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey(
+ ActivitiUserWorkflowAdapter.WF_PROCESS_ID).latestVersion().singleResult();
} catch (ActivitiException e) {
throw new WorkflowException(e);
}
- InputStream procDefIS = repositoryService.getResourceAsStream(
- procDef.getDeploymentId(), WF_PROCESS_RESOURCE);
+ InputStream procDefIS = repositoryService.getResourceAsStream(procDef.getDeploymentId(), WF_PROCESS_RESOURCE);
- DocumentBuilderFactory domFactory =
- DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document doc = builder.parse(procDefIS);
XPath xpath = XPathFactory.newInstance().newXPath();
- NodeList nodeList = (NodeList) xpath.evaluate(
- "//userTask | //serviceTask | //scriptTask",
- doc, XPathConstants.NODESET);
+ NodeList nodeList = (NodeList) xpath.evaluate("//userTask | //serviceTask | //scriptTask", doc,
+ XPathConstants.NODESET);
for (int i = 0; i < nodeList.getLength(); i++) {
- result.add(nodeList.item(i).getAttributes().
- getNamedItem("id").getNodeValue());
+ result.add(nodeList.item(i).getAttributes().getNamedItem("id").getNodeValue());
}
} catch (Exception e) {
throw new WorkflowException(e);
@@ -485,16 +448,14 @@ public class ActivitiUserWorkflowAdapter
try {
procDefIS.close();
} catch (IOException ioe) {
- LOG.error("While closing input stream for {}",
- procDef.getKey(), ioe);
+ LOG.error("While closing input stream for {}", procDef.getKey(), ioe);
}
}
return result;
}
- private WorkflowFormPropertyType fromActivitiFormType(
- final FormType activitiFormType) {
+ private WorkflowFormPropertyType fromActivitiFormType(final FormType activitiFormType) {
WorkflowFormPropertyType result = WorkflowFormPropertyType.String;
@@ -517,8 +478,7 @@ public class ActivitiUserWorkflowAdapter
return result;
}
- private WorkflowFormTO getFormTO(final Task task,
- final TaskFormData formData) {
+ private WorkflowFormTO getFormTO(final Task task, final TaskFormData formData) {
WorkflowFormTO formTO = new WorkflowFormTO();
formTO.setTaskId(task.getId());
@@ -529,18 +489,14 @@ public class ActivitiUserWorkflowAdapter
WorkflowFormPropertyTO propertyTO;
for (FormProperty fProp : formData.getFormProperties()) {
propertyTO = new WorkflowFormPropertyTO();
- BeanUtils.copyProperties(fProp, propertyTO,
- PROPERTY_IGNORE_PROPS);
+ BeanUtils.copyProperties(fProp, propertyTO, PROPERTY_IGNORE_PROPS);
propertyTO.setType(fromActivitiFormType(fProp.getType()));
if (propertyTO.getType() == WorkflowFormPropertyType.Date) {
- propertyTO.setDatePattern(
- (String) fProp.getType().getInformation("datePattern"));
+ propertyTO.setDatePattern((String) fProp.getType().getInformation("datePattern"));
}
if (propertyTO.getType() == WorkflowFormPropertyType.Enum) {
- propertyTO.setEnumValues(
- (Map<String, String>) fProp.getType().
- getInformation("values"));
+ propertyTO.setEnumValues((Map<String, String>) fProp.getType().getInformation("values"));
}
formTO.addProperty(propertyTO);
@@ -571,13 +527,11 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- public WorkflowFormTO getForm(final String workflowId)
- throws NotFoundException, WorkflowException {
+ public WorkflowFormTO getForm(final String workflowId) throws NotFoundException, WorkflowException {
Task task;
try {
- task = taskService.createTaskQuery().processInstanceId(workflowId).
- singleResult();
+ task = taskService.createTaskQuery().processInstanceId(workflowId).singleResult();
} catch (ActivitiException e) {
throw new WorkflowException(e);
}
@@ -598,8 +552,7 @@ public class ActivitiUserWorkflowAdapter
return result;
}
- private Map.Entry<Task, TaskFormData> checkTask(final String taskId,
- final String username)
+ private Map.Entry<Task, TaskFormData> checkTask(final String taskId, final String username)
throws NotFoundException {
Task task;
@@ -627,18 +580,15 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- public WorkflowFormTO claimForm(final String taskId,
- final String username)
+ public WorkflowFormTO claimForm(final String taskId, final String username)
throws NotFoundException, WorkflowException {
Map.Entry<Task, TaskFormData> checked = checkTask(taskId, username);
if (!adminUser.equals(username)) {
- List<Task> tasksForUser = taskService.createTaskQuery().taskId(
- taskId).taskCandidateUser(username).list();
+ List<Task> tasksForUser = taskService.createTaskQuery().taskId(taskId).taskCandidateUser(username).list();
if (tasksForUser.isEmpty()) {
- throw new WorkflowException(new RuntimeException(
- username + " is not candidate for task " + taskId));
+ throw new WorkflowException(new RuntimeException(username + " is not candidate for task " + taskId));
}
}
@@ -654,31 +604,24 @@ public class ActivitiUserWorkflowAdapter
}
@Override
- public WorkflowResult<Map.Entry<Long, String>> submitForm(
- final WorkflowFormTO form, final String username)
+ public WorkflowResult<Map.Entry<Long, String>> submitForm(final WorkflowFormTO form, final String username)
throws NotFoundException, WorkflowException {
- Map.Entry<Task, TaskFormData> checked =
- checkTask(form.getTaskId(), username);
+ Map.Entry<Task, TaskFormData> checked = checkTask(form.getTaskId(), username);
if (!checked.getKey().getOwner().equals(username)) {
- throw new WorkflowException(new RuntimeException(
- "Task " + form.getTaskId() + " assigned to "
- + checked.getKey().getOwner() + " but submited by "
- + username));
+ throw new WorkflowException(new RuntimeException("Task " + form.getTaskId() + " assigned to "
+ + checked.getKey().getOwner() + " but submited by " + username));
}
- SyncopeUser user = userDAO.findByWorkflowId(
- checked.getKey().getProcessInstanceId());
+ SyncopeUser user = userDAO.findByWorkflowId(checked.getKey().getProcessInstanceId());
if (user == null) {
- throw new NotFoundException("User with workflow id "
- + checked.getKey().getProcessInstanceId());
+ throw new NotFoundException("User with workflow id " + checked.getKey().getProcessInstanceId());
}
Set<String> preTasks = getPerformedTasks(user);
try {
- formService.submitTaskFormData(form.getTaskId(),
- form.getPropertiesForSubmit());
+ formService.submitTaskFormData(form.getTaskId(), form.getPropertiesForSubmit());
} catch (ActivitiException e) {
throw new WorkflowException(e);
}
@@ -691,20 +634,17 @@ public class ActivitiUserWorkflowAdapter
SyncopeUser updated = userDAO.save(user);
// see if there is any propagation to be done
- PropagationByResource propByRes =
- (PropagationByResource) runtimeService.getVariable(
- user.getWorkflowId(), PROP_BY_RESOURCE);
+ PropagationByResource propByRes = (PropagationByResource) runtimeService.getVariable(user.getWorkflowId(),
+ PROP_BY_RESOURCE);
// fetch - if available - the encrpted password
String clearPassword = null;
- String encryptedPwd = (String) runtimeService.getVariable(
- user.getWorkflowId(), ENCRYPTED_PWD);
+ String encryptedPwd = (String) runtimeService.getVariable(user.getWorkflowId(), ENCRYPTED_PWD);
if (StringUtils.isNotBlank(encryptedPwd)) {
clearPassword = decrypt(encryptedPwd);
}
- return new WorkflowResult<Map.Entry<Long, String>>(
- new DefaultMapEntry(updated.getId(), clearPassword),
+ return new WorkflowResult<Map.Entry<Long, String>>(new DefaultMapEntry(updated.getId(), clearPassword),
propByRes, postTasks);
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/NoOpUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/NoOpUserWorkflowAdapter.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/NoOpUserWorkflowAdapter.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/NoOpUserWorkflowAdapter.java Thu Mar 15 10:17:12 2012
@@ -37,33 +37,23 @@ import org.syncope.types.PropagationOper
/**
* Simple implementation basically not involving any workflow engine.
*/
-@Transactional(rollbackFor = {
- Throwable.class
-})
+@Transactional(rollbackFor = { Throwable.class })
public class NoOpUserWorkflowAdapter extends AbstractUserWorkflowAdapter {
- private static final List<String> TASKS =
- Arrays.asList(
- new String[]{
- "create", "activate", "update",
- "suspend", "reactivate", "delete"});
+ private static final List<String> TASKS = Arrays.asList(new String[] { "create", "activate", "update", "suspend",
+ "reactivate", "delete" });
public static final String ENABLED = "enabled";
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(
- final UserTO userTO,
- final boolean disablePwdPolicyCheck)
+ public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck)
throws WorkflowException {
return create(userTO, disablePwdPolicyCheck, null);
}
@Override
- public WorkflowResult<Map.Entry<Long, Boolean>> create(
- final UserTO userTO,
- final boolean disablePwdPolicyCheck,
- final Boolean enabled)
- throws WorkflowException {
+ public WorkflowResult<Map.Entry<Long, Boolean>> create(final UserTO userTO, final boolean disablePwdPolicyCheck,
+ final Boolean enabled) throws WorkflowException {
SyncopeUser user = new SyncopeUser();
dataBinder.create(user, userTO);
@@ -81,7 +71,9 @@ public class NoOpUserWorkflowAdapter ext
status = "created";
propagate_enable = true;
} else {
- status = enabled ? "active" : "suspended";
+ status = enabled
+ ? "active"
+ : "suspended";
propagate_enable = enabled;
}
@@ -91,18 +83,15 @@ public class NoOpUserWorkflowAdapter ext
final PropagationByResource propByRes = new PropagationByResource();
propByRes.set(PropagationOperation.CREATE, user.getResourceNames());
- return new WorkflowResult<Map.Entry<Long, Boolean>>(
- new DefaultMapEntry(user.getId(), propagate_enable), propByRes, "create");
+ return new WorkflowResult<Map.Entry<Long, Boolean>>(new DefaultMapEntry(user.getId(), propagate_enable),
+ propByRes, "create");
}
@Override
- protected WorkflowResult<Long> doActivate(final SyncopeUser user,
- final String token)
- throws WorkflowException {
+ protected WorkflowResult<Long> doActivate(final SyncopeUser user, final String token) throws WorkflowException {
if (!user.checkToken(token)) {
- throw new WorkflowException(
- new RuntimeException("Wrong token: " + token));
+ throw new WorkflowException(new RuntimeException("Wrong token: " + token));
}
user.removeToken();
@@ -113,21 +102,19 @@ public class NoOpUserWorkflowAdapter ext
}
@Override
- protected WorkflowResult<Map.Entry<Long, Boolean>> doUpdate(
- final SyncopeUser user, final UserMod userMod)
+ protected WorkflowResult<Map.Entry<Long, Boolean>> doUpdate(final SyncopeUser user, final UserMod userMod)
throws WorkflowException {
PropagationByResource propByRes = dataBinder.update(user, userMod);
SyncopeUser updated = userDAO.save(user);
- return new WorkflowResult<Map.Entry<Long, Boolean>>(
- new DefaultMapEntry(updated.getId(), true), propByRes, "update");
+ return new WorkflowResult<Map.Entry<Long, Boolean>>(new DefaultMapEntry(updated.getId(), true), propByRes,
+ "update");
}
@Override
- protected WorkflowResult<Long> doSuspend(final SyncopeUser user)
- throws WorkflowException {
+ protected WorkflowResult<Long> doSuspend(final SyncopeUser user) throws WorkflowException {
user.setStatus("suspended");
SyncopeUser updated = userDAO.save(user);
@@ -136,8 +123,7 @@ public class NoOpUserWorkflowAdapter ext
}
@Override
- protected WorkflowResult<Long> doReactivate(final SyncopeUser user)
- throws WorkflowException {
+ protected WorkflowResult<Long> doReactivate(final SyncopeUser user) throws WorkflowException {
user.setStatus("active");
SyncopeUser updated = userDAO.save(user);
@@ -146,40 +132,32 @@ public class NoOpUserWorkflowAdapter ext
}
@Override
- protected void doDelete(final SyncopeUser user)
- throws WorkflowException {
+ protected void doDelete(final SyncopeUser user) throws WorkflowException {
userDAO.delete(user);
}
@Override
- public WorkflowResult<Long> execute(final UserTO userTO,
- final String taskId)
- throws UnauthorizedRoleException, NotFoundException,
- WorkflowException {
+ public WorkflowResult<Long> execute(final UserTO userTO, final String taskId)
+ throws UnauthorizedRoleException, NotFoundException, WorkflowException {
- throw new WorkflowException(
- new UnsupportedOperationException("Not supported."));
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
}
@Override
- public WorkflowDefinitionTO getDefinition()
- throws WorkflowException {
+ public WorkflowDefinitionTO getDefinition() throws WorkflowException {
return new WorkflowDefinitionTO();
}
@Override
- public void updateDefinition(final WorkflowDefinitionTO definition)
- throws NotFoundException, WorkflowException {
+ public void updateDefinition(final WorkflowDefinitionTO definition) throws NotFoundException, WorkflowException {
- throw new WorkflowException(
- new UnsupportedOperationException("Not supported."));
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
}
@Override
- public List<String> getDefinedTasks()
- throws WorkflowException {
+ public List<String> getDefinedTasks() throws WorkflowException {
return TASKS;
}
@@ -190,8 +168,7 @@ public class NoOpUserWorkflowAdapter ext
}
@Override
- public WorkflowFormTO getForm(final String workflowId)
- throws NotFoundException, WorkflowException {
+ public WorkflowFormTO getForm(final String workflowId) throws NotFoundException, WorkflowException {
return null;
}
@@ -200,16 +177,13 @@ public class NoOpUserWorkflowAdapter ext
public WorkflowFormTO claimForm(final String taskId, final String username)
throws NotFoundException, WorkflowException {
- throw new WorkflowException(
- new UnsupportedOperationException("Not supported."));
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
}
@Override
- public WorkflowResult<Map.Entry<Long, String>> submitForm(
- final WorkflowFormTO form, final String username)
+ public WorkflowResult<Map.Entry<Long, String>> submitForm(final WorkflowFormTO form, final String username)
throws NotFoundException, WorkflowException {
- throw new WorkflowException(
- new UnsupportedOperationException("Not supported."));
+ throw new WorkflowException(new UnsupportedOperationException("Not supported."));
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/UserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/UserWorkflowAdapter.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/UserWorkflowAdapter.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/UserWorkflowAdapter.java Thu Mar 15 10:17:12 2012
@@ -41,8 +41,7 @@ public interface UserWorkflowAdapter {
* @throws UnauthorizedRoleException authorization exception
* @throws WorkflowException workflow exception
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO)
- throws UnauthorizedRoleException, WorkflowException;
+ WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO) throws UnauthorizedRoleException, WorkflowException;
/**
* Create an user, optionally disabling password policy check.
@@ -53,9 +52,7 @@ public interface UserWorkflowAdapter {
* @throws UnauthorizedRoleException authorization exception
* @throws WorkflowException workflow exception
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(
- UserTO userTO,
- boolean disablePwdPolicyCheck)
+ WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean disablePwdPolicyCheck)
throws UnauthorizedRoleException, WorkflowException;
/**
@@ -68,10 +65,7 @@ public interface UserWorkflowAdapter {
* @throws UnauthorizedRoleException authorization exception
* @throws WorkflowException workflow exception
*/
- WorkflowResult<Map.Entry<Long, Boolean>> create(
- UserTO userTO,
- boolean disablePwdPolicyCheck,
- final Boolean enabled)
+ WorkflowResult<Map.Entry<Long, Boolean>> create(UserTO userTO, boolean disablePwdPolicyCheck, final Boolean enabled)
throws UnauthorizedRoleException, WorkflowException;
/**
@@ -121,8 +115,7 @@ public interface UserWorkflowAdapter {
* @throws NotFoundException user not found exception
* @throws WorkflowException workflow exception
*/
- WorkflowResult<Long> suspend(Long userId)
- throws UnauthorizedRoleException, NotFoundException, WorkflowException;
+ WorkflowResult<Long> suspend(Long userId) throws UnauthorizedRoleException, NotFoundException, WorkflowException;
/**
* Suspend an user.
@@ -132,8 +125,7 @@ public interface UserWorkflowAdapter {
* @throws UnauthorizedRoleException authorization exception
* @throws WorkflowException workflow exception
*/
- WorkflowResult<Long> suspend(SyncopeUser user)
- throws UnauthorizedRoleException, WorkflowException;
+ WorkflowResult<Long> suspend(SyncopeUser user) throws UnauthorizedRoleException, WorkflowException;
/**
* Reactivate an user.
@@ -144,8 +136,7 @@ public interface UserWorkflowAdapter {
* @throws NotFoundException user not found exception
* @throws WorkflowException workflow exception
*/
- WorkflowResult<Long> reactivate(Long userId)
- throws UnauthorizedRoleException, NotFoundException, WorkflowException;
+ WorkflowResult<Long> reactivate(Long userId) throws UnauthorizedRoleException, NotFoundException, WorkflowException;
/**
* Delete an user.
@@ -155,8 +146,7 @@ public interface UserWorkflowAdapter {
* @throws NotFoundException user not found exception
* @throws WorkflowException workflow exception
*/
- void delete(Long userId)
- throws UnauthorizedRoleException, NotFoundException, WorkflowException;
+ void delete(Long userId) throws UnauthorizedRoleException, NotFoundException, WorkflowException;
/**
* Get workflow definition.
@@ -164,8 +154,7 @@ public interface UserWorkflowAdapter {
* @return workflow definition as XML
* @throws WorkflowException workflow exception
*/
- WorkflowDefinitionTO getDefinition()
- throws WorkflowException;
+ WorkflowDefinitionTO getDefinition() throws WorkflowException;
/**
* Update workflow definition.
@@ -174,8 +163,7 @@ public interface UserWorkflowAdapter {
* @throws NotFoundException definition not found exception
* @throws WorkflowException workflow exception
*/
- void updateDefinition(WorkflowDefinitionTO definition)
- throws NotFoundException, WorkflowException;
+ void updateDefinition(WorkflowDefinitionTO definition) throws NotFoundException, WorkflowException;
/**
* Get list of defined tasks in workflow.
@@ -183,8 +171,7 @@ public interface UserWorkflowAdapter {
* @return list of defined tasks in workflow
* @throws WorkflowException workflow exception
*/
- List<String> getDefinedTasks()
- throws WorkflowException;
+ List<String> getDefinedTasks() throws WorkflowException;
/**
* Get all defined forms for current workflow process instances.
@@ -201,8 +188,7 @@ public interface UserWorkflowAdapter {
* @throws NotFoundException definition not found exception
* @throws WorkflowException workflow exception
*/
- WorkflowFormTO getForm(String workflowId)
- throws NotFoundException, WorkflowException;
+ WorkflowFormTO getForm(String workflowId) throws NotFoundException, WorkflowException;
/**
* Claim a form for a given user.
@@ -213,8 +199,7 @@ public interface UserWorkflowAdapter {
* @throws NotFoundException not found exception
* @throws WorkflowException workflow exception
*/
- WorkflowFormTO claimForm(String taskId, String username)
- throws NotFoundException, WorkflowException;
+ WorkflowFormTO claimForm(String taskId, String username) throws NotFoundException, WorkflowException;
/**
* Submit a form.
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/WorkflowResult.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/WorkflowResult.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/WorkflowResult.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/WorkflowResult.java Thu Mar 15 10:17:12 2012
@@ -34,20 +34,14 @@ public class WorkflowResult<T> {
private Set<String> performedTasks;
- public WorkflowResult(
- final T result,
- final PropagationByResource propByRes,
- final String performedTask) {
+ public WorkflowResult(final T result, final PropagationByResource propByRes, final String performedTask) {
this.result = result;
this.propByRes = propByRes;
this.performedTasks = Collections.singleton(performedTask);
}
- public WorkflowResult(
- final T result,
- final PropagationByResource propByRes,
- final Set<String> performedTasks) {
+ public WorkflowResult(final T result, final PropagationByResource propByRes, final Set<String> performedTasks) {
this.result = result;
this.propByRes = propByRes;
@@ -90,7 +84,6 @@ public class WorkflowResult<T> {
@Override
public String toString() {
- return ReflectionToStringBuilder.toString(this,
- ToStringStyle.MULTI_LINE_STYLE);
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/AbstractActivitiDelegate.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/AbstractActivitiDelegate.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/AbstractActivitiDelegate.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/AbstractActivitiDelegate.java Thu Mar 15 10:17:12 2012
@@ -47,8 +47,7 @@ public abstract class AbstractActivitiDe
protected ConfDAO confDAO;
@Override
- public final void execute(final DelegateExecution execution)
- throws Exception {
+ public final void execute(final DelegateExecution execution) throws Exception {
taskService = CONTEXT.getBean(TaskService.class);
@@ -58,6 +57,5 @@ public abstract class AbstractActivitiDe
doExecute(execution);
}
- protected abstract void doExecute(DelegateExecution execution)
- throws Exception;
+ protected abstract void doExecute(DelegateExecution execution) throws Exception;
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/AutoActivate.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/AutoActivate.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/AutoActivate.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/AutoActivate.java Thu Mar 15 10:17:12 2012
@@ -24,8 +24,7 @@ import org.syncope.core.workflow.Activit
public class AutoActivate extends AbstractActivitiDelegate {
@Override
- protected void doExecute(final DelegateExecution execution)
- throws Exception {
+ protected void doExecute(final DelegateExecution execution) throws Exception {
execution.setVariable(ActivitiUserWorkflowAdapter.PROPAGATE_ENABLE, Boolean.TRUE);
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Create.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Create.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Create.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Create.java Thu Mar 15 10:17:12 2012
@@ -26,8 +26,7 @@ import org.syncope.core.workflow.Activit
public class Create extends AbstractActivitiDelegate {
@Override
- protected void doExecute(final DelegateExecution execution)
- throws Exception {
+ protected void doExecute(final DelegateExecution execution) throws Exception {
UserTO userTO = (UserTO) execution.getVariable(ActivitiUserWorkflowAdapter.USER_TO);
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Delete.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Delete.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Delete.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Delete.java Thu Mar 15 10:17:12 2012
@@ -25,11 +25,9 @@ import org.syncope.core.workflow.Activit
public class Delete extends AbstractActivitiDelegate {
@Override
- protected void doExecute(final DelegateExecution execution)
- throws Exception {
+ protected void doExecute(final DelegateExecution execution) throws Exception {
- SyncopeUser user = (SyncopeUser) execution.getVariable(
- ActivitiUserWorkflowAdapter.SYNCOPE_USER);
+ SyncopeUser user = (SyncopeUser) execution.getVariable(ActivitiUserWorkflowAdapter.SYNCOPE_USER);
// do something with SyncopeUser...
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/GenerateToken.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/GenerateToken.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/GenerateToken.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/GenerateToken.java Thu Mar 15 10:17:12 2012
@@ -25,15 +25,11 @@ import org.syncope.core.workflow.Activit
public class GenerateToken extends AbstractActivitiDelegate {
@Override
- protected void doExecute(final DelegateExecution execution)
- throws Exception {
+ protected void doExecute(final DelegateExecution execution) throws Exception {
- SyncopeUser user = (SyncopeUser) execution.getVariable(
- ActivitiUserWorkflowAdapter.SYNCOPE_USER);
+ SyncopeUser user = (SyncopeUser) execution.getVariable(ActivitiUserWorkflowAdapter.SYNCOPE_USER);
- user.generateToken(Integer.parseInt(
- confDAO.find("token.length", "256").getValue()),
- Integer.parseInt(
- confDAO.find("token.expireTime", "60").getValue()));
+ user.generateToken(Integer.parseInt(confDAO.find("token.length", "256").getValue()), Integer.parseInt(confDAO
+ .find("token.expireTime", "60").getValue()));
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Reactivate.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Reactivate.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Reactivate.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Reactivate.java Thu Mar 15 10:17:12 2012
@@ -23,7 +23,6 @@ import org.activiti.engine.delegate.Dele
public class Reactivate extends AbstractActivitiDelegate {
@Override
- protected void doExecute(final DelegateExecution execution)
- throws Exception {
+ protected void doExecute(final DelegateExecution execution) throws Exception {
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Suspend.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Suspend.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Suspend.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Suspend.java Thu Mar 15 10:17:12 2012
@@ -23,7 +23,6 @@ import org.activiti.engine.delegate.Dele
public class Suspend extends AbstractActivitiDelegate {
@Override
- protected void doExecute(final DelegateExecution execution)
- throws Exception {
+ protected void doExecute(final DelegateExecution execution) throws Exception {
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeGroupManager.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeGroupManager.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeGroupManager.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeGroupManager.java Thu Mar 15 10:17:12 2012
@@ -33,8 +33,7 @@ import org.syncope.core.persistence.bean
import org.syncope.core.persistence.dao.RoleDAO;
import org.syncope.core.persistence.dao.UserDAO;
-public class SyncopeGroupManager extends GroupManager
- implements SyncopeSession {
+public class SyncopeGroupManager extends GroupManager implements SyncopeSession {
@Autowired
private UserDAO userDAO;
@@ -79,8 +78,7 @@ public class SyncopeGroupManager extends
}
@Override
- public List<Group> findGroupByQueryCriteria(final Object query,
- final Page page) {
+ public List<Group> findGroupByQueryCriteria(final Object query, final Page page) {
throw new UnsupportedOperationException();
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeUserManager.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeUserManager.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeUserManager.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeUserManager.java Thu Mar 15 10:17:12 2012
@@ -36,8 +36,7 @@ import org.syncope.core.persistence.dao.
import org.syncope.core.persistence.dao.RoleDAO;
import org.syncope.core.persistence.dao.UserDAO;
-public class SyncopeUserManager extends UserManager
- implements SyncopeSession {
+public class SyncopeUserManager extends UserManager implements SyncopeSession {
@Autowired
private UserDAO userDAO;
@@ -99,8 +98,7 @@ public class SyncopeUserManager extends
}
@Override
- public List<User> findUserByQueryCriteria(final Object query,
- final Page page) {
+ public List<User> findUserByQueryCriteria(final Object query, final Page page) {
throw new UnsupportedOperationException();
}
@@ -111,15 +109,13 @@ public class SyncopeUserManager extends
}
@Override
- public IdentityInfoEntity findUserInfoByUserIdAndKey(final String userId,
- final String key) {
+ public IdentityInfoEntity findUserInfoByUserIdAndKey(final String userId, final String key) {
throw new UnsupportedOperationException();
}
@Override
- public List<String> findUserInfoKeysByUserIdAndType(final String userId,
- final String type) {
+ public List<String> findUserInfoKeysByUserIdAndType(final String userId, final String type) {
throw new UnsupportedOperationException();
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/SyncopeUserQueryImpl.java Thu Mar 15 10:17:12 2012
@@ -47,8 +47,7 @@ public class SyncopeUserQueryImpl implem
private List<User> result;
- public SyncopeUserQueryImpl(final UserDAO userDAO,
- final RoleDAO roleDAO, final EntitlementDAO entitlementDAO) {
+ public SyncopeUserQueryImpl(final UserDAO userDAO, final RoleDAO roleDAO, final EntitlementDAO entitlementDAO) {
this.userDAO = userDAO;
this.roleDAO = roleDAO;
@@ -164,8 +163,7 @@ public class SyncopeUserQueryImpl implem
// THIS CAN BE *VERY* DANGEROUS
if (result == null) {
result = new ArrayList<User>();
- for (SyncopeUser user : userDAO.findAll(
- EntitlementUtil.getRoleIds(entitlementDAO.findAll()))) {
+ for (SyncopeUser user : userDAO.findAll(EntitlementUtil.getRoleIds(entitlementDAO.findAll()))) {
result.add(fromSyncopeUser(user));
}
@@ -201,8 +199,7 @@ public class SyncopeUserQueryImpl implem
}
@Override
- public List<User> listPage(final int firstResult,
- final int maxResults) {
+ public List<User> listPage(final int firstResult, final int maxResults) {
throw new UnsupportedOperationException();
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Update.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Update.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Update.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/activiti/Update.java Thu Mar 15 10:17:12 2012
@@ -27,8 +27,7 @@ import org.syncope.core.workflow.Activit
public class Update extends AbstractActivitiDelegate {
@Override
- protected void doExecute(final DelegateExecution execution)
- throws Exception {
+ protected void doExecute(final DelegateExecution execution) throws Exception {
SyncopeUser user = (SyncopeUser) execution.getVariable(ActivitiUserWorkflowAdapter.SYNCOPE_USER);
UserMod userMod = (UserMod) execution.getVariable(ActivitiUserWorkflowAdapter.USER_MOD);
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/package-info.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/package-info.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/package-info.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/workflow/package-info.java Thu Mar 15 10:17:12 2012
@@ -17,3 +17,4 @@
* under the License.
*/
package org.syncope.core.workflow;
+
Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/AbstractTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/AbstractTest.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/AbstractTest.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/AbstractTest.java Thu Mar 15 10:17:12 2012
@@ -34,27 +34,20 @@ import org.springframework.test.context.
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {
- "classpath:syncopeContext.xml",
- "classpath:persistenceContext.xml",
- "classpath:schedulingContext.xml",
- "classpath:workflowContext.xml"
-})
+@ContextConfiguration(locations = { "classpath:syncopeContext.xml", "classpath:persistenceContext.xml",
+ "classpath:schedulingContext.xml", "classpath:workflowContext.xml" })
public abstract class AbstractTest {
/**
* Logger.
*/
- protected static final Logger LOG = LoggerFactory.getLogger(
- AbstractTest.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractTest.class);
protected static String connidSoapVersion;
protected static String bundlesDirectory;
- private void logTableContent(final Connection conn,
- final String tableName)
- throws SQLException {
+ private void logTableContent(final Connection conn, final String tableName) throws SQLException {
LOG.debug("Table: " + tableName);
@@ -67,10 +60,8 @@ public abstract class AbstractTest {
final StringBuilder row = new StringBuilder();
while (rs.next()) {
for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) {
- row.append(rs.getMetaData().getColumnLabel(i + 1)).
- append("=").
- append(rs.getString(i + 1)).
- append(" ");
+ row.append(rs.getMetaData().getColumnLabel(i + 1)).append("=").append(rs.getString(i + 1)).append(
+ " ");
}
LOG.debug(row.toString());
@@ -89,8 +80,7 @@ public abstract class AbstractTest {
public void setUpIdentityConnectorsBundles() {
Properties props = new java.util.Properties();
try {
- InputStream propStream =
- getClass().getResourceAsStream("/bundles.properties");
+ InputStream propStream = getClass().getResourceAsStream("/bundles.properties");
props.load(propStream);
connidSoapVersion = props.getProperty("connid.soap.version");
bundlesDirectory = props.getProperty("bundles.directory");
Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/init/ConnInstanceLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/init/ConnInstanceLoaderTest.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/init/ConnInstanceLoaderTest.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/init/ConnInstanceLoaderTest.java Thu Mar 15 10:17:12 2012
@@ -50,8 +50,8 @@ public class ConnInstanceLoaderTest exte
// Remove any other connector instance bean set up by
// standard ConnInstanceLoader.load()
- for (String bean : ApplicationContextManager.getApplicationContext().
- getBeanNamesForType(ConnectorFacadeProxy.class)) {
+ for (String bean : ApplicationContextManager.getApplicationContext().getBeanNamesForType(
+ ConnectorFacadeProxy.class)) {
cil.unregisterConnector(bean);
}
@@ -61,8 +61,7 @@ public class ConnInstanceLoaderTest exte
public void load() {
cil.load();
- assertEquals(resourceDAO.findAll().size(),
- ApplicationContextManager.getApplicationContext().
- getBeanNamesForType(ConnectorFacadeProxy.class).length);
+ assertEquals(resourceDAO.findAll().size(), ApplicationContextManager.getApplicationContext()
+ .getBeanNamesForType(ConnectorFacadeProxy.class).length);
}
}
Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/persistence/dao/AttrTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/persistence/dao/AttrTest.java?rev=1300882&r1=1300881&r2=1300882&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/persistence/dao/AttrTest.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/persistence/dao/AttrTest.java Thu Mar 15 10:17:12 2012
@@ -50,18 +50,15 @@ public class AttrTest extends AbstractTe
@Test
public void findAll() {
List<UAttr> list = attrDAO.findAll(UAttr.class);
- assertEquals("did not get expected number of attributes ",
- 9, list.size());
+ assertEquals("did not get expected number of attributes ", 9, list.size());
}
@Test
public void findById() {
UAttr attribute = attrDAO.find(100L, UAttr.class);
- assertNotNull("did not find expected attribute schema",
- attribute);
+ assertNotNull("did not find expected attribute schema", attribute);
attribute = attrDAO.find(200L, UAttr.class);
- assertNotNull("did not find expected attribute schema",
- attribute);
+ assertNotNull("did not find expected attribute schema", attribute);
}
@Test
@@ -74,8 +71,7 @@ public class AttrTest extends AbstractTe
}
@Test
- public void save()
- throws ClassNotFoundException {
+ public void save() throws ClassNotFoundException {
SyncopeUser user = userDAO.find(1L);
@@ -111,15 +107,13 @@ public class AttrTest extends AbstractTe
}
assertNull(iee);
- UAttr actual = attrDAO.find(attribute.getId(),
- UAttr.class);
+ UAttr actual = attrDAO.find(attribute.getId(), UAttr.class);
assertNotNull("expected save to work", actual);
assertEquals(attribute, actual);
}
@Test
- public void checkForEnumType()
- throws ClassNotFoundException {
+ public void checkForEnumType() throws ClassNotFoundException {
SyncopeUser user = userDAO.find(1L);
@@ -161,12 +155,10 @@ public class AttrTest extends AbstractTe
@Test
public void validateAndSave() {
- final USchema emailSchema =
- userSchemaDAO.find("email", USchema.class);
+ final USchema emailSchema = userSchemaDAO.find("email", USchema.class);
assertNotNull(emailSchema);
- final USchema fullnameSchema =
- userSchemaDAO.find("fullname", USchema.class);
+ final USchema fullnameSchema = userSchemaDAO.find("fullname", USchema.class);
assertNotNull(fullnameSchema);
UAttr attribute = new UAttr();
@@ -200,7 +192,6 @@ public class AttrTest extends AbstractTe
attrDAO.delete(attribute.getId(), UAttr.class);
USchema schema = userSchemaDAO.find(attrSchemaName, USchema.class);
- assertNotNull("user attribute schema deleted when deleting values",
- schema);
+ assertNotNull("user attribute schema deleted when deleting values", schema);
}
}