net.sf.ahtutils.controller.model.idm.AbstractIdentityUser Maven / Gradle / Ivy
package net.sf.ahtutils.controller.model.idm;
import java.util.Hashtable;
import java.util.Map;
import net.sf.ahtutils.model.interfaces.idm.UtilsUser;
import net.sf.ahtutils.model.interfaces.security.UtilsSecurityAction;
import net.sf.ahtutils.model.interfaces.security.UtilsSecurityCategory;
import net.sf.ahtutils.model.interfaces.security.UtilsSecurityRole;
import net.sf.ahtutils.model.interfaces.security.UtilsSecurityUsecase;
import net.sf.ahtutils.model.interfaces.security.UtilsSecurityView;
import net.sf.ahtutils.model.interfaces.status.UtilsDescription;
import net.sf.ahtutils.model.interfaces.status.UtilsLang;
public class AbstractIdentityUser ,
R extends UtilsSecurityRole,
V extends UtilsSecurityView,
U extends UtilsSecurityUsecase,
A extends UtilsSecurityAction,
USER extends UtilsUser>
{
public static final long serialVersionUID=1;
private Map mapUsecases,mapViews,mapRoles,mapActions;
public AbstractIdentityUser()
{
mapUsecases = new Hashtable();
mapViews = new Hashtable();
mapRoles = new Hashtable();
mapActions = new Hashtable();
}
public void allowUsecase(U usecase) {mapUsecases.put(usecase.getCode(), true);}
public void allowView(V view) {mapViews.put(view.getCode(), true);}
public void allowRole(R role) {mapRoles.put(role.getCode(), true);}
public void allowAction(A action) {mapActions.put(action.getCode(), true);}
public boolean hasUsecase(String code)
{
if(mapUsecases.containsKey(code))
{
return mapUsecases.get(code);
}
return false;
}
public boolean hasView(String code)
{
if(mapViews.containsKey(code))
{
return mapViews.get(code);
}
return false;
}
public boolean hasRole(String code)
{
if(mapRoles.containsKey(code))
{
return mapRoles.get(code);
}
return false;
}
public boolean hasAction(String code)
{
if(mapActions.containsKey(code))
{
return mapActions.get(code);
}
return false;
}
public int sizeAllowedUsecases() {return mapUsecases.size();}
public int sizeAllowedViews() {return mapViews.size();}
public int sizeAllowedRoles() {return mapRoles.size();}
public int sizeAllowedActions() {return mapActions.size();}
public Map getMapUsecases() {return mapUsecases;}
public Map getMapViews() {return mapViews;}
public Map getMapRoles() {return mapRoles;}
public Map getMapActions() {return mapActions;}
}