text:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginEnd="@dimen/card_margin"
            android:layout_marginLeft="@dimen/card_margin"
            android:layout_marginRight="@dimen/card_margin"
            android:layout_marginStart="@dimen/card_margin"
            android:background="@color/colorPrimary">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="@dimen/title_padding"
                android:text="@string/bmp180"
                android:textAlignment="center"
                android:textAllCaps="true"
                android:textColor="@color/white"
                android:textSize="@dimen/title_font_size"
                android:textStyle="bold" />
        </LinearLayout>

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="180dp"
            android:layout_marginEnd="@dimen/card_margin"
            android:layout_marginLeft="@dimen/card_margin"
            android:layout_marginRight="@dimen/card_margin"
            android:layout_marginStart="@dimen/card_margin"
            android:layout_marginTop="20dp">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:background="@color/colorPrimary"
                android:padding="@dimen/title_padding"
                android:text="@string/raw_data"
                android:textColor="@color/white"
                android:textSize="@dimen/sensor_title_font"
                android:textStyle="bold" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="60dp"
                android:orientation="horizontal">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20dp"
                    android:layout_marginStart="20dp"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="30dp"
                        android:gravity="center_vertical"
                        android:text="@string/temperature"
                        android:textColor="@color/black"
                        android:textSize="@dimen/sensor_body_font"
                        android:textStyle="bold" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="30dp"
                        android:gravity="center_vertical"
                        android:text="@string/altitude"
                        android:textColor="@color/black"
                        android:textSize="@dimen/sensor_body_font"
                        android:textStyle="bold" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="30dp"
                        android:gravity="center_vertical"
                        android:text="@string/pressure"
                        android:textColor="@color/black"
                        android:textSize="@dimen/sensor_body_font"
                        android:textStyle="bold" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="30dp"
                    android:layout_marginStart="30dp"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/tv_sensor_bmp180_temp"
                        android:layout_width="80dp"
                        android:layout_height="30dp"
                        android:background="@drawable/tv_border"
                        android:gravity="center_vertical"
                        android:textAlignment="center"
                        android:textColor="@color/black"
                        android:textSize="@dimen/sensor_body_font"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/tv_sensor_bmp180_altitude"
                        android:layout_width="80dp"
                        android:layout_height="30dp"
                        android:background="@drawable/tv_border"
                        android:gravity="center_vertical"
                        android:textAlignment="center"
                        android:textColor="@color/black"
                        android:textSize="@dimen/sensor_body_font"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/tv_sensor_bmp180_pressure"
                        android:layout_width="80dp"
                        android:layout_height="30dp"
                        android:background="@drawable/tv_border"
                        android:gravity="center_vertical"
                        android:textAlignment="center"
                        android:textColor="@color/black"
                        android:textSize="@dimen/sensor_body_font"
                        android:textStyle="bold" />
                </LinearLayout>

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="90dp"
                    android:src="@drawable/bmp180" />
            </LinearLayout>
        </android.support.v7.widget.CardView>

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginEnd="@dimen/card_margin"
            android:layout_marginLeft="@dimen/card_margin"
            android:layout_marginRight="@dimen/card_margin"
            android:layout_marginStart="@dimen/card_margin"
            android:layout_marginTop="20dp">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:background="@color/colorPrimary"
                android:padding="@dimen/title_padding"
                android:text="@string/plot_temperature"
                android:textColor="@color/white"
                android:textSize="@dimen/sensor_title_font"
                android:textStyle="bold" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="160dp"
                android:layout_marginTop="40dp">

                <RelativeLayout
                    android:id="@+id/chart_xaxis_layout_temp_bmp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:background="#000"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/tv_graph_label_xaxis_temp_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_centerHorizontal="true"
                        android:layout_gravity="center_vertical|center_horizontal|center"
                        android:foregroundGravity="center_vertical"
                        android:gravity="center_vertical|center_horizontal|center"
                        android:text="@string/time"
                        android:textColor="#ffff"
                        android:textSize="9sp"
                        android:textStyle="normal|bold"
                        tools:layout_editor_absoluteX="288dp"
                        tools:layout_editor_absoluteY="0dp" />

                    <TextView
                        android:id="@+id/tv_unit_xaxis_temp_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_toEndOf="@+id/tv_graph_label_xaxis_temp_bmp"
                        android:layout_toRightOf="@+id/tv_graph_label_xaxis_temp_bmp"
                        android:text="@string/seconds"
                        android:textColor="#ffff"
                        android:textSize="9sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintLeft_toRightOf="@+id/tv_graph_label_xaxis_temp_bmp"
                        tools:layout_editor_absoluteY="0dp" />
                </RelativeLayout>

                <android.support.constraint.ConstraintLayout
                    android:id="@+id/chart_yaxis_layout_temp_bmp"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:background="#000"
                    android:foregroundGravity="center_vertical"
                    android:gravity="center_vertical"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/tv_label_left_yaxis_temp_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="10dp"
                        android:layout_gravity="center"
                        android:foregroundGravity="center_horizontal"
                        android:gravity="top|center_horizontal"
                        android:includeFontPadding="false"
                        android:rotation="-90"
                        android:text="@string/temp2"
                        android:textColor="#ffff"
                        android:textSize="8sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/tv_unit_left_yaxis_temp_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_above="@+id/tv_label_left_yaxis_temp_bmp"
                        android:layout_marginBottom="12dp"
                        android:rotation="-90"
                        android:text="@string/celcius"
                        android:textColor="#fff"
                        android:textSize="8sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintBottom_toTopOf="@+id/tv_label_left_yaxis_temp_bmp"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent" />

                </android.support.constraint.ConstraintLayout>

                <com.github.mikephil.charting.charts.LineChart
                    android:id="@+id/chart_temp_bmp180"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#000"
                    android:layout_below="@+id/chart_xaxis_layout_temp_bmp"
                    android:layout_toEndOf="@+id/chart_yaxis_layout_temp_bmp"
                    android:layout_toRightOf="@+id/chart_yaxis_layout_temp_bmp"/>
            </RelativeLayout>
        </android.support.v7.widget.CardView>

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginEnd="@dimen/card_margin"
            android:layout_marginLeft="@dimen/card_margin"
            android:layout_marginRight="@dimen/card_margin"
            android:layout_marginStart="@dimen/card_margin"
            android:layout_marginTop="20dp">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:background="@color/colorPrimary"
                android:padding="@dimen/title_padding"
                android:text="@string/plot_altitude"
                android:textColor="@color/white"
                android:textSize="@dimen/title_font_size"
                android:textStyle="bold" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="160dp"
                android:layout_marginTop="40dp">

                <RelativeLayout
                    android:id="@+id/chart_xaxis_layout_alt_bmp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:background="#000"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/tv_graph_label_xaxis_alt_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_centerHorizontal="true"
                        android:layout_gravity="center_vertical|center_horizontal|center"
                        android:foregroundGravity="center_vertical"
                        android:gravity="center_vertical|center_horizontal|center"
                        android:text="@string/time"
                        android:textColor="#ffff"
                        android:textSize="9sp"
                        android:textStyle="normal|bold"
                        tools:layout_editor_absoluteX="288dp"
                        tools:layout_editor_absoluteY="0dp" />

                    <TextView
                        android:id="@+id/tv_unit_xaxis_alt_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_toEndOf="@+id/tv_graph_label_xaxis_alt_bmp"
                        android:layout_toRightOf="@+id/tv_graph_label_xaxis_alt_bmp"
                        android:text="@string/seconds"
                        android:textColor="#ffff"
                        android:textSize="9sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintLeft_toRightOf="@+id/tv_graph_label_xaxis_alt_bmp"
                        tools:layout_editor_absoluteY="0dp" />
                </RelativeLayout>

                <android.support.constraint.ConstraintLayout
                    android:id="@+id/chart_yaxis_layout_alt_bmp"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:background="#000"
                    android:foregroundGravity="center_vertical"
                    android:gravity="center_vertical"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/tv_label_left_yaxis_alt_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="10dp"
                        android:layout_gravity="center"
                        android:foregroundGravity="center_horizontal"
                        android:gravity="top|center_horizontal"
                        android:includeFontPadding="false"
                        android:rotation="-90"
                        android:text="@string/alt"
                        android:textColor="#ffff"
                        android:textSize="8sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/tv_unit_left_yaxis_alt_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_above="@+id/tv_label_left_yaxis_alt_bmp"
                        android:layout_marginBottom="8dp"
                        android:rotation="-90"
                        android:text="@string/meter"
                        android:textColor="#fff"
                        android:textSize="8sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintBottom_toTopOf="@+id/tv_label_left_yaxis_alt_bmp"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent" />

                </android.support.constraint.ConstraintLayout>

                <com.github.mikephil.charting.charts.LineChart
                    android:id="@+id/chart_alt_bmp180"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#000"
                    android:layout_below="@+id/chart_xaxis_layout_alt_bmp"
                    android:layout_toEndOf="@+id/chart_yaxis_layout_alt_bmp"
                    android:layout_toRightOf="@+id/chart_yaxis_layout_alt_bmp"/>
            </RelativeLayout>
        </android.support.v7.widget.CardView>

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_marginEnd="@dimen/card_margin"
            android:layout_marginLeft="@dimen/card_margin"
            android:layout_marginRight="@dimen/card_margin"
            android:layout_marginStart="@dimen/card_margin"
            android:layout_marginTop="20dp">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:background="@color/colorPrimary"
                android:padding="@dimen/title_padding"
                android:text="Plot - Pressure"
                android:textColor="@color/white"
                android:textSize="@dimen/title_font_size"
                android:textStyle="bold" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="160dp"
                android:layout_marginTop="40dp">

                <RelativeLayout
                    android:id="@+id/chart_xaxis_layout_pre_bmp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:background="#000"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/tv_graph_label_xaxis_pre_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_centerHorizontal="true"
                        android:layout_gravity="center_vertical|center_horizontal|center"
                        android:foregroundGravity="center_vertical"
                        android:gravity="center_vertical|center_horizontal|center"
                        android:text="@string/time"
                        android:textColor="#ffff"
                        android:textSize="9sp"
                        android:textStyle="normal|bold"
                        tools:layout_editor_absoluteX="288dp"
                        tools:layout_editor_absoluteY="0dp" />

                    <TextView
                        android:id="@+id/tv_unit_xaxis_pre_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_toEndOf="@+id/tv_graph_label_xaxis_pre_bmp"
                        android:layout_toRightOf="@+id/tv_graph_label_xaxis_pre_bmp"
                        android:text="@string/seconds"
                        android:textColor="#ffff"
                        android:textSize="9sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintLeft_toRightOf="@+id/tv_graph_label_xaxis_pre_bmp"
                        tools:layout_editor_absoluteY="0dp" />
                </RelativeLayout>

                <android.support.constraint.ConstraintLayout
                    android:id="@+id/chart_yaxis_layout_pre_bmp"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:background="#000"
                    android:foregroundGravity="center_vertical"
                    android:gravity="center_vertical"
                    android:orientation="vertical">

                    <TextView
                        android:id="@+id/tv_label_left_yaxis_pre_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="10dp"
                        android:layout_gravity="center"
                        android:foregroundGravity="center_horizontal"
                        android:gravity="top|center_horizontal"
                        android:includeFontPadding="false"
                        android:rotation="-90"
                        android:text="@string/pressure2"
                        android:textColor="#ffff"
                        android:textSize="8sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/tv_unit_left_yaxis_pre_bmp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_above="@+id/tv_label_left_yaxis_pre_bmp"
                        android:layout_marginBottom="12dp"
                        android:rotation="-90"
                        android:text="@string/pascal"
                        android:textColor="#fff"
                        android:textSize="8sp"
                        android:textStyle="normal|bold"
                        app:layout_constraintBottom_toTopOf="@+id/tv_label_left_yaxis_pre_bmp"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent" />

                </android.support.constraint.ConstraintLayout>

                <com.github.mikephil.charting.charts.LineChart
                    android:id="@+id/chart_pre_bmp180"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="#000"
                    android:layout_below="@+id/chart_xaxis_layout_pre_bmp"
                    android:layout_toEndOf="@+id/chart_yaxis_layout_pre_bmp"
                    android:layout_toRightOf="@+id/chart_yaxis_layout_pre_bmp"/>
            </RelativeLayout>
        </android.support.v7.widget.CardView>
    </LinearLayout>
