<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Jaggery - Delicious Javascript</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le styles -->
    <link href="../css/bootstrap.css" rel="stylesheet">
    <style type="text/css">
        body {
            padding-top: 60px;
        }
    </style>
    <link href="../css/prettify.css" rel="stylesheet">
    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../images/favicon.ico">
    <link rel="apple-touch-icon" href="../images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72"
          href="../images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114"
          href="../images/apple-touch-icon-114x114.png">
</head>

<body>

<%
include('/includes/topnavi.jag');
%>

<div class="container-fluid" style="width: 960px; margin: auto;">
    <div class="row">
        <div class="span16">
            <div class="page-header">
                <h1>
                    Documentation
                    <small>API documentation for Jaggery.js</small>
                </h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="span4">
            <div class="well">
                <%
                include('/includes/navi.jag');
                %>

            </div>

        </div>
        <div class="span12">
            <div class="content" id="email" name="email">
                <h3>Collection</h3>
        <pre class="prettyprint linenums">
&lt%

var dataStore = new MetadataStore("admin", "admin");
var collection = dataStore.newCollection();
dataStore.put("wso2products", collection);
 
//creating resource and adding it to collection 
var resource = dataStore.newResource();
dataStore.put("wso2products/jaggery.xml", resource);

//now we reading from collection
var res = dataStore.get("wso2products");
print(res.getChildren());



%&gt
</pre>
                <%
                var regCode = '&lt%'
                + '\n var dataStore = new MetadataStore("admin", "admin");'
                + '\n var collection = dataStore.newCollection();'
                + '\n dataStore.put("wso2products", collection);'
                + '\n //creating resource and adding it to collection '
                + '\n var resource = dataStore.newResource();'
                + '\n dataStore.put("wso2products/jaggery.xml", resource);'
                + '\n \n //now we reading from collection'
                + '\n var res = dataStore.get("wso2products");'
                + '\n print(res.getChildren());'
                + '\n %&gt';

                var codeSnip = encodeURIComponent(regCode);
                var urlString = '../tryitframe.jag?code='+codeSnip;

                include('/includes/tryit_but.jag');
                %>
<div id="pageLinks">
<a class="navilink" href="#overview">Overview</a>
<a class="navilink" href="#members">Members</a>
<a class="navilink" href="#operations">Operations</a>
</div>
 <section id="overview">


<h4>Overview</h4>
<p class="description">Collection can contain resources</p>

</section>
<section id="members">
    <h4>Members</h4>
                <table class="clsStd member-table">

                    <tbody>

                    <tr>
                        <th>Member</th>
                         <th>Type</th>
                        <th>Description</th>
                    </tr>

                <tr>
                    <td>
                    <code>author</code>
                    </td>
                    <td>String</td>
                    <td>
                    <pre class="prettyprint">collection.author;</pre>
                    Returns the author username on a collection 
					</td>
                </tr>
                <tr>
                    <td>
                    <code>lastUpdatedUser</code>
                    </td>
                    <td>String</td>
                    <td>get author username who did the last update on a collection </td>
                </tr>
                <tr>
                    <td>
                    <code>lastUpdatedTime</code>
                    </td>
                    <td>Date</td>
                    <td>get lastUpdatedTime</td>
                </tr>
                <tr>
                    <td>
                    <code>createdTime</code>
                    </td>
                    <td>Date</td>
                    <td>get createdTime</td>
                </tr>
                <tr>
                    <td>
                    <code>id</code>
                    </td>
                    <td>String</td>
                    <td>get id of the collection.</td>
                </tr>
                <tr>
                    <td>
                    <code>path</code>
                    </td>
                    <td>String</td>
                    <td>get path of the collection</td>
                </tr>
                <tr>
                    <td>
                    <code>parentPath</code>
                    </td>
                    <td>String</td>
                    <td>get parentPath</td>
                </tr>
                <tr>
                    <td>
                    <code>permanentPath</code>
                    </td>
                    <td>String</td>
                    <td>get permanentPath</td>
                </tr>
                <tr>
                    <td>
                    <code>state</code>
                    </td>
                    <td>Number</td>
                    <td>get state</td>
                </tr>
                 <tr>
                    <td>
                    <code>mediaType</code>
                    </td>
                    <td>String</td>
                    <td>get/set mediaType</td>
                </tr>
                 <tr>
                    <td>
                    <code>content</code>
                    </td>
                    <td>Object</td>
                    <td>get/set content</td>
                </tr>
                 <tr>
                    <td>
                    <code>description</code>
                    </td>
                    <td>String</td>
                    <td>get/set description</td>
                </tr>    
  				<tr>
                    <td>
                    <code>getChildren </code>
                    </td>
                    <td>Number</td>
                    <td>get resource count in collection</td>
                </tr>
                     </tbody>
                </table>

    </section>

                <section id="operations">
                    <h4>Operations</h4>

                    <table class="clsStd operations-table">
                        <tbody>
                        <tr>
                            <th>Operation</th>
                            <th>Returns</th>
                            <th>Description</th>
                        </tr>
                        <tr>

                        <td><code>addProperty("name", "value")</code></td>
                        <td>None</td>
                        <td>
