Package org.slim3.datastore.model

Examples of org.slim3.datastore.model.Aaa


    /**
     * @throws Exception
     */
    @Test
    public void asKeyListForPolyModel() throws Exception {
        DatastoreUtil.put(ds, null, AaaMeta.get().modelToEntity(new Aaa()));
        DatastoreUtil.put(ds, null, BbbMeta.get().modelToEntity(new Bbb()));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        List<Key> list = query.asKeyList();
        assertThat(list.size(), is(2));
View Full Code Here


    /**
     * @throws Exception
     */
    @Test
    public void asIteratorForPolyModel() throws Exception {
        DatastoreUtil.put(ds, null, AaaMeta.get().modelToEntity(new Aaa()));
        DatastoreUtil.put(ds, null, BbbMeta.get().modelToEntity(new Bbb()));
        DatastoreUtil.put(ds, null, CccMeta.get().modelToEntity(new Ccc()));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        Iterator<Aaa> iterator = query.asIterator();
View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void minForPolyModel() throws Exception {
        Aaa aaa = new Aaa();
        aaa.setVersion(1L);
        Bbb bbb = new Bbb();
        bbb.setVersion(2L);
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, aaa));
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, bbb));

View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void maxForPolyModel() throws Exception {
        Aaa aaa = new Aaa();
        aaa.setVersion(2L);
        Bbb bbb = new Bbb();
        bbb.setVersion(1L);
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, aaa));
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, bbb));

View Full Code Here

    /**
     * @throws Exception
     */
    @Test
    public void countForPolyModel() throws Exception {
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, new Aaa()));
        DatastoreUtil.put(ds, null, DatastoreUtil.modelToEntity(ds, new Bbb()));

        ModelQuery<Aaa> query = new ModelQuery<Aaa>(ds, aaaMeta);
        assertThat(query.count(), is(2));

View Full Code Here

        }

        @Override
        public void visitDeclaredType(DeclaredType declaredType) {
            TypeDeclaration typeDeclaration = toTypeDeclaration(declaredType);
            String className = typeDeclaration.getQualifiedName();
            dataType = getCoreReferenceType(className, declaredType);
            if (dataType != null) {
                return;
            }
            dataType = getModelRefType(className, declaredType);
View Full Code Here

         *            the element data type
         * @return a collection data type
         */
        protected CollectionType createCollectionType(String className,
                DeclaredType declaredType, DataType elementType) {
            String typeName = declaredType.toString();
            if (List.equals(className)) {
                return new ListType(className, typeName, elementType);
            }
            if (ArrayList.equals(className)) {
                return new ArrayListType(className, typeName, elementType);
View Full Code Here

                    "    throw new IllegalStateException(\"The version property of the model(%1$s) is not defined.\");",
                    modelMetaDesc.getModelClassName());
        } else {
            printer.println("    %1$s m = (%1$s) model;", modelMetaDesc
                .getModelClassName());
            DataType dataType = attr.getDataType();
            dataType.accept(
                new SimpleDataTypeVisitor<Void, Void, RuntimeException>() {

                    @Override
                    protected Void defaultAction(DataType type, Void p)
                            throws RuntimeException {
View Full Code Here

        final AttributeMetaDesc attr =
            modelMetaDesc.getVersionAttributeMetaDesc();
        if (attr != null) {
            printer.println("    %1$s m = (%1$s) model;", modelMetaDesc
                .getModelClassName());
            DataType dataType = attr.getDataType();
            dataType.accept(
                new SimpleDataTypeVisitor<Void, Void, RuntimeException>() {

                    @Override
                    protected Void defaultAction(DataType type, Void p)
                            throws RuntimeException {
View Full Code Here

            if (value != null && value.length() > 0) {
                name = value;
            }
        }
        DataTypeFactory dataTypeFactory = creaetDataTypeFactory();
        DataType dataType =
            dataTypeFactory.createDataType(fieldDeclaration, fieldDeclaration
                .getType());
        AttributeMetaDesc attributeMetaDesc =
            new AttributeMetaDesc(name, attributeName, dataType);
        handleField(
View Full Code Here

TOP

Related Classes of org.slim3.datastore.model.Aaa

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.