Class Feature<T>
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
TypedFeature,UntypedFeature
values belonging to one
product feature. This may be prepresented by a
ClassAttributeAssignment or simply a unique qualifier.
To add new values use the creation methods like this:
Feature<String> f = ...;
FeatureValue<String> newOne = f.createValue( "Blah" );
newOne.setDescription("This is just a test");
// another way
List<FeatureValue> newOnes = f.createValues( "foo", "bar" );
// to fetch all value objects
List<FeatureValue> fValues = f.getValues();
// to fetch just plain values directly (without value object)
List<String> stringValues = f.getValuesDirect();
Please note that any changes made to one instance are not automatically persistet (contrary to normal Item behaviour)
- see FeatureContainer for how to store and load feature
values.
There are some shortcut methods for single-feature management as well:
Product p = // my product
ClassAttributeAssignment asgnmt = // my assigned attribute
// assuming that we've got a number attribute:
TypedFeature<Number> feat = Feature.loadTyped( p, asgnmt );
// delete existing values
feat.clearAll();
// add some new values
feat.createValues( 123.45, 0.815, 555 );
// now store it by using automatically created container
feat.getParent().store();
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDeprecated.Clone constructor.protectedFeature(FeatureContainer parent, boolean localized) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd(SessionContext ctx, int index, FeatureValue<T> featureValue) Deprecated.protected voidassureOwnValue(FeatureValue<T> value) Deprecated.voidclear()Deprecated.Clears all values (for the current session languge if localized).voidclear(SessionContext ctx) Deprecated.Clears all values (for the specified session languge if localized).voidclearAll()Deprecated.Clears all values of this feature regardless of the session language.abstract Featureclone()Deprecated.createValue(int index, T value) Deprecated.Creates a new value for this feature.abstract FeatureValue<T>createValue(SessionContext ctx, int index, T value) Deprecated.Creates a new value for this feature.createValue(SessionContext ctx, T value) Deprecated.Creates a new value for this feature.createValue(T value) Deprecated.Creates a new value for this feature.createValues(SessionContext ctx, Collection<T> values) Deprecated.Creates a list of new values for this feature.createValues(SessionContext ctx, T... values) Deprecated.Creates a list of new values for this feature.createValues(Collection<T> values) Deprecated.Creates a list of new values for this feature.createValues(T... values) Deprecated.Creates a list of new values for this feature.final booleanDeprecated.Deprecated.Deprecated.Convenience method to gather all (different) value desciptions into one string.Deprecated.Convenience method to gather all (different) value desciptions into one string.Deprecated.Provides a date format for displaying date values according to the current locale.getLanguageValues(SessionContext ctx, Language language, boolean create) Deprecated.getName()Deprecated.Returns the name of this feature localized for the current session language.abstract StringgetName(SessionContext ctx) Deprecated.Returns the name of this feature localized for the specified session language.Deprecated.Provides a number format for displaying number values according to the current locale.Deprecated.Returns the containing feature container.protected abstract StringDeprecated.getValue(int index) Deprecated.Returns the value at a given position for the current session language.getValue(SessionContext ctx, int index) Deprecated.Returns the value at a given position for the specified session language.Deprecated.Returns all values for the specified language.getValues(SessionContext ctx) Deprecated.Returns all values for the specified language.Deprecated.Returns directly the content value of eachFeatureValuewithin this feature according to the current session language (if localized).Deprecated.Returns directly the content value of eachFeatureValuewithin this feature according to specified context language (if localized).Deprecated.Creates a string representation of the feature values of this feature.Deprecated.Creates a string representation of the feature values of this feature.final inthashCode()Deprecated.booleanisEmpty()Deprecated.Tells whether or not the feature holds values.booleanisEmpty(SessionContext ctx) Deprecated.Tells whether or not the feature holds values.booleanDeprecated.Tells whether or not the feature holds any value at all, regardless of any localization settings.protected booleanDeprecated.booleanDeprecated.Tells whether or not the feature is able to hold different values per session language.static <X> TypedFeature<X>loadTyped(Product product, ClassAttributeAssignment assignment) Deprecated.Shortcut to manage just a single typed feature.static <X> TypedFeature<X>loadTyped(Product product, ClassificationAttribute attr) Deprecated.Shortcut to manage just a single typed feature.protected FeatureValue<T>loadValue(SessionContext ctx, ProductFeature datbaseItem) Deprecated.voidmoveValue(int index, FeatureValue<T> featureValue) Deprecated.Moves a value to a given position within the current session language.voidmoveValue(SessionContext ctx, int index, FeatureValue<T> featureValue) Deprecated.Moves a value to a given position within the specified session language.remove(int index) Deprecated.Removes the value at a given position from the values of the current session language.remove(SessionContext ctx, int index) Deprecated.Removes the value at a given position from the values of the given session language.booleanremove(SessionContext ctx, FeatureValue<T> featureValue) Deprecated.Removes a given value from the values of the given session language.booleanremoveValue(FeatureValue<T> featureValue) Deprecated.Removes a given value from the values of the current session language.voidsetLocalized(boolean isLocalized) Deprecated.Changes localization statuc of this feature.setValue(SessionContext ctx, T value) Deprecated.Replaces all current feature values by a single newly create one for the given value object.Deprecated.Replaces all current feature values by a single newly create one for the given value object.setValues(SessionContext ctx, List<T> values) Deprecated.Replaces all current feature values by newly create ones for the given list of value objects.setValues(SessionContext ctx, T... values) Deprecated.Replaces all current feature values by newly create ones for the given list of value objects.Deprecated.Replaces all current feature values by newly create ones for the given list of value objects.Deprecated.Replaces all current feature values by newly create ones for the given list of value objects.intsize()Deprecated.Returns the amount of values stored inside this feature (for the current session language if localized).intsize(SessionContext ctx) Deprecated.Returns the amount of values stored inside this feature (for the specified session language if localized).toString()Deprecated.protected Collection<PK>writeToDatabase(int featurePosition) Deprecated.Stores all values of this feature into the database.
-
Constructor Details
-
Feature
Deprecated. -
Feature
Deprecated.Clone constructor.- Throws:
CloneNotSupportedException
-
-
Method Details
-
loadTyped
Deprecated.Shortcut to manage just a single typed feature. This will automatically create aFeatureContainerwhich is limited to this class-attribute assignment only.- Parameters:
product- the product to manage the feature (-values) forassignment- the class-attribute assignment to manage- Returns:
- the new typed feature
-
loadTyped
public static <X> TypedFeature<X> loadTyped(Product product, ClassificationAttribute attr) throws JaloInvalidParameterException Deprecated.Shortcut to manage just a single typed feature. This will automatically create aFeatureContainerwhich is limited to this attribute only.- Parameters:
product- the product to manage the feature (-values) forattr- the attribute to manage- Returns:
- the new typed feature
- Throws:
JaloInvalidParameterException- if the attribute is actually not assigned to any of the product's classes or if the attribute is ambiguous since there are multiple assignments
-
toString
Deprecated. -
getParent
Deprecated.Returns the containing feature container. -
setLocalized
public void setLocalized(boolean isLocalized) Deprecated.Changes localization statuc of this feature.Please note that this will modify the contained values: if the feature is made unlocalized all language dependent values are merged together into one value list. So eetting the feature localized again wont restore the original language-value mappings!
- Parameters:
isLocalized- switches localization on or off
-
isLocalized
public boolean isLocalized()Deprecated.Tells whether or not the feature is able to hold different values per session language.This means all value getter and setter methods ( e.g.
getValues(SessionContext)) work upon different value lists according to the session language specified within the session context or current session language where no context is specified. -
isEmpty
public boolean isEmpty()Deprecated.Tells whether or not the feature holds values.Please note that this method respects the localization status. So for localized features it will only tell if there are no values within the value list belonging to the current session language!
- See Also:
-
isEmpty
Deprecated.Tells whether or not the feature holds values.Please note that this method respects the localization status. So for localized features it will only tell if there are no values within the value list belonging to the specified session language!
- Parameters:
ctx- the session context defining the value list session language- See Also:
-
isEmptyIgnoringLanguage
public boolean isEmptyIgnoringLanguage()Deprecated.Tells whether or not the feature holds any value at all, regardless of any localization settings. So as soon as a localized feature holds at least one value in one language dependent value list this method will returntrue. -
clone
Deprecated.- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
hashCode
public final int hashCode()Deprecated. -
equals
Deprecated. -
createValue
Deprecated.Creates a new value for this feature. The value is appended to the existing values list (for the current session language if the feature is localized).- Parameters:
value- the new value- Returns:
- the value object
-
createValue
Deprecated.Creates a new value for this feature. The value is appended to the existing values list ( for the specified session language if the feature is localized).- Parameters:
value- the new valuectx- the context specifying the session language- Returns:
- the value object
-
createValues
Deprecated.Creates a list of new values for this feature. These values are appended to the existing values list for the current session language (if localized).- Parameters:
values- the new values- Returns:
- the value objects
-
createValues
Deprecated.Creates a list of new values for this feature. These values are appended to the existing values list for the specified session language (if localized).- Parameters:
values- the new valuesctx- the context specifying the session language- Returns:
- the value objects
-
createValues
Deprecated.Creates a list of new values for this feature. These values are appended to the existing values list for the current session language (if localized).- Parameters:
values- the new values- Returns:
- the value objects
-
createValues
Deprecated.Creates a list of new values for this feature. These values are appended to the existing values list for the specified session language (if localized).- Parameters:
values- the new valuesctx- the context specifying the session language- Returns:
- the value objects
-
createValue
Deprecated.Creates a new value for this feature. The value is inserted into the existing values list for the specified session language.- Parameters:
value- the new valueindex- the position to insert the new value at- Returns:
- the value object
-
createValue
Deprecated.Creates a new value for this feature. The value is inserted into the existing values list for the specified session language.- Parameters:
value- the new valuectx- the context specifying the session languageindex- the position to insert the new value at- Returns:
- the value object
-
setValues
Deprecated.Replaces all current feature values by newly create ones for the given list of value objects. For localized features this will replace the values belonging to the current session language.- Parameters:
values- the raw value objects to wrap insideFeatureValueinstances- Returns:
- the new
FeatureValueinstances
-
setValues
Deprecated.Replaces all current feature values by newly create ones for the given list of value objects.- Parameters:
ctx- the session context to specify the session language ( for localized features only)values- the raw value objects to wrap insideFeatureValueinstances- Returns:
- the new
FeatureValueinstances
-
setValues
Deprecated.Replaces all current feature values by newly create ones for the given list of value objects. For localized features this will replace the values belonging to the current session language.- Parameters:
values- the raw value objects to wrap insideFeatureValueinstances- Returns:
- the new
FeatureValueinstances
-
setValues
Deprecated.Replaces all current feature values by newly create ones for the given list of value objects.- Parameters:
ctx- specifies the session language (for localized features only)values- the raw value objects to wrap insideFeatureValueinstances- Returns:
- the new
FeatureValueinstances
-
setValue
Deprecated.Replaces all current feature values by a single newly create one for the given value object. For localized features this will replace all values belonging to the current session language.- Parameters:
value- the raw value object to wrap inside a newFeatureValue- Returns:
- the new
FeatureValueinstance
-
setValue
Deprecated.Replaces all current feature values by a single newly create one for the given value object.- Parameters:
ctx- specifies the session language (for localized features only)value- the raw value object to wrap inside a newFeatureValue- Returns:
- the new
FeatureValueinstance
-
clearAll
public void clearAll()Deprecated.Clears all values of this feature regardless of the session language. -
clear
public void clear()Deprecated.Clears all values (for the current session languge if localized). -
clear
Deprecated.Clears all values (for the specified session languge if localized).- Parameters:
ctx- the session context defining the session language
-
getValue
Deprecated.Returns the value at a given position for the current session language.- Parameters:
index-- Throws:
IndexOutOfBoundsException- if the index exceeds the current value list dimensions
-
getValue
Deprecated.Returns the value at a given position for the specified session language.- Parameters:
index-ctx- the session context defining the language to get values for- Throws:
IndexOutOfBoundsException- if the index exceeds the current value list dimensions
-
isFallbackEnabled
Deprecated. -
moveValue
Deprecated.Moves a value to a given position within the current session language.- Parameters:
index-featureValue- the new value to set- Throws:
IndexOutOfBoundsException- if the index exceeds the current value list dimensions
-
moveValue
public void moveValue(SessionContext ctx, int index, FeatureValue<T> featureValue) throws IndexOutOfBoundsException, JaloInvalidParameterException Deprecated.Moves a value to a given position within the specified session language.- Parameters:
index-ctx- the session context defining the language to set values forfeatureValue- the new value to set- Throws:
IndexOutOfBoundsException- if the index exceeds the current value list dimensionsJaloInvalidParameterException- if the feature value doesnt belong to this feature
-
removeValue
Deprecated.Removes a given value from the values of the current session language.- Parameters:
featureValue- the value to remove- Returns:
- true if the value actually belonged to the value list, false otherwise
-
remove
public boolean remove(SessionContext ctx, FeatureValue<T> featureValue) throws IndexOutOfBoundsException Deprecated.Removes a given value from the values of the given session language.- Parameters:
ctx- the session context defining the language to remove values forfeatureValue- the value to remove- Returns:
- true if the value actually belonged to the value list, false otherwise
- Throws:
IndexOutOfBoundsException
-
remove
Deprecated.Removes the value at a given position from the values of the current session language.- Parameters:
index- the value position- Returns:
- the value stored at this position
- Throws:
IndexOutOfBoundsException- if the index exceeds the current value list dimensions
-
remove
Deprecated.Removes the value at a given position from the values of the given session language.- Parameters:
ctx- the session context defining the language to remove values forindex- the value position- Returns:
- the value stored at this position
- Throws:
IndexOutOfBoundsException- if the index exceeds the current value list dimensions
-
size
public int size()Deprecated.Returns the amount of values stored inside this feature (for the current session language if localized). -
size
Deprecated.Returns the amount of values stored inside this feature (for the specified session language if localized).- Parameters:
ctx- the session context specifiying the session language to count values for
-
getValues
Deprecated.Returns all values for the specified language. -
getValues
Deprecated.Returns all values for the specified language.- Parameters:
ctx- the session context defining the language to change values for- Returns:
- all values stored for this language
-
getValuesDirect
Deprecated.Returns directly the content value of eachFeatureValuewithin this feature according to the current session language (if localized). -
getValuesDirect
Deprecated.Returns directly the content value of eachFeatureValuewithin this feature according to specified context language (if localized).- Parameters:
ctx- the session context defining the language to get values for
-
getAllDescriptions
Deprecated.Convenience method to gather all (different) value desciptions into one string. -
getAllDescriptions
Deprecated.Convenience method to gather all (different) value desciptions into one string.- Parameters:
ctx- the session context defining which langauge should be used for localized values
-
getName
Deprecated.Returns the name of this feature localized for the current session language. -
getName
Deprecated.Returns the name of this feature localized for the specified session language. -
getNumberFormat
Deprecated.Provides a number format for displaying number values according to the current locale. -
getDateFormat
Deprecated.Provides a date format for displaying date values according to the current locale. -
getValuesFormatted
Deprecated.Creates a string representation of the feature values of this feature. If the feature is localized the values belonging to the current session language are displayed. If multiple values exist the're separated by,. -
getValuesFormatted
Deprecated.Creates a string representation of the feature values of this feature. If multiple values exist the're separated by,.- Parameters:
ctx- the session context which defines the language to choose the value for
-
loadValue
Deprecated. -
getLanguageValues
public List<FeatureValue<T>> getLanguageValues(SessionContext ctx, Language language, boolean create) Deprecated. -
extractLanguage
Deprecated. -
writeToDatabase
Deprecated.Stores all values of this feature into the database.- Parameters:
featurePosition- the feature position - specified by the enclosing container- Returns:
- the PKs of all persistent
ProductFeatureitems holding these values
-
getUniqueKey
Deprecated. -
assureOwnValue
Deprecated.- Throws:
JaloInvalidParameterException
-
add
protected void add(SessionContext ctx, int index, FeatureValue<T> featureValue) throws IndexOutOfBoundsException Deprecated.- Throws:
IndexOutOfBoundsException
-
Featureinstead.