Examples of INode


Examples of helma.objectmodel.INode

        // 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

Examples of helma.objectmodel.INode

            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

Examples of helma.objectmodel.INode

            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

Examples of helma.objectmodel.INode

        }

        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

Examples of helma.objectmodel.INode

     * 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

Examples of helma.objectmodel.INode

                    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

Examples of helma.objectmodel.INode

                    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

Examples of helma.objectmodel.INode

     *
     *
     * @return ...
     */
    public boolean remove() {
        INode parent = getParent();
        if (parent != null) {
            try {
                parent.removeNode(this);
            } catch (Exception x) {
                // couldn't remove from parent. Log and continue
                getApp().logError("Couldn't remove node from parent: " + x);
            }
        }
View Full Code Here

Examples of helma.objectmodel.INode

        if (groupNode != null) {
            groupNode.releaseNode(node);
            return;
        }

        INode parent = node.getParent();

        checkWriteLock();
        node.checkWriteLock();

        // load subnodes in case they haven't been loaded.
View Full Code Here

Examples of helma.objectmodel.INode

                    }
                    // check if accessname has changed
                    if (subrel.accessName != null &&
                            subrel.accessName.equals(dbcolumn)) {
                        // if any other node is contained with the new value, remove it
                        INode n = (INode) parent.getChildElement(value);

                        if ((n != null) && (n != this)) {
                            throw new RuntimeException(this +
                                    " already contains an object named " + value);
                        }
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.