Package com.baasbox.dao

Examples of com.baasbox.dao.PermissionTagDao


*/
public class PermissionTagService {

    public static boolean areAllTagsEnabled(Set<String> tags) throws InvalidPermissionTagException, SqlInjectionException {
        if (tags==null||tags.isEmpty()) return true;
        PermissionTagDao dao = PermissionTagDao.getInstance();
        for (String tag:tags){
            if (!dao.isEnabled(tag)){
                return false;
            }
        }
        return true;
    }
View Full Code Here


        return true;
    }

    public static boolean isAtLeastOneTagEnabled(Set<String> tags) throws InvalidPermissionTagException, SqlInjectionException {
        if (tags==null||tags.isEmpty()) return true;
        PermissionTagDao dao=PermissionTagDao.getInstance();
        for (String tag:tags){
            if (dao.isEnabled(tag)) return true;
        }
        return false;
    }
View Full Code Here

        return false;
    }

    public static boolean isTagEnabled(String tag) throws InvalidPermissionTagException, SqlInjectionException {
        if (tag==null) return true;
        PermissionTagDao dao = PermissionTagDao.getInstance();
        return dao.isEnabled(tag);
    }
View Full Code Here

        PermissionTagDao dao = PermissionTagDao.getInstance();
        return dao.isEnabled(tag);
    }

    public static boolean setTagEnabled(String tag,boolean enabled) throws InvalidPermissionTagException, SqlInjectionException {
        PermissionTagDao dao = PermissionTagDao.getInstance();
        return dao.setEnabled(tag,enabled);
    }
View Full Code Here

        PermissionTagDao dao = PermissionTagDao.getInstance();
        return dao.setEnabled(tag,enabled);
    }

    public static List<ODocument> getPermissionTags(){
        PermissionTagDao dao = PermissionTagDao.getInstance();
        return dao.getAll();
    }
View Full Code Here

        }
        return map.build();
    }

    public static void createDefaultPermissions(){
        PermissionTagDao dao = PermissionTagDao.getInstance();
        for (Tags.Reserved tag:Tags.Reserved.values()){
            try {
                dao.createReserved(tag.name);
            } catch (Throwable throwable) {
                if (Logger.isErrorEnabled()) Logger.error("Error while creating defaults tags");
                throw new RuntimeException(throwable);
            }
        }
View Full Code Here

            }
        }
    }

    public static void createReservedPermission(Tags.Reserved reserved) {
        PermissionTagDao dao = PermissionTagDao.getInstance();
        try {
            if (dao.existsPermissionTag(reserved.name)) return;
            dao.createReserved(reserved.name);
        }catch (Throwable error){
            if (Logger.isErrorEnabled()) Logger.error("Error while creating reserved permission "+reserved.name,error);
            throw new RuntimeException(error);
        }
    }
View Full Code Here

        boolean enabled = doc.<Boolean>field(PermissionTagDao.ENABLED);
        return ImmutableMap.<String,Object>of(PermissionTagDao.TAG,tag,PermissionTagDao.ENABLED,enabled);
    }

    public static ODocument getPermissionTag(String name) throws SqlInjectionException {
        PermissionTagDao dao = PermissionTagDao.getInstance();
        return dao.getByName(name);
    }
View Full Code Here

TOP

Related Classes of com.baasbox.dao.PermissionTagDao

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.