Search in sources :

Example 1 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class Subform method getExplicitSubforms.

/* (non-Javadoc)
	 * @see org.openntf.domino.design.AnyFormOrSubform#getExplicitSubforms()
	 */
@Override
public List<String> getExplicitSubforms() {
    XMLNodeList nodes = getSubformNodes();
    ArrayList<String> subforms = new ArrayList<String>();
    for (XMLNode node : nodes) {
        // $NON-NLS-1$
        String name = node.getAttribute("name");
        if (!Strings.isBlankString(name)) {
            // $NON-NLS-1$
            subforms.add(node.getAttribute("name"));
        }
    }
    return subforms;
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode) ArrayList(java.util.ArrayList) XMLNodeList(org.openntf.domino.utils.xml.XMLNodeList)

Example 2 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class Subform method getExplicitSubformsRecursive.

/* (non-Javadoc)
	 * @see org.openntf.domino.design.AnyFormOrSubform#getExplicitSubformsRecursive(java.util.List)
	 */
@Override
public List<String> getExplicitSubformsRecursive(final List<String> existingList) {
    Database db = getAncestorDatabase();
    DatabaseDesign dbDesign = db.getDesign();
    XMLNodeList nodes = getSubformNodes();
    ArrayList<String> subforms = new ArrayList<String>();
    for (XMLNode node : nodes) {
        // $NON-NLS-1$
        String name = node.getAttribute("name");
        if (!Strings.isBlankString(name)) {
            if (!existingList.contains(name)) {
                // $NON-NLS-1$
                existingList.add(node.getAttribute("name"));
                org.openntf.domino.design.Subform sf = dbDesign.getSubform(name);
                existingList.addAll(sf.getExplicitSubformsRecursive(subforms));
            }
        }
    }
    return existingList;
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode) DatabaseDesign(org.openntf.domino.design.DatabaseDesign) Database(org.openntf.domino.Database) ArrayList(java.util.ArrayList) XMLNodeList(org.openntf.domino.utils.xml.XMLNodeList)

Example 3 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class IconNote method setLaunchXPageRunOnServer.

@Override
public void setLaunchXPageRunOnServer(final boolean enabled) {
    // $NON-NLS-1$ //$NON-NLS-2$
    XMLNode node = getDxlNode("/note/item[@name='" + DbProperties.LAUNCH_XPAGE_ON_SERVER.getPropertyName() + "']");
    if (enabled) {
        if (node == null) {
            // $NON-NLS-1$ //$NON-NLS-2$
            node = getDxlNode("/note").addChildElement("item");
            // $NON-NLS-1$
            node.setAttribute("name", DbProperties.LAUNCH_XPAGE_ON_SERVER.getPropertyName());
            // $NON-NLS-1$ //$NON-NLS-2$
            node.addChildElement("text").setTextContent("1");
        }
    } else {
        if (node != null) {
            node.getParentNode().removeChild(node);
        }
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 4 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class IconNote method setFileExpiry.

@Override
public void setFileExpiry(final int days) {
    // $NON-NLS-1$
    XMLNode node = getDxlNode("/note/item[@name='$FileExpires']");
    if (days > Integer.MIN_VALUE) {
        if (node == null) {
            // $NON-NLS-1$ //$NON-NLS-2$
            node = getDxlNode("/note").addChildElement("item");
            // $NON-NLS-1$
            node.setAttribute("name", DbProperties.LAUNCH_XPAGE_ON_SERVER.getPropertyName());
            // $NON-NLS-1$ //$NON-NLS-2$
            node.addChildElement("text").setTextContent("1");
        }
    } else {
        if (node != null) {
            node.getParentNode().removeChild(node);
        }
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 5 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class IconNote method setImageExpiry.

@Override
public void setImageExpiry(final int days) {
    // $NON-NLS-1$
    XMLNode node = getDxlNode("/note/item[@name='$ImageExpires']");
    if (days > Integer.MIN_VALUE) {
        if (node == null) {
            // $NON-NLS-1$ //$NON-NLS-2$
            node = getDxlNode("/note").addChildElement("item");
            // $NON-NLS-1$
            node.setAttribute("name", DbProperties.LAUNCH_XPAGE_ON_SERVER.getPropertyName());
            // $NON-NLS-1$ //$NON-NLS-2$
            node.addChildElement("text").setTextContent("1");
        }
    } else {
        if (node != null) {
            node.getParentNode().removeChild(node);
        }
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Aggregations

XMLNode (org.openntf.domino.utils.xml.XMLNode)35 ArrayList (java.util.ArrayList)7 XMLNodeList (org.openntf.domino.utils.xml.XMLNodeList)3 CDResourceFile (org.openntf.domino.nsfdata.structs.obj.CDResourceFile)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Database (org.openntf.domino.Database)1 DxlExporter (org.openntf.domino.DxlExporter)1 DatabaseDesign (org.openntf.domino.design.DatabaseDesign)1 FormField (org.openntf.domino.design.FormField)1 OpenNTFNotesException (org.openntf.domino.exceptions.OpenNTFNotesException)1 CData (org.openntf.domino.nsfdata.structs.cd.CData)1 CDObject (org.openntf.domino.nsfdata.structs.obj.CDObject)1 CDResourceEvent (org.openntf.domino.nsfdata.structs.obj.CDResourceEvent)1