@Test public void testGetEntityTypeDescriptionWithinNewTransactionFallbackToCommitted() { bindResource(TRANSACTION_ID_RESOURCE_NAME, "1"); assertEquals( entityTypeDescription, entityTypeRegistryImpl.getEntityTypeDescription( "org_molgenis_test_many_packages_deep#2409e1c6")); assertEquals( entityTypeDescription, entityTypeRegistryImpl.getEntityTypeDescription("org_molgenis_test_many#2409e1c6_mref")); assertNull( entityTypeRegistryImpl.getEntityTypeDescription( "org_molgenis_test_many#2409e1c6_stringAttribute")); assertNull( entityTypeRegistryImpl.getEntityTypeDescription( "org_molgenis_test_many#2409e1c6_xref_attribute_with_a_long_name")); }
@Override public EntityTypeDescription getEntityTypeDescription(String tableName) { return Optional.ofNullable(getTransactionId()) .filter(transactionsEntityTypeDescriptionMap::containsKey) .map(transactionsEntityTypeDescriptionMap::get) .filter(transactionMap -> transactionMap.containsKey(tableName)) .orElse(entityTypeDescriptionMap) .get(tableName); }
EntityTypeRegistryImpl implements EntityTypeRegistry, TransactionListener { @Override public EntityTypeDescription getEntityTypeDescription(String tableName) { return Optional.ofNullable(getTransactionId()) .filter(transactionsEntityTypeDescriptionMap::containsKey) .map(transactionsEntityTypeDescriptionMap::get) .filter(transactionMap -> transactionMap.containsKey(tableName)) .orElse(entityTypeDescriptionMap) .get(tableName); } }
EntityTypeRegistryImpl implements EntityTypeRegistry, TransactionListener { @Override public EntityTypeDescription getEntityTypeDescription(String tableName) { return Optional.ofNullable(getTransactionId()) .filter(transactionsEntityTypeDescriptionMap::containsKey) .map(transactionsEntityTypeDescriptionMap::get) .filter(transactionMap -> transactionMap.containsKey(tableName)) .orElse(entityTypeDescriptionMap) .get(tableName); } EntityTypeRegistryImpl(TransactionManager transactionManager); }
EntityTypeRegistryImpl implements EntityTypeRegistry, TransactionListener { @Override public EntityTypeDescription getEntityTypeDescription(String tableName) { return Optional.ofNullable(getTransactionId()) .filter(transactionsEntityTypeDescriptionMap::containsKey) .map(transactionsEntityTypeDescriptionMap::get) .filter(transactionMap -> transactionMap.containsKey(tableName)) .orElse(entityTypeDescriptionMap) .get(tableName); } EntityTypeRegistryImpl(TransactionManager transactionManager); @Override void registerEntityType(EntityType entityType); @Override void unregisterEntityType(EntityType entityType); @Override void addAttribute(EntityType entityType, Attribute attribute); @Override void updateAttribute(EntityType entityType, Attribute attr, Attribute updatedAttr); @Override void deleteAttribute(EntityType entityType, Attribute attr); @Override EntityTypeDescription getEntityTypeDescription(String tableName); @Override void afterCommitTransaction(String transactionId); @Override void rollbackTransaction(String transactionId); }
EntityTypeRegistryImpl implements EntityTypeRegistry, TransactionListener { @Override public EntityTypeDescription getEntityTypeDescription(String tableName) { return Optional.ofNullable(getTransactionId()) .filter(transactionsEntityTypeDescriptionMap::containsKey) .map(transactionsEntityTypeDescriptionMap::get) .filter(transactionMap -> transactionMap.containsKey(tableName)) .orElse(entityTypeDescriptionMap) .get(tableName); } EntityTypeRegistryImpl(TransactionManager transactionManager); @Override void registerEntityType(EntityType entityType); @Override void unregisterEntityType(EntityType entityType); @Override void addAttribute(EntityType entityType, Attribute attribute); @Override void updateAttribute(EntityType entityType, Attribute attr, Attribute updatedAttr); @Override void deleteAttribute(EntityType entityType, Attribute attr); @Override EntityTypeDescription getEntityTypeDescription(String tableName); @Override void afterCommitTransaction(String transactionId); @Override void rollbackTransaction(String transactionId);  }