</ScrollView>


text:
package adty.spark.tyv2.template

import java.sql.{Connection, PreparedStatement, SQLException, Timestamp}
import java.text.SimpleDateFormat
import java.util.Date

import aiouniya.spark.util.JdbcUtil
import org.apache.commons.dbutils.DbUtils
import org.apache.commons.lang.ObjectUtils
import org.apache.spark.SparkContext
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{Row, SQLContext}

import scala.collection.immutable

/**
  * Created by zstorm on 2017/5/25.
  */
object TemplateMysql {

  def deal(sc: SparkContext, outputPath: String) = {
    val sqlContext = new SQLContext(sc)
    //iflytek	com.kandian.vodapp	480X320	30	-1:30	813097

    //所有新数据
    //val rdd1 = sc.textFile("/drp/tyv2/data/template/20170524/")
    val rdd1 = sqlContext.sparkContext.textFile(outputPath)

    //去重的sizeList,titleLenList,descList
    val set1 = rdd1.collect().map(x => {
      val y = x.split("\t", -2)
      (y(2), y(3), y(4))
    }).toSet
    //数据库DYNA_NativeTemplate旧数据
    val rdd2 = JdbcUtil.getDmpDF(sqlContext, "DYNA_NativeTemplate").select(
      "id", "sizeList", "titleLenList", "descList").rdd.map { case Row(id, sizeList, titleLenList, descList) => (
      id.toString.toLong, (sizeList.toString, titleLenList.toString, descList.toString))
    }
    //数据库DYNA_NativeTemplate旧数据
    val set2 = rdd2.map(_._2).collect().toSet
    //保存DYNA_NativeTemplate的增量数据
    saveTemplate(set1 -- set2)
    //保存DYNA_NativeTemplateSspBundle的增量数据
    val seq = getReadySspBundle(rdd1, sqlContext)
    saveTemplateSspBundle(seq)

  }

  //将要入库的数据
  def getReadySspBundle(rdd1: RDD[String], sqlContext: SQLContext): Seq[(String, String, Long, Long, String)] = {
    val map2 = getNotExistSspBundle(rdd1, sqlContext)
    val rdd2 = sqlContext.sparkContext.parallelize(map2.toSeq).map {
      case ((ssp, bundle, sizeList, titleLenList, descList), pv) => (
        (sizeList, titleLenList, descList), (ssp, bundle, pv))
    }
    val rdd3 = JdbcUtil.getDmpDF(sqlContext, "DYNA_NativeTemplate").select(
      "id", "name", "sizeList", "titleLenList", "descList").rdd.map { case Row(id, name, sizeList, titleLenList, descList) => (
      (sizeList.toString, titleLenList.toString, descList.toString), (id.toString.toLong, ObjectUtils.toString(name)))
    }
    //ssp,bundle,pv,template_id,template_label,datein
    rdd2.join(rdd3).map(x => (x._2._1._1, x._2._1._2, x._2._1._3, x._2._2._1, x._2._2._2)).collect().toSeq
  }

  //数据库中不存在的数据
  def getNotExistSspBundle(rdd: RDD[String], sqlContext: SQLContext): Map[(String, String, String, String, String), Long] = {
    val hdfsRdd = rdd.collect().map(x => {
      val y = x.split("\t", -2)
      ((y(0), y(1), y(2), y(3), y(4)), y(5).toLong)
    })
    val ntRdd = JdbcUtil.getDmpDF(sqlContext, "DYNA_NativeTemplate").select(
      "id", "sizeList", "titleLenList", "descList").rdd.map { case Row(id, sizeList, titleLenList, descList) => (
      id.toString.toLong, (sizeList.toString, titleLenList.toString, descList.toString))
    }
    val sbRdd = JdbcUtil.getDmpDF(sqlContext, "DYNA_NativeTemplateSspBundle").select(
      "template_id", "ssp", "bundle", "template_label").rdd.map { case Row(template_id, ssp, bundle, template_label) => (
      template_id.toString.toLong, (ssp.toString, bundle.toString, template_label.toString))
    }
    //大表join小表
    val mysqlrdd = sbRdd.join(ntRdd).map(x => (x._2._1._1, x._2._1._2, x._2._2._1, x._2._2._2, x._2._2._3))
    // ssp,bundle,sizeList,titleLenList,descList
    val mysqlKeySet = mysqlrdd.collect().toSet
    hdfsRdd.toMap.filterKeys(x => !mysqlKeySet.contains(x))
  }

  def saveTemplateSspBundle(seq: Seq[(String, String, Long, Long, String)]) = {
    var conn: Connection = null
    var ps: PreparedStatement = null
    val sdf = new SimpleDateFormat("yyyyMMdd")
    val datein = sdf.parse(sdf.format(new Date)).getTime
    try {
      conn = JdbcUtil.getDmpConn
      conn.setAutoCommit(false)
      ps = conn.prepareStatement("insert into DYNA_NativeTemplateSspBundle (ssp,bundle,pv,template_id,template_label,datein)" +
        " values (?,?,?,?,?,?)")
      seq.foreach(x => {
        ps.setString(1, x._1)
        ps.setString(2, x._2)
        ps.setLong(3, x._3)
        ps.setLong(4, x._4)
        ps.setString(5, x._5)
        ps.setTimestamp(6, new Timestamp(datein))
        ps.addBatch()
      })
      ps.executeBatch()
      conn.commit()
    } catch {
      case e: SQLException =>
        DbUtils.rollbackAndCloseQuietly(conn)
        e.printStackTrace()
    } finally {
      DbUtils.closeQuietly(conn, ps, null)
    }
  }

  def saveTemplate(set: immutable.Set[(String, String, String)]) = {
    var conn: Connection = null
    var ps: PreparedStatement = null
    val sdf = new SimpleDateFormat("yyyyMMdd")
    val datein = sdf.parse(sdf.format(new Date)).getTime
    try {
      conn = JdbcUtil.getDmpConn
      conn.setAutoCommit(false)
      ps = conn.prepareStatement("insert into DYNA_NativeTemplate (sizeList,titleLenList,descList,datein)" +
        " values (?,?,?,?)")
      set.foreach(x => {
        ps.setString(1, x._1)
        ps.setString(2, x._2)
        ps.setString(3, x._3)
        ps.setTimestamp(4, new Timestamp(datein))
        ps.addBatch()
      })
      ps.executeBatch()
      conn.commit()
    } catch {
      case e: SQLException =>
        DbUtils.rollbackAndCloseQuietly(conn)
        e.printStackTrace()
    } finally {
      DbUtils.closeQuietly(conn, ps, null)
    }
  }

}

redpajama_set_name: RedPajamaGithub


text:
class CreateUsers <ActiveRecord::Migration
	def change
		create_table :users do |t|
			t.string    :first_name,          :null => false
			t.string    :last_name,           :null => false
			t.string    :login,             	:null => false
			t.string    :crypted_password,    :null => false
			t.string    :password_salt,       :null => false
			t.string    :email,               :null => false
			t.string    :persistence_token,   :null => false
			t.string    :single_access_token, :null => false
			t.string    :perishable_token,    :null => false

			t.integer   :login_count,         :null => false, :default => 0
			t.integer   :failed_login_count,  :null => false, :default => 0
			t.datetime  :last_request_at
			t.datetime  :current_login_at
			t.datetime  :last_login_at
			t.string    :current_login_ip
			t.string    :last_login_ip

			t.timestamps
		end
	end
