Search in sources :

Example 6 with XMLNode

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

the class DXLItemObject method create.

@SuppressWarnings("nls")
protected static DXLItemObject create(final XMLNode node, final int dupItemId) {
    XMLNode objectNode = node.getFirstChildElement();
    XMLNode objectDataNode = objectNode.getFirstChildElement();
    String objectDataNodeName = objectDataNode.getNodeName();
    if ("file".equals(objectDataNodeName)) {
        // $NON-NLS-1$
        return new DXLItemObjectFile(node, dupItemId);
    } else {
        throw new UnsupportedOperationException("Unsupported object type " + objectDataNodeName);
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 7 with XMLNode

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

the class DatabaseDesign method setDatabaseProperties.

/* (non-Javadoc)
	 * @see org.openntf.domino.design.DatabaseDesign#setDatabaseProperties(java.util.Map)
	 */
@Override
public void setDatabaseProperties(final Map<DbProperties, Boolean> props) {
    // Capture and error for non-settable options
    List<String> nonSettable = new ArrayList<>();
    List<String> setterMethods = new ArrayList<>();
    if (props.containsKey(DbProperties.DAOS_ENABLED)) {
        nonSettable.add(DbProperties.DAOS_ENABLED.name());
    }
    if (props.containsKey(DbProperties.DOCUMENT_SUMMARY_16MB)) {
        nonSettable.add(DbProperties.DOCUMENT_SUMMARY_16MB.name());
    }
    if (props.containsKey(DbProperties.ALLOW_DAS)) {
        setterMethods.add(DbProperties.ALLOW_DAS.name());
    }
    if (props.containsKey(DbProperties.DB_IS_TEMPLATE)) {
        setterMethods.add(DbProperties.DB_IS_TEMPLATE.name());
    }
    if (props.containsKey(DbProperties.INHERIT_FROM_TEMPLATE)) {
        setterMethods.add(DbProperties.INHERIT_FROM_TEMPLATE.name());
    }
    if (props.containsKey(DbProperties.REPLICATE_UNREAD)) {
        setterMethods.add(DbProperties.REPLICATE_UNREAD.name());
    }
    if (props.containsKey(DbProperties.MAX_REVISIONS)) {
        setterMethods.add(DbProperties.MAX_REVISIONS.name());
    }
    if (props.containsKey(DbProperties.MAX_UPDATED_BY)) {
        setterMethods.add(DbProperties.MAX_UPDATED_BY.name());
    }
    if (props.containsKey(DbProperties.SOFT_DELETE_EXPIRY)) {
        nonSettable.add(DbProperties.SOFT_DELETE_EXPIRY.name());
    }
    if (!setterMethods.isEmpty() || !nonSettable.isEmpty()) {
        // $NON-NLS-1$
        String message = "";
        if (!nonSettable.isEmpty()) {
            message = "The following cannot be set programmatically but need admin processes to run: " + Strings.join(nonSettable, ",") + ". ";
        }
        if (!setterMethods.isEmpty()) {
            message += "The following methods need to be set with specific setters in DatabaseDesign class: " + Strings.join(setterMethods, ",") + ".";
        }
        throw new OpenNTFNotesException(message);
    }
    XMLNode node = getDatabaseNode();
    // Use Javascript is false, or missing in DXL if checked
    if (props.containsKey(DbProperties.USE_JS)) {
        if (props.get(DbProperties.USE_JS)) {
            node.removeAttribute(DbProperties.USE_JS.getPropertyName());
        } else {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.USE_JS.getPropertyName(), "false");
        }
    }
    // Require SSL is true if checked or missing in DXL
    if (props.containsKey(DbProperties.REQUIRE_SSL)) {
        if (props.get(DbProperties.REQUIRE_SSL)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.REQUIRE_SSL.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.REQUIRE_SSL.getPropertyName());
        }
    }
    // Don't Allow URL Open is true if checked or missing in DXL
    if (props.containsKey(DbProperties.NO_URL_OPEN)) {
        if (props.get(DbProperties.NO_URL_OPEN)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.NO_URL_OPEN.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.NO_URL_OPEN.getPropertyName());
        }
    }
    // $AllowPost8HTML is a node or not
    if (props.containsKey(DbProperties.ENHANCED_HTML)) {
        getIconNote().setEnhancedHTML(props.get(DbProperties.ENHANCED_HTML));
        isIconDirty_ = true;
    }
    // $DisallowOpenInNBP is a node or not
    if (props.containsKey(DbProperties.BLOCK_ICAA)) {
        getIconNote().setBlockICAA(props.get(DbProperties.BLOCK_ICAA));
        isIconDirty_ = true;
    }
    // Don't Allow Background Agents is false if checked or missing in DXL
    if (props.containsKey(DbProperties.DISABLE_BACKGROUND_AGENTS)) {
        if (props.get(DbProperties.DISABLE_BACKGROUND_AGENTS)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.DISABLE_BACKGROUND_AGENTS.getPropertyName(), "false");
        } else {
            node.removeAttribute(DbProperties.DISABLE_BACKGROUND_AGENTS.getPropertyName());
        }
    }
    // Allow stored forms is false, or missing in DXL if checked
    if (props.containsKey(DbProperties.ALLOW_STORED_FORMS)) {
        if (props.get(DbProperties.ALLOW_STORED_FORMS)) {
            node.removeAttribute(DbProperties.ALLOW_STORED_FORMS.getPropertyName());
        } else {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.ALLOW_STORED_FORMS.getPropertyName(), "false");
        }
    }
    // Display Images After Loading is true if checked or missing in DXL
    if (props.containsKey(DbProperties.DEFER_IMAGE_LOADING)) {
        if (props.get(DbProperties.DEFER_IMAGE_LOADING)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.DEFER_IMAGE_LOADING.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.DEFER_IMAGE_LOADING.getPropertyName());
        }
    }
    // Allow document locking is true if checked or missing in DXL
    if (props.containsKey(DbProperties.ALLOW_DOC_LOCKING)) {
        if (props.get(DbProperties.ALLOW_DOC_LOCKING)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.ALLOW_DOC_LOCKING.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.ALLOW_DOC_LOCKING.getPropertyName());
        }
    }
    // Inherit OS theme is true if checked or missing in DXL
    if (props.containsKey(DbProperties.INHERIT_OS_THEME)) {
        if (props.get(DbProperties.INHERIT_OS_THEME)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.INHERIT_OS_THEME.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.INHERIT_OS_THEME.getPropertyName());
        }
    }
    // Allow design locking is true if checked or missing in DXL
    if (props.containsKey(DbProperties.ALLOW_DESIGN_LOCKING)) {
        if (props.get(DbProperties.ALLOW_DESIGN_LOCKING)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.ALLOW_DESIGN_LOCKING.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.ALLOW_DESIGN_LOCKING.getPropertyName());
        }
    }
    // Show in open dialog is false, or missing in DXL if checked
    if (props.containsKey(DbProperties.SHOW_IN_OPEN_DIALOG)) {
        if (props.get(DbProperties.SHOW_IN_OPEN_DIALOG)) {
            node.removeAttribute(DbProperties.SHOW_IN_OPEN_DIALOG.getPropertyName());
        } else {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.SHOW_IN_OPEN_DIALOG.getPropertyName(), "false");
        }
    }
    // Multi Db indexing is true if checked or missing in DXL
    if (props.containsKey(DbProperties.MULTI_DB_INDEXING)) {
        if (props.get(DbProperties.MULTI_DB_INDEXING)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.MULTI_DB_INDEXING.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.MULTI_DB_INDEXING.getPropertyName());
        }
    }
    // Don't mark modified unread is false if checked or missing in DXL
    if (props.containsKey(DbProperties.MODIFIED_NOT_UNREAD)) {
        if (props.get(DbProperties.MODIFIED_NOT_UNREAD)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.MODIFIED_NOT_UNREAD.getPropertyName(), "false");
        } else {
            node.removeAttribute(DbProperties.MODIFIED_NOT_UNREAD.getPropertyName());
        }
    }
    // Mark parent on reply or forward is true if checked or missing in DXL
    if (props.containsKey(DbProperties.MARK_PARENT_REPLY_FORWARD)) {
        if (props.get(DbProperties.MARK_PARENT_REPLY_FORWARD)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.MARK_PARENT_REPLY_FORWARD.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.MARK_PARENT_REPLY_FORWARD.getPropertyName());
        }
    }
    // Advanced template is true if checked or missing in DXL
    if (props.containsKey(DbProperties.ADVANCED_TEMPLATE)) {
        if (props.get(DbProperties.ADVANCED_TEMPLATE)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.ADVANCED_TEMPLATE.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.ADVANCED_TEMPLATE.getPropertyName());
        }
    }
    // Multilingual is true if checked or missing in DXL
    if (props.containsKey(DbProperties.MULTILINGUAL)) {
        if (props.get(DbProperties.MULTILINGUAL)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.MULTILINGUAL.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.MULTILINGUAL.getPropertyName());
        }
    }
    // Don't maintain unread is false, or missing in DXL if checked
    if (props.containsKey(DbProperties.DONT_MAINTAIN_UNREAD)) {
        if (props.get(DbProperties.DONT_MAINTAIN_UNREAD)) {
            node.removeAttribute(DbProperties.DONT_MAINTAIN_UNREAD.getPropertyName());
        } else {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.DONT_MAINTAIN_UNREAD.getPropertyName(), "false");
        }
    }
    // Optimize document table map is true if checked or missing in DXL
    if (props.containsKey(DbProperties.OPTIMIZE_DOC_MAP)) {
        if (props.get(DbProperties.OPTIMIZE_DOC_MAP)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.OPTIMIZE_DOC_MAP.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.OPTIMIZE_DOC_MAP.getPropertyName());
        }
    }
    // Don't overwrite free space is false if checked or missing in DXL
    if (props.containsKey(DbProperties.DONT_OVERWRITE_FREE_SPACE)) {
        if (props.get(DbProperties.DONT_OVERWRITE_FREE_SPACE)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.DONT_OVERWRITE_FREE_SPACE.getPropertyName(), "false");
        } else {
            node.removeAttribute(DbProperties.DONT_OVERWRITE_FREE_SPACE.getPropertyName());
        }
    }
    // Maintain last accessed is true if checked or missing in DXL
    if (props.containsKey(DbProperties.MAINTAIN_LAST_ACCESSED)) {
        if (props.get(DbProperties.MAINTAIN_LAST_ACCESSED)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.MAINTAIN_LAST_ACCESSED.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.MAINTAIN_LAST_ACCESSED.getPropertyName());
        }
    }
    // Disable transaction logging is false if checked or missing in DXL
    if (props.containsKey(DbProperties.DISABLE_TRANSACTION_LOGGING)) {
        if (props.get(DbProperties.DISABLE_TRANSACTION_LOGGING)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.DISABLE_TRANSACTION_LOGGING.getPropertyName(), "false");
        } else {
            node.removeAttribute(DbProperties.DISABLE_TRANSACTION_LOGGING.getPropertyName());
        }
    }
    // Don't support specialized response hierarchy is false if checked or missing in DXL
    if (props.containsKey(DbProperties.NO_SPECIAL_RESPONSE_HIERARCHY)) {
        if (props.get(DbProperties.NO_SPECIAL_RESPONSE_HIERARCHY)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.NO_SPECIAL_RESPONSE_HIERARCHY.getPropertyName(), "false");
        } else {
            node.removeAttribute(DbProperties.NO_SPECIAL_RESPONSE_HIERARCHY.getPropertyName());
        }
    }
    // LZ1 compression is true if checked or missing in DXL
    if (props.containsKey(DbProperties.USE_LZ1)) {
        if (props.get(DbProperties.USE_LZ1)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.USE_LZ1.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.USE_LZ1.getPropertyName());
        }
    }
    // Don't allow headline monitoring is false if checked or missing in DXL
    if (props.containsKey(DbProperties.NO_HEADLINE_MONITORING)) {
        if (props.get(DbProperties.NO_HEADLINE_MONITORING)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.NO_HEADLINE_MONITORING.getPropertyName(), "false");
        } else {
            node.removeAttribute(DbProperties.NO_HEADLINE_MONITORING.getPropertyName());
        }
    }
    // Allow more fields is true if checked or missing in DXL
    if (props.containsKey(DbProperties.ALLOW_MORE_FIELDS)) {
        if (props.get(DbProperties.ALLOW_MORE_FIELDS)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.ALLOW_MORE_FIELDS.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.ALLOW_MORE_FIELDS.getPropertyName());
        }
    }
    // Support response thread hierarchy is true if checked or missing in DXL
    if (props.containsKey(DbProperties.SUPPORT_RESPONSE_THREADS)) {
        if (props.get(DbProperties.SUPPORT_RESPONSE_THREADS)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.SUPPORT_RESPONSE_THREADS.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.SUPPORT_RESPONSE_THREADS.getPropertyName());
        }
    }
    // Don't allow simple search is true if checked or missing in DXL
    if (props.containsKey(DbProperties.NO_SIMPLE_SEARCH)) {
        if (props.get(DbProperties.NO_SIMPLE_SEARCH)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.NO_SIMPLE_SEARCH.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.NO_SIMPLE_SEARCH.getPropertyName());
        }
    }
    // Compress design is true if checked or missing in DXL
    if (props.containsKey(DbProperties.COMPRESS_DESIGN)) {
        if (props.get(DbProperties.COMPRESS_DESIGN)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.COMPRESS_DESIGN.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.COMPRESS_DESIGN.getPropertyName());
        }
    }
    // Compress data is true if checked or missing in DXL
    if (props.containsKey(DbProperties.COMPRESS_DATA)) {
        if (props.get(DbProperties.COMPRESS_DATA)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.COMPRESS_DATA.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.COMPRESS_DATA.getPropertyName());
        }
    }
    // Disable view auto update is true if checked or missing in DXL
    if (props.containsKey(DbProperties.NO_AUTO_VIEW_UPDATE)) {
        if (props.get(DbProperties.NO_AUTO_VIEW_UPDATE)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.NO_AUTO_VIEW_UPDATE.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.NO_AUTO_VIEW_UPDATE.getPropertyName());
        }
    }
    // $DisableViewExport is a node or not
    if (props.containsKey(DbProperties.NO_EXPORT_VIEW)) {
        getIconNote().setEnhancedHTML(props.get(DbProperties.NO_EXPORT_VIEW));
        isIconDirty_ = true;
    }
    // Allow soft deletions is true if checked or missing in DXL
    if (props.containsKey(DbProperties.ALLOW_SOFT_DELETE)) {
        if (props.get(DbProperties.ALLOW_SOFT_DELETE)) {
            // $NON-NLS-1$
            node.setAttribute(DbProperties.ALLOW_SOFT_DELETE.getPropertyName(), "true");
        } else {
            node.removeAttribute(DbProperties.ALLOW_SOFT_DELETE.getPropertyName());
        }
    }
    // $LaunchXPageRunOnServer is a node or not
    if (props.containsKey(DbProperties.LAUNCH_XPAGE_ON_SERVER)) {
        getIconNote().setEnhancedHTML(props.get(DbProperties.LAUNCH_XPAGE_ON_SERVER));
        isIconDirty_ = true;
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode) OpenNTFNotesException(org.openntf.domino.exceptions.OpenNTFNotesException) ArrayList(java.util.ArrayList)

