留言板

Deleting User When User is REJECTED from Workflow.

thumbnail
Gnaniyar Zubair,修改在10 年前。

Deleting User When User is REJECTED from Workflow.

Liferay Master 帖子: 722 加入日期: 07-12-19 最近的帖子
Hi,


I am trying to delete the user after getting REJECTED from workflow level . [Kaleo Workflow]. When User is REJECTED, I am receiving the userId from userservice hook updateStatus method .

@Override
public class CustomUserLocalServiceImpl extends UserLocalServiceWrapper  {
	/**
	 *
	 * @param userLocalService
	 */
	public CustomUserLocalServiceImpl(UserLocalService userLocalService) {
		super(userLocalService);
		_log.info("User Service Listener is up and running.");
	}
	public User updateStatus(long userId, int status) throws PortalException,
			SystemException {
		// TODO Auto-generated method stub
		
		if(status == WorkflowConstants.STATUS_DENIED) {
			_log.info("after rejecting user >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> .....userId >>>>" + userId +">>>>>>>>>>>>> user status >>>>>>>" + status);	
			  try {
								
						UserLocalServiceUtil.deleteUser(userId);
				
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}/
				  
				  		
			_log.info("user deleted>>>>>>");	
		}
		
		
		return super.updateStatus(userId, status);
		
			}
}


But No LUCK. During user REJECTED mode, it comes to this method perfectly. But user is not deleted from database. I couldn't track what happening as No Exception is being thrown.
Cant we delete the user while user is in workflow mode..? Is there any other solution? or Am i missing something?
thumbnail
Gnaniyar Zubair,修改在10 年前。

RE: Deleting User When User is REJECTED from Workflow.

Liferay Master 帖子: 722 加入日期: 07-12-19 最近的帖子
Gnaniyar Zubair:

@Override
public class CustomUserLocalServiceImpl extends UserLocalServiceWrapper  {
	/**
	 *
	 * @param userLocalService
	 */
	public CustomUserLocalServiceImpl(UserLocalService userLocalService) {
		super(userLocalService);
		_log.info("User Service Listener is up and running.");
	}
	public User updateStatus(long userId, int status) throws PortalException,
			SystemException {
		// TODO Auto-generated method stub
		
		if(status == WorkflowConstants.STATUS_DENIED) {
			_log.info("after rejecting user >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> .....userId >>>>" + userId +">>>>>>>>>>>>> user status >>>>>>>" + status);	
			  try {
								
						UserLocalServiceUtil.deleteUser(userId);
				
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}/
				  
				  		
			_log.info("user deleted>>>>>>");	
		}
		
		
		return super.updateStatus(userId, status);
		
			}
}


From the above code, I am deleting the user passing the userId into UserService. But After that that method
return super.updateStatus(userId, status);
It is updating the user status with that same userId. In this case, atleast it should throw the exception..? right?
thumbnail
Gnaniyar Zubair,修改在10 年前。

RE: Deleting User When User is REJECTED from Workflow.

Liferay Master 帖子: 722 加入日期: 07-12-19 最近的帖子
I have resolved this issue by overriding edit workflow task action through Struts Action of workflow.

/my_workflow_tasks/edit_workflow_task


I am receiving the transient name (APPROVE / REJECT ) from request object:

String transitionName = ParamUtil.getString(actionRequest, "transitionName");


if(transitionName .equals("REJECT")) {
// your logic goes here to delete the user and other operations.......
}
Abdur rasheed,修改在8 年前。

RE: Deleting User When User is REJECTED from Workflow.

Junior Member 帖子: 71 加入日期: 08-9-26 最近的帖子
Gnaniyar Bhai,

can we fix this issue through workflow xml file?, I want to try by xml file. getting same issue, so give me better idea to resolved this issue.

Thanks
Rasheed