Class MenuUtils
java.lang.Object
net.ontopia.topicmaps.nav2.portlets.pojos.MenuUtils
INTERNAL: Helper methods for Menu.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Menu.HeadingcreateHeading(TopicIF topic, String title) Create new Heading as child of the given parentstatic Menu.ItemcreateItem(TopicIF topic, String title) Create new Item as child of the given parentstatic ObjectgetFirstValue(TopicIF topic, ParsedQueryIF pq) Runs the given query with the given topic as parameter %topic% and returns the first value (of the first collumn) in the result collection.static booleangetResultTrue(TopicIF topic, String query) Test if the given query returns any result rows.static ListgetResultValues(TopicIF topic, ParsedQueryIF parsedQuery) Get the values of a given query with a given %topic% parameter as a Liststatic voidMove the given child one step up or down the list of children on the parentprotected static ParsedQueryIFoptimisticParse(String query, TopicMapIF tm) Parse the given query for the given topic map.protected static DeclarationContextIFoptimisticParse(TopicMapIF tm, String query) Parse the given declaration-context-query for the given topic map.static voidsetUniqueAssociation(TopicIF player1, String rType1Id, String aTypeId, String rType2Id, TopicIF player2) Set the binary association with given role types, association types and players, removing any existing associations with the same role types and association type on player1.static voidsetUniqueOccurrence(TopicIF topic, String typeId, String value) Set the occurrence of a given type on a given topic, removing any existing occurrences of the same type on that topic.static voidsetUniqueTopicName(TopicIF topic, String baseName) Set the basename of a given topic, removing any old basenames.
-
Field Details
-
UP
public static final boolean UP- See Also:
-
DOWN
public static final boolean DOWN- See Also:
-
-
Constructor Details
-
MenuUtils
public MenuUtils()
-
-
Method Details
-
getFirstValue
Runs the given query with the given topic as parameter %topic% and returns the first value (of the first collumn) in the result collection.- Parameters:
topic- The parameter refered to as %topic% in the query.pq- The query that genereates the result.- Returns:
- The first value returned by the query.
-
getResultValues
Get the values of a given query with a given %topic% parameter as a List- Parameters:
topic- The topic parameter represened by %topic% in the query.parsedQuery- The query.- Returns:
- the first result column values of the query, as a List.
-
getResultTrue
Test if the given query returns any result rows.- Parameters:
topic- The %topic% parameter in the query.query- The query.- Returns:
- true if query returns one or more result rows. Otherwise, false.
-
createHeading
Create new Heading as child of the given parent- Parameters:
topic- Represents the parent.title- The title of the Heading.- Returns:
- The Heading that was created.
-
createItem
Create new Item as child of the given parent- Parameters:
topic- Represents the parent.title- The title of the Item.- Returns:
- The Item that was created.
-
moveOne
Move the given child one step up or down the list of children on the parent- Parameters:
topic- Represents the chils.up- use UP or DOWN to move up or down the list, respectively.
-
setUniqueTopicName
Set the basename of a given topic, removing any old basenames.- Parameters:
topic- The topic.baseName- The new basename.
-
setUniqueOccurrence
Set the occurrence of a given type on a given topic, removing any existing occurrences of the same type on that topic.- Parameters:
topic- The topic that should have the occurrence.typeId- The type, as refered to in the query (e.g. "menu:link")value- The value of the occurrence.
-
setUniqueAssociation
public static void setUniqueAssociation(TopicIF player1, String rType1Id, String aTypeId, String rType2Id, TopicIF player2) Set the binary association with given role types, association types and players, removing any existing associations with the same role types and association type on player1.- Parameters:
player1- The first player, for which old associations are removed.rType1Id- The first role type, as a string (e.g. "menu:item")aTypeId- The association type, as a string (e.g. "menu:item-topic")rType2Id- The second role type, as a string (e.g. "menu:topic")player2- The second player.
-
optimisticParse
Parse the given query for the given topic map. InvalidQueryExceptions thrown during the parse process are caught and re-thrown with an additional message as OntopiaRuntimeExceptions. This avoids external try {} catch() {} blocks around this method.- Parameters:
query- The query to parse.tm- The topicmap used by the query.- Returns:
- A ParsedQueryIF representing the parsed query.
-
optimisticParse
Parse the given declaration-context-query for the given topic map. InvalidQueryExceptions thrown during the parse process are caught and re-thrown with an additional message as OntopiaRuntimeExceptions. This avoids external try {} catch() {} blocks around this method.- Parameters:
tm- The topicmap used by the query.query- The query to parse.- Returns:
- A DeclarationContextIF representing the parsed query.
-