end


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using WebApplication1.Models;

namespace WebApplication1.Controllers
{
    public class ItemsController : Controller
    {
        private ItemContext db = new ItemContext();

        // GET: Items
        public ActionResult Index()
        {
            return View(db.Items.ToList());
        }

        // GET: Items/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Item item = db.Items.Find(id);
            if (item == null)
            {
                return HttpNotFound();
            }
            return View(item);
        }

        // GET: Items/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: Items/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "ItemCode,ItemName")] Item item)
        {
            if (ModelState.IsValid)
            {
                db.Items.Add(item);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(item);
        }

        // GET: Items/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Item item = db.Items.Find(id);
            if (item == null)
            {
                return HttpNotFound();
            }
            return View(item);
        }

        // POST: Items/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Edit([Bind(Include = "ItemCode,ItemName")] Item item)
        {
            if (ModelState.IsValid)
            {
                db.Entry(item).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(item);
        }

        // GET: Items/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Item item = db.Items.Find(id);
            if (item == null)
            {
                return HttpNotFound();
            }
            return View(item);
        }

        // POST: Items/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(string id)
        {
            Item item = db.Items.Find(id);
            db.Items.Remove(item);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}


text:
import rospy
from map_labelling.srv import GoToLocation, GoToLocationResponse, MotionStatus,MotionStatusResponse
import random

locations = [ 	"grasp",
				"charitys_office",
				"vending_machines",
				"levine_far_corner",
				"towne_311",
				"towne_321",
				"to_skirkanich",
				"empty_spot",
				"bio_lab" ]

#====================================================
# node exectution

def runNode():

    #start node, initial localization is hard coded into launch file
    rospy.init_node('torture_test')
    rospy.loginfo("torture_test node initialized")

    rospy.wait_for_service('goto_location')
    rospy.wait_for_service('motion_status')
    rospy.loginfo("Navigation services are available")

    LocationList = [Location(s) for s in locations]

    rospy.sleep(10)
    rospy.loginfo("Beginning tests")

    #keep running while alive
    while not rospy.is_shutdown():

		#pick random place to go
		L = random.choice(LocationList)
		L.goto()
		L.print_status()

#======================================
# Location class

#Information and methods pertaining to a location
class Location:

	def __init__(self,name):
		self.name = name
		self.goToService = rospy.ServiceProxy('goto_location', GoToLocation)
		self.motionStatus = rospy.ServiceProxy('motion_status',MotionStatus)
		self.status = False

	#Navigate to this location
	def goto(self):
	    rospy.loginfo("Navigating to "+self.name)

	    try:
			self.goToService(self.name)
	    except rospy.service.ServiceException:
			rospy.logerr("Location " + self.name+ " does not exist.")
                        return

	    #wait for arrival
	    done = False
	    while not done:

			rospy.sleep(1)
			motionStatus = self.motionStatus().status

			#0=PENDING,1=ACTIVE so these are considered running, anything else means the goal is no longer running
			if not(motionStatus == 0 or motionStatus == 1):
				done = True
				if motionStatus == 3:  #3 is succeeded motion
					self.status = True
				else:
					self.status = False

	def print_status(self):
		if self.status:
			rospy.loginfo("Navigating to "+self.name+" succeeded")
		else:
			rospy.loginfo("Navigating to "+self.name+" failed")

#=================================
# Run main

if __name__ == '__main__':
    try:
        runNode()
    except rospy.ROSInterruptException:
         pass


text:
require "spec_helper"

describe Sinatra::Rider do
  it "has a version number" do
    expect(Sinatra::Rider::VERSION).not_to be nil
  end

  context 'When registering with Sinatra' do
    it 'sets the database file' do
      server = TestServer.new
      expect(server.settings.database_file).to match('config/database.yml')
    end
  end
end


text:
package org.apache.tez.dag.api;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.tez.common.TezCommonUtils;
import org.apache.tez.dag.api.VertexGroup.GroupInfo;
import org.apache.tez.dag.api.TaskLocationHint;
import org.apache.tez.runtime.api.LogicalIOProcessor;

import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * Defines a vertex in the DAG. It represents the application logic that
 * processes and transforms the input data to create the output data. The
 * vertex represents the template from which tasks are created to execute
 * the application in parallel across a distributed execution environment.
 */
@Public
public class Vertex {

  private final String vertexName;
  private final ProcessorDescriptor processorDescriptor;

  private int parallelism;
  private VertexLocationHint locationHint;
  private Resource taskResource;
  private final Map<String, LocalResource> taskLocalResources = new HashMap<String, LocalResource>();
  private Map<String, String> taskEnvironment = new HashMap<String, String>();
  private final List<RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor>> additionalInputs
                      = new ArrayList<RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor>>();
  private final List<RootInputLeafOutput<OutputDescriptor, OutputCommitterDescriptor>> additionalOutputs
                      = new ArrayList<RootInputLeafOutput<OutputDescriptor, OutputCommitterDescriptor>>();
  private VertexManagerPluginDescriptor vertexManagerPlugin;

  private final List<Vertex> inputVertices = new ArrayList<Vertex>();
  private final List<Vertex> outputVertices = new ArrayList<Vertex>();
  private final List<Edge> inputEdges = new ArrayList<Edge>();
  private final List<Edge> outputEdges = new ArrayList<Edge>();
  private final Map<String, GroupInfo> groupInputs = Maps.newHashMap();
  private final List<DataSourceDescriptor> dataSources = Lists.newLinkedList();
  private final List<DataSinkDescriptor> dataSinks = Lists.newLinkedList();

  private String taskLaunchCmdOpts = "";

  @InterfaceAudience.Private
  Vertex(String vertexName,
         ProcessorDescriptor processorDescriptor,
         int parallelism,
         Resource taskResource) {
    this(vertexName, processorDescriptor, parallelism, taskResource, false);
  }

  private Vertex(String vertexName, ProcessorDescriptor processorDescriptor, int parallelism) {
    this(vertexName, processorDescriptor, parallelism, null, true);
  }

  private Vertex(String vertexName, ProcessorDescriptor processorDescriptor) {
    this(vertexName, processorDescriptor, -1);
  }

  private Vertex(String vertexName,
      ProcessorDescriptor processorDescriptor,
      int parallelism,
      Resource taskResource,
      boolean allowIncomplete) {
    this.vertexName = vertexName;
    this.processorDescriptor = processorDescriptor;
    this.parallelism = parallelism;
    this.taskResource = taskResource;
    if (parallelism < -1) {
      throw new IllegalArgumentException(
          "Parallelism should be -1 if determined by the AM"
          + ", otherwise should be >= 0");
    }
    if (!allowIncomplete && taskResource == null) {
      throw new IllegalArgumentException("Resource cannot be null");
    }
  }

  /**
   * Create a new vertex with the given name.
   *
   * @param vertexName
   *          Name of the vertex
   * @param processorDescriptor
   *          Description of the processor that is executed in every task of
   *          this vertex
   * @param parallelism
   *          Number of tasks in this vertex. Set to -1 if this is going to be
   *          decided at runtime. Parallelism may change at runtime due to graph
   *          reconfigurations.
   * @param taskResource
   *          Physical resources like memory/cpu thats used by each task of this
   *          vertex.
   * @return a new Vertex with the given parameters
   */
  public static Vertex create(String vertexName,
                              ProcessorDescriptor processorDescriptor,
                              int parallelism,
                              Resource taskResource) {
    return new Vertex(vertexName, processorDescriptor, parallelism, taskResource);
  }

  /**
   * Create a new vertex with the given name.

   * The vertex task resource will be picked from configuration

   * The vertex parallelism will be inferred. If it cannot be inferred then an
   * error will be reported. This constructor may be used for vertices that have
   * data sources, or connected via 1-1 edges or have runtime parallelism
   * estimation via data source initializers or vertex managers. Calling this
   * constructor is equivalent to calling
   * {@link Vertex#Vertex(String, ProcessorDescriptor, int)} with the
   * parallelism set to -1.
   *
   * @param vertexName
   *          Name of the vertex
   * @param processorDescriptor
   *          Description of the processor that is executed in every task of
   *          this vertex
   * @return a new Vertex with the given parameters
   */
  public static Vertex create(String vertexName, ProcessorDescriptor processorDescriptor) {
    return new Vertex(vertexName, processorDescriptor);
  }

  /**
   * Create a new vertex with the given name and parallelism.

   * The vertex task resource will be picked from configuration
   * {@link TezConfiguration#TEZ_TASK_RESOURCE_MEMORY_MB} &
   * {@link TezConfiguration#TEZ_TASK_RESOURCE_CPU_VCORES} Applications that
   * want more control over their task resource specification may create their
   * own logic to determine task resources and use
   * {@link Vertex#Vertex(String, ProcessorDescriptor, int, Resource)} to create
   * the Vertex.
   *
   * @param vertexName
   *          Name of the vertex
   * @param processorDescriptor
   *          Description of the processor that is executed in every task of
   *          this vertex
   * @param parallelism
   *          Number of tasks in this vertex. Set to -1 if this is going to be
   *          decided at runtime. Parallelism may change at runtime due to graph
   *          reconfigurations.
   * @return a new Vertex with the given parameters
   */
  public static Vertex create(String vertexName, ProcessorDescriptor processorDescriptor,
                              int parallelism) {
    return new Vertex(vertexName, processorDescriptor, parallelism);
  }

  /**
   * Get the vertex name
   * @return vertex name
   */
  public String getName() {
    return vertexName;
  }

