Examples of DocumentDAO


Examples of com.baasbox.dao.DocumentDao

  public static final String FIELD_LINKS = NodeDao.FIELD_LINK_TO_VERTEX;
  private static final String OBJECT_QUERY_ALIAS = "result";

  public static ODocument create(String collection, JsonNode bodyJson) throws Throwable, InvalidCollectionException,InvalidModelException {
    DocumentDao dao = DocumentDao.getInstance(collection);
    DbHelper.requestTransaction();

    ODocument doc = dao.create();
    try  {
      dao.update(doc,(ODocument) (new ODocument()).fromJSON(bodyJson.toString()));
      dao.save(doc);
      DbHelper.commitTransaction();
    }catch (OSerializationException e){
      DbHelper.rollbackTransaction();
      throw new InvalidJsonException(e);
    }catch (UpdateOldVersionException e){
View Full Code Here

Examples of com.baasbox.dao.DocumentDao

   */
  public static ODocument update(String collectionName,String rid, JsonNode bodyJson) throws InvalidCollectionException,InvalidModelException, ODatabaseException, IllegalArgumentException, DocumentNotFoundException, UpdateOldVersionException {
    ODocument doc=get(collectionName,rid);
    if (doc==null) throw new InvalidParameterException(rid + " is not a valid document");
    //update the document
    DocumentDao dao = DocumentDao.getInstance(collectionName);
    dao.update(doc,(ODocument) (new ODocument()).fromJSON(bodyJson.toString()));

    return doc;//.toJSON("fetchPlan:*:0 _audit:1,rid");
  }//update
View Full Code Here

Examples of com.baasbox.dao.DocumentDao

    return doc;//.toJSON("fetchPlan:*:0 _audit:1,rid");
  }//update


  public static ODocument get(String collectionName,String rid) throws IllegalArgumentException,InvalidCollectionException,InvalidModelException, ODatabaseException, DocumentNotFoundException {
    DocumentDao dao = DocumentDao.getInstance(collectionName);
    ODocument doc=dao.get(rid);

    return doc;
  }
View Full Code Here

Examples of com.baasbox.dao.DocumentDao

    return doc;
  }


  public static ODocument get(String collectionName,String rid,PartsParser parser) throws IllegalArgumentException,InvalidCollectionException,InvalidModelException, ODatabaseException, DocumentNotFoundException, InvalidCriteriaException {
    DocumentDao dao = DocumentDao.getInstance(collectionName);
    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);
View Full Code Here

Examples of com.baasbox.dao.DocumentDao

    return result;
  }


  public static long getCount(String collectionName, QueryParams criteria) throws InvalidCollectionException, SqlInjectionException{
    DocumentDao dao = DocumentDao.getInstance(collectionName);
    return dao.getCount(criteria);
  }
View Full Code Here

Examples of com.baasbox.dao.DocumentDao

    DocumentDao dao = DocumentDao.getInstance(collectionName);
    return dao.getCount(criteria);
  }

  public static List<ODocument> getDocuments(String collectionName, QueryParams criteria) throws SqlInjectionException, InvalidCollectionException{
    DocumentDao dao = DocumentDao.getInstance(collectionName);
    return dao.get(criteria);
  }
View Full Code Here

Examples of com.baasbox.dao.DocumentDao

   * @param collectionName
   * @param rid
   * @throws Throwable
   */
  public static void delete(String collectionName, String rid) throws Throwable {
    DocumentDao dao = DocumentDao.getInstance(collectionName);
    try {
      dao.delete(rid);
    } catch (InvalidModelException e) {
      throw new InvalidCollectionException("The document " + rid + " does no belong to the collection " + collectionName);
    }
  }
View Full Code Here

Examples of com.baasbox.dao.DocumentDao

    public static ArrayList<ImmutableMap> collectionsDetails(List<ODocument> collectionsthrows InvalidCollectionException {
      ODatabaseRecordTx db = DbHelper.getConnection();
      ArrayList<ImmutableMap> collMap = new ArrayList<ImmutableMap>();
      for(ODocument doc:collections){
        String collectionName = doc.field(CollectionDao.NAME);
        DocumentDao docDao = DocumentDao.getInstance(collectionName);
        long numberOfRecords=0;
        try{
          numberOfRecords=docDao.getCount();
          OClass myClass = db.getMetadata().getSchema().getClass(collectionName);
          long size=0;
          for (int clusterId : myClass.getClusterIds()) {
            size += db.getClusterRecordSizeById(clusterId);
          }
View Full Code Here

Examples of com.wesabe.grendel.entities.dao.DocumentDAO

    protected Session session;
    protected DocumentDAO dao;
   
    public void setup() throws Exception {
      this.session = mock(Session.class);
      this.dao = new DocumentDAO(new Provider<Session>() {
        @Override
        public Session get() {
          return session;
        }
      });
View Full Code Here

Examples of org.zanata.dao.DocumentDAO

    @Test
    public void reuseTranslationsFromObsoleteDocuments() throws Exception {
        ProjectIterationDAO projectIterationDAO =
                seam.autowire(ProjectIterationDAO.class);
        DocumentDAO documentDAO = seam.autowire(DocumentDAO.class);

        // Make all documents obsolete
        HProjectIteration version =
                projectIterationDAO.getBySlug("same-project", "same-version");
        assert version != null;
        for (HDocument doc : version.getDocuments().values()) {
            doc.setObsolete(true);
            documentDAO.makePersistent(doc);
        }

        ProjectDAO projectDAO = seam.autowire(ProjectDAO.class);
        HProject project = projectDAO.getBySlug("different-project");
        assert project != null;
        for (HProjectIteration it : project.getProjectIterations()) {
            for (HDocument doc : it.getDocuments().values()) {
                doc.setObsolete(true);
                documentDAO.makePersistent(doc);
            }
        }

        // Run the copy trans scenario
        CopyTransExecution execution =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.