[Yanel-commits] rev 43923 -
public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources
guillaume at wyona.com
guillaume at wyona.com
Thu Jul 30 17:03:53 CEST 2009
Author: guillaume
Date: 2009-07-30 17:03:52 +0200 (Thu, 30 Jul 2009)
New Revision: 43923
Modified:
public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/CreateGroupResource.java
public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/CreateUserResource.java
public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/UpdateUserResource.java
Log:
Minor cleanup.
Issue: 7238
Modified: public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/CreateGroupResource.java
===================================================================
--- public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/CreateGroupResource.java 2009-07-30 14:31:09 UTC (rev 43922)
+++ public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/CreateGroupResource.java 2009-07-30 15:03:52 UTC (rev 43923)
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Wyona
+ * Copyright 2007-2009 Wyona
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.wyona.yanel.impl.resources;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
import org.wyona.security.core.api.AccessManagementException;
import org.wyona.security.core.api.GroupManager;
import org.wyona.yanel.impl.resources.usecase.ExecutableUsecaseResource;
@@ -28,11 +28,12 @@
*/
public class CreateGroupResource extends ExecutableUsecaseResource {
- private static Category log = Category.getInstance(CreateGroupResource.class);
+ private static final Logger log = Logger.getLogger(CreateGroupResource.class);
private static final String PARAM_GROUP_ID = "groupID";
private static final String PARAM_NAME = "name";
+ @Override
public void execute() throws UsecaseException {
GroupManager groupManager = getRealm().getIdentityManager().getGroupManager();
String id = getParameterAsString(PARAM_GROUP_ID);
@@ -44,11 +45,11 @@
groupManager.createGroup(id, name);
addInfoMessage("Group " + id + " (" + name + ") created successfully.");
} catch (AccessManagementException e) {
- log.error(e, e);
throw new UsecaseException(e.getMessage(), e);
}
}
+ @Override
public boolean checkPreconditions() throws UsecaseException {
String id = getParameterAsString(PARAM_GROUP_ID);
String name = getParameterAsString(PARAM_NAME);
Modified: public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/CreateUserResource.java
===================================================================
--- public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/CreateUserResource.java 2009-07-30 14:31:09 UTC (rev 43922)
+++ public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/CreateUserResource.java 2009-07-30 15:03:52 UTC (rev 43923)
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Wyona
+ * Copyright 2007-2009 Wyona
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,19 +16,16 @@
package org.wyona.yanel.impl.resources;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
import org.wyona.security.core.api.AccessManagementException;
import org.wyona.security.core.api.UserManager;
import org.wyona.yanel.impl.resources.usecase.ExecutableUsecaseResource;
import org.wyona.yanel.impl.resources.usecase.UsecaseException;
-/**
- *
- */
public class CreateUserResource extends ExecutableUsecaseResource {
- private static Category log = Category.getInstance(CreateUserResource.class);
+ private static final Logger log = Logger.getLogger(CreateUserResource.class);
private static final String PARAM_USER_ID = "userID";
private static final String PARAM_NAME = "name";
@@ -36,6 +33,7 @@
private static final String PARAM_PASSWORD1 = "password1";
private static final String PARAM_PASSWORD2 = "password2";
+ @Override
public void execute() throws UsecaseException {
UserManager userManager = getRealm().getIdentityManager().getUserManager();
String id = getParameterAsString(PARAM_USER_ID);
@@ -49,11 +47,11 @@
userManager.createUser(id, name, email, password);
addInfoMessage("User " + id + " (" + name + ") created successfully.");
} catch (AccessManagementException e) {
- log.error(e, e);
throw new UsecaseException(e.getMessage(), e);
}
}
+ @Override
public boolean checkPreconditions() throws UsecaseException {
String id = getParameterAsString(PARAM_USER_ID);
String name = getParameterAsString(PARAM_NAME);
Modified: public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/UpdateUserResource.java
===================================================================
--- public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/UpdateUserResource.java 2009-07-30 14:31:09 UTC (rev 43922)
+++ public/yanel/trunk/src/resources/user-mgmt/src/java/org/wyona/yanel/impl/resources/UpdateUserResource.java 2009-07-30 15:03:52 UTC (rev 43923)
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Wyona
+ * Copyright 2007-2009 Wyona
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.wyona.yanel.impl.resources;
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
import org.wyona.security.core.api.AccessManagementException;
import org.wyona.security.core.api.Group;
import org.wyona.security.core.api.GroupManager;
@@ -38,7 +38,7 @@
*/
public class UpdateUserResource extends ExecutableUsecaseResource {
- private static Category log = Category.getInstance(UpdateUserResource.class);
+ private static final Logger log = Logger.getLogger(UpdateUserResource.class);
private static final String PARAM_USER_ID = "userID";
private static final String PARAM_NAME = "name";
@@ -52,10 +52,12 @@
private static final String PROPERTY_ALLOW_EDIT_GROUPS = "allowEditGroups";
private static final String PROPERTY_VERIFY_PASSWORD = "verifyPassword";
+ @Override
public void cancel() {
// don't do anything
}
+ @Override
protected void init() throws UsecaseException {
super.init();
try {
@@ -77,6 +79,7 @@
}
}
+ @Override
public void execute() throws UsecaseException {
String name = getParameterAsString(PARAM_NAME);
String email = getParameterAsString(PARAM_EMAIL);
@@ -122,14 +125,13 @@
user.save();
addInfoMessage("User " + user.getID() + " (" + name + ") updated successfully.");
} catch (AccessManagementException e) {
- log.error(e, e);
throw new UsecaseException(e.getMessage(), e);
} catch (Exception e) {
- log.error(e, e);
throw new UsecaseException(e.getMessage(), e);
}
}
+ @Override
public boolean checkPreconditions() throws UsecaseException {
String name = getParameterAsString(PARAM_NAME);
String email = getParameterAsString(PARAM_EMAIL);
More information about the Yanel-commits
mailing list