Package org.bedework.calfacade.base
Class BwStringBase<T extends BwStringBase>
java.lang.Object
org.bedework.calfacade.base.DumpEntity<T>
org.bedework.calfacade.base.BwUnversionedDbentity<T>
org.bedework.calfacade.base.BwDbentity<T>
org.bedework.calfacade.base.BwStringBase<T>
- All Implemented Interfaces:
Serializable,Comparable<T>,SizedEntity,org.bedework.util.logging.Logged
- Direct Known Subclasses:
BwLongString,BwString
A base class for String values in bedework. This allows for i18n etc.
It also allows for moving all long strings to one or two tables.
RFC 2445 has the following properties with a language param:
ATTENDEE (cn param) CATEGORIES COMMENT CONTACT DESCRIPTION LOCATION ORGANIZER (cn param) REQUEST-STATUS RESOURCES SUMMARY TZNAMEx-properties can also take the language param. .
- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bedework.calfacade.base.DumpEntity
DumpEntity.DumpType -
Constructor Summary
ConstructorsConstructorDescriptionConstructorBwStringBase(String lang, String value) Create a string by specifying all its fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck this is properly trimmedclone()Make visibleintprotected static BwStringBasefindLanguage(String lang, Collection<? extends BwStringBase> c) Search the collection for a string that matches the given language code.getLang()Get the langnet.fortuna.ical4j.model.ParameterIf there is a language attached return as a parameter else return nullintgetSize()Size to use for quotas.getValue()Get the valuebooleanOverride this if we want to optionally suppress the dump based on some attributes.inthashCode()voidSet the langvoidSet the valuetoString()protected voidtoStringSegment(org.bedework.util.misc.ToString ts) Add our stuff to the ToString objectbooleanupdate(BwStringBase from) Figure out what's different and update it.Methods inherited from class org.bedework.calfacade.base.BwDbentity
addDeletedEntity, afterDeletion, beforeDeletion, beforeSave, beforeUpdate, getByteSize, getDeletedEntities, getSeq, length, setByteSize, setSeqMethods inherited from class org.bedework.calfacade.base.BwUnversionedDbentity
equals, getHref, getId, markUnsaved, setHref, setId, unsavedMethods inherited from class org.bedework.calfacade.base.DumpEntity
dump, dump, getLoggerMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, trace, warn
-
Constructor Details
-
BwStringBase
public BwStringBase()Constructor -
BwStringBase
Create a string by specifying all its fields- Parameters:
lang- String language codevalue- String value
-
-
Method Details
-
setLang
Set the lang- Parameters:
val- String lang
-
getLang
Get the lang- Returns:
- String lang
-
setValue
Set the value- Parameters:
val- String value
-
getValue
Get the value- Returns:
- String value
-
hasDumpValue
public boolean hasDumpValue()Description copied from class:DumpEntityOverride this if we want to optionally suppress the dump based on some attributes. This allows us to skip empty objects which occasionally turn up.- Overrides:
hasDumpValuein classDumpEntity<T extends BwStringBase>- Returns:
- boolean true to continue with dump.
-
findLanguage
Search the collection for a string that matches the given language code.A supplied lang of null implies the default language code.
If the supplied language equals any language in the collection we return with that.
Otherwise if if matches the first part of a qualified code we take that, e.g lan="en" could match "en_US"
Otherwise we return the first one we found.
- Parameters:
lang- language codec- collection of strings- Returns:
- BwString or null if no strings.
-
update
Figure out what's different and update it. This should reduce the number of spurious changes to the db.- Parameters:
from- the before value- Returns:
- true if we changed something.
-
getLangPar
public net.fortuna.ical4j.model.Parameter getLangPar()If there is a language attached return as a parameter else return null- Returns:
- Language or null
-
checkNulls
public boolean checkNulls()Check this is properly trimmed- Returns:
- boolean true if changed
-
getSize
public int getSize()Size to use for quotas.- Specified by:
getSizein interfaceSizedEntity- Returns:
- int
-
compareTo
- Specified by:
compareToin interfaceComparable<T extends BwStringBase>- Overrides:
compareToin classBwUnversionedDbentity<T extends BwStringBase>
-
hashCode
public int hashCode()- Overrides:
hashCodein classBwUnversionedDbentity<T extends BwStringBase>
-
toStringSegment
protected void toStringSegment(org.bedework.util.misc.ToString ts) Description copied from class:BwUnversionedDbentityAdd our stuff to the ToString object- Overrides:
toStringSegmentin classBwUnversionedDbentity<T extends BwStringBase>- Parameters:
ts- ToString for result
-
toString
-
clone
Description copied from class:BwUnversionedDbentityMake visible- Overrides:
clonein classBwUnversionedDbentity<T extends BwStringBase>- Returns:
- Object of class T
-