Package com.baasbox.dao.exception

Examples of com.baasbox.dao.exception.DocumentNotFoundException



  public ODocument get(ORID rid) throws InvalidModelException, DocumentNotFoundException {
    if (Logger.isTraceEnabled()) Logger.trace("Method Start");
    Object doc=db.load(rid);
    if (doc==null) throw new DocumentNotFoundException();
    if (!(doc instanceof ODocument)) throw new IllegalArgumentException(rid +" is a rid not referencing a valid Document");
    try{
      checkModelDocument((ODocument)doc);
    }catch(InvalidModelException e){
      //the rid may reference a ORecordBytes which is not a ODocument
View Full Code Here


      try {
        file = getById(id);
      } catch (InvalidModelException e1) {
        throw new DocumentIsNotAFileException("The id " + id + " is not a file");
      }
      if (file==null) throw new DocumentNotFoundException();
      //is the file an image?
      if (!StorageUtils.docIsAnImage(file)) throw new DocumentIsNotAnImageException("The file " + id + " is not an image");
      //are the dimensions allowed?
      //the check is delegated to the caller
      String sizePattern= dimensions.toString();
View Full Code Here

 
  public static OrientVertex getNodeVertex(String nodeId) throws DocumentNotFoundException{
    GenericDao dao = GenericDao.getInstance();
    OrientGraph conn = DbHelper.getOrientGraphConnection();
    ORID nodeORID = dao.getRidNodeByUUID(nodeId);
    if (nodeORID==null) throw new DocumentNotFoundException(nodeId + " is not a valid Id");
    ODocument nodeDoc = dao.get(nodeORID);
    if (nodeDoc==null) throw new DocumentNotFoundException(nodeId + " is not a valid Id");
    return conn.getVertex(nodeDoc.field(NodeDao.FIELD_LINK_TO_VERTEX));
  }
View Full Code Here

    ODocument doc=dao.get(rid);
    if(parser.isMultiField()){
      Object v = doc.field(parser.treeFields());

      if(v==null){
        throw new DocumentNotFoundException("Unable to find a field "+parser.treeFields()+" into document:"+rid);
      }
    }

    StringBuffer q = new StringBuffer();
    q.append("select ")
View Full Code Here

  public static ODocument grantPermissionToUser(String collectionName, String rid, Permissions permission, String username) throws UserNotFoundException, IllegalArgumentException, InvalidCollectionException, InvalidModelException, DocumentNotFoundException {
    OUser user=UserService.getOUserByUsername(username);
    if (user==null) throw new UserNotFoundException(username);
    ODocument doc = get(collectionName, rid);
    if (doc==null) throw new DocumentNotFoundException(rid);
    return PermissionsHelper.grant(doc, permission, user);
  }
View Full Code Here

  public static ODocument revokePermissionToUser(String collectionName, String rid, Permissions permission, String username) throws UserNotFoundException, IllegalArgumentException, InvalidCollectionException, InvalidModelException, DocumentNotFoundException {
    OUser user=UserService.getOUserByUsername(username);
    if (user==null) throw new UserNotFoundException(username);
    ODocument doc = get(collectionName, rid);
    if (doc==null) throw new DocumentNotFoundException(rid);
    return PermissionsHelper.revoke(doc, permission, user);
  }
View Full Code Here

  public static ODocument grantPermissionToRole(String collectionName, String rid, Permissions permission, String rolename) throws RoleNotFoundException, IllegalArgumentException, InvalidCollectionException, InvalidModelException, DocumentNotFoundException {
    ORole role=RoleDao.getRole(rolename);
    if (role==null) throw new RoleNotFoundException(rolename);
    ODocument doc = get(collectionName, rid);
    if (doc==null) throw new DocumentNotFoundException(rid);
        return PermissionsHelper.grant(doc, permission, role);
  }
View Full Code Here

  public static ODocument revokePermissionToRole(String collectionName, String rid, Permissions permission, String rolename) throws  IllegalArgumentException, InvalidCollectionException, InvalidModelException, DocumentNotFoundException, RoleNotFoundException {
    ORole role=RoleDao.getRole(rolename);
    if (role==null) throw new RoleNotFoundException(rolename);
    ODocument doc = get(collectionName, rid);
    if (doc==null) throw new DocumentNotFoundException(rid);
    return PermissionsHelper.revoke(doc, permission, role);
  }
View Full Code Here

TOP

Related Classes of com.baasbox.dao.exception.DocumentNotFoundException

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.