Example 8 with XMLNode

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

the class DatabaseDesign method getDatabaseProperties.

/* (non-Javadoc)
	 * @see org.openntf.domino.design.DatabaseDesign#getDatabaseProperties()
	 */
@Override
public List<DbProperties> getDatabaseProperties() {
    List<DbProperties> returnVal = new ArrayList<DbProperties>();
    XMLNode node = getDatabaseNode();
    // Use Javascript is false, or missing in DXL if checked
    if (!"false".equals(node.getAttribute(DbProperties.USE_JS.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.USE_JS);
    }
    // Require SSL is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.REQUIRE_SSL.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.REQUIRE_SSL);
    }
    // Don't Allow URL Open is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.NO_URL_OPEN.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.NO_URL_OPEN);
    }
    // Enable enhanced HTML has an item called $AllowPost8HTML
    if (getIconNote().isEnhancedHTML()) {
        returnVal.add(DbProperties.ENHANCED_HTML);
    }
    // Don't allow open in ICAA has an item called $DisallowOpenInNBP
    if (getIconNote().isBlockICAA()) {
        returnVal.add(DbProperties.BLOCK_ICAA);
    }
    // Don't allow background agents is false if checked or missing in DXL - SO NEEDS REVERSING
    if ("false".equals(node.getAttribute(DbProperties.DISABLE_BACKGROUND_AGENTS.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.DISABLE_BACKGROUND_AGENTS);
    }
    // Allow stored forms is false or missing in DXL if checked
    if (!"false".equals(node.getAttribute(DbProperties.ALLOW_STORED_FORMS.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.ALLOW_STORED_FORMS);
    }
    // Display images after loading is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.DEFER_IMAGE_LOADING.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.DEFER_IMAGE_LOADING);
    }
    // Allow document locking is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.ALLOW_DOC_LOCKING.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.ALLOW_DOC_LOCKING);
    }
    // Inherit OS theme is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.INHERIT_OS_THEME.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.INHERIT_OS_THEME);
    }
    // Allow design locking is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.ALLOW_DESIGN_LOCKING.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.ALLOW_DESIGN_LOCKING);
    }
    // Show in open dialog is false or missing in DXL if checked
    if (!"false".equals(node.getAttribute(DbProperties.SHOW_IN_OPEN_DIALOG.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.SHOW_IN_OPEN_DIALOG);
    }
    // Multi db indexed is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.MULTI_DB_INDEXING.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.MULTI_DB_INDEXING);
    }
    // Don't mark modified unread is false if checked or missing in DXL - SO NEEDS REVERSING
    if ("false".equals(node.getAttribute(DbProperties.MODIFIED_NOT_UNREAD.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.MODIFIED_NOT_UNREAD);
    }
    // Mark parent on reply or forward is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.MARK_PARENT_REPLY_FORWARD.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.MARK_PARENT_REPLY_FORWARD);
    }
    // Source template name is set or missing
    if (!StringUtil.isEmpty(node.getAttribute(DbProperties.INHERIT_FROM_TEMPLATE.getPropertyName()))) {
        returnVal.add(DbProperties.INHERIT_FROM_TEMPLATE);
    }
    // Template name is set or missing
    if (!StringUtil.isEmpty(node.getAttribute(DbProperties.DB_IS_TEMPLATE.getPropertyName()))) {
        returnVal.add(DbProperties.DB_IS_TEMPLATE);
    }
    // Advanced template is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.ADVANCED_TEMPLATE.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.ADVANCED_TEMPLATE);
    }
    // Multilingual is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.MULTILINGUAL.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.MULTILINGUAL);
    }
    // Don't maintain unread is false or missing in DXL if checked
    if (!"false".equals(node.getAttribute(DbProperties.DONT_MAINTAIN_UNREAD.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.DONT_MAINTAIN_UNREAD);
    }
    // Replicate unread marks is "cluster", "all", or missing
    if (!StringUtil.isEmpty(node.getAttribute(DbProperties.REPLICATE_UNREAD.getPropertyName()))) {
        returnVal.add(DbProperties.REPLICATE_UNREAD);
    }
    // Optimize document table map is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.OPTIMIZE_DOC_MAP.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.OPTIMIZE_DOC_MAP);
    }
    // Don't overwrite free space is false if checked or missing in DXL - SO NEEDS REVERSING
    if ("false".equals(node.getAttribute(DbProperties.DONT_OVERWRITE_FREE_SPACE.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.DONT_OVERWRITE_FREE_SPACE);
    }
    // Maintain last accessed is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.MAINTAIN_LAST_ACCESSED.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.MAINTAIN_LAST_ACCESSED);
    }
    // Disable transaction logging is false if checked or missing in DXL - SO NEEDS REVERSING
    if ("false".equals(node.getAttribute(DbProperties.DISABLE_TRANSACTION_LOGGING.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.DISABLE_TRANSACTION_LOGGING);
    }
    // Don't support specialized response hierarchy is false if checked or missing in DXL - SO NEEDS REVERSING
    if ("false".equals(node.getAttribute(DbProperties.NO_SPECIAL_RESPONSE_HIERARCHY.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.NO_SPECIAL_RESPONSE_HIERARCHY);
    }
    // Use LZ1 compression is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.USE_LZ1.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.USE_LZ1);
    }
    // Dont' allow headling monitoring is false if checked or missing in DXL - SO NEEDS REVERSING
    if ("false".equals(node.getAttribute(DbProperties.NO_HEADLINE_MONITORING.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.NO_HEADLINE_MONITORING);
    }
    // Allow more fields is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.ALLOW_MORE_FIELDS.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.ALLOW_MORE_FIELDS);
    }
    // Support response thread history is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.SUPPORT_RESPONSE_THREADS.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.SUPPORT_RESPONSE_THREADS);
    }
    // Don't allow simple search is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.NO_SIMPLE_SEARCH.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.NO_SIMPLE_SEARCH);
    }
    // Compress design is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.COMPRESS_DESIGN.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.COMPRESS_DESIGN);
    }
    // Compress data is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.COMPRESS_DATA.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.COMPRESS_DATA);
    }
    // Disable view auto update is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.NO_AUTO_VIEW_UPDATE.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.NO_AUTO_VIEW_UPDATE);
    }
    // Disable view export  has an item called $DisableExport
    if (getIconNote().isDisableViewExport()) {
        returnVal.add(DbProperties.NO_EXPORT_VIEW);
    }
    // Allow soft deletions is true if checked or missing in DXL
    if ("true".equals(node.getAttribute(DbProperties.ALLOW_SOFT_DELETE.getPropertyName()))) {
        // $NON-NLS-1$
        returnVal.add(DbProperties.ALLOW_SOFT_DELETE);
    }
    // Limit $UpdatedBy entries has a value or, if missing, = 0
    if (!StringUtil.isEmpty(node.getAttribute(DbProperties.MAX_UPDATED_BY.getPropertyName()))) {
        returnVal.add(DbProperties.MAX_UPDATED_BY);
    }
    // Limit $Revisions entries has a value or, if missing, = 0
    if (!StringUtil.isEmpty(node.getAttribute(DbProperties.MAX_REVISIONS.getPropertyName()))) {
        returnVal.add(DbProperties.MAX_REVISIONS);
    }
    // Allow DAS has an item called $AllowDas
    if (getIconNote().isAllowDas()) {
        returnVal.add(DbProperties.ALLOW_DAS);
    }
    // DAOS has an item called $Daos, set to 1
    if (getIconNote().isDaosEnabled()) {
        returnVal.add(DbProperties.DAOS_ENABLED);
    }
    // Lunch XPage Run On Server has an item called $LaunchXPageRunOnServer, set to 1
    if (getIconNote().isLaunchXPageRunOnServer()) {
        returnVal.add(DbProperties.LAUNCH_XPAGE_ON_SERVER);
    }
    // Document Summary 16Mb has an item called $LargeSummary, set to 1
    if (getIconNote().isDocumentSummary16MB()) {
        returnVal.add(DbProperties.DOCUMENT_SUMMARY_16MB);
    }
    return returnVal;
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode) ArrayList(java.util.ArrayList)

