1 23 package org.infoglue.cms.applications.workflowtool.function; 24 25 import org.infoglue.cms.controllers.kernel.impl.simple.UserControllerProxy; 26 import org.infoglue.cms.entities.management.SystemUserVO; 27 import org.infoglue.cms.util.ConstraintExceptionBuffer; 28 29 import com.opensymphony.workflow.WorkflowException; 30 31 34 public class UserErrorPopulator extends ErrorPopulator 35 { 36 39 private static final String USER_ERROR_PROPERTYSET_PREFIX = ERROR_PROPERTYSET_PREFIX + "systemuser_"; 40 41 42 45 private SystemUserVO systemUserVO; 46 47 50 public UserErrorPopulator() 51 { 52 super(); 53 } 54 55 58 protected void clean() throws WorkflowException 59 { 60 clean(USER_ERROR_PROPERTYSET_PREFIX); 61 } 62 63 protected void populate() throws WorkflowException 64 { 65 final ConstraintExceptionBuffer ceb = systemUserVO.validate(); 66 populate(ceb); 67 if(ceb.isEmpty()) 68 { 69 checkUniqueUserName(); 70 } 71 } 72 73 76 protected void checkUniqueUserName() throws WorkflowException 77 { 78 try 79 { 80 if(UserControllerProxy.getController().getUser(systemUserVO.getUserName()) != null) 81 { 82 setPropertySetString(USER_ERROR_PROPERTYSET_PREFIX + UserProvider.USER_NAME_ATTRIBUTE, getStringManager().getString("302")); 83 } 84 } 85 catch(Exception e) 86 { 87 } 89 } 90 91 97 protected void initialize() throws WorkflowException 98 { 99 super.initialize(); 100 systemUserVO = (SystemUserVO) getParameter(UserProvider.USER_PARAMETER); 101 } 102 } 103 | Popular Tags |