Examples of DataContext


Examples of me.daddychurchill.CityWorld.Context.DataContext

    // now the map
    for (int x = 1; x < 16; x++) {
      for (int z = 1; z < 16; z++) {
        int originX = (16 - x) * -10;
        int originZ = (16 - z) * -10;
        DataContext context = generator.shapeProvider.getContext(originX, originZ);
        if (context != null) {
          chunk.setBlock(x, y - 2, z, context.getMapRepresentation());
        }
      }
    }
  }
View Full Code Here

Examples of net.hydromatic.optiq.DataContext

    final RelTraitSet desiredTraits = getDesiredRootTraitSet(rootRel);
    final Program program1 =
        new Program() {
          public RelNode run(RelOptPlanner planner, RelNode rel,
              RelTraitSet requiredOutputTraits) {
            final DataContext dataContext = context.getDataContext();
            planner.setExecutor(new RexExecutorImpl(dataContext));

            for (Materialization materialization : materializations) {
              planner.addMaterialization(
                  new RelOptMaterialization(materialization.tableRel,
View Full Code Here

Examples of net.hydromatic.optiq.DataContext

    Frameworks.withPrepare(
        new Frameworks.PrepareAction<Void>() {
          public Void apply(RelOptCluster cluster, RelOptSchema relOptSchema,
              SchemaPlus rootSchema, OptiqServerStatement statement) {
            final RexBuilder rexBuilder = cluster.getRexBuilder();
            DataContext dataContext =
                Schemas.createDataContext(statement.getConnection());
            final RexExecutorImpl executor = new RexExecutorImpl(dataContext);
            action.check(rexBuilder, executor);
            return null;
          }
View Full Code Here

Examples of net.hydromatic.optiq.DataContext

   * Can change the value of the variable and execute again. */
  @Test public void testVariableExecution() throws Exception {
    check(new Action() {
      public void check(RexBuilder rexBuilder, RexExecutorImpl executor) {
        Object[] values = new Object[1];
        final DataContext testContext = new TestDataContext(values);
        final RelDataType varchar = rexBuilder.getTypeFactory().createSqlType(
            SqlTypeName.VARCHAR);
        final RelDataType integer = rexBuilder.getTypeFactory().createSqlType(
            SqlTypeName.INTEGER);
        // optiq is internally creating the creating the input ref via a
View Full Code Here

Examples of net.sourceforge.processdash.data.DataContext

        return items;
    }


    private void writeTable() throws IOException {
        DataContext dataContext = getDataContext();
       
        // retrieve the heading and label the user wants displayed
        String heading = getParameter(HEADING_PARAM);
        String label = getParameter(LABEL_PARAM);

        // retrieve the list of columns the user wants to display
        List columns = new ArrayList();
        for (int i = 0; i < COLUMNS.length; i++) {
            if (COLUMNS[i].isShowing(parameters))
                columns.add(COLUMNS[i]);
        }
        if (dataContext.getSimpleValue("Rollup Tag") != null)
            columns.remove(MetricsTableColumn.TO_DATE);
        if (columns.isEmpty()) {
            out.write("<!-- no columns selected;  no table to display -->\n\n");
            return;
        }
View Full Code Here

Examples of org.apache.cayenne.access.DataContext

        }

    }
   
    public void testUpdate() throws Exception {
        final DataContext context = createDataContext();
        final DbEntity entity = context.getEntityResolver().lookupObjEntity(
                SoftTest.class).getDbEntity();
       
        try {
            context.getParentDataDomain().setQueryBuilderFactory(new SoftDeleteQueryBuilderFactory());
           
            final SoftTest test = context.newObject(SoftTest.class);
            test.setName("SoftDeleteBatchQueryBuilderTest");
            context.commitChanges();
           
            final SelectQuery query = new SelectQuery(SoftTest.class);
           
            new ThreadedTestHelper() {
                @Override
                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(1, context.performQuery(query).size());
                   
                    query.andQualifier(ExpressionFactory.matchDbExp("DELETED", true));
                    assertEquals(0, context.performQuery(query).size());
                }
            }.assertWithTimeout(200);
           
            context.deleteObject(test);
            assertEquals(test.getPersistenceState(), PersistenceState.DELETED);
            context.commitChanges();
           
            new ThreadedTestHelper() {
                @Override
                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(0, context.performQuery(query).size());
                   
                    SQLTemplate template = new SQLTemplate(entity, "SELECT * FROM SOFT_TEST");
                    template.setFetchingDataRows(true);
                    assertEquals(1, context.performQuery(template).size());
                }
            }.assertWithTimeout(200);
        }
        finally {
            context.performQuery(new SQLTemplate(entity, "DELETE FROM SOFT_TEST"));
            context.getParentDataDomain().setQueryBuilderFactory(null);
        }
    }
View Full Code Here

Examples of org.apache.cayenne.access.DataContext

     * Load data files into the database
     *
     * @throws IOException if an I/O error occurs
     */
    private void loadDatabase() throws IOException {
        final DataContext dataContext = DataContext.createDataContext();

        // Load users data file
        loadUsers(dataContext);

        // Load customers data file
        loadCustomers(dataContext);

        // Load customers data file
        loadSystemCodes(dataContext);

        // Load post codes data file
        loadPostCodes(dataContext);

        // Load course data file
        loadCourses(dataContext);

        // Load student houses data file
        loadStudentHouses(dataContext);

        dataContext.commitChanges();
    }
View Full Code Here

Examples of org.apache.cayenne.access.DataContext

            this.schedulerService = schedulerService;
        }

        @SuppressWarnings("unchecked")
        public void run() {
            DataContext dataContext = null;
            try {
                dataContext = DataContext.createDataContext();

                SelectQuery query = new SelectQuery(Customer.class);
                List<Customer> list = dataContext.performQuery(query);

                if (list.size() < 60) {
                    dataContext.deleteObjects(list);

                    loadCustomers(dataContext);

                    dataContext.commitChanges();
                }

                loadQuartzJobs(schedulerService);

            } catch (Throwable t) {
                t.printStackTrace();

                if (dataContext != null) {
                    dataContext.rollbackChanges();
                }
            }
        }
View Full Code Here

Examples of org.apache.cayenne.access.DataContext

        Injector injector = DIBootstrap.createInjector(testModule);

        DataContextFactory factory = new DataContextFactory();
        injector.injectMembers(factory);

        DataContext c3 = (DataContext) factory.createContext();
        assertNotNull(c3.getObjectStore().getDataRowCache());
        assertNull(domain.getSharedSnapshotCache());
        assertNotSame(c3.getObjectStore().getDataRowCache(), domain
                .getSharedSnapshotCache());
    }
View Full Code Here

Examples of org.apache.cayenne.access.DataContext

        Injector injector = DIBootstrap.createInjector(testModule);

        DataContextFactory factory = new DataContextFactory();
        injector.injectMembers(factory);

        DataContext c1 = (DataContext) factory.createContext();
        assertTrue(c1.isValidatingObjectsOnCommit());

        domain.setValidatingObjectsOnCommit(false);

        DataContext c2 = (DataContext) factory.createContext();
        assertFalse(c2.isValidatingObjectsOnCommit());
    }
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.