use of org.jaffa.transaction.services.configdomain.TransactionInfo in project jaffa-framework by jaffa-projects.
the class TransactionManagerTest method testRegisterTransactionInfo.
/**
* tests the registerTransactionInfo
*/
@Test
public void testRegisterTransactionInfo() {
// test
transactionManager.registerTransactionInfo(new ContextKey("testBean", null, "DEF", "cust-code"), new TransactionInfo());
// verify
verify(transactionRepoMock).register(eq(new ContextKey("testBean", null, "DEF", "cust-code")), Matchers.anyObject());
}
use of org.jaffa.transaction.services.configdomain.TransactionInfo in project jaffa-framework by jaffa-projects.
the class TransactionEngine method getAccessibleSubTypeNames.
/**
* Returns an array of Transaction SubType names, as defined in the configuration file.
* The array will contain the accessible SubTypes only.
*
* @return an array of Transaction SubType names, as defined in the configuration file.
*/
public String[] getAccessibleSubTypeNames() {
Collection<String> subTypes = new LinkedHashSet<String>();
TransactionInfo[] allTransactionInfo = ConfigurationService.getInstance().getAllTransactionInfo();
for (TransactionInfo transactionInfo : allTransactionInfo) {
if (transactionInfo != null && transactionInfo.getSubType() != null && transactionInfo.getSubType().length() > 0 && hasBrowseAccess(transactionInfo.getType())) {
subTypes.add(transactionInfo.getSubType());
}
}
return subTypes.toArray(new String[subTypes.size()]);
}
use of org.jaffa.transaction.services.configdomain.TransactionInfo in project jaffa-framework by jaffa-projects.
the class TransactionManager method getTransactionInfo.
/**
* Returns the TransactionInfo object for the input dataBeanClass, as defined in the configuration file.
*
* @param dataBeanClass the class for a dataBean.
* @return the TransactionInfo object for the input dataBeanClass, as defined in the configuration file.
*/
public TransactionInfo getTransactionInfo(Class dataBeanClass) {
final String dataBeanClassName = dataBeanClass.getName();
TransactionInfo transactionInfo = getTransactionInfo(dataBeanClassName);
if (transactionInfo == null) {
// Lookup the class heirarchy. Add a NULL for the dataBeanClassName, even if a TransactionInfo is not found
ContextKey superClassContextKey = null;
while (dataBeanClass.getSuperclass() != null) {
dataBeanClass = dataBeanClass.getSuperclass();
transactionInfo = getTransactionInfo(dataBeanClass.getName());
superClassContextKey = getTransactionRepository().findKey(dataBeanClass.getName());
if (transactionInfo != null)
break;
}
if (superClassContextKey != null) {
registerTransactionInfo(new ContextKey(transactionInfo.getDataBean(), superClassContextKey.getFileName(), superClassContextKey.getVariation(), superClassContextKey.getPrecedence()), transactionInfo);
}
}
return transactionInfo;
}
use of org.jaffa.transaction.services.configdomain.TransactionInfo 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.TransactionInfo 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);
}
}
}
}
Aggregations