Search in sources :

Example 1 with QueueMetaData

use of org.jaffa.qm.apis.data.QueueMetaData in project jaffa-framework by jaffa-projects.

the class JmsQueueAdmin method createQueueMetaData.

/**
 * Creates MetaData for the input Queue, based on the available fields in the PropertyFilter.
 */
private static QueueMetaData createQueueMetaData(String queueName, PropertyFilter pf) {
    QueueMetaData qmd = null;
    if (pf.isFieldIncluded("queueMetaData")) {
        qmd = new QueueMetaData();
        if (pf.isFieldIncluded("queueMetaData.queueSystemId"))
            qmd.setQueueSystemId(QUEUE_SYSTEM_ID);
        if (pf.isFieldIncluded("queueMetaData.type"))
            qmd.setType(queueName);
        if (pf.isFieldIncluded("queueMetaData.supportedMessageStatus"))
            qmd.setSupportedMessageStatus(SUPPORTED_MESSAGE_STATUS);
        if (pf.isFieldIncluded("queueMetaData.supportedApplicationFields")) {
            QueueInfo queueInfo = ConfigurationService.getInstance().getQueueInfo(queueName);
            if (queueInfo != null && queueInfo.getDisplayParam() != null) {
                Collection<MessageFieldMetaData> supportedApplicationFields = new LinkedList<MessageFieldMetaData>();
                for (DisplayParam displayParam : queueInfo.getDisplayParam()) {
                    // Ignore fields that are included in the main graph or are part of the technical-details
                    if (displayParam.getName().startsWith("JMS") || displayParam.getName().startsWith("jaffa_"))
                        continue;
                    MessageFieldMetaData supportedApplicationField = new MessageFieldMetaData();
                    if (pf.isFieldIncluded("queueMetaData.supportedApplicationFields.name"))
                        supportedApplicationField.setName(displayParam.getName());
                    if (pf.isFieldIncluded("queueMetaData.supportedApplicationFields.label"))
                        supportedApplicationField.setLabel(MessageHelper.replaceTokens(displayParam.getLabel()));
                    supportedApplicationFields.add(supportedApplicationField);
                }
                if (!supportedApplicationFields.isEmpty())
                    qmd.setSupportedApplicationFields(supportedApplicationFields.toArray(new MessageFieldMetaData[supportedApplicationFields.size()]));
            }
        }
        if (pf.isFieldIncluded("queueMetaData.supportsTechnicalFields"))
            qmd.setSupportsTechnicalFields(SUPPORTS_TECHNICAL_FIELDS);
        if (pf.isFieldIncluded("queueMetaData.supportsBusinessEventLogs"))
            qmd.setSupportsBusinessEventLogs(SUPPORTS_BUSINESS_EVENT_LOGS);
        if (pf.isFieldIncluded("queueMetaData.supportsDependencies"))
            qmd.setSupportsDependencies(SUPPORTS_DEPENDENCIES);
    }
    return qmd;
}
Also used : QueueInfo(org.jaffa.modules.messaging.services.configdomain.QueueInfo) MessageFieldMetaData(org.jaffa.qm.apis.data.MessageFieldMetaData) QueueMetaData(org.jaffa.qm.apis.data.QueueMetaData) DisplayParam(org.jaffa.modules.messaging.services.configdomain.DisplayParam) LinkedList(java.util.LinkedList)

Example 2 with QueueMetaData

use of org.jaffa.qm.apis.data.QueueMetaData in project jaffa-framework by jaffa-projects.

the class TransactionAdmin method createQueueMetaData.

/**
 * Creates MetaData for the input Type, based on the available fields in the PropertyFilter.
 */
private static QueueMetaData createQueueMetaData(String type, PropertyFilter pf) {
    QueueMetaData qmd = null;
    if (pf.isFieldIncluded("queueMetaData")) {
        qmd = new QueueMetaData();
        if (pf.isFieldIncluded("queueMetaData.queueSystemId")) {
            qmd.setQueueSystemId(QUEUE_SYSTEM_ID);
        }
        if (pf.isFieldIncluded("queueMetaData.type")) {
            qmd.setType(type);
        }
        if (pf.isFieldIncluded("queueMetaData.supportedMessageStatus")) {
            qmd.setSupportedMessageStatus(SUPPORTED_MESSAGE_STATUS);
        }
        if (pf.isFieldIncluded("queueMetaData.supportedApplicationFields")) {
            TypeInfo typeInfo = ConfigurationService.getInstance().getTypeInfo(type);
            if (typeInfo != null && typeInfo.getDisplayParam() != null) {
                Collection<MessageFieldMetaData> supportedApplicationFields = new LinkedList<MessageFieldMetaData>();
                for (DisplayParam displayParam : typeInfo.getDisplayParam()) {
                    MessageFieldMetaData supportedApplicationField = new MessageFieldMetaData();
                    if (pf.isFieldIncluded("queueMetaData.supportedApplicationFields.name")) {
                        supportedApplicationField.setName(displayParam.getName());
                    }
                    if (pf.isFieldIncluded("queueMetaData.supportedApplicationFields.label")) {
                        supportedApplicationField.setLabel(MessageHelper.replaceTokens(displayParam.getLabel()));
                    }
                    supportedApplicationFields.add(supportedApplicationField);
                }
                if (!supportedApplicationFields.isEmpty()) {
                    qmd.setSupportedApplicationFields(supportedApplicationFields.toArray(new MessageFieldMetaData[supportedApplicationFields.size()]));
                }
            }
        }
        if (pf.isFieldIncluded("queueMetaData.supportsTechnicalFields")) {
            qmd.setSupportsTechnicalFields(SUPPORTS_TECHNICAL_FIELDS);
        }
        if (pf.isFieldIncluded("queueMetaData.supportsBusinessEventLogs")) {
            qmd.setSupportsBusinessEventLogs(SUPPORTS_BUSINESS_EVENT_LOGS);
        }
        if (pf.isFieldIncluded("queueMetaData.supportsDependencies")) {
            qmd.setSupportsDependencies(SUPPORTS_DEPENDENCIES);
        }
    }
    return qmd;
}
Also used : MessageFieldMetaData(org.jaffa.qm.apis.data.MessageFieldMetaData) QueueMetaData(org.jaffa.qm.apis.data.QueueMetaData) TypeInfo(org.jaffa.transaction.services.configdomain.TypeInfo) DisplayParam(org.jaffa.transaction.services.configdomain.DisplayParam) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)2 MessageFieldMetaData (org.jaffa.qm.apis.data.MessageFieldMetaData)2 QueueMetaData (org.jaffa.qm.apis.data.QueueMetaData)2 DisplayParam (org.jaffa.modules.messaging.services.configdomain.DisplayParam)1 QueueInfo (org.jaffa.modules.messaging.services.configdomain.QueueInfo)1 DisplayParam (org.jaffa.transaction.services.configdomain.DisplayParam)1 TypeInfo (org.jaffa.transaction.services.configdomain.TypeInfo)1