  /**
   * Get the vertex task processor descriptor
   * @return process descriptor
   */
  public ProcessorDescriptor getProcessorDescriptor() {
    return this.processorDescriptor;
  }

  /**
   * Get the specified number of tasks specified to run in this vertex. It may
   * be -1 if the parallelism is defined at runtime. Parallelism may change at
   * runtime
   * @return vertex parallelism
   */
  public int getParallelism() {
    return parallelism;
  }

  /**
   * Set the number of tasks for this vertex
   * @param parallelism Parallelism for this vertex
   */
  void setParallelism(int parallelism) {
    this.parallelism = parallelism;
  }

  /**
   * Get the resources for the vertex
   * @return the physical resources like pcu/memory of each vertex task
   */
  public Resource getTaskResource() {
    return taskResource;
  }

  /**
   * Specify location hints for the tasks of this vertex. Hints must be specified
   * for all tasks as defined by the parallelism
   * @param locationHint list of locations for each task in the vertex
   * @return this Vertex
   */
  public Vertex setLocationHint(VertexLocationHint locationHint) {
    List<TaskLocationHint> locations = locationHint.getTaskLocationHints();
    if (locations == null) {
      return this;
    }
    Preconditions.checkArgument((locations.size() == parallelism),
        "Locations array length must match the parallelism set for the vertex");
    this.locationHint = locationHint;
    return this;
  }

  // used internally to create parallelism location resource file
  VertexLocationHint getLocationHint() {
    return locationHint;
  }

  /**
   * Set the files etc that must be provided to the tasks of this vertex
   * @param localFiles
   *          files that must be available locally for each task. These files
   *          may be regular files, archives etc. as specified by the value
   *          elements of the map.
   * @return this Vertex
   */
  public Vertex addTaskLocalFiles(Map<String, LocalResource> localFiles) {
    if (localFiles != null) {
      TezCommonUtils.addAdditionalLocalResources(localFiles, taskLocalResources);
    }
    return this;
  }

  /**
   * Get the files etc that must be provided by the tasks of this vertex
   * @return local files of the vertex. Key is the file name.
   */
  public Map<String, LocalResource> getTaskLocalFiles() {
    return taskLocalResources;
  }

  /**
   * Set the Key-Value pairs of environment variables for tasks of this vertex.
   * This method should be used if different vertices need different env. Else,
   * set environment for all vertices via Tezconfiguration#TEZ_TASK_LAUNCH_ENV
   * @param environment
   * @return this Vertex
   */
  public Vertex setTaskEnvironment(Map<String, String> environment) {
    Preconditions.checkArgument(environment != null);
    this.taskEnvironment.putAll(environment);
    return this;
  }

  /**
   * Get the environment variables of the tasks
   * @return environment variable map
   */
  public Map<String, String> getTaskEnvironment() {
    return taskEnvironment;
  }

  /**
   * Set the command opts for tasks of this vertex. This method should be used
   * when different vertices have different opts. Else, set the launch opts for '
   * all vertices via Tezconfiguration#TEZ_TASK_LAUNCH_CMD_OPTS
   * @param cmdOpts
   * @return this Vertex
   */
  public Vertex setTaskLaunchCmdOpts(String cmdOpts){
     this.taskLaunchCmdOpts = cmdOpts;
     return this;
  }

  /**
   * Specifies an external data source for a Vertex. This is meant to be used
   * when a Vertex reads Input directly from an external source

   *
   * For vertices which read data generated by another vertex - use the
   * {@link DAG addEdge} method.
   *
   * If a vertex needs to use data generated by another vertex in the DAG and
   * also from an external source, a combination of this API and the DAG.addEdge
   * API can be used.

   *
   * Note: If more than one RootInput exists on a vertex, which generates events
   * which need to be routed, or generates information to set parallelism, a
   * custom vertex manager should be setup to handle this. Not using a custom
   * vertex manager for such a scenario will lead to a runtime failure.
   *
   * @param inputName
   *          the name of the input. This will be used when accessing the input
   *          in the {@link LogicalIOProcessor}
   * @param dataSourceDescriptor
   *          the @{link DataSourceDescriptor} for this input.
   * @return this Vertex
   */
  public Vertex addDataSource(String inputName, DataSourceDescriptor dataSourceDescriptor) {
    additionalInputs
        .add(new RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor>(
            inputName, dataSourceDescriptor.getInputDescriptor(),
            dataSourceDescriptor.getInputInitializerDescriptor()));
    this.dataSources.add(dataSourceDescriptor);
    return this;
  }

  /**
   * Specifies an external data sink for a Vertex. This is meant to be used when
   * a Vertex writes Output directly to an external destination.

   *
   * If an output of the vertex is meant to be consumed by another Vertex in the
   * DAG - use the {@link DAG addEdge} method.
   *
   * If a vertex needs generate data to an external source as well as for
   * another Vertex in the DAG, a combination of this API and the DAG.addEdge
   * API can be used.
   *
   * @param outputName
   *          the name of the output. This will be used when accessing the
   *          output in the {@link LogicalIOProcessor}
   * @param dataSinkDescriptor
   *          the {@link DataSinkDescriptor} for this output
   * @return this Vertex
   */
  public Vertex addDataSink(String outputName, DataSinkDescriptor dataSinkDescriptor) {
    additionalOutputs
        .add(new RootInputLeafOutput<OutputDescriptor, OutputCommitterDescriptor>(
            outputName, dataSinkDescriptor.getOutputDescriptor(),
            dataSinkDescriptor.getOutputCommitterDescriptor()));
    this.dataSinks.add(dataSinkDescriptor);
    return this;
  }

  Vertex addAdditionalDataSink(RootInputLeafOutput<OutputDescriptor, OutputCommitterDescriptor> output) {
    additionalOutputs.add(output);
    return this;
  }

  /**
   * Specifies a {@link VertexManagerPlugin} for the vertex. This plugin can be
   * used to modify the parallelism or reconfigure the vertex at runtime using
   * user defined code embedded in the plugin
   *
   * @param vertexManagerPluginDescriptor
   * @return this Vertex
   */
  public Vertex setVertexManagerPlugin(
      VertexManagerPluginDescriptor vertexManagerPluginDescriptor) {
    this.vertexManagerPlugin = vertexManagerPluginDescriptor;
    return this;
  }

  /**
   * Get the launch command opts for tasks in this vertex
   * @return launch command opts
   */
  public String getTaskLaunchCmdOpts(){
	  return taskLaunchCmdOpts;
  }

  @Override
  public String toString() {
    return "[" + vertexName + " : " + processorDescriptor.getClassName() + "]";
  }

  VertexManagerPluginDescriptor getVertexManagerPlugin() {
    return vertexManagerPlugin;
  }

  Map<String, GroupInfo> getGroupInputs() {
    return groupInputs;
  }

  void addGroupInput(String groupName, GroupInfo groupInputInfo) {
    if (groupInputs.put(groupName, groupInputInfo) != null) {
      throw new IllegalStateException(
          "Vertex: " + getName() +
          " already has group input with name:" + groupName);
    }
  }

  void addInputVertex(Vertex inputVertex, Edge edge) {
    inputVertices.add(inputVertex);
    inputEdges.add(edge);
  }

  void addOutputVertex(Vertex outputVertex, Edge edge) {
    outputVertices.add(outputVertex);
    outputEdges.add(edge);
  }

  /**
   * Get the input vertices for this vertex
   * @return List of input vertices
   */
  public List<Vertex> getInputVertices() {
    return Collections.unmodifiableList(inputVertices);
  }

  /**
   * Get the output vertices for this vertex
   * @return List of output vertices
   */
  public List<Vertex> getOutputVertices() {
    return Collections.unmodifiableList(outputVertices);
  }

  /**
   * Set the cpu/memory etc resources used by tasks of this vertex
   * @param resource {@link Resource} for the tasks of this vertex
   */
  void setTaskResource(Resource resource) {
    this.taskResource = resource;
  }

  @Private
  public List<DataSourceDescriptor> getDataSources() {
    return dataSources;
  }

  @Private
  public List<DataSinkDescriptor> getDataSinks() {
    return dataSinks;
  }

  List<Edge> getInputEdges() {
    return inputEdges;
  }

  List<Edge> getOutputEdges() {
    return outputEdges;
  }

  List<RootInputLeafOutput<InputDescriptor, InputInitializerDescriptor>> getInputs() {
    return additionalInputs;
  }

  List<RootInputLeafOutput<OutputDescriptor, OutputCommitterDescriptor>> getOutputs() {
    return additionalOutputs;
  }
}


text:
define(
    function (require) {
        var lib = require('./lib');
        var Helper = require('./Helper');

        /**
         * 提供控件类常用的辅助方法
         *
         * **此对象将在4.0版本中移除** ,请按以下规则迁移:
         *
         * - `getGUID`移至{@link lib#getGUID}
         * - `createRepaint`移至{@link painters#createRepaint}
         * - 多数方法移至{@link Helper}类下
         * - 浮层相关方法移至{@link Layer}类下
         *
         * @class controlHelper
         * @singleton
         */
        var helper = {};

        /**
         * @ignore
         */
        helper.getGUID = lib.getGUID;

        var methods = [
            // life
            'initViewContext', 'initExtensions',
            'isInStage', 'changeStage',
            'dispose', 'beforeDispose', 'afterDispose',
            // dom
            'getPartClasses', 'addPartClasses', 'removePartClasses',
            'getStateClasses', 'addStateClasses', 'removeStateClasses',
            'getId', 'replaceMain',
            // event
            'addDOMEvent', 'removeDOMEvent', 'clearDOMEvents'
        ];

        helper.createRepaint = require('./painters').createRepaint;

        // 补上原有的方法,全部代理到`Helper`上
        require('underscore').each(
            methods,
            function (name) {
                helper[name] = function (control) {
                    var helper = control.helper || new Helper(control);
                    var args = [].slice.call(arguments, 1);
                    return helper[name].apply(helper, args);
                };
            }
        );

        // 再往下的全部是等待废弃的

        /**
         * @ignore
         * @deprecated 使用{@link Helper#extractOptionsFromInput}代替
         */
        helper.extractValueFromInput = function (control, options) {
            var main = control.main;
            // 如果是输入元素
            if (lib.isInput(main)) {
                if (main.value && !options.value) {
                    options.value = main.value;
                }
                if (main.name && !options.name) {
                    options.name = main.name;
                }
                if (main.disabled
                    && (options.disabled === null
                        || options.disabled === undefined)) {
                    options.disabled = main.disabled;
                }
                if (main.readOnly
                    && (options.readOnly === null
                        || options.readOnly === undefined)) {
                    options.readOnly = main.readonly || main.readOnly;
                }
            }
        };

        var layer = helper.layer = {};
        var Layer = require('./Layer');

        /**
         * @ignore
         */
        layer.create = Layer.create;

        /**
         * @ignore
         */
        layer.getZIndex = Layer.getZIndex;

        /**
         * @ignore
         */
        layer.moveToTop = Layer.moveToTop;

        /**
         * @ignore
         */
        layer.moveTo = Layer.moveTo;

        /**
         * @ignore
         */
        layer.resize = Layer.resize;

        /**
         * @ignore
         */
        layer.attachTo = Layer.attachTo;

        /**
         * @ignore
         */
        layer.centerToView = Layer.centerToView;

        return helper;
    }
);


text:
<?php

/**
 *
 * @package BLW\Mail
 * @version GIT: 0.2.0
 * @author  Walter Otsyula <wotsyula@mast3rpee.tk>
 */
namespace BLW\Model\Mail\Transport;

use BLW\Type\Mail\IMessage;

// @codeCoverageIgnoreStart
if (! defined('BLW')) {

    if (strstr($_SERVER['PHP_SELF'], basename(__FILE__))) {
        header("$_SERVER[SERVER_PROTOCOL] 404 Not Found");
        header('Status: 404 Not Found');

        $_SERVER['REDIRECT_STATUS'] = 404;

        echo "\r\n<title>404 Not Found</title>\r\n
404 Not Found
\r\n
\r\nnginx/1.5.9\r\n\r\n\r\n";
        exit();
    }

    return false;
}
// @codeCoverageIgnoreEnd

/**
 * NULL transport.
 *
 * @package BLW\Mail
 * @author  mAsT3RpEE <wotsyula@mast3rpee.tk>
 */
class NULL extends \BLW\Type\Mail\ATransport
{

    /**
     * Does the actual work of sending the message.
     *
     * @codeCoverageIgnore
     *
     * @param \BLW\Type\Mail\IMessage $Message
     *            Message to send.
     * @return integer ITransport::RESULT_FLAGS
     */
    public function doSend(IMessage $Message)
    {
    }
}

// @codeCoverageIgnoreStart
return true;
// @codeCoverageIgnoreEnd


text:
<?php
if ( ! defined( 'ABSPATH' ) ) {
    // prevent direct access to this file
    exit;
}
?>

        <a  href="<?php echo esc_url_raw( add_query_arg( array( 'page' => $laterpay['admin_menu']['account']['url'] ), admin_url( 'admin.php' ) ) ); ?>"
            id="lp_js_pluginModeIndicator"
            class="lp_plugin-mode-indicator"
            <?php if ( $laterpay['plugin_is_in_live_mode'] ) : ?>style="display:none;"<?php endif; ?>
            data-icon="h">

<?php echo laterpay_sanitize_output( __( 'Test mode', 'laterpay' ) ); ?>

            <?php echo laterpay_sanitize_output( __( 'Earn money in live mode', 'laterpay' ) ); ?>

        <?php echo laterpay_sanitized( $laterpay['top_nav'] ); ?>

            <?php echo laterpay_sanitize_output( __( 'The LaterPay plugin is in', 'laterpay' ) ); ?>

                <form id="laterpay_plugin_mode" method="post">
                    <input type="hidden" name="form"    value="laterpay_plugin_mode">
                    <input type="hidden" name="action"  value="laterpay_account">
                    <?php if ( function_exists( 'wp_nonce_field' ) ) { wp_nonce_field( 'laterpay_form' ); } ?>

                        <input type="checkbox"
                                id="lp_js_togglePluginMode"
                                class="lp_toggle__input"
                                name="plugin_is_in_live_mode"
                                value="1"
                                <?php if ( $laterpay['plugin_is_in_live_mode'] ) { echo 'checked'; } ?>>

                </form>

<?php echo laterpay_sanitize_output( __( 'mode.', 'laterpay' ) ); ?>
            <div id="lp_js_pluginVisibilitySetting"
                class="lp_inline-block"
                <?php if ( $laterpay['plugin_is_in_live_mode'] ) { echo ' style="display:none;"'; } ?>>
                <?php echo laterpay_sanitize_output( __( 'It is invisible', 'laterpay' ) ); ?>

                    <form id="laterpay_test_mode" method="post">
                        <input type="hidden" name="form"    value="laterpay_test_mode">
                        <input type="hidden" name="action"  value="laterpay_account">
                        <input type="hidden" id="lp_js_hasInvalidSandboxCredentials" name="invalid_credentials" value="0">
                        <?php if ( function_exists( 'wp_nonce_field' ) ) { wp_nonce_field( 'laterpay_form' ); } ?>

                            <input type="checkbox"
                                   id="lp_js_toggleVisibilityInTestMode"
                                   class="lp_toggle__input"
                                   name="plugin_is_in_visible_test_mode"
                                   value="1"
                                <?php if ( $laterpay['plugin_is_in_visible_test_mode'] ) { echo 'checked'; } ?>>

                    </form>

<?php echo laterpay_sanitize_output( __( 'visible to visitors.', 'laterpay' ) ); ?>

                <fieldset class="lp_api-credentials__fieldset">
                    <legend class="lp_api-credentials__legend"><?php echo laterpay_sanitize_output( __( 'Sandbox Environment', 'laterpay' ) ); ?></legend>

                    <dfn class="lp_api-credentials__hint">
                        <?php echo laterpay_sanitize_output( __( 'for testing with simulated payments', 'laterpay' ) ); ?>
                    </dfn>

                            <form id="laterpay_sandbox_merchant_id" method="post">
                                <input type="hidden" name="form"   value="laterpay_sandbox_merchant_id">
                                <input type="hidden" name="action" value="laterpay_account">
                                <?php if ( function_exists( 'wp_nonce_field' ) ) { wp_nonce_field( 'laterpay_form' ); } ?>

                                <input type="text"
                                    id="lp_js_sandboxMerchantId"
                                    class="lp_js_validateMerchantId lp_api-credentials__input"
                                    name="laterpay_sandbox_merchant_id"
                                    value="<?php echo esc_attr( $laterpay['sandbox_merchant_id'] ); ?>"
                                    maxlength="22"
                                    required>
                                <label for="laterpay_sandbox_merchant_id"
                                    alt="<?php echo esc_attr( __( 'Paste Sandbox Merchant ID here', 'laterpay' ) ); ?>"
                                    placeholder="<?php echo esc_attr( __( 'Merchant ID', 'laterpay' ) ); ?>">

                            </form>

                            <form id="laterpay_sandbox_api_key" method="post">
                                <input type="hidden" name="form"   value="laterpay_sandbox_api_key">
                                <input type="hidden" name="action" value="laterpay_account">
                                <?php if ( function_exists( 'wp_nonce_field' ) ) { wp_nonce_field( 'laterpay_form' ); } ?>

                                <input type="text"
                                    id="lp_js_sandboxApiKey"
                                    class="lp_js_validateApiKey lp_api-credentials__input"
                                    name="laterpay_sandbox_api_key"
                                    value="<?php echo esc_attr( $laterpay['sandbox_api_key'] ); ?>"
                                    maxlength="32"
                                    required>
                                <label for="laterpay_sandbox_api_key"
                                    alt="<?php echo esc_attr( __( 'Paste Sandbox API Key here', 'laterpay' ) ); ?>"
                                    placeholder="<?php echo esc_attr( __( 'API Key', 'laterpay' ) ); ?>">

                            </form>

                </fieldset>

            <div id="lp_js_liveCredentials"
                class="lp_api-credentials lp_api-credentials--live<?php if ( $laterpay['plugin_is_in_live_mode'] ) { echo ' lp_is-live'; } ?>"
                data-icon="k">
                <fieldset class="lp_api-credentials__fieldset">
                    <legend class="lp_api-credentials__legend"><?php echo laterpay_sanitize_output( __( 'Live Environment', 'laterpay' ) ); ?></legend>

                    <dfn class="lp_api-credentials__hint">
                        <?php echo laterpay_sanitize_output( __( 'for processing real financial transactions', 'laterpay' ) ); ?>
                    </dfn>

                            <form id="laterpay_live_merchant_id" method="post">
                                <input type="hidden" name="form"   value="laterpay_live_merchant_id">
                                <input type="hidden" name="action" value="laterpay_account">
                                <?php if ( function_exists( 'wp_nonce_field' ) ) { wp_nonce_field( 'laterpay_form' ); } ?>

                                <input type="text"
                                    id="lp_js_liveMerchantId"
                                    class="lp_js_validateMerchantId lp_api-credentials__input"
                                    name="laterpay_live_merchant_id"
                                    value="<?php echo esc_attr( $laterpay['live_merchant_id'] ); ?>"
                                    maxlength="22"
                                    required>
                                <label for="laterpay_live_merchant_id"
                                    alt="<?php echo esc_attr( __( 'Paste Live Merchant ID here', 'laterpay' ) ); ?>"
                                    placeholder="<?php echo esc_attr( __( 'Merchant ID', 'laterpay' ) ); ?>">

                            </form>

                            <form id="laterpay_live_api_key" method="post">
                                <input type="hidden" name="form"    value="laterpay_live_api_key">
                                <input type="hidden" name="action"  value="laterpay_account">
                                <?php if ( function_exists( 'wp_nonce_field' ) ) { wp_nonce_field( 'laterpay_form' ); } ?>

                                <input type="text"
                                    id="lp_js_liveApiKey"
                                    class="lp_js_validateApiKey lp_api-credentials__input"
                                    name="laterpay_live_api_key"
                                    value="<?php echo esc_attr( $laterpay['live_api_key'] ); ?>"
                                    maxlength="32"
                                    required>
                                <label for="laterpay_sandbox_api_key"
                                    alt="<?php echo esc_attr( __( 'Paste Live API Key here', 'laterpay' ) ); ?>"
                                    placeholder="<?php echo esc_attr( __( 'API Key', 'laterpay' ) ); ?>">

                            </form>

                            <a href="#"
                                id="lp_js_showMerchantContracts"
                                class="button button-primary"
                                <?php if ( ! empty( $laterpay['live_merchant_id'] ) && ! empty( $laterpay['live_api_key'] ) ) { echo 'style="display:none";'; } ?>>
                                <?php echo laterpay_sanitize_output( __( 'Request Live API Credentials', 'laterpay' ) ); ?>

                </fieldset>


text:
title: Projects
visible: false
rows:
  - title: One on one tutoring.
    description: Open hours for students to come with homework, lab or extra-curricular project questions.
    description_position: right
    image: feature-image-3.png
    name: cross-browser
  - title: Events
    description: Technology centered events to encourage and promote exploration of technology. Hackathons. Tech talks. Speakers. Hack nights.
    description_position: left
    image: feature-image-1.png
    name: design
  - title: Community.
    description: A 24 space for students to come together to study and work, allowing for greater collaboration and support.
    description_position: right
    image: feature-image-4.png
    name: video
  - title: Student-led projects.
    description: A space with the resources and community for students to create projects that solve real world problems at NYUAD and beyond.
    description_position: left
    image: feature-image-2.png
    name: responsive
---


text:
package com.gilt.gfc.aws.cloudwatch.periodic.metric

import com.gilt.gfc.aws.cloudwatch.periodic.metric.aggregator.CloudWatchMetricDataAggregatorBuilder

import scala.concurrent.duration.FiniteDuration
import scala.language.postfixOps

/**
 * Maintains state necessary to aggregate metrics on the client side.
 * Interface is different and less flexible than underlying CW API but
 * it results in fewer API calls, which are expensive.
 */
trait CloudWatchMetricDataAggregator {

  /** Handles a single metric datum sample value. */
  def sampleValue(v: Double): Unit

  /** A common use case, increment by 1. */
  def increment(): Unit = { sampleValue(1) }

  /** Stops background tasks. */
  def stop(): Unit
}

object CloudWatchMetricDataAggregator {

  /** Constructs a builder (immutable) that collects all the necessary parameters as well
    * as allows for a partial construction of CloudWatchMetricDataAggregator objects,
    * with common groups of parameters shared by multiple aggregated metrics.
    *
    * N.B. fully constructed CloudWatchMetricDataAggregator instances start to collect
    *      metrics immediately, so a global background task that dumps them to CW needs
    *      to be started first, please call start() somewhere early in your app startup sequence.
    *
    * @return builder instance that you can start customizing
    */
  def builder(publisher: CloudWatchMetricsPublisher): CloudWatchMetricDataAggregatorBuilder = {
    CloudWatchMetricDataAggregatorBuilder().withPublisher(publisher)
  }

  /** Constructs a builder (immutable) that collects all the necessary parameters as well
    * as allows for a partial construction of CloudWatchMetricDataAggregator objects,
    * with common groups of parameters shared by multiple aggregated metrics.
    *
    * N.B. fully constructed CloudWatchMetricDataAggregator instances start to collect
    *      metrics immediately, so a global background task that dumps them to CW needs
    *      to be started first, please call start() somewhere early in your app startup sequence.
    *
    * @return builder instance that you can start customizing
    */
  @deprecated("Use builder(CloudWatchMetricsPublisher)", "1.2.0")
  def builder(): CloudWatchMetricDataAggregatorBuilder = {

    // This is needed to make sure we consume what aggregated metrics start to produce, otherwise
    // system will OOM.
    publisher.map(CloudWatchMetricDataAggregatorBuilder().withPublisher(_)).getOrElse(
      throw new AssertionError("Please call start() before building any aggregated metrics.")
    )
  }

  /** Starts a background task that periodically dumps aggregated metric data to CW.
    *
    * @param interval how frequently to dump data to CW. This is intentionally different
    *                 from the metric aggregation interval. E.g. you may be aggregating
    *                 metrics for 1min but dump them to CW every 5min, thus taking advantage
    *                 of larger batch size in API calls and reducing costs.
    */
  @deprecated("Use CloudWatchMetricsPublisher.start()", "1.2.0")
  def start( interval: FiniteDuration
           ): Unit = synchronized {
    if (publisher.isEmpty) {
      publisher = Some(CloudWatchMetricsPublisher.start(interval))
    }
  }

  /** Stops background tasks. */
  @deprecated("Use CloudWatchMetricsPublisher.stop()", "1.2.0")
  def stop(): Unit = synchronized {
    publisher.foreach(_.stop())
  }

  /** Completely shuts down, can not be restarted. */
  @deprecated("Use CloudWatchMetricsPublisher.shutdown()", "1.2.0")
  def shutdown(): Unit = synchronized {
    publisher.foreach(_.shutdown())
  }

  @volatile private[this]
  var publisher: Option[CloudWatchMetricsPublisher] = None
}


text:
package org.site_monitor.service;

import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;

import org.site_monitor.BuildConfig;
import org.site_monitor.util.GsonUtil;

import java.io.Serializable;

/**
 * An {@link IntentService} subclass for handling asynchronous task requests in
 * a service on a separate handler thread.
 */
public class SharedPreferencesService extends IntentService {

    public static final String KEY_JSON_SITE_SETTINGS = "org.site_monitor.activity.settings.json.siteSettings";
    private static final String ACTION_SAVE_DATA = "org.site_monitor.service.action.SAVE_DATA";
    private static final String EXTRA_DATA = "org.site_monitor.service.extra.DATA";
    private static final String EXTRA_DATA_KEY = "org.site_monitor.service.extra.DATA_KEY";
    private static final String TAG = SharedPreferencesService.class.getSimpleName();

    public SharedPreferencesService() {
        super(TAG);
    }

    /**
     * Calls start service with given params.
     *
     * @param context
     * @param key
     * @param data
     */
    public static void startActionSaveData(Context context, String key, Serializable data) {
        Intent intent = new Intent(context, SharedPreferencesService.class);
        intent.setAction(ACTION_SAVE_DATA);
        intent.putExtra(EXTRA_DATA_KEY, key);
        intent.putExtra(EXTRA_DATA, data);
        context.startService(intent);
    }

    /**
     * in default shard preferences
     *
     * @param context
     * @param key
     * @return value for given key or 0 if none
     */
    public static long getLongNow(Context context, String key) {
        SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        return defaultSharedPreferences.getLong(key, 0);
    }

    /**
     * in default shard preferences
     *
     * @param context
     * @param key
     * @return value for given key or empty string if none
     */
    public static String getStringNow(Context context, String key) {
        SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        return defaultSharedPreferences.getString(key, "");
    }

    /**
     * Saves value for given key in default shard preferences.
     *
     * @param context
     * @param key
     * @param value
     */
    public static void saveNow(Context context, String key, String value) {
        SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        defaultSharedPreferences.edit().putString(key, value).commit();
    }

    /**
     * Saves value for given key in default shard preferences.
     *
     * @param context
     * @param key
     * @param value
     */
    public static void saveNow(Context context, String key, long value) {
        SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        defaultSharedPreferences.edit().putLong(key, value).commit();
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        if (intent != null) {
            final String action = intent.getAction();
            if (ACTION_SAVE_DATA.equals(action)) {
                final String key = intent.getStringExtra(EXTRA_DATA_KEY);
                final Serializable data = intent.getSerializableExtra(EXTRA_DATA);
                if (BuildConfig.DEBUG) {
                    Log.d(TAG, "handleActionSaveData key: " + key);
                }
                saveNow(this, key, GsonUtil.toJson(data));
            }
        }
    }

}


text:
package org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.parts;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.swt.graphics.Color;
import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.wso2.developerstudio.eclipse.gmf.esb.InputConnector;
import org.wso2.developerstudio.eclipse.gmf.esb.ProxyInSequenceInputConnector;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.AbstractBaseFigureEditPart;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.AbstractBaseFigureInputConnectorEditPart;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.AbstractConnectorEditPart;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.AbstractMediator;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.AbstractMediatorCompartmentEditPart;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.AbstractMediatorFlowCompartmentEditPart;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.ConnectionUtils;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.EastPointerShape;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.EditorUtils;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.custom.FixedBorderItemLocator;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.edit.policies.ProxyInSequenceInputConnectorItemSemanticEditPolicy;
import org.wso2.developerstudio.eclipse.gmf.esb.diagram.providers.EsbElementTypes;

/**
 * @generated NOT
 */
public class ProxyInSequenceInputConnectorEditPart extends AbstractBaseFigureInputConnectorEditPart {

	/**
	 * @generated
	 */
	public static final int VISUAL_ID = 3731;

	/**
	 * @generated
	 */
	protected IFigure contentPane;

	/**
	 * @generated
	 */
	protected IFigure primaryShape;

	public NodeFigure figure_;

	private ProxyInSequenceInputConnectorEditPart instance;

	public NodeFigure getNodeFigureInput() {

		return figure_;
	}

	public void notifyChanged(Notification notification) {
		super.notifyChanged(notification);
		if (((ENotificationImpl) notification).getOldValue() != null) {
			/*
			 * Removing ProxyInSequenceInputConnector when the link which connected to the inputConnector get deleted.
			 */
			if ((((ENotificationImpl) notification).getOldValue() instanceof org.wso2.developerstudio.eclipse.gmf.esb.impl.EsbLinkImpl)
					&& (((ENotificationImpl) notification).getNewValue() == null)) {
				RemoveCommand removeCmd = new RemoveCommand(getEditingDomain(), ((Node) EditorUtils
						.getAbstractBaseFigureEditPart(this).getModel()).getElement(),
						EsbPackage.Literals.PROXY_SERVICE__IN_SEQUENCE_INPUT_CONNECTORS,
						((Node) this.getModel()).getElement());
				if (removeCmd.canExecute()) {
					getEditingDomain().getCommandStack().execute(removeCmd);
				}
			}
		}
	}

	/**
	 * @generated NOT
	 */
	public ProxyInSequenceInputConnectorEditPart(View view) {
		super(view);
		instance = this;
	}

	private void connectToSendMediator(SendMediatorEditPart sendMediatorEditPart) {
		if (sendMediatorEditPart != null) {
			ConnectionUtils.createConnection((AbstractConnectorEditPart) this,
					EditorUtils.getMediatorOutputConnector(sendMediatorEditPart));
		}
	}

	/*	public void reallocateInputConnectors(SendMediatorEditPart sendMediatorEditPart){
	 int proxyOutSequenceOutputConnectorLocation = EditorUtils.getProxyOutSequenceOutputConnector(EditorUtils.getProxy(sendMediatorEditPart)).getFigure().getBounds().getLocation().y;
	 int proxyLocation=EditorUtils.getProxy(sendMediatorEditPart).getFigure().getBounds().getLocation().y;
	 int relativeProxyOutSequenceOutputConnectorLocation=proxyOutSequenceOutputConnectorLocation-proxyLocation;

	 int totalHeight=(int) (((float)relativeProxyOutSequenceOutputConnectorLocation)/0.75);

	 int relativeSendMediatorOutputConnectorLocation=EditorUtils.getOutputConnector(sendMediatorEditPart, SendMediatorOutputConnectorEditPart.class).getFigure().getBounds().getLocation().y;

	 GraphicalEditPart parent=(GraphicalEditPart) sendMediatorEditPart.getParent();
	 relativeSendMediatorOutputConnectorLocation=relativeSendMediatorOutputConnectorLocation+5;
	 while(!(parent instanceof AbstractBaseFigureEditPart)){
	 if((parent instanceof AbstractMediatorFlowCompartmentEditPart)){
	 relativeSendMediatorOutputConnectorLocation=relativeSendMediatorOutputConnectorLocation+((GraphicalEditPart)parent.getParent()).getFigure().getBounds().getLocation().y;
	 }
	 parent=(GraphicalEditPart) parent.getParent();
	 }

	 float ratio = (float)(relativeSendMediatorOutputConnectorLocation-100)/totalHeight;
	 ratio=(float) 0.25;

	 AbstractBaseFigureEditPart baseFigureEditPart = (AbstractBaseFigureEditPart) EditorUtils.getAbstractBaseFigureEditPart(this);
	 GraphicalEditPart ob=(GraphicalEditPart) ((EditPart)((EditPart)this.getParent().getChildren().get(5)).getChildren().get(0)).getChildren().get(0);
	 BorderItemLocator inputLocator = new FixedBorderItemLocator(ob.getFigure(),
	 baseFigureEditPart.inSequenceInputConnectorFigure, PositionConstants.EAST, ratio);
	 baseFigureEditPart.getBorderedFigure().getBorderItemContainer()
	 .add(baseFigureEditPart.inSequenceInputConnectorFigure, inputLocator);
	 }*/

	/**
	 * @generated NOT
	 */
	protected void createDefaultEditPolicies() {
		super.createDefaultEditPolicies();
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
				new ProxyInSequenceInputConnectorItemSemanticEditPolicy());
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
		// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
		removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
	}

	/**
	 * @generated
	 */
	protected LayoutEditPolicy createLayoutEditPolicy() {
		org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {

			protected EditPolicy createChildEditPolicy(EditPart child) {
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
				if (result == null) {
					result = new NonResizableEditPolicy();
				}
				return result;
			}

			protected Command getMoveChildrenCommand(Request request) {
				return null;
			}

			protected Command getCreateCommand(CreateRequest request) {
				return null;
			}
		};
		return lep;
	}

	/**
	 * @generated NOT
	 */
	protected IFigure createNodeShape() {
		return primaryShape = new EastPointerFigure() {
			public void setBounds(org.eclipse.draw2d.geometry.Rectangle rect) {
				super.setBounds(rect);
				if (this.getBounds().getLocation().x != 0 && this.getBounds().getLocation().y != 0) {
					if (EditorUtils.getAbstractBaseFigureEditPart(instance) != null) {
						Map<InputConnector, SendMediatorEditPart> map = EditorUtils
								.getAbstractBaseFigureEditPart(instance)
								.getSendMediatorAndInSequenceInputConnectorMap();
						SendMediatorEditPart sendMediatorEditPart = (SendMediatorEditPart) (map
								.get(((Node) instance.getModel()).getElement()));
						connectToSendMediator(sendMediatorEditPart);
					}
				}
			};
		};
	}

	/**
	 * @generated
	 */
	public EastPointerFigure getPrimaryShape() {
		return (EastPointerFigure) primaryShape;
	}

	/**
	 * @generated
	 */
	protected NodeFigure createNodePlate() {
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(12, 10);

		//FIXME: workaround for #154536
		result.getBounds().setSize(result.getPreferredSize());
		return result;
	}

	/**
	 * Creates figure for this edit part.
	 *
	 * Body of this method does not depend on settings in generation model
	 * so you may safely remove <i>generated</i> tag and modify it.
	 *
	 * @generated NOT
	 */
	protected NodeFigure createNodeFigure() {
		NodeFigure figure = createNodePlate();
		figure.setLayoutManager(new StackLayout());
		IFigure shape = createNodeShape();
		figure.add(shape);
		contentPane = setupContentPane(shape);
		figure_ = figure;

		return figure;
	}

	/**
	 * Default implementation treats passed figure as content pane.
	 * Respects layout one may have set for generated figure.
	 * @param nodeShape instance of generated figure class
	 * @generated
	 */
	protected IFigure setupContentPane(IFigure nodeShape) {
		return nodeShape; // use nodeShape itself as contentPane
	}

	/**
	 * @generated
	 */
	public IFigure getContentPane() {
		if (contentPane != null) {
			return contentPane;
		}
		return super.getContentPane();
	}

	/**
	 * @generated
	 */
	protected void setForegroundColor(Color color) {
		if (primaryShape != null) {
			primaryShape.setForegroundColor(color);
		}
	}

	/**
	 * @generated
	 */
	protected void setBackgroundColor(Color color) {
		if (primaryShape != null) {
			primaryShape.setBackgroundColor(color);
		}
	}

	/**
	 * @generated
	 */
	protected void setLineWidth(int width) {
		if (primaryShape instanceof Shape) {
			((Shape) primaryShape).setLineWidth(width);
		}
	}

	/**
	 * @generated
	 */
	protected void setLineType(int style) {
		if (primaryShape instanceof Shape) {
			((Shape) primaryShape).setLineStyle(style);
		}
	}

	/**
	 * @generated
	 */
	public List<IElementType> getMARelTypesOnTarget() {
		ArrayList<IElementType> types = new ArrayList<IElementType>(1);
		types.add(EsbElementTypes.EsbLink_4001);
		return types;
	}

