public void createDom(String domainName) {

    Vertex v = getRoot(domainName);

    if (v == null) {
      v = graph.addVertex(GDomConfig.global().getRootClass(), (String) null);
      v.setProperty("tag", domainName);
      graph.commit();
    }
  }
 private Vertex getRoot(String cls) {
   try {
     List<ODocument> list =
         graph
             .getRawGraph()
             .query(
                 new OSQLSynchQuery<ODocument>(
                     "SELECT FROM "
                         + GDomConfig.global().getRootClass()
                         + " WHERE tag='"
                         + cls
                         + "'"));
     if (list == null) return null;
     if (!(list.size() > 0)) return null;
     return graph.getVertex(list.get(0).getIdentity());
   } catch (Exception ex) {
     return null;
   }
 }
  public List<String> listDomains(String username) {

    Set<? extends OSecurityRole> roles = graph.getRawGraph().getUser().getRoles();
    for (OSecurityRole role : roles) {
      if (role.hasRule(ResourceGeneric.BYPASS_RESTRICTED, null)) {
        return new GenericNodeCollection<String>(
            query("select from " + GDomConfig.global().getRootClass()),
            new NameAttributeProvider());
      }
    }

    String q =
        "select from ( select expand(domain) from (select from orole where @this in (select expand(roles) from ouser where name = '"
            + username
            + "')))";

    List<ODocument> list = query(q);

    return new GenericNodeCollection<String>(list, new NameAttributeProvider());
  }
 public List<String> domList() {
   List<ODocument> list = query("SELECT FROM " + GDomConfig.global().getRootClass());
   return new GenericNodeCollection<String>(list, new NameAttributeProvider());
 }