Example 9 with XMLNode

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

the class AbstractDesignBase method setItemValue.

/**
 * Sets the <code>value</code> of the Item with the given <code>itemName</code>
 *
 * @param itemName
 *            the itemName
 * @param value
 *            the value to set
 */
public final void setItemValue(final String itemName, final Object value, final Set<ItemFlag> flags) {
    // load DXL before modification
    getDxlFormat(true);
    // $NON-NLS-1$ //$NON-NLS-2$
    XMLNode node = getDxlNode("//item[@name='" + XMLDocument.escapeXPathValue(itemName) + "']");
    if (node == null) {
        // $NON-NLS-1$ //$NON-NLS-2$
        node = getDxl().selectSingleNode("/*").addChildElement("item");
        // $NON-NLS-1$
        node.setAttribute("name", itemName);
    } else {
        node.removeChildren();
    }
    if (flags.contains(ItemFlag._SIGN)) {
        // $NON-NLS-1$ //$NON-NLS-2$
        node.setAttribute("sign", "true");
    } else {
        // $NON-NLS-1$
        node.removeAttribute("sign");
    }
    if (flags.contains(ItemFlag._SUMMARY)) {
        // $NON-NLS-1$
        node.removeAttribute("summary");
    } else {
        // $NON-NLS-1$ //$NON-NLS-2$
        node.setAttribute("summary", "false");
    }
    if (value instanceof Iterable) {
        Object first = ((Iterable<?>) value).iterator().next();
        // $NON-NLS-1$ //$NON-NLS-2$
        XMLNode list = node.addChildElement(first instanceof Number ? "numberlist" : "textlist");
        for (Object val : (Iterable<?>) value) {
            appendItemValueNode(list, val);
        }
    } else {
        appendItemValueNode(node, value);
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 10 with XMLNode

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

the class AbstractDesignBase method getItemValueStrings.

/**
 * Reads the given item name and returns the containing string (can only read number and text items)
 *
 * @param itemName
 *            the ItemName
 * @return the values as List<String>
 */
public final List<String> getItemValueStrings(final String itemName) {
    if (dxlFormat_ == DxlFormat.NONE) {
        return document_.getItemValues(itemName, String.class);
    }
    List<String> result = new ArrayList<String>();
    // $NON-NLS-1$ //$NON-NLS-2$
    XMLNode node = getDxlNode("//item[@name='" + XMLDocument.escapeXPathValue(itemName) + "']");
    if (node != null) {
        // $NON-NLS-1$
        List<XMLNode> nodes = node.selectNodes(".//number | .//text");
        for (XMLNode child : nodes) {
            result.add(child.getText());
        }
    }
    return result;
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode) ArrayList(java.util.ArrayList)

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