<pre class="prettyprint">
var dataStore = new MetadataStore("admin", "admin");
var collection = dataStore.newCollection();
collection.addProperty("company", "WSO2");
</pre>
adding property for collection
                        </td>

                    </tr>
                                            <tr>

                        <td><code>addProperty("name", "value")</code></td>
                        <td>None</td>
                        <td>
<pre class="prettyprint">
collection.res.getChildren();
</pre>
list of childrean in collection.
                        </td>

                    </tr>
                        <tr>

                        <td><code>getProperty(String collectionName);</code></td>
                        <td>String</td>
                        <td>
<pre class="prettyprint">
var value = collection.getProperty("company");
</pre>
                            This method returns value of a collection <br><br>

                            Above code returns last added value for a collection if there is a list of values.
                        </td>

                    </tr>
                     <tr>

                        <td><code>getPropertyValues(String propertyName);</code></td>
                        <td>String []</td>
                        <td>
<pre class="prettyprint">
var value = collection.getPropertyValues("company");
</pre>
                            This method returns list of values of a property in collection
                        </td>

                    </tr>
                    <tr>
                        <td>
                            <code>getProperties();</code>
                        </td>
                        <td>Object[]</td>                        
                        <td><pre class="prettyprint">
var properties = collection.getProperties();
</pre>
                        
                        This method returns the list of properties with 'name' and 'value'. value is list of a vlaue for particular collection<br><br>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <code>editPropertyValue(String propertyName,String propertyValue,String propertyNewValue );</code>
                        </td>
                        <td>None</td>
                        <td><pre class="prettyprint">
                        editPropertyValue("company","WSO2","WSO2 Inc");
                        </pre>
                        This method will edit property value in to new value.
                        </td>
                    </tr>
                                        <tr>
                        <td>
                            <code>removePropertyValue(String propertyName,String propertyValue);</code>
                        </td>
                        <td>None</td>
                        <td>
                        <pre class="prettyprint">
                        removePropertyValue("company","WSO2 Inc");
                        </pre>
                         This method will remove property value in property.
                        </td>
                    </tr>
                       <tr>
                    <td>
                            <code>removeProperty(String propertyName);</code>
                        </td>
                        <td>None</td>
                        <td>
                        <pre class="prettyprint">
                        removeProperty("company");
                        </pre>
                         This method will remove property from the resource.
                        </td>
                    </tr>
                                   <tr>
                    <td>
                            <code>setProperty(String propertyName, String propertyValue/Values);</code>
                        </td>
                        <td>None</td>
                        <td>
                        <pre class="prettyprint">
                        setProperty("company","WSO2");
                        </pre>
                         This method will set property values.
                        </td>
                    </tr>
    
                        </tbody>
                    </table>
                </section>

            </div>
            <br>
            <br>
        </div>

    </div>
    <%
    include('/includes/footer.jag');
    %>

</div>

<!-- /container -->
<%
include('/includes/scripts.jag')
%>
	<script>	
		
		$(document).ready(function(){
        $('#col').toggleClass('active')
		$('#docs').addClass('active')
        })
	</script>
</body>
</html>