Package helma.objectmodel

Examples of helma.objectmodel.INode


            Session s = (Session) e.nextElement();

            if (s != null && s.isLoggedIn()) {
                // returns a session if it is logged in and has not been
                // returned before (so for each logged-in user is only added once)
                INode node = s.getUserNode();

                // we check again because user may have been logged out between the first check
                if (node != null && !list.contains(node)) {
                    list.add(node);
                }
View Full Code Here


        }

        // check if the skinset object is a HopObject (db based skin)
        // or a String (file based skin)
        if (skinset instanceof INode) {
            INode n = (INode) ((INode) skinset).getChildElement(prototype);

            if (n != null) {
                n = (INode) n.getChildElement(skinname);

                if (n != null) {
                    String skin = n.getString(skinProperty);

                    if (skin != null) {
                        return new Skin(skin, app);
                    }
                }
View Full Code Here

            } catch (Exception x) {
                System.err.println("Error in Java constructor: "+x);
                throw new EvaluatorException(x.toString());
            }
        } else {
            INode node = new Node(protoname, protoname,
                    core.app.getWrappedNodeManager());
            Scriptable proto = core.getPrototype(protoname);
            HopObject hobj = new HopObject(protoname, core, node, proto);

            if (proto != null) {
View Full Code Here

        // counter for constraints and satisfied constraints
        int count = 0;
        int satisfied = 0;

        INode nonvirtual = parent.getNonVirtualParent();
        DbMapping otherDbm = child.getDbMapping();
        if (otherDbm == null) {
            otherDbm = otherType;
        }

        for (int i = 0; i < constraints.length; i++) {
            Constraint cnst = constraints[i];
            String propname = cnst.foreignProperty(otherDbm);

            if (propname != null) {
                INode home = cnst.isGroupby ? parent
                                            : nonvirtual;
                String value = null;

                if (cnst.localKeyIsPrimary(home.getDbMapping())) {
                    value = home.getID();
                } else if (cnst.localKeyIsPrototype()) {
                    value = home.getDbMapping().getStorageTypeName();
                } else if (ownType.isRelational()) {
                    value = home.getString(cnst.localProperty());
                } else {
                    value = home.getString(cnst.localKey);
                }

                count++;

                if (value != null && value.equals(child.getString(propname))) {
View Full Code Here

            if (crel != null) {

                if (cnst.localKeyIsPrimary(home.getDbMapping())) {
                    // only set node if property in child object is defined as reference.
                    if (crel.reftype == REFERENCE) {
                        INode currentValue = child.getNode(crel.propName);

                        // we set the backwards reference iff the reference is currently unset, if
                        // is set to a transient object, or if the new target is not transient. This
                        // prevents us from overwriting a persistent refererence with a transient one,
                        // which would most probably not be what we want.
                        if ((currentValue == null) ||
                                ((currentValue != home) &&
                                ((currentValue.getState() == Node.TRANSIENT) ||
                                (home.getState() != Node.TRANSIENT)))) try {
                            child.setNode(crel.propName, home);
                        } catch (Exception ignore) {
                            // in some cases, getNonVirtualParent() doesn't work
                            // correctly for transient nodes, so this may fail.
View Full Code Here

            if (crel != null) {
                if (cnst.localKeyIsPrimary(home.getDbMapping())) {
                    // only set node if property in child object is defined as reference.
                    if (crel.reftype == REFERENCE) {
                        INode currentValue = child.getNode(crel.propName);

                        if ((currentValue == home)) {
                            child.setString(crel.propName, null);
                        }
                    } else if (crel.reftype == PRIMITIVE) {
View Full Code Here

        }

        public void addToQuery(StringBuffer q, INode home, INode nonvirtual, DbMapping otherDbm)
                        throws SQLException, ClassNotFoundException {
            String local;
            INode ref = isGroupby ? home : nonvirtual;

            if (localKeyIsPrimary(ref.getDbMapping())) {
                local = ref.getID();
            } else if (localKeyIsPrototype()) {
                local = ref.getDbMapping().getStorageTypeName();
            } else {
                String homeprop = ownType.columnNameToProperty(localKey);
                if (homeprop == null) {
                    throw new SQLException("Invalid local name '" + localKey +
                            "' on " + ownType);
                }
                local = ref.getString(homeprop);
            }

            String columnName;
            if (foreignKeyIsPrimary()) {
                columnName = otherDbm.getIDField();
View Full Code Here

     * Get the node's path
     */
    public String getPath() {
        String divider = null;
        StringBuffer b = new StringBuffer();
        INode p = this;
        int loopWatch = 0;

        while (p != null && p.getParent() != null) {
            if (divider != null) {
                b.insert(0, divider);
            } else {
                divider = "/";
            }

            b.insert(0, p.getElementName());
            p = p.getParent();

            loopWatch++;

            if (loopWatch > 10) {
                b.insert(0, "...");
View Full Code Here

                    String propname = (localrel == null) ? prel.accessName
                                                         : localrel.propName;
                    String prop = node.getString(propname);

                    if (prop != null && prop.length() > 0) {
                        INode old = (INode) getChildElement(prop);

                        if (old != null && old != node) {
                            // A node with this name already exists. This is a
                            // programming error, throw an exception.
                            throw new RuntimeException("An object named \"" + prop +
View Full Code Here

                    return nmgr.getNode(this, name, rel);
                } else {
                    // Do what we have to do: loop through subnodes and
                    // check if any one matches
                    String propname = rel.groupby != null ? "groupname" : rel.accessName;
                    INode node = null;
                    Enumeration e = getSubnodes();
                    while (e.hasMoreElements()) {
                        Node n = (Node) e.nextElement();
                        if (name.equalsIgnoreCase(n.getString(propname))) {
                            node = n;
                            break;
                        }
                    }
                    // set DbMapping for embedded db group nodes
                    if (node != null && rel.groupby != null) {
                         node.setDbMapping(dbmap.getGroupbyMapping());
                    }
                    return node;
                }
            }

            return getSubnode(name);
        } else {
            // no dbmapping - just try child collection first, then named property.
            INode child = getSubnode(name);

            if (child == null) {
                child = getNode(name);
            }
View Full Code Here

TOP

Related Classes of helma.objectmodel.INode

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.