Package com.psddev.dari.db

Examples of com.psddev.dari.db.ObjectType.createObject()


                                        @SuppressWarnings("unchecked")
                                        Map<String, Object> objectMap = (Map<String, Object>) ObjectUtils.fromJson(objectString.trim());
                                        ObjectType type = ObjectType.getInstance(ObjectUtils.to(UUID.class, objectMap.remove("_typeId")));

                                        if (type != null) {
                                            Object object = type.createObject(ObjectUtils.to(UUID.class, objectMap.remove("_id")));
                                            State objectState = State.getInstance(object);

                                            objectState.setValues(objectMap);
                                            substitutions.put(objectState.getId(), object);
                                        }
View Full Code Here


                    from(Object.class).
                    where("_id = ?", getParentId()).
                    first();
            if (parent == null && getParentTypeId() != null) {
                ObjectType parentType = ObjectType.getInstance(getParentTypeId());
                parent = parentType.createObject(null);
            }
            query.and(additionalPredicate, parent);
        }

        String advancedQuery = getAdvancedQuery();
View Full Code Here

                FileItem[] files = request.getFileItems("file");
                StringBuilder js = new StringBuilder();

                if (files != null && files.length > 0) {
                    Object common = selectedType.createObject(page.param(UUID.class, "typeForm-" + selectedType.getId()));

                    page.updateUsingParameters(common);

                    for (FileItem file : files) {
View Full Code Here

                            }
                        }

                        item.save();

                        Object object = selectedType.createObject(null);
                        State state = State.getInstance(object);

                        state.setValues(State.getInstance(common));

                        Site site = page.getSite();
View Full Code Here

        if (type == null) {
            throw new IllegalArgumentException(String.format(
                    "[%s] is not a valid type ID!", typeId));

        } else {
            Object object = type.createObject(id);
            State state = State.getInstance(object);

            state.setResolveInvisible(true);
            state.setValues(jsonValues);
View Full Code Here

                    if (selectedType.getGroups().contains(Singleton.class.getName())) {
                        object = Query.fromType(selectedType).first();
                    }

                    if (object == null) {
                        object = selectedType.createObject(objectId);
                        State.getInstance(object).as(Site.ObjectModification.class).setOwner(getSite());
                    }
                }
            }
        }
View Full Code Here

                page.writeEnd();
            page.writeEnd();

            for (ObjectType type : types) {
                String name = "typeForm-" + type.getId();
                Object common = type.createObject(null);

                page.writeStart("div", "class", "typeForm " + name);
                    page.writeElement("input",
                            "type", "hidden",
                            "name", name,
View Full Code Here

                noCache().
                resolveInvisible().
                first();

        if (object == null) {
            object = type.createObject(id);
        }

        State.getInstance(object).putAll(getObjectChanges());
        return object;
    }
View Full Code Here

    protected void doService(ToolPageContext page) throws IOException, ServletException {
        List<UUID> ids = page.params(UUID.class, ContentSearchAdvanced.ITEMS_PARAMETER);
        Query<?> query = ids.isEmpty() ? new Search(page).toQuery(page.getSite()) : Query.fromAll().where("_id = ?", ids);
        long count = query.count();
        ObjectType type = ObjectType.getInstance(page.param(UUID.class, "typeId"));
        State state = State.getInstance(type.createObject(page.param(UUID.class, "id")));

        state.clear();

        page.writeHeader();
            if (page.isFormPost() &&
View Full Code Here

                UUID sectionPageId = ObjectUtils.to(UUID.class, map.get("page"));
                Object section;
                if (!Boolean.TRUE.equals(map.get("isShareable")) &&
                        !page.getId().equals(sectionPageId)) {
                    section = type.createObject(null);
                } else {
                    UUID id = ObjectUtils.to(UUID.class, map.get("_id"));
                    section = Query.findById(Object.class, id);
                    if (section == null) {
                        section = type.createObject(id);
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.