com.googlecode.fascinator.common
Class Manifest

java.lang.Object
  extended by com.googlecode.fascinator.common.JsonSimple
      extended by com.googlecode.fascinator.common.Manifest

public class Manifest
extends JsonSimple

Represents a JSON manifest as used in other parts of the application. Provides methods to simplify common manipulations of the manifest.

Author:
Greg Pendlebury

Constructor Summary
Manifest(InputStream jsonIn)
          Creates Manifest object from the provided input stream
Manifest(JsonObject newJsonObject)
          Wrap a JsonObject in this class
Manifest(String jsonString)
          Creates Manifest object from the provided string
 
Method Summary
 boolean addTopNode(String id, String title)
          Add a new child node to the top level.
 boolean delete(String id)
           
 String getDescription()
          Get the description for this manifest
 ManifestNode getNode(String key)
          Get the requested node from the manifest.
 String getTitle()
          Get the title for this manifest
 List<ManifestNode> getTopNodes()
          Get the requested node from the manifest.
 String getType()
          Get the type of this manifest
 String getViewId()
          Get the 'viewId' node for this manifest
 boolean move(String id, String destination)
           
 boolean moveAfter(String id, String destination)
           
 boolean moveBefore(String id, String destination)
           
 void setDescription(String description)
          Set the description for this manifest
 void setTitle(String title)
          Set the title for this manifest
 void setType(String type)
          Set the type of this manifest
 void setViewId(String viewId)
          Set the 'viewId' node for this manifest
 int size()
          Return the total number of nodes in this manifest.
 
Methods inherited from class com.googlecode.fascinator.common.JsonSimple
fromJavaMap, getArray, getBoolean, getInteger, getJsonObject, getJsonSimpleList, getJsonSimpleMap, getObject, getPath, getString, getStringList, getStringList, getStringList, search, setPropertySubstitution, toJavaList, toJavaMap, toString, toString, writeArray, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Manifest

public Manifest(JsonObject newJsonObject)
Wrap a JsonObject in this class

Parameters:
newJsonObject - : The JsonObject to wrap

Manifest

public Manifest(InputStream jsonIn)
         throws IOException
Creates Manifest object from the provided input stream

Parameters:
jsonIn - : The input stream to read
Throws:
IOException - if there was an error during creation

Manifest

public Manifest(String jsonString)
         throws IOException
Creates Manifest object from the provided string

Parameters:
jsonString - : The JSON in string form
Throws:
IOException - if there was an error during creation
Method Detail

size

public int size()
Return the total number of nodes in this manifest.

Returns:
int : The number of nodes.

getNode

public ManifestNode getNode(String key)
Get the requested node from the manifest.

Parameters:
id - : The node key to retrieve
Returns:
ManifestNode : The retrieved node, null if not found

addTopNode

public boolean addTopNode(String id,
                          String title)
Add a new child node to the top level.

Parameters:
id - : The ID value to put in this node.
title - : The title value to put in this node.
Returns:
boolean : True if successful, otherwise False

getTopNodes

public List<ManifestNode> getTopNodes()
Get the requested node from the manifest.

Parameters:
id - : The node key to retrieve
Returns:
ManifestNode : The retrieved node, null if not found

move

public boolean move(String id,
                    String destination)

moveAfter

public boolean moveAfter(String id,
                         String destination)

moveBefore

public boolean moveBefore(String id,
                          String destination)

delete

public boolean delete(String id)

getDescription

public String getDescription()
Get the description for this manifest

Returns:
String : The description of this manifest

setDescription

public void setDescription(String description)
Set the description for this manifest

Parameters:
description - : The new description

getTitle

public String getTitle()
Get the title for this manifest

Returns:
String : The title of this manifest

setTitle

public void setTitle(String title)
Set the title for this manifest

Parameters:
title - : The new title

getType

public String getType()
Get the type of this manifest

Returns:
String : The type of this manifest

setType

public void setType(String type)
Set the type of this manifest

Parameters:
type - : The new type

getViewId

public String getViewId()
Get the 'viewId' node for this manifest

Returns:
String : The viewId of this manifest

setViewId

public void setViewId(String viewId)
Set the 'viewId' node for this manifest

Parameters:
viewId - : The new viewId


Copyright © 2009-2012. All Rights Reserved.