Examples of DocumentService


Examples of ag.ion.bion.officelayer.internal.document.DocumentService

  public IDocumentService getDocumentService()
      throws OfficeApplicationException {
    if (officeConnection == null)
      throw new OfficeApplicationException("Application is not active.");
    if (documentService == null)
      documentService = new DocumentService(officeConnection,
          getServiceProvider());
    return documentService;
  }
View Full Code Here

Examples of ag.ion.bion.officelayer.internal.document.DocumentService

   */
  public IDocumentService getDocumentService() throws OfficeApplicationException {
    if (officeConnection == null)
      throw new OfficeApplicationException("Application is not active.");
    if (documentService == null)
      documentService = new DocumentService(officeConnection, getServiceProvider());
    return documentService;
  }
View Full Code Here

Examples of com.imaginea.mongodb.services.DocumentService

                               @Context final HttpServletRequest request) throws JSONException {

        String response = new ResponseTemplate().execute(logger, connectionId, request,
            new ResponseCallback() {
                public Object execute() throws Exception {
                    DocumentService documentService = new DocumentServiceImpl(connectionId);
                    // Get query
                    int startIndex = query.indexOf("("), endIndex = query.lastIndexOf(")");
                    if (startIndex == -1 || endIndex == -1) {
                        throw new InvalidMongoCommandException(ErrorCodes.INVALID_QUERY, "Invalid query");
                    }
                    String cmdStr = query.substring(0, startIndex);
                    int lastIndexOfDot = cmdStr.lastIndexOf(".");
                    if (lastIndexOfDot + 1 == cmdStr.length()) {
                        // In this case the cmsStr = db.collectionName.
                        throw new InvalidMongoCommandException(ErrorCodes.COMMAND_EMPTY, "Command is empty");
                    }
                    String command = cmdStr.substring(lastIndexOfDot + 1, cmdStr.length());
                    String collection = null;
                    int firstIndexOfDot = cmdStr.indexOf(".");
                    if (firstIndexOfDot != lastIndexOfDot) {
                        collection = cmdStr.substring(firstIndexOfDot + 1, lastIndexOfDot);
                    }
                    String jsonStr = query.substring(startIndex + 1, endIndex);
                    int docsLimit = Integer.parseInt(limit);
                    int docsSkip = Integer.parseInt(skip);
                    return documentService.executeQuery(dbName, collection, command, jsonStr, fields, sortBy, docsLimit, docsSkip, allKeys);
                }
            });

        return response;
    }
View Full Code Here

Examples of com.imaginea.mongodb.services.DocumentService

                                  @Context final HttpServletRequest request) {

        String response = new ResponseTemplate().execute(logger, connectionId, request, new ResponseCallback() {
            public Object execute() throws Exception {

                DocumentService documentService = new DocumentServiceImpl(connectionId);
                JSONObject resultJSON = new JSONObject();
                String result = null;
                RequestMethod method = null;
                for (RequestMethod m : RequestMethod.values()) {
                    if ((m.toString()).equals(action)) {
                        method = m;
                        break;
                    }
                }
                switch (method) {
                    case PUT: {
                        if ("".equals(documentData)) {
                            ApplicationException e = new DocumentException(ErrorCodes.DOCUMENT_DOES_NOT_EXIST, "Document Data Missing in Request Body");
                            result = formErrorResponse(logger, e);
                        } else {
                            DBObject document = (DBObject) JSON.parse(documentData);
                            result = documentService.insertDocument(dbName, collectionName, document);
                        }
                        break;
                    }
                    case DELETE: {
                        if ("".equals(_id)) {
                            ApplicationException e = new DocumentException(ErrorCodes.DOCUMENT_DOES_NOT_EXIST, "Document Data Missing in Request Body");
                            result = formErrorResponse(logger, e);
                        } else {
                            result = documentService.deleteDocument(dbName, collectionName, _id);
                        }
                        break;
                    }
                    case POST: {
                        if ("".equals(_id) || "".equals(keys)) {
                            ApplicationException e = new DocumentException(ErrorCodes.DOCUMENT_DOES_NOT_EXIST, "Document Data Missing in Request Body");
                            formErrorResponse(logger, e);
                        } else {
                            // New Document Keys
                            DBObject newDoc = (DBObject) JSON.parse(keys);
                            result = documentService.updateDocument(dbName, collectionName, _id, newDoc);
                            Set<String> completeSet = new HashSet<String>();
                            getNestedKeys(newDoc, completeSet, "");
                            completeSet.remove("_id");
                            resultJSON.put("keys", completeSet);
                        }
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.