Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

1 total

On This Page:

  1. 1 test test

test test

// description of your code here

/**
 * create and maintain metadata for the the events list
 */
function EventsListMetadataFactory() {
    this._metadataForView = {};
}

EventsListMetadataFactory.prototype._className = "EventsListMetadataFactory";
EventsListMetadataFactory.prototype._metadataForView;

EventsListMetadataFactory._instance;

EventsListMetadataFactory.GROUPING_BY_CASE_STATUS = "TRACKING_STATE_TYPE_COL";

EventsListMetadataFactory.getInstance = function() {
    if (!EventsListMetadataFactory._instance) {
        EventsListMetadataFactory._instance = new EventsListMetadataFactory();
    }
    return EventsListMetadataFactory._instance;
}

/**
 * get the metadata
 */
EventsListMetadataFactory.prototype.getMetadata = function() {
    // todo: apply caching
    return this._createMetadata();
}

/**
 * create the metadata
 */
EventsListMetadataFactory.prototype._createMetadata = function() {
    var metadata = this._metadata = new VerixTreeMetadata();

    var columnsMetadata = getUserView().getViewData().getDisplayData().getColumnsMetadata();
    if (columnsMetadata && columnsMetadata.length>0) {
        for (var i=0; i<columnsMetadata.length; i++) {
            var columnMetadata = columnsMetadata[i];

            metadata.addCol(this.getColMetadataByLogicalName(columnMetadata));
        }

    } else {

        metadata.addCol(new EventTitleColMetadata());

        if (getCommonPropertie("eventsList.showPinColumn")=="true") {
            metadata.addCol(new EventNodePropertyColMetadata(getNodePropertyManager().getNodePropertyOfMainPin(),false));
        }

        if (getCommonPropertie("eventsList.showDiscoveryNDateColumn")=="true") {
            metadata.addCol(new EventDiscoveryTimeColMetadata());
        }

        if (getCommonPropertie("eventsList.showStateColumn")=="true") {
            metadata.addCol(new EventStateColMetadata());
        }

        // handle column highlighting for node properties
        var highlightedColumns = getCommonPropertyArray("eventsList.highlightedColumns");
        var highlightedColumnsMap = {};
        if (highlightedColumns) {
            for (var i = 0; i < highlightedColumns.length; i++) {
                highlightedColumnsMap[highlightedColumns[i]] = true;
            }
        }

        // add node properties
        var nodeProperties = getNodePropertyManager().getNodePropertiesByIds(getCommonPropertyArray("eventLists.columns"));
        for (var i = 0; i < nodeProperties.length; i++) {
            var nodeProperty = nodeProperties[i];
            // decide upon highlighting
            var isHighlighted = false;
            if (highlightedColumnsMap[i]) {
                isHighlighted = true;
            }
            // add column
            metadata.addCol(new EventNodePropertyColMetadata(nodeProperty,isHighlighted));
        }

        if (getCommonPropertie("eventsList.showRelatedEventColumn")=="true") {
            metadata.addCol(new EventRelatedColMetadata());
        }
        if (isDebug()) {
            metadata.addCol(new EventTagIconColMetadata());
            metadata.addCol(new EventIdColMetadata());
        }

        // add dimensions
        var dNameKeys = getApplicationCodeTableManager().getKeys("D_NAME");
        dNameKeys.sort(function compare(a, b) {
            return a - b;
        });
        //create map of the required dimensions in regular mode
        var requiredDimensionMap = {};
        var requiredDimensions = getCommonPropertyArray("eventLists.dimensionColumns");
        for (var i = 0; i < requiredDimensions.length; i++){
            requiredDimensionMap[requiredDimensions[i]] = true;
        }
        for (var i = 0; i < dNameKeys.length; i++) {
            var dimensionId = dNameKeys[i];
            if (isDebug() || requiredDimensionMap[dimensionId] != null) {
                metadata.addCol(new EventDimensionColMetadata(dimensionId));
            }
        }
    }

    return metadata;
}

/**
 * create the col meta data according to the passed logical name
 */
EventsListMetadataFactory.prototype.getColMetadataByLogicalName = function(columnMetadata) {
    var logicalName = columnMetadata.logicalName;
    var width = columnMetadata.width;
    var colMetadata = eval("new " + logicalName + "()");
    if (width) {
        colMetadata.setWidth(width)
    }
    return colMetadata;
}

1 total

On This Page:

  1. 1 test test