public class DatabaseTopic extends Topic
Modifier and Type | Class and Description |
---|---|
private class |
DatabaseTopic.EqualAssociationWrapper |
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
baseName |
protected java.util.Hashtable<Topic,java.util.Hashtable<Topic,java.lang.String>> |
data |
protected boolean |
dataFetched |
protected boolean |
full |
protected java.lang.String |
id |
private static int |
idcounter |
protected boolean |
removed |
protected boolean |
sisFetched |
protected java.lang.ref.WeakReference<java.util.Hashtable<Topic,java.util.Hashtable<Topic,java.util.Collection<Association>>>> |
storedAssociations |
protected java.util.HashSet<Locator> |
subjectIdentifiers |
protected Locator |
subjectLocator |
protected DatabaseTopicMap |
topicMap |
protected java.util.HashSet<Topic> |
types |
protected boolean |
typesFetched |
protected java.util.Hashtable<java.util.Set<Topic>,Tuples.T2<java.lang.String,java.lang.String>> |
variants |
protected boolean |
variantsFetched |
Constructor and Description |
---|
DatabaseTopic(DatabaseTopicMap tm)
Creates a new instance of DatabaseTopic
|
DatabaseTopic(java.util.Map<java.lang.String,java.lang.Object> row,
DatabaseTopicMap tm) |
DatabaseTopic(java.lang.Object baseName,
java.lang.Object subjectLocator,
java.lang.Object id,
DatabaseTopicMap tm) |
DatabaseTopic(java.lang.String id,
DatabaseTopicMap tm) |
Modifier and Type | Method and Description |
---|---|
void |
addSubjectIdentifier(Locator l)
Adds a subject identifier for the topic.
|
void |
addType(Topic t)
Adds a topic type.
|
(package private) void |
associationChanged(DatabaseAssociation a,
Topic type,
Topic oldType,
Topic role,
Topic oldRole) |
(package private) void |
create()
Inserts a new topic in the database with the data currently set in this
DatabaseTopic object.
|
protected java.lang.String |
escapeSQL(java.lang.String s) |
(package private) static void |
fetchAllSubjectIdentifiers(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> res,
java.util.Map<java.lang.String,DatabaseTopic> topics,
DatabaseTopicMap topicMap) |
protected java.util.Hashtable<Topic,java.util.Hashtable<Topic,java.util.Collection<Association>>> |
fetchAssociations() |
protected void |
fetchData() |
protected void |
fetchSubjectIdentifiers() |
protected void |
fetchTypes() |
protected void |
fetchVariants() |
java.util.Collection<Association> |
getAssociations()
Gets all associations where this topic is a player.
|
java.util.Collection<Association> |
getAssociations(Topic type)
Gets all associations of specified type where this topic is a player.
|
java.util.Collection<Association> |
getAssociations(Topic type,
Topic role)
Gets associations of the specified type where this topic is in the specified role
|
java.util.Collection<Association> |
getAssociationsWithRole()
Gets associations that have this topic as role.
|
java.util.Collection<Association> |
getAssociationsWithType()
Gets associations that have this topic as type.
|
java.lang.String |
getBaseName()
Gets the topic base name or null if no base name has been set.
|
java.util.Hashtable<Topic,java.lang.String> |
getData(Topic type)
Returns a Hashtable mapping data versions to data content.
|
java.lang.String |
getData(Topic type,
Topic version)
Gets data with the specified type and version.
|
java.util.Collection<Topic> |
getDataTypes()
Gets all used data types.
|
long |
getDependentEditTime() |
long |
getEditTime() |
java.lang.String |
getID()
Gets the topic ID.
|
java.util.Collection<Locator> |
getSubjectIdentifiers()
Gets all subject identifiers of the topic.
|
Locator |
getSubjectLocator()
Gets the topic subject locator or null if it has not been set.
|
TopicMap |
getTopicMap()
Gets the topic map this topic belongs to.
|
java.util.Collection<Topic> |
getTopicsWithDataType()
Gets topics which have data with this topic as type.
|
java.util.Collection<Topic> |
getTopicsWithDataVersion()
Gets topics which have data with this topic as version.
|
java.util.Collection<Topic> |
getTopicsWithVariantScope()
Gets topics which have variants with this topic in scope.
|
java.util.Collection<Topic> |
getTypes()
Gets all topic types.
|
java.lang.String |
getVariant(java.util.Set<Topic> scope)
Gets a variant with the specified scope.
|
java.util.Set<java.util.Set<Topic>> |
getVariantScopes()
Gets the scopes of all variant names.
|
(package private) void |
initialize(java.lang.Object baseName,
java.lang.Object subjectLocator) |
(package private) void |
initialize(java.lang.String baseName,
java.lang.String subjectLocator)
Initializes this DatabaseTopic object setting the basename and subject locator
but does not modify the actual database.
|
protected void |
internalSetBaseName(java.lang.String bn)
Sets the base name in this DatabaseTopic object but does not modify the database.
|
boolean |
isDeleteAllowed()
Returns true if and only if remove() can be called without it throwing TopicInUseException.
|
boolean |
isOfType(Topic t)
Checks if this topic is of the specified type.
|
boolean |
isRemoved()
Returns true if this topic has been removed from the topic map it belonged to.
|
(package private) void |
makeFull()
Fetch all information from database that hasn't already been fetched.
|
protected static java.lang.String |
makeID()
Makes an ID string that can be used as an identifier in the database.
|
void |
mergeIn(Topic t) |
void |
remove()
Removes this topic.
|
void |
removeData(Topic type)
Removes all data with the specified type.
|
void |
removeData(Topic type,
Topic version)
Removes data with specified type and version.
|
(package private) void |
removeDuplicateAssociations() |
void |
removeSubjectIdentifier(Locator l)
Removes a subject identifier.
|
void |
removeType(Topic t)
Removes a topic type.
|
void |
removeVariant(java.util.Set<Topic> scope)
Removes a variant name with the specified scope.
|
void |
setBaseName(java.lang.String name)
Sets the topic base name.
|
void |
setData(Topic type,
java.util.Hashtable<Topic,java.lang.String> versionData)
Sets several data values.
|
void |
setData(Topic type,
Topic version,
java.lang.String value)
Sets data with specified type and version.
|
void |
setDependentEditTime(long time) |
void |
setEditTime(long time) |
protected void |
setSubjectIdentifiers(java.util.HashSet<Locator> sis)
Sets subject identifiers in this DatabaseTopic but does not modify
the underlying database.
|
void |
setSubjectLocator(Locator l)
Sets the topic subject locator overwriting possible previous value.
|
void |
setVariant(java.util.Set<Topic> scope,
java.lang.String name)
Sets the variant with the specified scope.
|
getData, getDisplayName, getDisplayName, getFirstSubjectIdentifier, getName, getOneSubjectIdentifier, getSortName, mergesWithTopic, setDisplayName, toString
protected boolean full
protected boolean sisFetched
protected boolean dataFetched
protected boolean variantsFetched
protected boolean typesFetched
protected DatabaseTopicMap topicMap
protected java.lang.String baseName
protected java.lang.String id
protected Locator subjectLocator
protected java.util.HashSet<Locator> subjectIdentifiers
protected java.util.Hashtable<java.util.Set<Topic>,Tuples.T2<java.lang.String,java.lang.String>> variants
protected java.util.HashSet<Topic> types
protected java.lang.ref.WeakReference<java.util.Hashtable<Topic,java.util.Hashtable<Topic,java.util.Collection<Association>>>> storedAssociations
protected boolean removed
private static int idcounter
public DatabaseTopic(DatabaseTopicMap tm)
public DatabaseTopic(java.lang.String id, DatabaseTopicMap tm)
public DatabaseTopic(java.util.Map<java.lang.String,java.lang.Object> row, DatabaseTopicMap tm) throws TopicMapException
TopicMapException
public DatabaseTopic(java.lang.Object baseName, java.lang.Object subjectLocator, java.lang.Object id, DatabaseTopicMap tm) throws TopicMapException
TopicMapException
void initialize(java.lang.Object baseName, java.lang.Object subjectLocator) throws TopicMapException
TopicMapException
void initialize(java.lang.String baseName, java.lang.String subjectLocator) throws TopicMapException
TopicMapException
protected void internalSetBaseName(java.lang.String bn) throws TopicMapException
TopicMapException
protected static java.lang.String makeID()
void create() throws TopicMapException
TopicMapException
protected java.lang.String escapeSQL(java.lang.String s)
protected void setSubjectIdentifiers(java.util.HashSet<Locator> sis)
protected void fetchSubjectIdentifiers() throws TopicMapException
TopicMapException
protected void fetchData() throws TopicMapException
TopicMapException
protected void fetchVariants() throws TopicMapException
TopicMapException
protected void fetchTypes() throws TopicMapException
TopicMapException
static void fetchAllSubjectIdentifiers(java.util.Collection<java.util.Map<java.lang.String,java.lang.Object>> res, java.util.Map<java.lang.String,DatabaseTopic> topics, DatabaseTopicMap topicMap) throws TopicMapException
TopicMapException
protected java.util.Hashtable<Topic,java.util.Hashtable<Topic,java.util.Collection<Association>>> fetchAssociations() throws TopicMapException
TopicMapException
void makeFull() throws TopicMapException
TopicMapException
public java.lang.String getID()
Topic
public java.util.Collection<Locator> getSubjectIdentifiers() throws TopicMapException
Topic
getSubjectIdentifiers
in class Topic
TopicMapException
public void addSubjectIdentifier(Locator l) throws TopicMapException
Topic
addSubjectIdentifier
in class Topic
TopicMapException
public void mergeIn(Topic t) throws TopicMapException
TopicMapException
public void removeSubjectIdentifier(Locator l) throws TopicMapException
Topic
removeSubjectIdentifier
in class Topic
TopicMapException
public java.lang.String getBaseName()
Topic
getBaseName
in class Topic
public void setBaseName(java.lang.String name) throws TopicMapException
Topic
setBaseName
in class Topic
TopicMapException
public java.util.Collection<Topic> getTypes() throws TopicMapException
Topic
getTypes
in class Topic
TopicMapException
public void addType(Topic t) throws TopicMapException
Topic
addType
in class Topic
TopicMapException
public void removeType(Topic t) throws TopicMapException
Topic
removeType
in class Topic
TopicMapException
public boolean isOfType(Topic t) throws TopicMapException
Topic
isOfType
in class Topic
TopicMapException
public java.lang.String getVariant(java.util.Set<Topic> scope) throws TopicMapException
Topic
getVariant
in class Topic
TopicMapException
public void setVariant(java.util.Set<Topic> scope, java.lang.String name) throws TopicMapException
Topic
setVariant
in class Topic
TopicMapException
public java.util.Set<java.util.Set<Topic>> getVariantScopes() throws TopicMapException
Topic
getVariantScopes
in class Topic
TopicMapException
public void removeVariant(java.util.Set<Topic> scope) throws TopicMapException
Topic
removeVariant
in class Topic
TopicMapException
public java.lang.String getData(Topic type, Topic version) throws TopicMapException
Topic
getData
in class Topic
TopicMapException
public java.util.Hashtable<Topic,java.lang.String> getData(Topic type) throws TopicMapException
Topic
getData
in class Topic
TopicMapException
public java.util.Collection<Topic> getDataTypes() throws TopicMapException
Topic
getDataTypes
in class Topic
TopicMapException
public void setData(Topic type, java.util.Hashtable<Topic,java.lang.String> versionData) throws TopicMapException
Topic
setData
in class Topic
TopicMapException
public void setData(Topic type, Topic version, java.lang.String value) throws TopicMapException
Topic
setData
in class Topic
TopicMapException
public void removeData(Topic type, Topic version) throws TopicMapException
Topic
removeData
in class Topic
TopicMapException
public void removeData(Topic type) throws TopicMapException
Topic
removeData
in class Topic
TopicMapException
public Locator getSubjectLocator()
Topic
getSubjectLocator
in class Topic
public void setSubjectLocator(Locator l) throws TopicMapException
Topic
setSubjectLocator
in class Topic
TopicMapException
public TopicMap getTopicMap()
Topic
getTopicMap
in class Topic
public java.util.Collection<Association> getAssociations() throws TopicMapException
Topic
getAssociations
in class Topic
TopicMapException
public java.util.Collection<Association> getAssociations(Topic type) throws TopicMapException
Topic
getAssociations
in class Topic
TopicMapException
public java.util.Collection<Association> getAssociations(Topic type, Topic role) throws TopicMapException
Topic
getAssociations
in class Topic
TopicMapException
public void remove() throws TopicMapException
Topic
remove
in class Topic
TopicMapException
public long getEditTime()
getEditTime
in class Topic
public void setEditTime(long time)
setEditTime
in class Topic
public long getDependentEditTime()
getDependentEditTime
in class Topic
public void setDependentEditTime(long time)
setDependentEditTime
in class Topic
public boolean isRemoved()
Topic
public boolean isDeleteAllowed() throws TopicMapException
Topic
isDeleteAllowed
in class Topic
TopicMapException
public java.util.Collection<Topic> getTopicsWithDataType() throws TopicMapException
Topic
getTopicsWithDataType
in class Topic
TopicMapException
public java.util.Collection<Association> getAssociationsWithType() throws TopicMapException
Topic
getAssociationsWithType
in class Topic
TopicMapException
public java.util.Collection<Association> getAssociationsWithRole() throws TopicMapException
Topic
getAssociationsWithRole
in class Topic
TopicMapException
public java.util.Collection<Topic> getTopicsWithDataVersion() throws TopicMapException
Topic
getTopicsWithDataVersion
in class Topic
TopicMapException
public java.util.Collection<Topic> getTopicsWithVariantScope() throws TopicMapException
Topic
getTopicsWithVariantScope
in class Topic
TopicMapException
void associationChanged(DatabaseAssociation a, Topic type, Topic oldType, Topic role, Topic oldRole)
void removeDuplicateAssociations() throws TopicMapException
TopicMapException
Copyright 2004-2015 Wandora Team