Package org.faktorips.runtime
Class InMemoryRuntimeRepository
java.lang.Object
org.faktorips.runtime.internal.AbstractRuntimeRepository
org.faktorips.runtime.InMemoryRuntimeRepository
- All Implemented Interfaces:
IModifiableRuntimeRepository,IRuntimeRepository
public class InMemoryRuntimeRepository
extends AbstractRuntimeRepository
implements IModifiableRuntimeRepository
A runtime repository that keeps its data in memory.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEnumXmlAdapter(IIpsXmlAdapter<?, ?> enumXmlAdapter) Adds anIIpsXmlAdapterfor a Faktor-IPS enumeration that defers its content to a enumeration content to this repository.protected voidgetAllEnumClasses(LinkedHashSet<Class<?>> result) Same asAbstractRuntimeRepository.getAllEnumClasses()but searches only in this repository and not the ones this repository depends on.protected List<IIpsXmlAdapter<?,?>> getAllInternalEnumXmlAdapters(IRuntimeRepository repository) Returns all enumeration XmlAdapters available in this repository that generated by Faktor-IPS.protected voidgetAllIpsTestCases(List<IpsTest2> result, IRuntimeRepository runtimeRepository) Same asAbstractRuntimeRepository.getAllIpsTestCases(IRuntimeRepository)but searches only in this repository and not the ones this repository depends on.protected voidSame asAbstractRuntimeRepository.getAllModelTypeImplementationClasses()but searches only in this repository and not the ones this repository depends on.voidgetAllProductComponentIds(List<String> result) Same asAbstractRuntimeRepository.getAllProductComponentIds()but searches only in this repository and not the ones this repository depends on.voidgetAllProductComponents(String kindId, List<IProductComponent> result) Same as getAllProductComponent(String kindId) but searches only in this repository and not the ones this repository depends on.voidgetAllProductComponents(List<IProductComponent> result) Same as getAllProductComponents() but searches only in this repository and not the ones this repository depends on.voidgetAllTableIds(List<String> result) Same asAbstractRuntimeRepository.getAllTableIds()but searches only in this repository and not the ones this repository depends on.protected voidgetAllTables(List<ITable<?>> result) Same asAbstractRuntimeRepository.getAllTables()but searches only in this repository and not the ones this repository depends on.protected <T> TgetCustomRuntimeObjectInternal(Class<T> type, String ipsObjectQualifiedName) Same asAbstractRuntimeRepository.getCustomRuntimeObject(Class, String)but searches only in this repository and not the ones this repository depends on.<T> org.faktorips.values.InternationalStringgetEnumDescription(Class<T> enumClazz) Returns the description for the given enumeration type.protected <T> List<T>getEnumValuesInternal(Class<T> clazz) Returns the list of enumeration values of the enumeration type that is identified by its class which is provided to it.protected IpsTestCaseBasegetIpsTestCaseInternal(String qName, IRuntimeRepository runtimeRepository) Same asAbstractRuntimeRepository.getIpsTestCase(String, IRuntimeRepository)but searches only in this repository and not the ones this repository depends on.protected voidgetIpsTestCasesStartingWith(String qNamePrefix, List<IpsTest2> result, IRuntimeRepository runtimeRepository) Gets all ips test cases starting with the given qualified name prefix.protected IProductComponentGenerationprotected IProductComponentGenerationprotected intprotected IProductComponentGenerationprotected IProductComponentGenerationgetProductComponentGenerationInternal(String productCmptId, Calendar effectiveDate) Same as getProductComponentGeneration(String id, Calendar effectiveDate) but searches only in this repository and not the ones this repository depends on.voidgetProductComponentGenerations(IProductComponent productCmpt, List<IProductComponentGeneration> result) Same as getProductComponentGenerations() but searches only in this repository and not the ones this repository depends on.protected IProductComponentSame as getProductComponent(String id) but searches only in this repository and not the ones this repository depends on.protected IProductComponentgetProductComponentInternal(String kindId, String versionId) Same as getProductComponent(String kindId, String versionId) but searches only in this repository and not the ones this repository depends on.protected <T extends ITable<?>>
TgetTableInternal(Class<T> tableClass) InMemoryRepository also searches for tables that are instances of subclasses of the given tableClass.protected ITable<?>getTableInternal(String qualifiedTableName) Same asAbstractRuntimeRepository.getTable(String)) but searches only in this repository and not the ones this repository depends on.voidNothing to do for the in memory repository.booleanReturnstrueif the repository's content is modifiable.<T extends IRuntimeObject>
voidputCustomRuntimeObject(Class<T> type, String ipsObjectQualifiedName, T runtimeObject) Puts the runtimeObject into the repository.<T> voidputEnumValues(Class<T> enumTypeClass, List<T> enumValues, org.faktorips.values.InternationalString description) Puts the given enum values and description in the repository replacing all existing values for the given enumType.voidPuts the test case into the repository.voidputProductCmptGeneration(IProductComponentGeneration generation) Puts the product component generation and its product component into the repository.voidputProductComponent(IProductComponent productCmpt) Puts the product component into the repository.Puts the table into the repository.voidDeprecated, for removal: This API element is subject to removal in a future version.since 24.7 for removal.<T> booleanremoveCustomRuntimeObject(Class<T> type, String ipsObjectQualifiedName) removes the runtimeObject from the repository.<T> booleanremoveEnumValues(Class<T> enumTypeClass) removes the enum values and description of the given enumType from the repository.booleanRemoves the specified IPS test case.booleanremoveProductCmptGeneration(IProductComponentGeneration productCmptGeneration) Removes the given product component generation from the list of generationsbooleanremoveProductComponent(IProductComponent productCmpt) Removes the product component from the repository.booleanremoveTable(ITable<?> table) Removes the table from the repository.Methods inherited from class org.faktorips.runtime.internal.AbstractRuntimeRepository
addAllEnumXmlAdapters, addDirectlyReferencedRepository, addEnumValueLookupService, getAllEnumClasses, getAllIpsTestCases, getAllModelTypeImplementationClasses, getAllProductComponentIds, getAllProductComponents, getAllProductComponents, getAllProductComponents, getAllProductComponentsInternal, getAllReferencedRepositories, getAllTableIds, getAllTables, getClassLoader, getCustomRuntimeObject, getDirectlyReferencedRepositories, getEnumValue, getEnumValue, getEnumValueLookupService, getEnumValues, getEnumValuesDefinedInType, getExistingEnumValue, getExistingProductComponent, getExistingProductComponentGeneration, getFormulaEvaluatorFactory, getIpsTest, getIpsTest, getIpsTestCase, getIpsTestCase, getIpsTestCasesStartingWith, getIpsTestSuite, getIpsTestSuite, getLatestProductComponentGeneration, getModelType, getModelType, getModelType, getName, getNextProductComponentGeneration, getNumberOfProductComponentGenerations, getPreviousProductComponentGeneration, getProductComponent, getProductComponent, getProductComponentGeneration, getProductComponentGenerations, getRuntimeRepositoryLookup, getTable, getTable, isMultiContent, newJAXBContext, newJAXBContext, removeEnumValueLookupService, setFormulaEvaluatorFactory, setRuntimeRepositoryLookup, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.faktorips.runtime.IModifiableRuntimeRepository
putEnumValuesMethods inherited from interface org.faktorips.runtime.IRuntimeRepository
addDirectlyReferencedRepository, addEnumValueLookupService, getAllEnumClasses, getAllIpsTestCases, getAllModelTypeImplementationClasses, getAllProductComponentIds, getAllProductComponents, getAllProductComponents, getAllProductComponents, getAllReferencedRepositories, getAllTableIds, getAllTables, getClassLoader, getCustomRuntimeObject, getDirectlyReferencedRepositories, getEnumValue, getEnumValue, getEnumValueLookupService, getEnumValues, getExistingEnumValue, getExistingProductComponent, getExistingProductComponentGeneration, getFormulaEvaluatorFactory, getIpsTest, getIpsTest, getIpsTestCase, getIpsTestCase, getIpsTestCasesStartingWith, getIpsTestSuite, getIpsTestSuite, getLatestProductComponentGeneration, getModelType, getModelType, getModelType, getName, getNextProductComponentGeneration, getNumberOfProductComponentGenerations, getPreviousProductComponentGeneration, getProductComponent, getProductComponent, getProductComponentGeneration, getProductComponentGenerations, getRuntimeRepositoryLookup, getTable, getTable, newJAXBContext, removeEnumValueLookupService, setRuntimeRepositoryLookup
-
Constructor Details
-
InMemoryRuntimeRepository
public InMemoryRuntimeRepository() -
InMemoryRuntimeRepository
-
-
Method Details
-
getProductComponentInternal
Description copied from class:AbstractRuntimeRepositorySame as getProductComponent(String id) but searches only in this repository and not the ones this repository depends on.- Specified by:
getProductComponentInternalin classAbstractRuntimeRepository
-
getProductComponentInternal
Description copied from class:AbstractRuntimeRepositorySame as getProductComponent(String kindId, String versionId) but searches only in this repository and not the ones this repository depends on.- Specified by:
getProductComponentInternalin classAbstractRuntimeRepository
-
getAllProductComponents
Description copied from class:AbstractRuntimeRepositorySame as getAllProductComponent(String kindId) but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getAllProductComponentsin classAbstractRuntimeRepository
-
getProductComponentGenerations
public void getProductComponentGenerations(IProductComponent productCmpt, List<IProductComponentGeneration> result) Description copied from class:AbstractRuntimeRepositorySame as getProductComponentGenerations() but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getProductComponentGenerationsin classAbstractRuntimeRepository
-
initialize
public void initialize()Nothing to do for the in memory repository. -
getAllTables
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllTables()but searches only in this repository and not the ones this repository depends on. Adds the tables found to the given result list.- Specified by:
getAllTablesin classAbstractRuntimeRepository
-
getAllTableIds
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllTableIds()but searches only in this repository and not the ones this repository depends on. Adds the tables found to the given result list.- Specified by:
getAllTableIdsin classAbstractRuntimeRepository
-
getTableInternal
InMemoryRepository also searches for tables that are instances of subclasses of the given tableClass. This allows to mock a table class for testing purposes.Same as
AbstractRuntimeRepository.getTable(Class)but searches only in this repository and not the ones this repository depends on.- Specified by:
getTableInternalin classAbstractRuntimeRepository
-
putTable
Puts the table into the repository. Replaces any table instance of the same class or any of its superclasses. The latter check is needed to replace tables with mock implementations.- Specified by:
putTablein interfaceIModifiableRuntimeRepository- Returns:
- an
Optionalcontaining the old single content table if a single content table of the same class has been replaced, or an emptyOptionalif a multi-content table has been added. - Throws:
NullPointerException- if table isnull.
-
putTable
Deprecated, for removal: This API element is subject to removal in a future version.since 24.7 for removal. UseIModifiableRuntimeRepository.putTable(ITable)for all kinds of tables and make sure theqNameis set as the table's name.Puts the table with the indicated name into the repository. Replaces any table instance with the same qualified name.- Throws:
NullPointerException- if table or qName isnull.
-
putEnumValues
public <T> void putEnumValues(Class<T> enumTypeClass, List<T> enumValues, org.faktorips.values.InternationalString description) Description copied from interface:IModifiableRuntimeRepositoryPuts the given enum values and description in the repository replacing all existing values for the given enumType.- Specified by:
putEnumValuesin interfaceIModifiableRuntimeRepository- Parameters:
enumTypeClass- the Java class representing the enumeration typeenumValues- the value of the enumeration type as listdescription- the description of the enumeration
-
removeEnumValues
Description copied from interface:IModifiableRuntimeRepositoryremoves the enum values and description of the given enumType from the repository.- Specified by:
removeEnumValuesin interfaceIModifiableRuntimeRepository- Parameters:
enumTypeClass- the Java class representing the enumeration type- Returns:
- whether the given enum type was part of this repository and was successfully removed
-
getEnumDescription
Description copied from interface:IRuntimeRepositoryReturns the description for the given enumeration type.- Specified by:
getEnumDescriptionin interfaceIRuntimeRepository- Type Parameters:
T- The enum type- Parameters:
enumClazz- the enum type's class
-
getTableInternal
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getTable(String)) but searches only in this repository and not the ones this repository depends on.- Specified by:
getTableInternalin classAbstractRuntimeRepository
-
getAllProductComponents
Description copied from class:AbstractRuntimeRepositorySame as getAllProductComponents() but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getAllProductComponentsin classAbstractRuntimeRepository
-
getAllProductComponentIds
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllProductComponentIds()but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getAllProductComponentIdsin classAbstractRuntimeRepository
-
getAllEnumClasses
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllEnumClasses()but searches only in this repository and not the ones this repository depends on. Adds the classes found to the given result set.- Specified by:
getAllEnumClassesin classAbstractRuntimeRepository
-
isModifiable
public boolean isModifiable()Description copied from interface:IRuntimeRepositoryReturnstrueif the repository's content is modifiable. This feature is mainly targeted for writing test cases that need to setup a repository with a test specific content programmatically. Returnsfalseotherwise.- Specified by:
isModifiablein interfaceIRuntimeRepository
-
putProductComponent
Puts the product component into the repository. If the repository already contains a component with the same id, the new component replaces the old one.- Specified by:
putProductComponentin interfaceIModifiableRuntimeRepository- Throws:
IllegalRepositoryModificationException- if this repository does not allows to modifyNullPointerException- if productCmpt isnullits contents.- See Also:
-
removeProductComponent
Description copied from interface:IModifiableRuntimeRepositoryRemoves the product component from the repository.- Specified by:
removeProductComponentin interfaceIModifiableRuntimeRepository- Returns:
- whether the given product component was part of this repository
- See Also:
-
removeTable
Description copied from interface:IModifiableRuntimeRepositoryRemoves the table from the repository.- Specified by:
removeTablein interfaceIModifiableRuntimeRepository- Returns:
- whether the given table component was part of this repository
-
removeProductCmptGeneration
Description copied from interface:IModifiableRuntimeRepositoryRemoves the given product component generation from the list of generations- Specified by:
removeProductCmptGenerationin interfaceIModifiableRuntimeRepository- Parameters:
productCmptGeneration- the product component generation to be removed;- Returns:
trueif the product component generation was successfully removed,falseif the generation was not found in the list of generations.
-
removeIpsTestCase
Description copied from interface:IModifiableRuntimeRepositoryRemoves the specified IPS test case.- Specified by:
removeIpsTestCasein interfaceIModifiableRuntimeRepository- Parameters:
test- the IPS test case to be removed. It must not benull.- Returns:
trueif the test case was successfully removed,falseif no test case with the given test case's qualified name exists.
-
getProductComponentGenerationInternal
protected IProductComponentGeneration getProductComponentGenerationInternal(String productCmptId, Calendar effectiveDate) Description copied from class:AbstractRuntimeRepositorySame as getProductComponentGeneration(String id, Calendar effectiveDate) but searches only in this repository and not the ones this repository depends on.- Specified by:
getProductComponentGenerationInternalin classAbstractRuntimeRepository
-
putProductCmptGeneration
Puts the product component generation and its product component into the repository. If the repository already contains a generation with the same id, the new component replaces the old one. The same applies for the product component.- Specified by:
putProductCmptGenerationin interfaceIModifiableRuntimeRepository- Throws:
IllegalRepositoryModificationException- if this repository does not allows to modify its contents.NullPointerException- if generation isnull- See Also:
-
getAllIpsTestCases
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllIpsTestCases(IRuntimeRepository)but searches only in this repository and not the ones this repository depends on. Adds the components found to the given result list.- Specified by:
getAllIpsTestCasesin classAbstractRuntimeRepository
-
getIpsTestCasesStartingWith
protected void getIpsTestCasesStartingWith(String qNamePrefix, List<IpsTest2> result, IRuntimeRepository runtimeRepository) Description copied from class:AbstractRuntimeRepositoryGets all ips test cases starting with the given qualified name prefix.- Specified by:
getIpsTestCasesStartingWithin classAbstractRuntimeRepository
-
getIpsTestCaseInternal
protected IpsTestCaseBase getIpsTestCaseInternal(String qName, IRuntimeRepository runtimeRepository) Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getIpsTestCase(String, IRuntimeRepository)but searches only in this repository and not the ones this repository depends on. The given runtimeRepository specifies the repository which will be used to instantiate the test case (e.g. the first repository which contains all dependence repositories).- Specified by:
getIpsTestCaseInternalin classAbstractRuntimeRepository
-
putIpsTestCase
Puts the test case into the repository.- Specified by:
putIpsTestCasein interfaceIModifiableRuntimeRepository
-
getAllModelTypeImplementationClasses
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getAllModelTypeImplementationClasses()but searches only in this repository and not the ones this repository depends on. Adds the types found to the given result list.- Specified by:
getAllModelTypeImplementationClassesin classAbstractRuntimeRepository
-
getNextProductComponentGenerationInternal
protected IProductComponentGeneration getNextProductComponentGenerationInternal(IProductComponentGeneration generation) - Specified by:
getNextProductComponentGenerationInternalin classAbstractRuntimeRepository
-
getNumberOfProductComponentGenerationsInternal
- Specified by:
getNumberOfProductComponentGenerationsInternalin classAbstractRuntimeRepository
-
getPreviousProductComponentGenerationInternal
protected IProductComponentGeneration getPreviousProductComponentGenerationInternal(IProductComponentGeneration generation) - Specified by:
getPreviousProductComponentGenerationInternalin classAbstractRuntimeRepository
-
getLatestProductComponentGenerationInternal
protected IProductComponentGeneration getLatestProductComponentGenerationInternal(IProductComponent productCmpt) - Specified by:
getLatestProductComponentGenerationInternalin classAbstractRuntimeRepository
-
getEnumValuesInternal
Description copied from class:AbstractRuntimeRepositoryReturns the list of enumeration values of the enumeration type that is identified by its class which is provided to it.- Specified by:
getEnumValuesInternalin classAbstractRuntimeRepository
-
addEnumXmlAdapter
Adds anIIpsXmlAdapterfor a Faktor-IPS enumeration that defers its content to a enumeration content to this repository. -
getAllInternalEnumXmlAdapters
Description copied from class:AbstractRuntimeRepositoryReturns all enumeration XmlAdapters available in this repository that generated by Faktor-IPS.- Specified by:
getAllInternalEnumXmlAdaptersin classAbstractRuntimeRepository- Parameters:
repository- the runtime repository that needs to be used by the XmlAdapters that are returned by this method
-
putCustomRuntimeObject
public <T extends IRuntimeObject> void putCustomRuntimeObject(Class<T> type, String ipsObjectQualifiedName, T runtimeObject) Puts the runtimeObject into the repository.- Specified by:
putCustomRuntimeObjectin interfaceIModifiableRuntimeRepository
-
getCustomRuntimeObjectInternal
Description copied from class:AbstractRuntimeRepositorySame asAbstractRuntimeRepository.getCustomRuntimeObject(Class, String)but searches only in this repository and not the ones this repository depends on.- Specified by:
getCustomRuntimeObjectInternalin classAbstractRuntimeRepository
-
removeCustomRuntimeObject
Description copied from interface:IModifiableRuntimeRepositoryremoves the runtimeObject from the repository.- Specified by:
removeCustomRuntimeObjectin interfaceIModifiableRuntimeRepository- Parameters:
type- the Java class representing the runtime objectipsObjectQualifiedName- the qualified name of the runtime object- Returns:
- whether the given runtime object was part of this repository
-