<!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>Resource</h3>
        <pre class="prettyprint linenums">
&lt%
 var dataStore = new MetadataStore("admin", "admin");
 var resource = dataStore.newResource();
 resource.content = "<a>Hello Jaggery</a>";
 resource.addProperty("url", "http://wso2.com");
 resource.addProperty("company", "WSO2 Inc.");
 dataStore.put("wso2products.xml", resource);
 
 //now we read the resource again
 var res = dataStore.get("wso2products.xml");

print("Company : "+res.getProperty("company"));
print("&ltbr&gtURL : " +res.getProperty("url"));
print("&ltbr&gtContent : "+res.content);
%&gt
</pre>
                <%
                var regCode = '&lt%'
                + '\n var dataStore = new MetadataStore("admin", "admin");'
                + '\n var resource = dataStore.newResource();'
                + '\n resource.content = "&lt;a&gt;Hello Jaggery&lt;/a&gt;";'
                + '\n resource.addProperty("url", "http://wso2.com");'
                + '\n resource.addProperty("company", "WSO2 Inc.");'
                + '\n dataStore.put("wso2products.xml", resource);'
                + '\n '
                + '\n //now we read the resource again'
                + '\n var res = dataStore.get("wso2products.xml");'
                + '\n'
                + '\n print("Company : "+res.getProperty("company"));'
                + '\n print("&ltbr&gtURL : " +res.getProperty("url"));'
                + '\n print("&ltbr&gtContent : "+res.content);'
                + '\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">Store any type of data or metadata as resources including contracts, models, workflows, documents and more</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">resource.author;</pre>
                    Returns the author username on a resource 
					</td>
                </tr>
                <tr>
                    <td>
                    <code>lastUpdatedUser</code>
                    </td>
                    <td>String</td>
                    <td>get author username who did the last update on a resource </td>
                </tr>
                <tr>
                    <td>
                    <code>lastUpdatedTime</code>
                    </td>
                    <td>scriptable</td>
                    <td>get lastUpdatedTime</td>
                </tr>
                <tr>
                    <td>
                    <code>createdTime</code>
                    </td>
                    <td>scriptable</td>
                    <td>get createdTime</td>
                </tr>
                <tr>
                    <td>
                    <code>id</code>
                    </td>
                    <td>String</td>
                    <td>get id of the resource.</td>
                </tr>
                <tr>
                    <td>
                    <code>path</code>
                    </td>
                    <td>String</td>
                    <td>get path of the resource</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>String | Object | XML</td>
                    <td>get/set content</td>
                </tr>
                 <tr>
                    <td>
                    <code>description</code>
                    </td>
                    <td>String</td>
                    <td>get/set description</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 resource = dataStore.newResource();
resource.addProperty("company", "WSO2");
</pre>
adding property for resource
                        </td>

                    </tr>
                        <tr>

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

                            Above code returns last added value for a property 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 = resource.getPropertyValues("company");
</pre>
                            This method returns list of values of a property 
                        </td>

                    </tr>
                    <tr>
                        <td>
                            <code>getProperties();</code>
                        </td>
                        <td>Object[]</td>                        
                        <td><pre class="prettyprint">
var properties = resource.getProperties();
</pre>
                        
                        This method returns the list of properties with 'name' and 'value'. value is list of a vlaue for particular property<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(){
        $('#ress').toggleClass('active')
		$('#docs').addClass('active')
        })
	</script>
</body>
</html>