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());
}
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);
}
}
}
}
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);
}
}
}
}
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;
}
Aggregations