|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.qriterium.dogma.DogmaResource
public class DogmaResource
DogmaResource
is a class which represents resource in Dogma program's context (in
this class's comments "resource" refer to "DogmaResource").
Nested Class Summary | |
---|---|
static class |
DogmaResource.defaultType
|
Field Summary | |
---|---|
static long |
serialVersionUID
|
static java.lang.String |
tagSeparator
|
Constructor Summary | |
---|---|
DogmaResource()
A minimal constructor which initializes empty collections for multi-valued attibutes. |
|
DogmaResource(java.lang.String name,
java.lang.String canoname,
java.lang.String rawName,
java.lang.String resourceClass,
java.lang.String type,
java.util.Date added,
java.util.Date created,
java.util.Date imported,
java.util.Date viewed,
java.util.Date found,
java.util.Date loaded,
java.lang.String source,
int inSourceId,
int value,
int views,
int recency,
int loads,
int rank,
int activity)
Another default constructor for creating the resource from metadata (which is imported by Updater). |
|
DogmaResource(java.lang.String name,
java.lang.String canoname,
java.lang.String rawName,
java.lang.String resourceClass,
java.lang.String type,
java.util.Date added,
java.util.Date created,
java.util.Date imported,
java.util.Date viewed,
java.util.Date found,
java.util.Date loaded,
java.lang.String source,
int inSourceId,
int value,
int views,
int recency,
int loads,
int rank,
int activity,
int toConnections,
int fromConnections,
int totalConnections)
Another default constructor for creating the resource from metadata (which is imported by Updater). |
|
DogmaResource(java.lang.String name,
java.lang.String canoname,
java.lang.String rawName,
java.lang.String resourceClass,
java.lang.String type,
java.util.Date added,
java.util.Date created,
java.util.Date imported,
java.lang.String source,
int inSourceId)
A default constructor for creating the resource from metadata (which is imported by Updater). |
Method Summary | |
---|---|
void |
addConnection(boolean tothis,
iConnection connection)
Adds a new connection to resource's connections. |
void |
addConnection(iConnection connection)
Adds connection from this resource, calls method addConnection(boolean, DogmaConnection) . |
void |
addTag(java.lang.String tag)
Adds a new tag to resource's @see #tags |
void |
addUri(DogmaURI uri)
|
void |
addUri(java.lang.String uri)
Adds a new uri to resource's uris. |
java.lang.String[] |
attributesToString(java.lang.String[] attrNames)
Method returns all attributevalues corresponding to given names as String array, same order as name array. |
java.lang.String[] |
attributesToString(java.lang.String[] attrNames,
java.lang.String[] returnval)
Works same way than getValuesAsString(String[]), but attribute value Strings are put in the array given as parameter. |
java.lang.String |
attributeToString(java.lang.String name)
Returns a String representation of attribute, never returns null ("" instead of it). |
void |
changeUris(int index)
|
boolean |
containsAttribute(java.lang.String name)
|
boolean |
containsTag(java.lang.String tag)
|
static java.lang.String |
dateString(java.util.Date date)
|
int |
fromX(java.lang.String type)
|
int |
getActivity()
|
java.util.Date |
getAdded()
|
static java.lang.String[] |
getAttributeList()
Returns the attribute-names used. |
java.lang.String[] |
getAttributeNames(boolean sorted)
Returns names of attributes, that are set in this resource, as array. |
java.lang.Object |
getAttributeValue(java.lang.String name)
Returns the value of attribute, which name is param-name |
java.util.Date |
getAttributeValueAsDate(java.lang.String name)
|
double |
getAttributeValueAsDouble(java.lang.String name)
|
int |
getAttributeValueAsInt(java.lang.String name)
|
java.lang.String |
getAttributeValueAsString(java.lang.String name)
|
java.lang.String |
getCanoname()
|
java.util.Vector<DogmaConnection> |
getConnections()
|
java.util.Date |
getCreated()
|
java.util.Date |
getFound()
|
int |
getFromAmount()
|
java.util.Date |
getImported()
|
int |
getInSourceId()
|
java.util.Date |
getLoaded()
|
int |
getLoads()
|
java.lang.String |
getName()
|
int |
getRank()
|
java.lang.String |
getRawName()
|
int |
getRecency()
|
java.lang.String |
getResourceClass()
|
java.lang.String |
getSource()
|
java.util.HashSet<java.lang.String> |
getTags()
|
int |
getToAmount()
|
java.lang.String |
getType()
|
java.util.Vector<DogmaURI> |
getUris()
|
int |
getValue()
|
java.util.Date |
getViewed()
|
int |
getViews()
|
boolean |
hasConnection(java.lang.String idString)
Returns true if the connectionvector of the resource already has a connection identical to the given identificationstring. |
boolean |
hasUri(java.lang.String uriString)
Returns true if the uri-vector of the resource already has an uri identical to the given uristring. |
void |
incrementAttribute(java.lang.String name)
Method for incrementing some int-attributes, like loads. |
void |
merge(DogmaResource another)
Merges two resources into one |
static java.util.HashSet<java.lang.String> |
parseTags(java.lang.String tagText)
Parses tags from String, where tags are separated by tagSeparator |
void |
removeConnection(DogmaConnection c)
Removes connection from this resource, calls method removeConnection(DogmaConnection, boolean) . |
void |
removeConnection(DogmaConnection c,
boolean toThis)
Removes connection from this resource, decrements toAmount/fromAmount depending of connection's direction. |
void |
removeConnectionFromBoth(DogmaConnection c)
Removes connection from this resource, and from the resource that is at another side of connection, if connection contains reference to that resource. |
void |
removeTag(java.lang.String tag)
Removes tag from resource's @see #tags, does nothing there isn't such a tag. |
void |
setActivity(int activity)
|
void |
setAdded(java.util.Date added)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets a value to this resource's attribute, only if that attribute-name is in the global mapping in Attribute class |
boolean |
setAttributeAsString(java.lang.String name,
java.lang.String value)
Sets the given attribute value as it's canonical String-conversion |
void |
setCanoname(java.lang.String canoname)
|
void |
setConnections(java.util.Vector<DogmaConnection> connections)
Set resource's connections to be the given set. |
void |
setCreated(java.util.Date created)
|
boolean |
setDateAsString(java.lang.String name,
java.lang.String value)
Sets a new Date value to attribute, if parameter-String is in valid format (otherwise old value will remain). |
void |
setFound(java.util.Date found)
|
void |
setFromAmount(int amount)
|
void |
setImmutableDateAttribute(java.lang.String name,
java.util.Date time)
Sets a Date value to DATE-attribute if previous value is null, otherwise does nothing. |
void |
setImported(java.util.Date imported)
|
void |
setInSourceId(int inSourceId)
|
void |
setLoaded(java.util.Date loaded)
|
void |
setLoads(int loads)
|
void |
setName(java.lang.String name)
|
void |
setRank(int rank)
|
void |
setRawName(java.lang.String rawName)
|
void |
setRecency(int recency)
|
void |
setResourceClass(java.lang.String resourceClass)
|
void |
setSource(java.lang.String source)
|
void |
setTags(java.util.HashSet<java.lang.String> tags)
Adds the given tag-set to the resource's @see #tags |
void |
setToAmount(int amount)
|
void |
setType(java.lang.String type)
|
void |
setUris(java.util.Vector<DogmaURI> uris)
Set the given DogmaURI-set to be resource's Won't change anything is parameter has only invalid elements. |
void |
setValue(int value)
|
void |
setViewed(java.util.Date viewed)
|
void |
setViews(int views)
|
DogmaResource[] |
split(java.util.Vector<DogmaConnection> moveToNew)
Splits this resource in two resources. |
int |
toX(java.lang.String type)
|
void |
updateConnection(DogmaConnection conn)
This method is meant to be used for updating resources existing connections. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String tagSeparator
public static final long serialVersionUID
Constructor Detail |
---|
public DogmaResource()
public DogmaResource(java.lang.String name, java.lang.String canoname, java.lang.String rawName, java.lang.String resourceClass, java.lang.String type, java.util.Date added, java.util.Date created, java.util.Date imported, java.lang.String source, int inSourceId)
name
- value to resource's @see #namecanoname
- value to resource's @see #canonamerawName
- value to resource's @see #rawNameresourceClass
- value to resource's @see #resourceClasstype
- value to resource's @see #typeadded
- value to resource's @see #addedcreated
- value to resource's @see #createdimported
- value to resource's @see #importedsource
- value to resource's @see #sourceinSourceId
- value to resource's @see #inSourceIdpublic DogmaResource(java.lang.String name, java.lang.String canoname, java.lang.String rawName, java.lang.String resourceClass, java.lang.String type, java.util.Date added, java.util.Date created, java.util.Date imported, java.util.Date viewed, java.util.Date found, java.util.Date loaded, java.lang.String source, int inSourceId, int value, int views, int recency, int loads, int rank, int activity)
public DogmaResource(java.lang.String name, java.lang.String canoname, java.lang.String rawName, java.lang.String resourceClass, java.lang.String type, java.util.Date added, java.util.Date created, java.util.Date imported, java.util.Date viewed, java.util.Date found, java.util.Date loaded, java.lang.String source, int inSourceId, int value, int views, int recency, int loads, int rank, int activity, int toConnections, int fromConnections, int totalConnections)
Method Detail |
---|
public java.lang.String attributeToString(java.lang.String name)
public java.lang.String[] attributesToString(java.lang.String[] attrNames)
attrNames
- Attribute names
public java.lang.String[] attributesToString(java.lang.String[] attrNames, java.lang.String[] returnval)
attrNames
- returnval
- Array for return values, must be same length as another parameter attrNames.
public boolean containsAttribute(java.lang.String name)
name
- attribute name
public java.lang.Object getAttributeValue(java.lang.String name)
name
- name of the attribute
public void setAttribute(java.lang.String name, java.lang.Object value)
name
- attribute namevalue
- attribute valuepublic java.lang.String[] getAttributeNames(boolean sorted)
defines
- is return array sorted (alphabetically)
public void addConnection(iConnection connection)
addConnection(boolean, DogmaConnection)
.
connection
- DogmaConnection to be addedpublic void addConnection(boolean tothis, iConnection connection)
addConnection
in interface iResource
tothis
- true
, if connection is directed into this resourceconnection
- a connection to be addedpublic void addUri(java.lang.String uri)
uri
- uri - string to be added.public void addUri(DogmaURI uri)
public void removeConnection(DogmaConnection c)
removeConnection(DogmaConnection, boolean)
.
c
- DogmaConnection to be removedpublic void removeConnection(DogmaConnection c, boolean toThis)
c
- DogmaConnection to be removedtoThis
- true
, if connection is directed into this resourcepublic void removeConnectionFromBoth(DogmaConnection c)
c
- DogmaConnection to be removedpublic void updateConnection(DogmaConnection conn)
conn
- Connection to updatedpublic void changeUris(int index)
changeUris
in interface iResource
public java.util.Vector<DogmaURI> getUris()
public void addTag(java.lang.String tag)
tag
- a tag-String to be addedpublic boolean containsTag(java.lang.String tag)
tag
- String
true
, if resource have this tagpublic void removeTag(java.lang.String tag)
tag
- a tag to be removedpublic void merge(DogmaResource another)
another
- DogmaResource to be merged with this resourcepublic DogmaResource[] split(java.util.Vector<DogmaConnection> moveToNew)
moveToNew
- A set of Current resource's connections to be moved to new resource
public java.util.Vector<DogmaConnection> getConnections()
public void setConnections(java.util.Vector<DogmaConnection> connections)
connections
- The resource's new connectionspublic java.util.HashSet<java.lang.String> getTags()
public void setTags(java.util.HashSet<java.lang.String> tags)
tags
- new set of tags to resource's tagspublic void setUris(java.util.Vector<DogmaURI> uris)
uris
- new DogmaURI seturis
public boolean hasUri(java.lang.String uriString)
uriString
-
public boolean hasConnection(java.lang.String idString)
idString
-
public int getFromAmount()
public void setFromAmount(int amount)
amount
- fromAmount to setpublic int getToAmount()
public void setToAmount(int amount)
amount
- toAmount to setpublic int fromX(java.lang.String type)
public int toX(java.lang.String type)
public boolean setAttributeAsString(java.lang.String name, java.lang.String value)
name
- attribute namevalue
- attribute value as String
public static java.lang.String dateString(java.util.Date date)
date
-
public boolean setDateAsString(java.lang.String name, java.lang.String value)
name
- attribute names
- is assumed to be in format YYYY-MM-DD-hh-mm-ss, or format that is substring of previous
starting from index 0. For example 1982-05-12 is valid, it will be converted to String
19820512000000. 1982-5-12 is not valid form.
public int getAttributeValueAsInt(java.lang.String name)
name
- attribute name
public java.lang.String getAttributeValueAsString(java.lang.String name)
name
- attribute name
public java.util.Date getAttributeValueAsDate(java.lang.String name)
name
- attribute name
public double getAttributeValueAsDouble(java.lang.String name)
name
- attribute name
public int getActivity()
public void setActivity(int activity)
activity
- The activity to set.public java.util.Date getAdded()
public void setAdded(java.util.Date added)
setAdded
in interface iResource
added
- The added to set.public java.lang.String getCanoname()
getCanoname
in interface iResource
public void setCanoname(java.lang.String canoname)
canoname
- The canoname to set.public java.util.Date getCreated()
public void setCreated(java.util.Date created)
setCreated
in interface iResource
created
- The created to set.public java.util.Date getFound()
public void setFound(java.util.Date found)
found
- The found to set.public java.util.Date getImported()
public void setImported(java.util.Date imported)
imported
- The imported to set.public int getInSourceId()
public void setInSourceId(int inSourceId)
inSourceId
- The inSourceId to set.public java.util.Date getLoaded()
public void setLoaded(java.util.Date loaded)
loaded
- The loaded to set.public int getLoads()
public void setLoads(int loads)
loads
- The loads to set.public java.lang.String getName()
public void setName(java.lang.String name)
setName
in interface iResource
name
- The name to set.public int getRank()
public void setRank(int rank)
rank
- The rank to set.public java.lang.String getRawName()
public void setRawName(java.lang.String rawName)
rawName
- The rawName to set.public int getRecency()
public void setRecency(int recency)
recency
- The recency to set.public java.lang.String getResourceClass()
public void setResourceClass(java.lang.String resourceClass)
resourceClass
- The resourceClass to set.public java.lang.String getSource()
public void setSource(java.lang.String source)
setSource
in interface iResource
source
- The source to set.public java.lang.String getType()
getType
in interface iResource
public void setType(java.lang.String type)
type
- The type to set.public int getValue()
public void setValue(int value)
value
- The value to set.public java.util.Date getViewed()
public void setViewed(java.util.Date viewed)
viewed
- The viewed to set.public int getViews()
public void setViews(int views)
views
- The views to set.public static java.lang.String[] getAttributeList()
public static java.util.HashSet<java.lang.String> parseTags(java.lang.String tagText)
tagText
-
public void incrementAttribute(java.lang.String name)
name
- attribute namepublic void setImmutableDateAttribute(java.lang.String name, java.util.Date time)
name
- attribute nametime
- The Date to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |