aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoDAOJavaFile.cshtml
blob: 46bd6532c89756ae713dfc5a388dc0641e659d4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.twine.tango.dal.dao;

import com.raizlabs.android.dbflow.sql.language.SQLite;
@foreach (var entity in Model.Entities)
{
    <div>import com.twine.tango.dal.entities.@(entity.Name);</div>
}
import java.util.List;

public class TangoDAO
{
@foreach (var entity in Model.Entities)
{
<div>
    /**
    * Gets all the @(entity.TableName) from database.
    *
    * @@return all @(entity.TableName)
    */
    public static List<@(entity.Name)> getAll@(entity.TableName)()
    {
        return SQLite.select().from(@(entity.Name).class).queryList();
    }

</div>
}
}
{ color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
@{
    Tango.CodeGeneration.TangoWebClientv2CodeFile model = Model as Tango.CodeGeneration.TangoWebClientv2CodeFile;
}
using System;
using System.Threading.Tasks;
using Tango.Web;

namespace @(model.Namespace)
{
    /// <summary>
    /// Represents a machine service @(model.ControllerName) web client.
    /// </summary>
    /// <seealso cref="Tango.Web.TangoWebClient" />
    public abstract class @(model.Name) : TangoWebClientV2<@(model.LoginRequest), @(model.LoginResponse)>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
        /// </summary>
        /// <param name="address">The service address.</param>
        /// <param name="token">Existing token.</param>
        public @(model.Name)(String address, String token) : base(address, "@(model.ControllerName)", token)
        {
            
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
        /// </summary>
        /// <param name="address">The service address.</param>
        public @(model.Name)(String address) : this(address, null)
        {

        }

        /// <summary>
        /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
        /// </summary>
        /// <param name="address">The service address.</param>
        /// <param name="controller">The controller name.</param>
        public @(model.Name)(String address, String controller, String token) : base(address, controller, token)
        {

        }

        /// <summary>
        /// Initializes a new instance of the <see cref="@(model.Name)"/> class.
        /// </summary>
        /// <param name="cloned">Other instance.</param>
        public @(model.Name)(@(model.Name) cloned) : base(cloned)
        {

        }

        @foreach (var action in model.Actions)
        {
          <div>
            /// <summary>
            /// Executes the @(action.Name) action and returns @(action.Response).
            /// </summary>
            /// <returns></returns>
            public Task<@(action.Response)> @(action.Name)(@(action.Request) request)
            {
                return Post<@(action.Request), @(action.Response)>("@(action.Name)", request);
            }

          </div>
        }
    }
}