Removed not needed code and realted exception handling

This commit is contained in:
Mauro Mugnaini 2020-11-17 11:42:58 +01:00
parent 28aadbc143
commit 753c962acb
2 changed files with 8 additions and 42 deletions

View File

@ -3,8 +3,6 @@ package org.gcube.portal.event.publisher.lr62.model;
import java.util.Map;
import org.gcube.portal.event.publisher.lr62.PortalEvent;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
import com.liferay.portal.model.BaseModel;
import com.liferay.portal.model.User;
@ -20,17 +18,13 @@ public class PortalModelListenerEvent<T extends BaseModel<T>> extends PortalEven
setModelClassName(baseModel.getModelClassName());
}
public PortalModelListenerEvent(String name, User user, T baseModel)
throws UserManagementSystemException, UserRetrievalFault {
public PortalModelListenerEvent(String name, User user, T baseModel) {
super(name);
setUser(user);
setModelClassName(baseModel.getModelClassName());
}
public PortalModelListenerEvent(String name, Map<String, String> data, User user, T baseModel)
throws UserManagementSystemException, UserRetrievalFault {
public PortalModelListenerEvent(String name, Map<String, String> data, User user, T baseModel) {
super(name, data);
setUser(user);
setModelClassName(baseModel.getModelClassName());

View File

@ -1,10 +1,5 @@
package org.gcube.portal.event.publisher.lr62.model;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.User;
@ -18,52 +13,29 @@ public class UserEvent extends PortalModelListenerEvent<User> {
public static final String UG_CREATED_NAME = "user-group_created";
public static final String UG_DELETED_NAME = "user-group_deleted";
private UserEvent(String name, User user) throws UserManagementSystemException, UserRetrievalFault {
private UserEvent(String name, User user) {
super(name, user, user);
}
private UserEvent(String name, User user, Group group)
throws PortalException, SystemException, UserManagementSystemException, UserRetrievalFault {
private UserEvent(String name, User user, Group group) {
this(name, user);
setGroup(group);
}
public static UserEvent newCreatedEvent(User user) {
try {
return new UserEvent(CREATED_NAME, user);
} catch (UserManagementSystemException | UserRetrievalFault e) {
log.error("Cannot create event from User model object", e);
return null;
}
}
public static UserEvent newDeletedEvent(User user) {
try {
return new UserEvent(DELETED_NAME, user);
} catch (UserManagementSystemException | UserRetrievalFault e) {
log.error("Cannot create event from User model object", e);
return null;
}
}
public static UserEvent newCreatedEvent(User user, Group group) {
try {
return new UserEvent(UG_CREATED_NAME, user, group);
} catch (PortalException | SystemException | UserManagementSystemException | UserRetrievalFault e) {
log.error("Cannot create event from one model object", e);
return null;
}
}
public static UserEvent newDeletedEvent(User user, Group group) {
try {
return new UserEvent(UG_DELETED_NAME, user, group);
} catch (PortalException | SystemException | UserManagementSystemException | UserRetrievalFault e) {
log.error("Cannot create event from one model object", e);
return null;
}
}
}