org.mmbase.module.builders
Class DayMarkers

java.lang.Object
  extended byorg.mmbase.module.core.MMTable
      extended byorg.mmbase.module.core.MMObjectBuilder
          extended byorg.mmbase.module.builders.DayMarkers

public class DayMarkers
extends MMObjectBuilder

Daymarkers are used to calculate the age of MMBase objects. Every day a daymarker is added to the daymarks table. Such an entry consists of a daycount (number of days from 1970), and a count (current object number of that day).

Version:
$Id: DayMarkers.java,v 1.31.2.1 2004/06/15 21:04:39 robmaris Exp $
Author:
Daniel Ockeloen,Rico Jansen, Michiel Meeuwissen
Warning: Contains Database Legacy Code

Field Summary
static java.lang.String FIELD_DAYCOUNT
           
 
Fields inherited from class org.mmbase.module.core.MMObjectBuilder
AGE_PARAMETERS, broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, GUI_PARAMETERS, listCache, nodeCache, OBJ2TYPE_MAX_SIZE, oType, REPLACE_CACHE, searchAge, sortedDBLayout, TEMPNODE_DEFAULT_SIZE, TemporaryNodes, virtual
 
Fields inherited from class org.mmbase.module.core.MMTable
mmb, tableName
 
Constructor Summary
DayMarkers()
          set the current day.
 
Method Summary
 int getAge(MMObjectNode node)
          Returns the age, in days, of a node.
 java.util.Date getDate(MMObjectNode node)
          Returns the date of a daymarker
 int getDayCount()
          The current day count.
 int getDayCountAge(int daysold)
          Given an age, this function returns a mark, _not a day count_.
 int getDayCountByObject(int number)
           
 java.lang.String getLocaleGUIIndicator(java.util.Locale locale, MMObjectNode node)
          Returns gui information for a specific node.
 int getMonthsByDayCount(int daycount)
           
 boolean init()
          Calculate smallestMark, and smallestDay.
 void probe()
          This gets called every hour to see if the day has past.
 java.lang.String replace(scanpage sp, java.util.StringTokenizer command)
          Scan.
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, commit, convertMMNode2SQL, count, count, create, createAlias, delete, deleteNodeCache, drop, equals, equals, executeFunction, executeFunction, fieldLocalChanged, getAliasedNode, getAncestors, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getConfigFile, getDBByte, getDBKey, getDBState, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getField, getFieldNames, getFields, getFields, getFunctionParameters, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getList, getLocaleGUIIndicator, getMachineName, getMaintainer, getMMBase, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParameterDefinition, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRawNodes, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hashCode, hostname_function, insert, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, nodeLocalChanged, nodeRemoteChanged, preCommit, preEdit, process, processSearchResults, putTmpNode, readSearchResults, removeField, removeNode, removeRelations, removeSyncNodes, removeTmpNode, safeCache, safeCommit, safeInsert, search, search, search, searchIn, searchIn, searchIn, searchList, searchList, searchNumbers, searchVector, searchVector, searchVector, searchVector, searchVectorIn, searchVectorIn, searchVectorIn, searchVectorIn, searchWithWhere, sendFieldChangeSignal, setDBLayout_xml, setDefaults, setDescription, setDescriptions, setInitParameter, setMaintainer, setMMBase, setParentBuilder, setPluralNames, setSearchAge, setSingularNames, setTableName, setUniqueValue, setUniqueValue, setValue, setValue, setVersion, setXMLPath, setXMLValues, signalNewObject, testValidData, toString, toString, toXML, updateFields, waitUntilNodeChanged, wrap
 
Methods inherited from class org.mmbase.module.core.MMTable
created, getFullTableName, getTableName, size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_DAYCOUNT

public static java.lang.String FIELD_DAYCOUNT
Constructor Detail

DayMarkers

public DayMarkers()
set the current day. This is the number of days from 1970.

Method Detail

init

public boolean init()
Calculate smallestMark, and smallestDay. smallestMark is the smallest object number for which a daymark exists. smallestDay is the first daymarker that was set.

Overrides:
init in class MMObjectBuilder
Returns:
true if init was completed, false if uncompleted.
See Also:
MMObjectBuilder.create()
Warning: Contains Database Legacy Code

probe

public void probe()
This gets called every hour to see if the day has past.


getAge

public int getAge(MMObjectNode node)
Returns the age, in days, of a node. So, this does the inverse of most methods in this class. It converts a node number (which is like a mark) to a day.

Overrides:
getAge in class MMObjectBuilder
Parameters:
node - The node whose age to determine
Returns:
the age in days, or 0 if unknown (daymarks builder not present)
Warning: Contains Database Legacy Code

getDayCount

public int getDayCount()
The current day count.

Returns:
the number of days from 1970 of today.

getDayCountAge

public int getDayCountAge(int daysold)
Given an age, this function returns a mark, _not a day count_.

Parameters:
daysold - a time in days ago.
Returns:
the smallest object number of all objects that are younger than given parameter daysold.

replace

public java.lang.String replace(scanpage sp,
                                java.util.StringTokenizer command)
Scan. Known tokens are: COUNT-X gets an object number of X days after 1970 COUNTAGE-X gets an object number of X days old COUNTMONTH-X gets an object number of X months after 1970 COUNTNEXTMONTH-X gets an object number of X+1 months after 1970 COUNTPREVMONTH-X gets an object number of X-1 months after 1970 COUNTPREVDELTAMONTH-X-Y gets an object number of X-Y months after 1970 COUNTNEXTDELTAMONTH-X-Y gets an object number of X+Y months after 1970 TIMETOOBJECTNUMBER gets an object number of X seconds after 1970

Overrides:
replace in class MMObjectBuilder
Parameters:
sp - The scanpage (containing http and user info) that calls the function
command - a list of strings that describe the (sub)command to execute
Returns:
the result value as a String

getDayCountByObject

public int getDayCountByObject(int number)
Warning: No Java Documentation Available.
Warning: Contains Database Legacy Code

getMonthsByDayCount

public int getMonthsByDayCount(int daycount)
Warning: No Java Documentation Available.

getDate

public java.util.Date getDate(MMObjectNode node)
Returns the date of a daymarker

Parameters:
node - The node of which the date is wanted
Returns:
a Date which is the date

getLocaleGUIIndicator

public java.lang.String getLocaleGUIIndicator(java.util.Locale locale,
                                              MMObjectNode node)
Returns gui information for a specific node. This value is retrieved by retrieving the field 'gui()' of the node (node.getStringValue("gui()") )

Overrides:
getLocaleGUIIndicator in class MMObjectBuilder
Parameters:
node - The node of which the gui information is wanted
Returns:
a String in which the current date is shown


MMBase build 1.7.1.20041002