	/**
	 * @generated
	 */
	public List<IElementType> getMATypesForSource(IElementType relationshipType) {
		LinkedList<IElementType> types = new LinkedList<IElementType>();
		if (relationshipType == EsbElementTypes.EsbLink_4001) {
			types.add(EsbElementTypes.ProxyOutputConnector_3002);
			types.add(EsbElementTypes.ProxyOutSequenceOutputConnector_3729);
			types.add(EsbElementTypes.PropertyMediatorOutputConnector_3034);
			types.add(EsbElementTypes.ThrottleMediatorOutputConnector_3122);
			types.add(EsbElementTypes.ThrottleMediatorOnAcceptOutputConnector_3581);
			types.add(EsbElementTypes.ThrottleMediatorOnRejectOutputConnector_3582);
			types.add(EsbElementTypes.FilterMediatorOutputConnector_3534);
			types.add(EsbElementTypes.FilterMediatorPassOutputConnector_3011);
			types.add(EsbElementTypes.FilterMediatorFailOutputConnector_3012);
			types.add(EsbElementTypes.LogMediatorOutputConnector_3019);
			types.add(EsbElementTypes.EnrichMediatorOutputConnector_3037);
			types.add(EsbElementTypes.XSLTMediatorOutputConnector_3040);
			types.add(EsbElementTypes.SwitchCaseBranchOutputConnector_3043);
			types.add(EsbElementTypes.SwitchMediatorOutputConnector_3499);
			types.add(EsbElementTypes.SwitchDefaultBranchOutputConnector_3044);
			types.add(EsbElementTypes.SequenceOutputConnector_3050);
			types.add(EsbElementTypes.EventMediatorOutputConnector_3053);
			types.add(EsbElementTypes.EntitlementMediatorOutputConnector_3056);
			types.add(EsbElementTypes.ClassMediatorOutputConnector_3059);
			types.add(EsbElementTypes.SpringMediatorOutputConnector_3062);
			types.add(EsbElementTypes.ScriptMediatorOutputConnector_3065);
			types.add(EsbElementTypes.FaultMediatorOutputConnector_3068);
			types.add(EsbElementTypes.XQueryMediatorOutputConnector_3071);
			types.add(EsbElementTypes.CommandMediatorOutputConnector_3074);
			types.add(EsbElementTypes.DBLookupMediatorOutputConnector_3077);
			types.add(EsbElementTypes.DBReportMediatorOutputConnector_3080);
			types.add(EsbElementTypes.SmooksMediatorOutputConnector_3083);
			types.add(EsbElementTypes.SendMediatorOutputConnector_3086);
			types.add(EsbElementTypes.SendMediatorEndpointOutputConnector_3539);
			types.add(EsbElementTypes.HeaderMediatorOutputConnector_3101);
			types.add(EsbElementTypes.CloneMediatorOutputConnector_3104);
			types.add(EsbElementTypes.CloneMediatorTargetOutputConnector_3133);
			types.add(EsbElementTypes.CacheMediatorOutputConnector_3107);
			types.add(EsbElementTypes.CacheMediatorOnHitOutputConnector_3618);
			types.add(EsbElementTypes.IterateMediatorOutputConnector_3110);
			types.add(EsbElementTypes.IterateMediatorTargetOutputConnector_3606);
			types.add(EsbElementTypes.CalloutMediatorOutputConnector_3116);
			types.add(EsbElementTypes.TransactionMediatorOutputConnector_3119);
			types.add(EsbElementTypes.RMSequenceMediatorOutputConnector_3125);
			types.add(EsbElementTypes.RuleMediatorOutputConnector_3128);
			types.add(EsbElementTypes.RuleMediatorChildMediatorsOutputConnector_3640);
			types.add(EsbElementTypes.OAuthMediatorOutputConnector_3131);
			types.add(EsbElementTypes.AggregateMediatorOutputConnector_3113);
			types.add(EsbElementTypes.AggregateMediatorOnCompleteOutputConnector_3132);
			types.add(EsbElementTypes.StoreMediatorOutputConnector_3590);
			types.add(EsbElementTypes.BuilderMediatorOutputConector_3593);
			types.add(EsbElementTypes.CallTemplateMediatorOutputConnector_3596);
			types.add(EsbElementTypes.PayloadFactoryMediatorOutputConnector_3599);
			types.add(EsbElementTypes.EnqueueMediatorOutputConnector_3602);
			types.add(EsbElementTypes.URLRewriteMediatorOutputConnector_3622);
			types.add(EsbElementTypes.ValidateMediatorOutputConnector_3625);
			types.add(EsbElementTypes.ValidateMediatorOnFailOutputConnector_3626);
			types.add(EsbElementTypes.RouterMediatorOutputConnector_3630);
			types.add(EsbElementTypes.RouterMediatorTargetOutputConnector_3631);
			types.add(EsbElementTypes.ConditionalRouterMediatorOutputConnector_3637);
			types.add(EsbElementTypes.ConditionalRouterMediatorAdditionalOutputConnector_3638);
			types.add(EsbElementTypes.BAMMediatorOutputConnector_3682);
			types.add(EsbElementTypes.BeanMediatorOutputConnector_3685);
			types.add(EsbElementTypes.EJBMediatorOutputConnector_3688);
			types.add(EsbElementTypes.DefaultEndPointOutputConnector_3022);
			types.add(EsbElementTypes.AddressEndPointOutputConnector_3031);
			types.add(EsbElementTypes.FailoverEndPointOutputConnector_3090);
			types.add(EsbElementTypes.FailoverEndPointWestOutputConnector_3097);
			types.add(EsbElementTypes.RecipientListEndPointOutputConnector_3694);
			types.add(EsbElementTypes.RecipientListEndPointWestOutputConnector_3695);
			types.add(EsbElementTypes.WSDLEndPointOutputConnector_3093);
			types.add(EsbElementTypes.NamedEndpointOutputConnector_3662);
			types.add(EsbElementTypes.LoadBalanceEndPointOutputConnector_3096);
			types.add(EsbElementTypes.LoadBalanceEndPointWestOutputConnector_3098);
			types.add(EsbElementTypes.APIResourceEndpointOutputConnector_3676);
			types.add(EsbElementTypes.AddressingEndpointOutputConnector_3691);
			types.add(EsbElementTypes.HTTPEndPointOutputConnector_3711);
			types.add(EsbElementTypes.TemplateEndpointOutputConnector_3718);
			types.add(EsbElementTypes.CloudConnectorOutputConnector_3721);
			types.add(EsbElementTypes.CloudConnectorOperationOutputConnector_3724);
			types.add(EsbElementTypes.MessageOutputConnector_3047);
			types.add(EsbElementTypes.MergeNodeOutputConnector_3016);
			types.add(EsbElementTypes.SequencesOutputConnector_3617);
			types.add(EsbElementTypes.DefaultEndPointOutputConnector_3645);
			types.add(EsbElementTypes.AddressEndPointOutputConnector_3648);
			types.add(EsbElementTypes.FailoverEndPointOutputConnector_3651);
			types.add(EsbElementTypes.FailoverEndPointWestOutputConnector_3652);
			types.add(EsbElementTypes.RecipientListEndPointOutputConnector_3698);
			types.add(EsbElementTypes.RecipientListEndPointWestOutputConnector_3699);
			types.add(EsbElementTypes.WSDLEndPointOutputConnector_3655);
			types.add(EsbElementTypes.LoadBalanceEndPointOutputConnector_3658);
			types.add(EsbElementTypes.LoadBalanceEndPointWestOutputConnector_3659);
			types.add(EsbElementTypes.HTTPEndPointOutputConnector_3714);
			types.add(EsbElementTypes.TemplateEndpointOutputConnector_3727);
			types.add(EsbElementTypes.APIResourceOutputConnector_3671);
			types.add(EsbElementTypes.APIResourceOutSequenceOutputConnector_3730);
			types.add(EsbElementTypes.ComplexEndpointsOutputConnector_3679);
		}
		return types;
	}

	/**
	 * @generated
	 */
	public class EastPointerFigure extends EastPointerShape {

		/**
		 * @generated
		 */
		public EastPointerFigure() {
			this.setBackgroundColor(THIS_BACK);
			this.setPreferredSize(new Dimension(getMapMode().DPtoLP(12), getMapMode().DPtoLP(10)));
		}

	}

	public boolean isSelectable() {
		return false;
	}

	/**
	 * @generated
	 */
	static final Color THIS_BACK = new Color(null, 50, 50, 50);

}


text:
import { DynamoDBStorageHandler } from './../../src/index'

describe('Storage handler', () => {

  describe('Test methods provided by DynamoDB storage handler.', () => {
    it('It should shandle schemas with missing table names', (done) => {
      let erros = []
      let entityTypeId = 'test'
      let schemaKey = 'testSchemaKey'
      let tablePrefix = 'tablePrefixTest_'

      let handler = new DynamoDBStorageHandler({
        entityTypeId: entityTypeId,
        tablePrefix: tablePrefix,
        schemaData: [
          {
            schema: {
              schemaKey: `${schemaKey}_row_0`
            }
          },
          {
            title: 'This is not valid schema, it will be dropped.'
          },
          {
            schema: {
              schemaKey:`${schemaKey}_row_1`
            }
          }
        ]
      })

      if (handler.getStorageTablePrefix() != tablePrefix) {
        return done(new Error('Storage backend table prefix was not expected'))
      }

      if (handler.getStorageTableName() != `${tablePrefix}${entityTypeId}`) {
        return done(new Error('Storage backend table name was not prefixed as expected'))
      }

      let schemas = handler.getSchemas()

      if (!schemas || schemas.length != 2) {
        return done(new Error('Schema length doesn\'t match'))
      }

      schemas.forEach((schema, index) => {
        if (schema.TableName != `${tablePrefix}${entityTypeId}`) {
          erros.push(new Error('Schema table name is not expected.'))
        }

        if (schema.schemaKey != `${schemaKey}_row_${index}`) {
          erros.push(new Error('Schema key doesn\'t match.'))
        }
      })

      if (erros.length) {
        done(erros.pop())
      } else {
        done()
      }
    })
  })

  describe('Test methods provided by DynamoDB storage handler.', () => {
    it('It should handle schemas with predefined table names', (done) => {
      let erros = []
      let entityTypeId = 'test'
      let tablePrefix = 'tablePrefixTest_'
      let tableName = 'testTableName'

      let handler = new DynamoDBStorageHandler({
        entityTypeId: entityTypeId,
        tablePrefix: tablePrefix,
        schemaData: [
          {
            schema: {
              TableName: `${tableName}_row_0`
            }
          },
          {
            title: 'This is not valid schema, it will be dropped.'
          },
          {
            schema: {
              TableName: `${tableName}_row_1`
            }
          }
        ]
      })

      if (handler.getStorageTablePrefix() != tablePrefix) {
        return done(new Error('Storage backend table prefix was not expected'))
      }

      if (handler.getStorageTableName() != `${tablePrefix}${entityTypeId}`) {
        return done(new Error('Storage backend table name was not prefixed as expected'))
      }

      const schemas = handler.getSchemas()

      if (!schemas || schemas.length != 2) {
        return done(new Error('Schema length doesn\'t match'))
      }

      schemas.forEach((schema, index) => {
        if (schema.TableName != `${tablePrefix}${tableName}_row_${index}`) {
          erros.push(new Error('Schema table name is not expected.'))
        }
      })

      if (erros.length) {
        done(erros.pop())
      } else {
        done()
      }
    })
  })
})