Search in sources :

Example 1 with StringHandle

use of com.marklogic.client.io.StringHandle in project components by Talend.

the class MarkLogicWriter method patchRecord.

private void patchRecord(String docId, String docContent) {
    StringHandle patchHandle = new StringHandle(docContent);
    if (MarkLogicOutputProperties.DocType.JSON == docType) {
        patchHandle.withFormat(Format.JSON);
    } else if (MarkLogicOutputProperties.DocType.XML == docType) {
        patchHandle.withFormat(Format.XML);
    } else {
        throw new MarkLogicException(new MarkLogicErrorCode("Cant patch for docType " + docType));
    }
    docMgr.patch(docId, patchHandle);
}
Also used : StringHandle(com.marklogic.client.io.StringHandle) MarkLogicException(org.talend.components.marklogic.exceptions.MarkLogicException) MarkLogicErrorCode(org.talend.components.marklogic.exceptions.MarkLogicErrorCode)

Example 2 with StringHandle

use of com.marklogic.client.io.StringHandle in project components by Talend.

the class MarkLogicCriteriaReader method prepareQueryOption.

private void prepareQueryOption() {
    QueryOptionsManager qryOptMgr = connectionClient.newServerConfigManager().newQueryOptionsManager();
    if (StringUtils.isNotEmpty(settings.queryOptionLiterals)) {
        StringHandle strHandle = new StringHandle();
        switch(settings.queryLiteralType) {
            case "JSON":
                {
                    strHandle.withFormat(Format.JSON);
                    break;
                }
            case "XML":
                {
                    strHandle.withFormat(Format.XML);
                    break;
                }
        }
        strHandle.set(settings.queryOptionLiterals);
        qryOptMgr.writeOptions(settings.queryOptionName, strHandle);
    }
}
Also used : StringHandle(com.marklogic.client.io.StringHandle) QueryOptionsManager(com.marklogic.client.admin.QueryOptionsManager)

Aggregations

StringHandle (com.marklogic.client.io.StringHandle)2 QueryOptionsManager (com.marklogic.client.admin.QueryOptionsManager)1 MarkLogicErrorCode (org.talend.components.marklogic.exceptions.MarkLogicErrorCode)1 MarkLogicException (org.talend.components.marklogic.exceptions.MarkLogicException)1