001: /*
002: * UserHandler.java
003: *
004: * Created on June 22, 2004, 5:44 PM
005: */
006:
007: package org.manentia.kasai.authobject;
008:
009: import java.util.Collection;
010:
011: import org.manentia.kasai.AuthObject;
012: import org.manentia.kasai.exceptions.DataAccessException;
013: import org.manentia.kasai.exceptions.DoesntExistsException;
014:
015: import com.manentia.commons.xml.XMLException;
016:
017: /**
018: *
019: * @author rzuasti
020: */
021: public class AuthObjectHandler {
022: private static AuthObjectHandler instance;
023:
024: private AuthObjectHandler() {
025: }
026:
027: public static synchronized AuthObjectHandler getInstance() {
028: if (instance == null) {
029: instance = new AuthObjectHandler();
030: }
031:
032: return instance;
033: }
034:
035: public void copyPermissionsFromObject(String sourceObject,
036: String destinationObject) throws DoesntExistsException,
037: DataAccessException {
038: AuthObjectDAOFactory.getInstance().createDAO()
039: .copyPermissionsFromObject(sourceObject,
040: destinationObject);
041: }
042:
043: public void create(String object) throws DataAccessException {
044: AuthObjectDAOFactory.getInstance().createDAO().create(object);
045: }
046:
047: public void createObjectGroupRole(String object, String group,
048: int role) throws DoesntExistsException,
049: DataAccessException, XMLException {
050: AuthObjectDAOFactory.getInstance().createDAO()
051: .createObjectGroupRole(object, group, role);
052: }
053:
054: public void createObjectUserRole(String object, String login,
055: int role) throws DoesntExistsException,
056: DataAccessException, XMLException {
057: AuthObjectDAOFactory.getInstance().createDAO()
058: .createObjectUserRole(object, login, role);
059: }
060:
061: public void delete(String object) throws DataAccessException {
062: AuthObjectDAOFactory.getInstance().createDAO().delete(object);
063: }
064:
065: public void deleteObjectGroupRole(int id)
066: throws DataAccessException {
067: AuthObjectDAOFactory.getInstance().createDAO()
068: .deleteObjectGroupRole(id);
069: }
070:
071: public void deleteObjectUserRole(int id) throws DataAccessException {
072: AuthObjectDAOFactory.getInstance().createDAO()
073: .deleteObjectUserRole(id);
074: }
075:
076: public void deleteObjectUserRole(String login, String object,
077: int role) throws DataAccessException {
078: AuthObjectDAOFactory.getInstance().createDAO()
079: .deleteObjectUserRole(login, object, role);
080: }
081:
082: public void deleteObjectUserRole(String login, String object)
083: throws DataAccessException {
084: AuthObjectDAOFactory.getInstance().createDAO()
085: .deleteObjectUserRole(login, object);
086: }
087:
088: public Collection listObjectGroupsRoles(String object)
089: throws DataAccessException {
090: return AuthObjectDAOFactory.getInstance().createDAO()
091: .listObjectGroupsRoles(object);
092: }
093:
094: public Collection listObjectUsersRoles(String object)
095: throws DataAccessException {
096: return AuthObjectDAOFactory.getInstance().createDAO()
097: .listObjectUsersRoles(object);
098: }
099:
100: public AuthObject read(String id) throws DataAccessException {
101: return AuthObjectDAOFactory.getInstance().createDAO().read(id);
102: }
103: }
|