Search in sources :

Example 6 with TypeInfo

use of org.jaffa.transaction.services.configdomain.TypeInfo in project jaffa-framework by jaffa-projects.

the class TransactionManagerTest method testRegisterTypeInfo.

/**
 * tests the registerTypeInfo
 */
@Test
public void testRegisterTypeInfo() {
    // initialize
    TypeInfo typeInfo = new TypeInfo();
    typeInfo.setName("typeInfoName");
    ContextKey key = new ContextKey("typeInfoName", null, "DEF", "cust-code");
    // test
    transactionManager.registerTypeInfo(key, typeInfo);
    // verify
    verify(typeInfoRepoMock).register(eq(key), Matchers.anyObject());
}
Also used : ContextKey(org.jaffa.loader.ContextKey) TypeInfo(org.jaffa.transaction.services.configdomain.TypeInfo) Test(org.junit.Test)

Example 7 with TypeInfo

use of org.jaffa.transaction.services.configdomain.TypeInfo in project jaffa-framework by jaffa-projects.

the class TransactionManager method unregisterResource.

/**
 * {@inheritDoc}
 */
@Override
public void unregisterResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Config config = JAXBHelper.unmarshalConfigFile(Config.class, resource, CONFIGURATION_SCHEMA_FILE);
    if (config.getTransactionOrType() != null) {
        for (final Object o : config.getTransactionOrType()) {
            if (o.getClass() == TransactionInfo.class) {
                final TransactionInfo transactionInfo = (TransactionInfo) o;
                ContextKey contextKey = new ContextKey(transactionInfo.getDataBean(), resource.getURI().toString(), variation, context);
                unregisterTransactionInfo(contextKey);
            } else if (o.getClass() == TypeInfo.class) {
                final TypeInfo typeInfo = (TypeInfo) o;
                ContextKey contextKey = new ContextKey(typeInfo.getName(), resource.getURI().toString(), variation, context);
                unregisterTypeInfo(contextKey);
            }
        }
    }
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Config(org.jaffa.transaction.services.configdomain.Config) TransactionInfo(org.jaffa.transaction.services.configdomain.TransactionInfo) TypeInfo(org.jaffa.transaction.services.configdomain.TypeInfo)

Example 8 with TypeInfo

use of org.jaffa.transaction.services.configdomain.TypeInfo in project jaffa-framework by jaffa-projects.

the class TransactionManager method registerResource.

/**
 * {@inheritDoc}
 */
@Override
public void registerResource(Resource resource, String context, String variation) throws JAXBException, SAXException, IOException {
    Config config = JAXBHelper.unmarshalConfigFile(Config.class, resource, CONFIGURATION_SCHEMA_FILE);
    if (config.getTransactionOrType() != null) {
        for (final Object o : config.getTransactionOrType()) {
            if (o.getClass() == TransactionInfo.class) {
                final TransactionInfo transactionInfo = (TransactionInfo) o;
                ContextKey contextKey = new ContextKey(transactionInfo.getDataBean(), resource.getURI().toString(), variation, context);
                registerTransactionInfo(contextKey, transactionInfo);
            } else if (o.getClass() == TypeInfo.class) {
                final TypeInfo typeInfo = (TypeInfo) o;
                ContextKey contextKey = new ContextKey(typeInfo.getName(), resource.getURI().toString(), variation, context);
                registerTypeInfo(contextKey, typeInfo);
            }
        }
    }
}
Also used : ContextKey(org.jaffa.loader.ContextKey) Config(org.jaffa.transaction.services.configdomain.Config) TransactionInfo(org.jaffa.transaction.services.configdomain.TransactionInfo) TypeInfo(org.jaffa.transaction.services.configdomain.TypeInfo)

Example 9 with TypeInfo

use of org.jaffa.transaction.services.configdomain.TypeInfo 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

TypeInfo (org.jaffa.transaction.services.configdomain.TypeInfo)9 ContextKey (org.jaffa.loader.ContextKey)5 LinkedList (java.util.LinkedList)3 Config (org.jaffa.transaction.services.configdomain.Config)3 TransactionInfo (org.jaffa.transaction.services.configdomain.TransactionInfo)3 DisplayParam (org.jaffa.transaction.services.configdomain.DisplayParam)2 Test (org.junit.Test)2 LinkedHashMap (java.util.LinkedHashMap)1 MessageDependency (org.jaffa.qm.apis.data.MessageDependency)1 MessageField (org.jaffa.qm.apis.data.MessageField)1 MessageFieldMetaData (org.jaffa.qm.apis.data.MessageFieldMetaData)1 MessageGraph (org.jaffa.qm.apis.data.MessageGraph)1 QueueMetaData (org.jaffa.qm.apis.data.QueueMetaData)1 TransactionDependency (org.jaffa.transaction.domain.TransactionDependency)1 TransactionField (org.jaffa.transaction.domain.TransactionField)1 PathMatchingResourcePatternResolver (org.springframework.core.io.support.PathMatchingResourcePatternResolver)1