Package com.lastcalc.db

Examples of com.lastcalc.db.Worksheet




        final Objectify obj = DAO.begin();

        final Worksheet worksheet = obj.load().type(Worksheet.class).id(request.worksheetId).get();
        //System.out.println("Worksheet: "+Misc.gsonpp.toJson(worksheet));
        //System.out.println("Request: "+Misc.gsonpp.toJson(request));
        if (worksheet == null) {
            resp.sendError(404);
            return;
View Full Code Here


      return;
    }

    if (path.equals("/")) {
      // Create a new worksheet and redirect to it
      final Worksheet worksheet = new Worksheet();

      obj.save().entity(worksheet).now();

      resp.sendRedirect("/" + worksheet.id + (skipUACheck ? "?skipuacheck=1" : ""));
    } else {

      final String worksheetId = path.substring(1);

      if (worksheetId.length() == 8) {
        // This is readonly, duplicate it and redirect to
        // a new id
        final Worksheet worksheet = new Worksheet();

        final Worksheet template = obj.load().type(Worksheet.class).filter("readOnlyId", worksheetId).first().get();

        if (template == null) {
          resp.sendError(404);
          return;
        }

        worksheet.parentId = worksheet.id;

        worksheet.qaPairs = template.qaPairs;

        obj.save().entity(worksheet);

        resp.sendRedirect("/" + worksheet.id);
      } else {
        final Worksheet worksheet;
        try {
          worksheet = obj.load().type(Worksheet.class).id(worksheetId).get();
        } catch (final NotFoundException e) {
          resp.sendError(404, "Worksheet not found");
          return;
View Full Code Here


    @Test
    public void testFunctionCreation() throws IOException {

        final Worksheet worksheet=new Worksheet();

        {
            WorksheetServlet.WorksheetRequest worksheetRequest=new WorksheetServlet.WorksheetRequest();

            worksheetRequest.questions=new HashMap<Integer, String>();
View Full Code Here

TOP

Related Classes of com.lastcalc.db.Worksheet

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.