2017-08-25

Collibra - DGC Workflow to export a domain view and save it as an attachment in that domain

import com.collibra.dgc.core.file.FileInfo;

// Define the view to download
// Get this from the "excel" object produced behind the scenes when you manually export the view (use Firefox or Chrome's inspector... Network Resources tab)
def tableViewConfig = '{"TableViewConfig":{"displayLength":-1,... "fieldName":"Asfdb5d2c95585d5af41aed"}}]}}'

// File Name
def fileName = "Your file name here.xlsx"
execution.setVariable( "fileName", fileName )
loggerComponent.info("File Name:" + fileName )

// Produce the file
def fileInfo = outputViewComponent.exportExcelWithoutJob( tableViewConfig, fileName, null, true, true);

// Get the file's Id
def fileId = fileInfo.getUuid()
execution.setVariable( "fileId", fileId )
loggerComponent.info("File Id:" + fileId )

// Define the target URL
outputUrl = applicationComponent.getBaseURL() + "rest/1.0/file/" + fileId
loggerComponent.info( "Output URL: " + outputUrl )

// Add as an attachment to the hosting/calling domain
// This task may need to reside within a separate script task, for synchronous execution
attachmentComponent.addAttachmentToResource( item.id, item.type.name(), fileId, fileName )

Collibra - Workaround for groovy string size limitation in Collibra DGC workflows

def VARIABLE_NAME = new TextArea( “LONG_STRING_HERE” )

PS. Tentative, yet to confirm. I assume then you can pass this variable from one workflow to another.

Meteor - Production deployment ignores CSS/Stylus

This happens, amongst perhaps other causes, due to a combination of the existence, in your project, of two packages in your project:

(1) Stylus
(2) Standard CSS Minifier

If you are using Stylus, remove the Standard CSS Minifier... that worked for me.

2017-08-13

MongoDB - Sub-document filtering to return only desired sub-documents

db.COLLECTION_NAME.find(

    // Filtering. match
    {
        "FIELD_TO_FILTER_BY": FILTER_VALUE
    }

    // Projection
    , {
        ARRAY_OF_SUBDOCS:{
            $elemMatch:{"SUB_DOC_FIELD": FILTER_VALUE }
        }
    }
);