text:
package API;

import java.util.ArrayList;
import java.util.List;

import tournament.Tournament.Side;

public class TournamentTree {
	private Node<Match> root;
	private List<Node<Match>> gameList;
	private Side side;

	public TournamentTree(Side side) {
		root = new Node<Match>();
		// root.setParent(finalGame);
		this.side = side;
		gameList = new ArrayList<Node<Match>>();
	}

	public void generateATree(int children) {
		root.setRound(children);
		root.setSide(side);
		createASideChildren(root, children);
	}

	private void createASideChildren(Node<Match> parent, int children) {
		Node<Match> leftChild = new Node<Match>(parent, children - 1, side);
		Node<Match> rightChild = new Node<Match>(parent, children - 1, side);
		while (true) {
			parent.setLeftChild(leftChild);
			parent.setRightChild(rightChild);
			if (leftChild.getRound() > 1) {
				createASideChildren(leftChild, children - 1);
			}
			if (rightChild.getRound() > 1) {
				createASideChildren(rightChild, children - 1);
			}
			break;
		}
	}

	public void generateBTree(int children) {
		Node<Match> dummy = new Node<Match>();
		dummy.setRightChild(new Node<Match>());
		dummy.setRound(children);
		root.setParent(dummy);
		root.setRound(children);
		root.setSide(side);
		createBSideChildren(root, children);
	}

	private void createBSideChildren(Node<Match> parent, int children) {
		while (children != 0) {
			if (parent.getParent().getRightChild() == null) {
				if (children == 1) {
					break;
				}
				Node<Match> leftChild = new Node<Match>(parent, children, side);
				Node<Match> rightChild = new Node<Match>(parent, children, side);
				parent.setRightChild(rightChild);
				createBSideChildren(rightChild, children);
				parent.setLeftChild(leftChild);
				createBSideChildren(leftChild, children);

			} else if (parent.getParent().getRightChild() != null) {
				Node<Match> leftChild = new Node<Match>(parent, children - 1,
						side);
				parent.setLeftChild(leftChild);
				createBSideChildren(leftChild, children - 1);
			}
			break;
		}
	}

	public void insertPlayers(List<Player> playerList, boolean bottemSideFirst) {
		Player p = playerList.get(0);
		if (bottemSideFirst) {
			if (addPlayersRecursively(p, root.getRightChild())) {
				playerList.remove(p);
			}
		}
		while (!playerList.isEmpty()) {
			p = playerList.get(0);
			if (addPlayersRecursively(p, root.getLeftChild())) {
				playerList.remove(p);
				if (!playerList.isEmpty()) {
					p = playerList.get(0);
				} else {
					break;
				}
			}
			if (addPlayersRecursively(p, root.getRightChild())) {
				playerList.remove(p);
			}
		}
	}

	private boolean addPlayersRecursively(Player p, Node<Match> parent) {
		Node<Match> game = parent;
		while (game.getLeftChild() != null) {
			game = game.getLeftChild();
		}
		if (newPlayerCorrection(game, p)) {
			return true;
		}
		game = parent;
		while (game.getRightChild() != null) {
			game = game.getRightChild();
		}
		if (newPlayerCorrection(game, p)) {
			return true;
		}
		if (parent.getLeftChild() != null) {
			if (addPlayersRecursively(p, parent.getLeftChild())) {
				return true;
			}
		}
		if (parent.getRightChild() != null) {
			if (addPlayersRecursively(p, parent.getRightChild())) {
				return true;
			}
		}
		return false;

	}

	private boolean newPlayerCorrection(Node<Match> game, Player p) {
		if ((game.getSibling().getMatch().getPlayerOne() != null)
				&& (game.getSibling().getMatch().getPlayerTwo() != null)) {
			if (game.getMatch().getPlayerOne() == null) {
				game.getMatch().setPlayerOne(p);
				return true;
			} else if (game.getMatch().getPlayerTwo() == null) {
				game.getMatch().setPlayerTwo(p);
				return true;
			}
		} else {
			if (game.getMatch().getPlayerOne() == null
					&& game.getSibling().getMatch().getWinner() == null
					&& game.getSibling().getMatch().getByePlayer() == null) {
				if (game.getSibling().getMatch().getPlayerOne() != null) {
					game.getMatch().setPlayerOne(
							game.getSibling().getMatch().getPlayerOne());
					game.getSibling().getMatch().setPlayerOne(p);
				} else if (game.getSibling().getMatch().getPlayerTwo() != null) {
					game.getMatch().setPlayerOne(
							game.getSibling().getMatch().getPlayerTwo());
					game.getSibling().getMatch().setPlayerTwo(p);

				}
				return true;
			} else if (game.getMatch().getPlayerTwo() == null) {
				if (game.getMatch().getPlayerOne() != null
						&& game.getSibling().getMatch().getWinner() == null
						&& game.getSibling().getMatch().getByePlayer() == null) {
					if (game.getSibling().getMatch().getPlayerOne() != null) {
						game.getMatch().setPlayerTwo(
								game.getSibling().getMatch().getPlayerOne());
						game.getSibling().getMatch().setPlayerOne(p);
					} else if (game.getSibling().getMatch().getPlayerTwo() != null) {
						game.getMatch().setPlayerTwo(
								game.getSibling().getMatch().getPlayerTwo());
						game.getSibling().getMatch().setPlayerTwo(p);

					}
				}
				return true;
			}
		}
		return false;
	}

	public void startPlayers(List<Player> playerList) {
		Player p = playerList.get(0);
		while (!playerList.isEmpty()) {
			p = playerList.get(0);
			if (startPlayersRecursively(p, root.getLeftChild())) {
				playerList.remove(p);
				if (!playerList.isEmpty()) {
					p = playerList.get(0);
				} else {
					break;
				}
			} else {
				break;
			}
			if (startPlayersRecursively(p, root.getRightChild())) {
				playerList.remove(p);
			}
		}
	}

	private boolean startPlayersRecursively(Player p, Node<Match> parent) {
		Node<Match> game = parent;
		while (game.getLeftChild() != null) {
			game = game.getLeftChild();
		}
		if (game.getMatch().getPlayerOne() == null) {
			game.getMatch().setPlayerOne(p);
			return true;
		}

		game = parent;
		while (game.getRightChild() != null) {
			game = game.getRightChild();
		}
		if (game.getMatch().getPlayerOne() == null) {
			game.getMatch().setPlayerOne(p);
			return true;
		}
		if (parent.getLeftChild() != null) {
			if (startPlayersRecursively(p, parent.getLeftChild())) {
				return true;
			}
		}
		if (parent.getRightChild() != null) {
			if (startPlayersRecursively(p, parent.getRightChild())) {
				return true;
			}
		}
		return false;

	}

	/**
	 * depth first search of tournament tree
	 *
	 * @param node
	 * @param round
	 */
	private void findRound(Node<Match> node, int round) {
		Node<Match> left = node.getLeftChild();
		Node<Match> right = node.getRightChild();
		int nodeRound = node.getRound();
		if (nodeRound >= round) {
			if (left != null) {
				findRound(left, round);
			}
			if (right != null) {
				findRound(right, round);
			}

			if (nodeRound == round) {
				gameList.add(node);
			}
		}
	}

	/**
	 * depth first search of tournament tree. Returns an ordered list of the
	 * games
	 *
	 * @param round
	 */
	public List<Node<Match>> getRound(int round) {
		gameList.clear();
		findRound(getRoot(), round);
		return gameList;
	}

	public String printTree(Node<Match> node) {
		Node<Match> left = node.getLeftChild();
		Node<Match> right = node.getRightChild();
		String tree = "";
		if (left != null) {
			tree += printTree(left);
			if (left.getMatch().getPlayerOne() != null
					&& left.getMatch().getPlayerTwo() != null
					&& left.getMatch().getWinner() == null) {
				tree += "Round= " + left.getRound() + "Side= " + left.getSide()
						+ " PlayerOne= "
						+ left.getMatch().getPlayerOne().getName()
						+ " PlayerTwo= "
						+ left.getMatch().getPlayerTwo().getName() + "\n";
			}
		}
		if (right != null) {
			tree += printTree(right);
			if (right.getMatch().getPlayerOne() != null
					&& right.getMatch().getPlayerTwo() != null
					&& right.getMatch().getWinner() == null) {
				tree += "Round= " + right.getRound() + right.getRound()
						+ "Side= " + right.getSide() + " PlayerOne= "
						+ right.getMatch().getPlayerOne().getName()
						+ " PlayerTwo= "
						+ right.getMatch().getPlayerTwo().getName() + "\n";
			}
		}
		return tree;
	}

	public List<Node<Match>> findAllPlayableGames(Node<Match> node) {
		Node<Match> left = node.getLeftChild();
		Node<Match> right = node.getRightChild();
		List<Node<Match>> playableGames = new ArrayList<Node<Match>>();
		Match match = node.getMatch();
		if (match.getPlayerOne() != null && match.getPlayerTwo() != null) {

			// if the game has already been won
			if (match.getWinner() == null) {
				playableGames.add(node);
			}
		} else if (match.getPlayerOne() != null || match.getPlayerTwo() != null) {
			if (match.getByePlayer() == null) {
				playableGames.add(node);
			}
		}

		if (left != null) {
			playableGames.addAll(findAllPlayableGames(node.getLeftChild()));
		}
		if (right != null) {
			playableGames.addAll(findAllPlayableGames(node.getRightChild()));
		}
		return playableGames;
	}

	public List<Node<Match>> getAllPlayableGames() {
		return findAllPlayableGames(root);
	}

	private void expandASideChildren(Node<Match> parent) {
		Node<Match> leftChild = parent.getLeftChild();
		Node<Match> rightChild = parent.getRightChild();

		if (leftChild == null && rightChild == null) {
			createASideChildren(parent, 2);
			if (parent.getMatch().getWinner() == null
					&& parent.getMatch().getByePlayer() == null) {
				parent.getLeftChild().getMatch()
						.setPlayerOne(parent.getMatch().getPlayerOne());
				parent.getRightChild().getMatch()
						.setPlayerOne(parent.getMatch().getPlayerTwo());
				parent.setMatch(new Match());
			}
		} else {
			expandASideChildren(leftChild);
			expandASideChildren(rightChild);
		}
		parent.setRound(parent.getRound() + 1);
	}

	public void expandASide() {
		expandASideChildren(root);
	}

	private void expandBSideChildren(Node<Match> parent) {
		Node<Match> leftChild = parent.getLeftChild();
		Node<Match> rightChild = parent.getRightChild();

		if (leftChild == null && rightChild == null) {
			createBSideChildren(parent, 2);
			if (parent.getMatch().getWinner() == null
					&& parent.getMatch().getByePlayer() == null) {
				parent.getLeftChild().getLeftChild().getMatch()
						.setPlayerOne(parent.getMatch().getPlayerOne());
				parent.getRightChild().getLeftChild().getMatch()
						.setPlayerOne(parent.getMatch().getPlayerTwo());
				parent.setMatch(new Match());
			}
		} else {
			expandBSideChildren(leftChild);
			if (rightChild != null) {
				expandBSideChildren(rightChild);
			}
		}
		parent.setRound(parent.getRound() + 1);
	}

	public void expandBSide() {
		expandBSideChildren(root);
	}

	public Node<Match> getRoot() {
		return root;
	}

	public void setRoot(Node<Match> root) {
		this.root = root;
	}

	public int size() {
		return (size(getRoot()));
	}

	private int size(Node<Match> node) {
		if (node == null)
			return (0);
		else {
			return (size(node.getLeftChild()) + 1 + size(node.getRightChild()));
		}
	}

	public static class Node<T> {
		private Match match;
		private Node<T> parent;
		private Node<T> leftChild;
		private Node<T> rightChild;
		private Node<T> cousin;
		private Node<T> sibling;
		private boolean wasDoubles;

		public boolean isWasDoubles() {
			return wasDoubles;
		}

		public void setWasDoubles(boolean wasDoubles) {
			this.wasDoubles = wasDoubles;
		}

		public Node<T> getSibling() {
			return sibling;
		}

		public void setSibling(Node<T> sibling) {
			this.sibling = sibling;
		}

		private int round;
		private Side side;

		public Side getSide() {
			return side;
		}

		public void setSide(Side side) {
			this.side = side;
		}

		public Node<T> getCousin() {
			return cousin;
		}

		public void setCousin(Node<T> cousin) {
			this.cousin = cousin;
		}

		public Node() {
			match = new Match();
		}

		public Node(Node<T> parent, int round, Side side) {
			this.parent = parent;
			this.round = round;
			this.side = side;
			match = new Match();
		}

		public boolean hasPlayableChildren() {
			return checkChildren(this);
		}

		private boolean checkChildren(Node<T> node) {
			if (node.leftChild != null) {
				if ((node.leftChild.match.getPlayerOne() != null || node.leftChild.match
						.getPlayerTwo() != null)
						&& (node.leftChild.match.getWinner() == null)
						&& (node.leftChild.match.getByePlayer() == null)) {
					return true;
				} else {
					if (checkChildren(node.leftChild)) {
						return true;
					}
				}
			}
			if (node.rightChild != null) {
				if ((node.rightChild.match.getPlayerOne() != null || node.rightChild.match
						.getPlayerTwo() != null)
						&& ((node.rightChild.match.getWinner() == null) && (node.rightChild.match
								.getByePlayer() == null))) {
					return true;
				} else {
					return checkChildren(node.rightChild);
				}
			}

			return false;

		}

		public boolean hasPlayableCousin() {
			if (cousin != null) {
				if (checkChildren(cousin)
						|| ((cousin.getMatch().getPlayerOne() != null
								&& cousin.getMatch().getPlayerTwo() != null && cousin
								.getMatch().getWinner() == null) && cousin
								.getMatch().getByePlayer() == null)
						|| ((cousin.getSibling().getMatch().getPlayerOne() != null
								&& cousin.getSibling().getMatch()
										.getPlayerTwo() != null && cousin
								.getSibling().getMatch().getWinner() == null) && cousin
								.getSibling().getMatch().getByePlayer() == null)) {
					return true;
				} else
					return false;
			} else
				return false;
		}

		public Match getMatch() {
			return match;
		}

		public void setMatch(Match match) {
			this.match = match;
		}

		public Node<T> getParent() {
			return parent;
		}

		public void setParent(Node<T> parent) {
			this.parent = parent;
		}

		public Node<T> getLeftChild() {
			return leftChild;
		}

		public void setLeftChild(Node<T> leftChild) {
			this.leftChild = leftChild;
		}

		public Node<T> getRightChild() {
			return rightChild;
		}

		public void setRightChild(Node<T> rightChild) {
			this.rightChild = rightChild;
		}

		public void setRound(int round) {
			this.round = round;
		}

		public int getRound() {
			return round;
		}
	}
}


text:
<?php

namespace IBM\MTMBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use IBM\MTMBundle\Services\CustomerService;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use IBM\MTMBundle\Form\CustomerType;
use IBM\MTMBundle\Entity\Customer;

class CustomerController extends Controller
{
    public function setStatusAction($account)
    {
    	$customerService = $this->get('ibmmtm.customerservice');
    	$status = $customerService->setCustomerStatus($account);

    	$this->get('session')->getFlashBag()->add('success','The account has been '.$status);
    	return $this->redirect($this->generateUrl('customer'));
    }

    public function indexAction(Request $request)
    {
    	$query = $this->getDoctrine()->getManager()
    		->getRepository('IBMMTMBundle:Customer')
    		->createQueryBuilder('c');

    	$filtreField = $request->query->get('filterField');
    	$filtreValue = $request->query->get('filterValue');
    	if($filtreField && $filtreValue)
    		$query = $query->where($filtreField." LIKE '%".$filtreValue."%'");

    	$paginator  = $this->get('knp_paginator');
    	$pagination = $paginator->paginate(
    			$query,
    			$this->get('request')->query->get('page', 1)/*page number*/,
    			10/*limit per page*/
    	);

    	return $this->render('IBMMTMBundle:Customer:index.html.twig', array('pagination' => $pagination,
    				'filtres' => array('c.account' => 'Account',
    					'c.status' => 'Status',
    					'c.firstName' => 'First name',
    					'c.lastName' => 'Last name',
    					'c.city' => 'City',
    					'c.address' => 'Address',
    					'c.state' => 'State')));
    }

    public function newAction(Request $request)
    {
    	$form = $this->createForm('customer_type', new Customer(), array('action' => $this->generateUrl('customer_create')));
    	return $this->render('IBMMTMBundle:Customer:new.html.twig', array('form' => $form->createView()));
    }

    public function createAction(Request $request)
    {
	    	$customerService = $this->get('ibmmtm.customerservice');
	    	return $customerService->createCustomer($request, $this->container->get('security.encoder_factory'));
    }

    public function editAction(Request $request, $account)
    {
    	$customerService = $this->get('ibmmtm.customerservice');
    	return $customerService->editCustomer($request, $account);
    }

    public function deleteAction(Request $request, $account)
    {
    	$customerService = $this->get('ibmmtm.customerservice');
    	return $customerService->deleteCustomer($request, $account);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
require_once "open_basedir.inc";
test_open_basedir("is_link");
?>


text:
/**
* @file
* Local javascript file: 1001_addon/assets/snippets/tuto04-multiselist/lang/js/english.js
*/

// ############################################################
// ############################################################
// ############################################################
// Init:
$(document).ready(init_document);	// when the document is ready (using the jquery library)
function init_document ()
{
	// Input action
	var temp_insert_id = dco_get_temp_insert_id ();
	select_empty_ajax(temp_insert_id);
	$("#insert_button")
	.button()			// uses the jQueryUI in order to create a nice button.
	.click(insert_ajax);	// attach a function to the click event.

	// Display
	select_ajax();

	// Write action
	$("#update_button")
	.button()			// uses the jQueryUI in order to create a nice button.
	.click(update_ajax);	// attach a function to the click event.

	// Delete action
	$("#delete_button")
	.button()			// uses the jQueryUI in order to create a nice button.
	.click(delete_ajax);	// attach a function to the click event.
}

// ############################################################
// ############################################################
// ############################################################
// Ajax call to the server responding page for

/*
* This function draws the insert form depending on your datamalico configuraiton (See the "Tuto 2 - Datamalico configuration")
*/
function select_empty_ajax(temp_insert_id)
{
	console.log("select_empty_ajax() - " + temp_insert_id);

	mil_ajax ({
		form_id: "insert_form"
		, url: window.location.protocol + "//" + window.location.hostname + "/1001_addon/assets/snippets/tuto04-multiselist/server.select_empty.ajax.php"
		, data: {
			temp_insert_id: {
				field: "starwars_data_character.char_id"
				, value: temp_insert_id
			}
		}
		, success: on_success
	});

	function on_success (ajaxReturn, textStatus, jqXHR)
	{
		//if (!mil_ajax_debug (ajaxReturn, textStatus, jqXHR, "div_debug_display")) return;

		// ####################
		// WORK for the entity itself:
		if (
			ajaxReturn.character.metadata.returnCode == "1_RESULT_DISPLAYED" ||
			ajaxReturn.character.metadata.returnCode == "X_RESULTS_DISPLAYED"
		)
		{
			$("#input_div")
			.datamalico(ajaxReturn.character)	// warning, here you must give the result of the datamalico_server_dbquery::output resulting of the datamalico_server_dbquery::select_empty()
			.display({
				field_name : "fullname"
				, row_num: 1
			});

			/*
			$("#input_div")
			.datamalico(ajaxReturn.character)	// warning, here you must give the result of the datamalico_server_dbquery::output resulting of the datamalico_server_dbquery::select_empty()
			.display_datagrid({			// display_datagrid action with a simple configuration See the documentation for more information.
			template: {
			grid: '

'
			, row: '

'
			, cell: '	'
			, header_cell: '	'
			}
			});
			*/
		}
		else
		{
			alert (ajaxReturn.character.metadata.returnMessage);
		}

		// ####################
		// WORK for the multiselist:
		if (
			ajaxReturn.attribute.metadata.returnCode == "1_RESULT_DISPLAYED" ||
			ajaxReturn.attribute.metadata.returnCode == "X_RESULTS_DISPLAYED"
		)
		{
			//$("#input_multiselist_div").datamalico(ajaxReturn.attribute).display({field_name : "fullname", row_num: 1});

			$("#input_multiselist_div")
			.datamalico(ajaxReturn.attribute)	// warning, here you must give the result of the datamalico_server_dbquery::output resulting of the datamalico_server_dbquery::select_empty()
			.display_datagrid({			// display_datagrid action with a simple configuration See the documentation for more information.
				template: {
					grid: '

'
					, row: '

'
					, cell: '	'
					//, header_cell: '	'
				}
				, columns_order: ["char_id", "attribute"]
			});
		}
		else
		{
			alert (ajaxReturn.attribute.metadata.returnMessage);
		}
	}
}

/*
* This function sends your data in order to insert the new record you create.
*/
function insert_ajax ()
{
	//console.log("insert_ajax()");

	mil_ajax ({
		form_id: "insert_form"
		, url: window.location.protocol + "//" + window.location.hostname + "/1001_addon/assets/snippets/tuto04-multiselist/server.delupsert.ajax.php"
		, success: on_success
	});

	function on_success (ajaxReturn, textStatus, jqXHR)
	{
		//if (!mil_ajax_debug (ajaxReturn, textStatus, jqXHR, "div_debug_display")) return;

		// ####################
		// WORK
		if (ajaxReturn.metadata.returnCode === "API_HAS_BEEN_CALLED")
		{
			select_ajax (); // refresh the grid from the DB itself

			$("body").datamalico(ajaxReturn).display_errors(); // displays, but alos hides previous errors if no more error.
		}
		else if (ajaxReturn.metadata.returnCode === "THERE_ARE_INVALID_DATA")
		{
			$("body")		// body, in order to find all potential error message zones within it.
			.datamalico(ajaxReturn)	// datamalico object creation.
			.display_errors({
				display_error_msg: "before" // displays the error message before the field.
			});
		}
	}
}

/*
* This function displays the grid where you can make changes:
*/
function select_ajax ()
{
	mil_ajax ({	// you can use any other ajax method to reach your server page. I'm using my own mil_ajax() method. See the mil_ library for more information.
		data: {	any_variable: 58 }
		, url: window.location.protocol + "//" + window.location.hostname + "/1001_addon/assets/snippets/tuto04-multiselist/server.select.ajax.php"	// the path to reach your ajax responding server page which returns a json result of a mysql query.
		, success: on_success					// links the success case with the below function.
	});

	function on_success (ajaxReturn, textStatus, jqXHR)
	{
		//if (!mil_ajax_debug (ajaxReturn, textStatus, jqXHR, "div_debug_display")) return;

		// ####################
		// WORK for the entity itself:
		if (
			ajaxReturn.character.metadata.returnCode == "1_RESULT_DISPLAYED" ||
			ajaxReturn.character.metadata.returnCode == "X_RESULTS_DISPLAYED"
		)
		{

			// #######################################
			// display_datagrid()
			$('#write_div')			// jquery selector
			.datamalico(ajaxReturn.character)		// datamalico obj creation with the server result set (json)
			.display_datagrid({		// display_datagrid action with a simple configuration See the documentation for more information.
				template: {
					grid: '

'
					, row: '

'
					, cell: '	'
					, header_cell: '	'
				}
			});

			makeup_rows ('#write_div tr.row_class'); // put a make-up to rows
		}

		// ####################
		// WORK for the multiselist:
		if (
			ajaxReturn.attribute.metadata.returnCode == "1_RESULT_DISPLAYED" ||
			ajaxReturn.attribute.metadata.returnCode == "X_RESULTS_DISPLAYED"
		)
		{
			//$("#input_multiselist_div").datamalico(ajaxReturn.attribute).display({field_name : "fullname", row_num: 1});

			$("#write_multiselist_div")
			.datamalico(ajaxReturn.attribute)	// warning, here you must give the result of the datamalico_server_dbquery::output resulting of the datamalico_server_dbquery::select_empty()
			.display_datagrid({			// display_datagrid action with a simple configuration See the documentation for more information.
				template: {
					grid: '

'
					, row: '

'
					, cell: '	'
					//, header_cell: '	'
				}
				, columns_order: ["char_id", "attribute"]
			});
		}
	}
}

/*
* This function sends your modifications on existing records.
*/
function update_ajax ()
{
	//console.log("update_ajax()");

	mil_ajax ({
		form_id: "update_form"
		, url: window.location.protocol + "//" + window.location.hostname + "/1001_addon/assets/snippets/tuto04-multiselist/server.delupsert.ajax.php"
		, success: on_success
	});

	function on_success (ajaxReturn, textStatus, jqXHR)
	{
		//if (!mil_ajax_debug (ajaxReturn, textStatus, jqXHR, "div_debug_display")) return;

		// ####################
		// WORK
		if (ajaxReturn.metadata.returnCode === "API_HAS_BEEN_CALLED")
		{
			select_ajax (); // refresh the grid from the DB itself
		}
		else if (ajaxReturn.metadata.returnCode === "THERE_ARE_INVALID_DATA")
		{
			ajaxReturn.display_error_msg = "before";	// "before", "after"
			dco_display_errors (ajaxReturn);
		}
	}
}

/*
* This function sends data in order to make some delete.
*/
function delete_ajax ()
{
	console.log("delete_ajax()");

	var data_without_sqlfields_for_delete = get_update_form_data_and_prepare_for_deletion();
	//console.log(data_without_sqlfields_for_delete);

	mil_ajax ({
		data: data_without_sqlfields_for_delete
		, url: window.location.protocol + "//" + window.location.hostname + "/1001_addon/assets/snippets/tuto04-multiselist/server.delupsert.ajax.php"
		, success: on_success
	});

	function on_success (ajaxReturn, textStatus, jqXHR)
	{
		//if (!mil_ajax_debug (ajaxReturn, textStatus, jqXHR, "div_debug_display")) return;

		// ####################
		// WORK
		if (ajaxReturn.metadata.returnCode === "API_HAS_BEEN_CALLED")
		{
			select_ajax (); // refresh the grid from the DB itself
			alert("All the records tagged with your IP address have been deleted.");
		}
		else if (ajaxReturn.metadata.returnCode === "THERE_ARE_INVALID_DATA")
		{
			ajaxReturn.display_error_msg = "before";	// "before", "after"
			dco_display_errors (ajaxReturn);
		}
	}
}

/*
* This function get data written in HTML fields in the update_form.
* These data are transformed into a JSON format.
* Then, in order to fit the rules of the delupsert concept, fields matching the SQL fields are deleted of the retruned list, so that the server page,
* 	will receive only:
* 	- a SQL table name
* 	- a criteria (the WHERE clause) in order to make a DELETE command.
*/
function get_update_form_data_and_prepare_for_deletion()
{
	var data = $('#update_form').serializeObject();

	for (i in data)
	{
		var pattern = /\[f\]/gi;
		if (pattern.test(i)) delete data[i]; // equivalent to unset()
	}

	return data;
}


text:
package bham

import (
	"fmt"
	"strings"
	"text/template/parse"
)

func (pt *protoTree) compile() {
	cleanName := pt.name
	i := strings.Index(pt.name, ".bham")
	if i >= 0 {
		cleanName = pt.name[:i] + pt.name[i+5:]
	}

	pt.outputTree = newTree(pt.name, cleanName)

	pt.compileToList(pt.outputTree.Root, pt.nodes)
}

func (pt *protoTree) compileToList(arr *parse.ListNode, nodes []protoNode) {
	for _, node := range nodes {
		switch node.identifier {
		case identRaw:
			arr.Nodes = append(arr.Nodes, newTextNode(node.content))
		case identFilter:
			if node.needsRuntimeData() {
			} else {
				content := node.filter.Open + node.filter.Handler(node.content) + node.filter.Close
				arr.Nodes = append(arr.Nodes, newTextNode(content))
			}
		case identExecutable:
			node, err := pt.parseTemplateCode(node.content)
			if err == nil {
				arr.Nodes = append(arr.Nodes, &parse.ActionNode{
					NodeType: parse.NodeAction,
					Pipe:     node,
				})
			} else {
				pt.err = err
			}
		case identTag:
			nodes, err := pt.newStandaloneTag(node.content)
			if err == nil {
				arr.Nodes = append(arr.Nodes, nodes...)
			} else {
				pt.err = err
			}
		case identTagOpen:
			td, c, err := pt.parseTag(node.content)
			if err == nil {
				if td.executableOpen {
					arr.Nodes = append(arr.Nodes, pt.newMaybeTextNode(td.Opening())...)
				} else {
					arr.Nodes = append(arr.Nodes, newTextNode(td.Opening()))
				}
				if c != "" {
					arr.Nodes = append(arr.Nodes, pt.newMaybeTextNode(c)...)
				}
			} else {
				pt.err = err
			}
		case identTagClose:
			td, _, err := pt.parseTag(node.content)
			if err == nil {
				arr.Nodes = append(arr.Nodes, newTextNode(td.Close()))
			} else {
				pt.err = err
			}
		case identText:
			arr.Nodes = append(arr.Nodes, pt.newMaybeTextNode(node.content)...)
		case identIf:
			branching, err := pt.parseTemplateCode(node.content)
			if err == nil {
				in := &parse.IfNode{
					parse.BranchNode{
						NodeType: parse.NodeIf,
						Pipe:     branching,
						List: &parse.ListNode{
							NodeType: parse.NodeList,
						},
						ElseList: &parse.ListNode{
							NodeType: parse.NodeList,
						},
					},
				}
				if len(node.list) > 0 {
					pt.compileToList(in.List, node.list)
				}
				if len(node.elseList) > 0 {
					pt.compileToList(in.ElseList, node.elseList)
				}
				arr.Nodes = append(arr.Nodes, in)
			} else {
				pt.err = err
			}

		case identRange:
			branching, err := pt.parseTemplateCode(node.content)
			if err == nil {
				in := &parse.RangeNode{
					parse.BranchNode{
						NodeType: parse.NodeIf,
						Pipe:     branching,
						List: &parse.ListNode{
							NodeType: parse.NodeList,
						},
						ElseList: &parse.ListNode{
							NodeType: parse.NodeList,
						},
					},
				}
				if len(node.list) > 0 {
					pt.compileToList(in.List, node.list)
				}
				if len(node.elseList) > 0 {
					pt.compileToList(in.ElseList, node.elseList)
				}
				arr.Nodes = append(arr.Nodes, in)
			} else {
				pt.err = err
			}

		case identWith:
			branching, err := pt.parseTemplateCode(node.content)
			if err == nil {
				wn := &parse.WithNode{
					parse.BranchNode{
						NodeType: parse.NodeWith,
						Pipe:     branching,
						List: &parse.ListNode{
							NodeType: parse.NodeList,
						},
						ElseList: &parse.ListNode{
							NodeType: parse.NodeList,
						},
					},
				}
				if len(node.list) > 0 {
					pt.compileToList(wn.List, node.list)
				}
				arr.Nodes = append(arr.Nodes, wn)
			} else {
				pt.err = err
			}

		default:
			fmt.Println(node.identifier)
			fmt.Println(node.content)
		}
	}
}


text:
package org.pmiops.workbench.reporting;

import java.util.Set;
import org.pmiops.workbench.model.ReportingSnapshot;

public interface ReportingVerificationService {
  boolean verifyAndLog(ReportingSnapshot reportingSnapshot);

  /** Verifies batched uploaded result for each table. Returns {@code true} if all are verified. */
  boolean verifyBatchesAndLog(Set<String> batchTables, long captureSnapshotTime);
}


text:
using System.Collections.Generic;

namespace Caelan.FrameworksTest.DTO
{
	public class RoleDTO
	{
		public int Id { get; set; }
		public string Description { get; set; }
		public IEnumerable<UserRoleDTO> UserRoles { get; set; }
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Class wdb.metadata.WDBObject
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
wdb.metadata.WDBObject

Packages that use WDBObject

wdb

wdb.metadata

wdb.parser

Uses of WDBObject in wdb

Methods in wdb that return WDBObject

 WDBObject
SleepyCatDataAdapter.getObject(java.lang.String className,
          java.lang.Integer Uid)

Methods in wdb that return types with arguments of type WDBObject

 java.util.ArrayList<WDBObject>
SleepyCatDataAdapter.getObjects(IndexDef index,
           java.lang.String key)

Methods in wdb with parameters of type WDBObject

private static void
WDB.checkRequiredValues(ClassDef targetClass,
                    WDBObject targetObject,
                    SleepyCatDataAdapter scda)

 void
SleepyCatDataAdapter.putObject(WDBObject object)

private static void
WDB.setDefaultValues(ClassDef targetClass,
                 WDBObject targetObject,
                 SleepyCatDataAdapter scda)

private static void
WDB.setValues(java.util.ArrayList assignmentList,
          WDBObject targetObject,
          SleepyCatDataAdapter scda)

Uses of WDBObject in wdb.metadata

Fields in wdb.metadata with type parameters of type WDBObject

private  java.util.ArrayList<WDBObject>
IndexSelectResult.filteredList

Methods in wdb.metadata that return WDBObject

 WDBObject
WDBObject.getBaseObject(SleepyCatDataAdapter scda)

 WDBObject
WDBObject.getChildObject(java.lang.String subClassName,
               SleepyCatDataAdapter scda)

 WDBObject[]
WDBObject.getEvaObjects(java.lang.String evaName,
              SleepyCatDataAdapter scda)

 WDBObject[]
IndexSelectResult.getFilteredResults(SleepyCatDataAdapter scda,
                   java.util.ArrayList indexes)

 WDBObject
ClassDef.getInstance(int index,
            SleepyCatDataAdapter da)

 WDBObject
WDBObject.getParentObject(java.lang.String superClassName,
                SleepyCatDataAdapter scda)

 WDBObject
SubclassDef.newInstance(WDBObject baseParent,
            SleepyCatDataAdapter scda)

 WDBObject
ClassDef.newInstance(WDBObject parent,
            SleepyCatDataAdapter scda)

 WDBObject[]
ClassDef.search(SimpleNode expression,
       SleepyCatDataAdapter scda)

Methods in wdb.metadata that return types with arguments of type WDBObject

private  java.util.ArrayList<WDBObject>
IndexSelectResult.andFilteredList(java.util.ArrayList<WDBObject> objectsList)

private  java.util.ArrayList<WDBObject>
IndexSelectResult.orFilteredList(java.util.ArrayList<WDBObject> objectsList)

Methods in wdb.metadata with parameters of type WDBObject

 void
WDBObject.addChildObject(WDBObject child)

private  void
WDBObject.addEvaObject(EVA targetEva,
             WDBObject targetEvaObject,
             SleepyCatDataAdapter scda)

 void
WDBObject.addParentObject(WDBObject parent)

 WDBObject
SubclassDef.newInstance(WDBObject baseParent,
            SleepyCatDataAdapter scda)

 WDBObject
ClassDef.newInstance(WDBObject parent,
            SleepyCatDataAdapter scda)

 void
WDBObject.removeChildObject(WDBObject child)

private  java.lang.Boolean
WDBObject.removeEvaObject(EVA targetEva,
                WDBObject targetEvaObject,
                SleepyCatDataAdapter scda)

 void
WDBObject.removeEvaObjects(java.lang.String evaName,
                 java.lang.String targetClass,
                 WDBObject[] targetObjects,
                 SleepyCatDataAdapter scda)

 void
WDBObject.removeParentObject(WDBObject parent)

Method parameters in wdb.metadata with type arguments of type WDBObject

private  java.util.ArrayList<WDBObject>
IndexSelectResult.andFilteredList(java.util.ArrayList<WDBObject> objectsList)

private  java.util.ArrayList<WDBObject>
IndexSelectResult.orFilteredList(java.util.ArrayList<WDBObject> objectsList)

Uses of WDBObject in wdb.parser

Methods in wdb.parser with parameters of type WDBObject

 boolean
True.eval(SleepyCatDataAdapter da,
     WDBObject wdbO)

 boolean
SimpleNode.eval(SleepyCatDataAdapter da,
     WDBObject wdbO)

 boolean
Root.eval(SleepyCatDataAdapter da,
     WDBObject wdbO)

 boolean
Or.eval(SleepyCatDataAdapter da,
     WDBObject wdbO)

 boolean
Not.eval(SleepyCatDataAdapter da,
     WDBObject wdbO)

 boolean
False.eval(SleepyCatDataAdapter da,
     WDBObject wdbO)

 boolean
Cond.eval(SleepyCatDataAdapter da,
     WDBObject wdbO)

 boolean
And.eval(SleepyCatDataAdapter da,
     WDBObject wdbO)

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes


text:
namespace compchem {
  template <class Matrix,
            class Determinant,
            class Inverse,
            class SlaterDeterminantImplementation>
  class SlaterDeterminant {
  public:

    typedef Matrix matrix_type;
    typedef Determinant determinant_functor_type;
    typedef Inverse inverse_functor_type;
    typedef SlaterDeterminantImplementation
            slater_determinant_implementation_type;

    SlaterDeterminant() = default;
    ~SlaterDeterminant() = default;
    SlaterDeterminant(const SlaterDeterminant&) = default;
    SlaterDeterminant(SlaterDeterminant&&) = default;
    SlaterDeterminant& operator=(const SlaterDeterminant&) = default;

    matrix_type
    operator()(const matrix_type& D,
               const matrix_type& V,
               const size_t numSteps,
               const double threshold);
  private:
    slater_determinant_implementation_type _impl;
  };
}

#include <fast_slater/implementation/slater_determinant.cpp>

#endif


text:
-- Ordering system  related alter table script*/

create sequence CATISSUE_ORDER_SEQ;
create sequence CATISSUE_ORDER_ITEM_SEQ;

create table CATISSUE_PATH_CASE_ORDER_ITEM (
   IDENTIFIER number(19,0) not null,
   PATHOLOGICAL_STATUS varchar(255),
   TISSUE_SITE varchar(255),
   SPECIMEN_COLL_GROUP_ID number(19,0),
   primary key (IDENTIFIER)
);

create table CATISSUE_DERIEVED_SP_ORD_ITEM (
   IDENTIFIER number(19,0) not null,
   SPECIMEN_ID number(19,0),
   primary key (IDENTIFIER)
);

create table CATISSUE_NEW_SPEC_ORD_ITEM (
   IDENTIFIER number(19,0) not null,
   SPECIMEN_CLASS varchar(255),
   SPECIMEN_TYPE varchar(255),
   primary key (IDENTIFIER)
);

create table CATISSUE_EXISTING_SP_ORD_ITEM (
   IDENTIFIER number(19,0) not null,
   SPECIMEN_ID number(19,0),
   primary key (IDENTIFIER)
);

create table CATISSUE_SPECIMEN_ORDER_ITEM (
   IDENTIFIER number(19,0) not null,
   ARRAY_ORDER_ITEM_ID number(19,0),
   primary key (IDENTIFIER)
);

create table CATISSUE_EXIST_SP_AR_ORD_ITEM (
   IDENTIFIER number(19,0) not null,
   SPECIMEN_ARRAY_ID number(19,0),
   primary key (IDENTIFIER)
);

create table CATISSUE_NEW_SP_AR_ORDER_ITEM (
   IDENTIFIER number(19,0) not null,
   ARRAY_TYPE_ID number(19,0),
   NAME varchar(255),
   SPECIMEN_ARRAY_ID number(19,0),
   primary key (IDENTIFIER)
);

create table CATISSUE_SP_ARRAY_ORDER_ITEM (
   IDENTIFIER number(19,0) not null,
   primary key (IDENTIFIER)
);

create table CATISSUE_ORDER_ITEM (
   IDENTIFIER number(19,0) not null,
   DESCRIPTION varchar2(500),
   DISTRIBUTED_ITEM_ID number(19,0),
   STATUS varchar(50),
   REQUESTED_QUANTITY double precision,
   ORDER_ID number(19,0),
   primary key (IDENTIFIER)
);

create table CATISSUE_ORDER (
   IDENTIFIER number(19,0) not null,
   COMMENTS varchar2(500),
   DISTRIBUTION_PROTOCOL_ID number(19,0),
   NAME varchar2(500),
   REQUESTED_DATE date,
   STATUS varchar(50),
   primary key (IDENTIFIER)
);

/* extra for catissue_distribution */
 alter table catissue_distribution add ORDER_ID number(19,0);
 alter table catissue_distributed_item add  SPECIMEN_ARRAY_ID number(19,0);
/* extra finished */

alter table CATISSUE_PATH_CASE_ORDER_ITEM add constraint FKBD5029D5F69249F7 foreign key (SPECIMEN_COLL_GROUP_ID) references CATISSUE_SPECIMEN_COLL_GROUP (IDENTIFIER);
alter table CATISSUE_PATH_CASE_ORDER_ITEM add constraint FKBD5029D5BC7298A9 foreign key (IDENTIFIER) references CATISSUE_NEW_SPEC_ORD_ITEM (IDENTIFIER);

alter table CATISSUE_DERIEVED_SP_ORD_ITEM add constraint FK3742152BBC7298A9 foreign key (IDENTIFIER) references CATISSUE_NEW_SPEC_ORD_ITEM (IDENTIFIER);
alter table CATISSUE_DERIEVED_SP_ORD_ITEM add constraint FK3742152B60773DB2 foreign key (SPECIMEN_ID) references CATISSUE_SPECIMEN (IDENTIFIER);

alter table CATISSUE_NEW_SPEC_ORD_ITEM add constraint FK_NW_SPEC_ODR_ITM foreign key (IDENTIFIER) references CATISSUE_SPECIMEN_ORDER_ITEM (IDENTIFIER);

alter table CATISSUE_EXISTING_SP_ORD_ITEM add constraint FKF8B855EEBC7298A9 foreign key (IDENTIFIER) references CATISSUE_SPECIMEN_ORDER_ITEM (IDENTIFIER);
alter table CATISSUE_EXISTING_SP_ORD_ITEM add constraint FKF8B855EE60773DB2 foreign key (SPECIMEN_ID) references CATISSUE_SPECIMEN (IDENTIFIER);

alter table CATISSUE_SPECIMEN_ORDER_ITEM add constraint FK48C3B39FBC7298A9 foreign key (IDENTIFIER) references CATISSUE_ORDER_ITEM (IDENTIFIER);
alter table CATISSUE_SPECIMEN_ORDER_ITEM add constraint FK48C3B39F83505A30 foreign key (ARRAY_ORDER_ITEM_ID) references CATISSUE_NEW_SP_AR_ORDER_ITEM (IDENTIFIER);

alter table CATISSUE_EXIST_SP_AR_ORD_ITEM add constraint FKE3823170BC7298A9 foreign key (IDENTIFIER) references CATISSUE_SP_ARRAY_ORDER_ITEM (IDENTIFIER);
alter table CATISSUE_EXIST_SP_AR_ORD_ITEM add constraint FKE3823170C4A3C438 foreign key (SPECIMEN_ARRAY_ID) references CATISSUE_SPECIMEN_ARRAY (IDENTIFIER);

alter table CATISSUE_NEW_SP_AR_ORDER_ITEM add constraint FKC5C92CCBCE5FBC3A foreign key (ARRAY_TYPE_ID) references CATISSUE_SPECIMEN_ARRAY_TYPE (IDENTIFIER);
alter table CATISSUE_NEW_SP_AR_ORDER_ITEM add constraint FKC5C92CCBBC7298A9 foreign key (IDENTIFIER) references CATISSUE_SP_ARRAY_ORDER_ITEM (IDENTIFIER);
alter table CATISSUE_NEW_SP_AR_ORDER_ITEM add constraint FKC5C92CCBC4A3C438 foreign key (SPECIMEN_ARRAY_ID) references CATISSUE_SPECIMEN_ARRAY (IDENTIFIER);

alter table CATISSUE_SP_ARRAY_ORDER_ITEM add constraint FK_SP_ARAY_ODR_ITM foreign key (IDENTIFIER) references CATISSUE_ORDER_ITEM (IDENTIFIER);

alter table CATISSUE_ORDER_ITEM add constraint FKB501E88060975C0B foreign key (DISTRIBUTED_ITEM_ID) references CATISSUE_DISTRIBUTED_ITEM (IDENTIFIER);
alter table CATISSUE_ORDER_ITEM add constraint FKB501E880783867CC foreign key (ORDER_ID) references CATISSUE_ORDER (IDENTIFIER);
alter table CATISSUE_ORDER add constraint FK543F22B26B1F36E7 foreign key (DISTRIBUTION_PROTOCOL_ID) references CATISSUE_DISTRIBUTION_PROTOCOL (IDENTIFIER);

alter table CATISSUE_DISTRIBUTION add constraint FK54276680783867CC foreign key (ORDER_ID) references CATISSUE_ORDER (IDENTIFIER);
alter table CATISSUE_DISTRIBUTED_ITEM add constraint FKA7C3ED4BC4A3C438 foreign key (SPECIMEN_ARRAY_ID) references CATISSUE_SPECIMEN_ARRAY;

-- csm_inserData_Oracle.sql */
-------Ordering System------*/
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Order','Order Object','edu.wustl.catissuecore.domain.OrderDetails',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'OrderItem','OrderItem Object','edu.wustl.catissuecore.domain.OrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Derived Specimen Order Item','Derived Specimen Order Item Object','edu.wustl.catissuecore.domain.DerivedSpecimenOrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Existing Specimen Array Order Item','Existing Specimen Array Order Item Object','edu.wustl.catissuecore.domain.ExistingSpecimenArrayOrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Existing Specimen Order Item','Existing Specimen Order Item Object','edu.wustl.catissuecore.domain.ExistingSpecimenOrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'New Specimen Array Order Item','New Specimen Array Order Item Object','edu.wustl.catissuecore.domain.NewSpecimenArrayOrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'New Specimen Order Item','New Specimen Order Item Object','edu.wustl.catissuecore.domain.NewSpecimenOrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Pathological Case Order Item','Pathological Case Order Item Object','edu.wustl.catissuecore.domain.PathologicalCaseOrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Specimen Array Order Item','Specimen Array Order Item Object','edu.wustl.catissuecore.domain.SpecimenArrayOrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Specimen Order Item','Specimen Order Item Object','edu.wustl.catissuecore.domain.SpecimenOrderItem',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;

INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'edu.wustl.catissuecore.action.RequestListAction','edu.wustl.catissuecore.action.RequestListAction','edu.wustl.catissuecore.action.RequestListAction',NULL,NULL,1,TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='edu.wustl.catissuecore.action.RequestListAction'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='edu.wustl.catissuecore.action.RequestListAction'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='edu.wustl.catissuecore.action.RequestListAction'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;

-- giving create priviledge to scientist for order -start*/
INSERT INTO CSM_ROLE SELECT MAX(ROLE_ID)+1,'CREATE_ONLY','Create only role',1,0,TO_DATE('0001-01-01','yyyy-mm-dd') FROM CSM_ROLE;
INSERT INTO CSM_ROLE_PRIVILEGE SELECT MAX(a.ROLE_PRIVILEGE_ID)+1,MAX(b.ROLE_ID) ,1,TO_DATE('0001-01-01','yyyy-mm-dd') FROM CSM_ROLE_PRIVILEGE a,CSM_ROLE b;
INSERT INTO CSM_PROTECTION_GROUP SELECT MAX(PROTECTION_GROUP_ID)+1,'SCIENTIST_PROTECTION_GROUP',NULL,1,0,TO_DATE('0001-01-01','yyyy-mm-dd'),NULL FROM CSM_PROTECTION_GROUP;
alter sequence CSM_PROTECTIO_PROTECTION_G_SEQ increment by 2;
select  CSM_PROTECTIO_PROTECTION_G_SEQ.nextval from dual;
alter sequence CSM_PROTECTIO_PROTECTION_G_SEQ increment by 1;

INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Order'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='OrderItem'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Derived Specimen Order Item'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Existing Specimen Array Order Item'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Existing Specimen Order Item'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='New Specimen Array Order Item'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='New Specimen Order Item'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Pathological Case Order Item'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Specimen Array Order Item'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,(SELECT MAX(PROTECTION_GROUP_ID) FROM CSM_PROTECTION_GROUP),(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Specimen Order Item'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;

INSERT INTO CSM_USER_GROUP_ROLE_PG SELECT MAX(USER_GROUP_ROLE_PG_ID)+1 ,NULL,4,MAX(c.ROLE_ID),MAX(b.protection_group_id),TO_DATE('0001-01-01','yyyy-mm-dd') FROM CSM_USER_GROUP_ROLE_PG a,CSM_PROTECTION_GROUP b ,CSM_ROLE c;
select CSM_USER_GROU_USER_GROUP_R_SEQ.NEXTVAL from dual;
-- giving create priviledge to scientist for order -finish*/

	---------Ordering System---------*/
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Order'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Order'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Order'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='OrderItem'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='OrderItem'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='OrderItem'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Derived Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Derived Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Derived Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Existing Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Existing Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Existing Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Existing Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Existing Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Existing Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='New Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='New Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='New Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='New Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='New Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='New Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Pathological Case Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Pathological Case Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Pathological Case Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Specimen Array Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Specimen Order Item'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;

-- cde_dummydata_common.sql */

--******Ordering System******/
INSERT INTO CATISSUE_CDE VALUES ( '4284','Request Status','Statuses for the ordered requests',1.0,NULL);
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5000,'All',NULL,'4284');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5001,'New',NULL,'4284');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5002,'Pending',NULL,'4284');

INSERT INTO CATISSUE_CDE VALUES ( '4285','Requested Items Status','Statuses for the individual elements in the ordered request',1.0,NULL);
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5005,'New',NULL,'4285');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5006,'Pending - Protocol Review',NULL,'4285');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5007,'Pending - For Distribution',NULL,'4285');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5012,'Distributed',NULL,'4285');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5008,'Pending - Specimen Preparation',NULL,'4285');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5009,'Rejected - Inappropriate Request',NULL,'4285');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5010,'Rejected - Specimen Unavailable',NULL,'4285');
INSERT INTO CATISSUE_PERMISSIBLE_VALUE (IDENTIFIER, VALUE, PARENT_IDENTIFIER, PUBLIC_ID) VALUES(5011,'Rejected - Unable to Create',NULL,'4285');

-- initDB_inser_Common.sql */
--Ordering System*/
INSERT INTO CATISSUE_QUERY_TABLE_DATA  SELECT MAX(TABLE_ID)+1, 'CATISSUE_ORDER', 'Order', 'OrderDetails', 2,NULL FROM CATISSUE_QUERY_TABLE_DATA ;
-- order system finish */

-- ordering changes finish */

----------Consent Tracking-------*/
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Consent Tier','ConsentTier Object','edu.wustl.catissuecore.domain.ConsentTier',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Consent Tier Response','Consent Tier Response Object','edu.wustl.catissuecore.domain.ConsentTierResponse',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Consent Tier Status','Consent Tier Status Object','edu.wustl.catissuecore.domain.ConsentTierStatus',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;

----------Consent Tracking-------*/
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier Response'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier Response'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier Response'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier Status'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier Status'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='Consent Tier Status'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;

--Consent Tracking related drop, create and add foreign key scripts.*/
--drop table CATISSUE_CONSENT_TIER_RESPONSE;
--drop table CATISSUE_CONSENT_TIER_STATUS;
--drop table CATISSUE_CONSENT_TIER;

CREATE TABLE CATISSUE_CONSENT_TIER_RESPONSE (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   RESPONSE VARCHAR(255),
   CONSENT_TIER_ID NUMBER(19,0),
   COLL_PROT_REG_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_CONSENT_TIER_STATUS (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   CONSENT_TIER_ID NUMBER(19,0),
   STATUS VARCHAR(255),
   SPECIMEN_ID NUMBER(19,0),
   SPECIMEN_COLL_GROUP_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_CONSENT_TIER (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   STATEMENT VARCHAR2(500),
   COLL_PROTOCOL_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);

ALTER TABLE CATISSUE_CONSENT_TIER_RESPONSE  ADD constraint FKFB1995FD4AD77FCB foreign key (COLL_PROT_REG_ID) references CATISSUE_COLL_PROT_REG (IDENTIFIER);
ALTER TABLE CATISSUE_CONSENT_TIER_RESPONSE  ADD constraint FKFB1995FD17B9953 foreign key (CONSENT_TIER_ID) references CATISSUE_CONSENT_TIER (IDENTIFIER);
ALTER TABLE CATISSUE_CONSENT_TIER_STATUS  ADD constraint FKF74E94AEF69249F7 foreign key (SPECIMEN_COLL_GROUP_ID) references CATISSUE_SPECIMEN_COLL_GROUP (IDENTIFIER);
ALTER TABLE CATISSUE_CONSENT_TIER_STATUS  ADD constraint FKF74E94AE60773DB2 foreign key (SPECIMEN_ID) references CATISSUE_SPECIMEN (IDENTIFIER);
ALTER TABLE CATISSUE_CONSENT_TIER_STATUS  ADD constraint FKF74E94AE17B9953 foreign key (CONSENT_TIER_ID) references CATISSUE_CONSENT_TIER (IDENTIFIER);
ALTER TABLE CATISSUE_CONSENT_TIER  ADD constraint FK51725303E36A4B4F foreign key (COLL_PROTOCOL_ID) references CATISSUE_COLLECTION_PROTOCOL (IDENTIFIER);

CREATE sequence CATISSUE_CONSENT_TIER_RES_SEQ;
CREATE sequence CATISSUE_CONSENT_TIER_STAT_SEQ;
CREATE sequence CATISSUE_CONSENT_TIER_SEQ;

------caTissue tables changed for and consent tracking----- */
--alter table CATISSUE_COLL_PROT_REG drop constraint FK5EB25F13A0FF79D4;
ALTER TABLE CATISSUE_COLLECTION_PROTOCOL ADD  UNSIGNED_CONSENT_DOC_URL VARCHAR2(500);
ALTER TABLE CATISSUE_COLL_PROT_REG ADD  (CONSENT_SIGN_DATE DATE,CONSENT_DOC_URL VARCHAR2(500),CONSENT_WITNESS NUMBER(19,0));
ALTER TABLE CATISSUE_COLL_PROT_REG ADD constraint FK5EB25F13A0FF79D4 foreign key (CONSENT_WITNESS) references CATISSUE_USER (IDENTIFIER);

-- ------------------------New Table entry For ConsentWithdrawal ---------- Mandar : 18-Jan-07 -------------start */
INSERT INTO CATISSUE_QUERY_TABLE_DATA  SELECT MAX(TABLE_ID)+1, 'CATISSUE_RETURN_EVENT_PARAM', 'Return Event Parameters', 'ReturnEventParameters',2,2 FROM CATISSUE_QUERY_TABLE_DATA;
INSERT INTO CATISSUE_INTERFACE_COLUMN_DATA SELECT MAX(IDENTIFIER)+1, MAX(b.table_id), 'IDENTIFIER', 'bigint' FROM CATISSUE_INTERFACE_COLUMN_DATA a,CATISSUE_QUERY_TABLE_DATA b;

CREATE TABLE CATISSUE_RETURN_EVENT_PARAM (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   primary key (IDENTIFIER)
);

ALTER TABLE CATISSUE_RETURN_EVENT_PARAM ADD constraint FKD8890A48BC7298A91 foreign key (IDENTIFIER) references CATISSUE_SPECIMEN_EVENT_PARAM (IDENTIFIER);

INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'ReturnEventParameters','ReturnEventParameters Class','edu.wustl.catissuecore.domain.ReturnEventParameters',NULL,NULL,1,TO_DATE('2007-01-18','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='ReturnEventParameters'),TO_DATE('2006-01-18','yyyy-mm-dd') FROM dual;

-- ------------------------New Table entry For ConsentWithdrawal ---------- Mandar : 18-Jan-07 -------------end	 */

--------------------------New Column Entry For ConsentWaived ---------- Mandar : 25-Jan-07 -------------start */
ALTER TABLE CATISSUE_COLLECTION_PROTOCOL ADD CONSENTS_WAIVED NUMBER(1,0);
UPDATE CATISSUE_COLLECTION_PROTOCOL SET CONSENTS_WAIVED=0 WHERE CONSENTS_WAIVED IS NULL;
--------------------------New Column Entry For ConsentWaived ---------- Mandar : 25-Jan-07 -------------end */

--***Participant add column- start**********/
ALTER TABLE CATISSUE_PARTICIPANT ADD  MARITAL_STATUS VARCHAR2(50);
--***Participant add column- end**********/

--***caTIES Realated Tables - start**********/

--drop table CATISSUE_REPORT_TEXTCONTENT cascade constraints;
--drop table CATISSUE_IDENTIFIED_REPORT cascade constraints;
--drop table CATISSUE_CONCEPT_REFERENT cascade constraints;
--drop table CATISSUE_REPORT_CONTENT cascade constraints;
--drop table CATISSUE_REVIEW_PARAMS cascade constraints;
--drop table CATISSUE_REPORT_BICONTENT cascade constraints;
--drop table CATISSUE_REPORT_SECTION cascade constraints;
--drop table CATISSUE_DEIDENTIFIED_REPORT cascade constraints;
--drop table CATISSUE_QUARANTINE_PARAMS cascade constraints;
--drop table CATISSUE_PATHOLOGY_REPORT cascade constraints;
--drop table CATISSUE_REPORT_XMLCONTENT cascade constraints;
--drop table CATISSUE_REPORT_QUEUE cascade constraints;
--drop table CATISSUE_REPORT_PARTICIP_REL cascade constraints;
--drop table CATISSUE_CONCEPT cascade constraints;
--drop table CATISSUE_SEMANTIC_TYPE cascade constraints;
--drop table CATISSUE_CONCEPT_CLASSIFICATN cascade constraints;

-- drop sequence CATISSUE_CONCEPT_REFERENT_SEQ;
--drop sequence CATISSUE_PATHOLOGY_REPORT_SEQ;
--drop sequence CATISSUE_QUARANTINE_PARAMS_SEQ;
--drop sequence CATISSUE_REPORT_SECTION_SEQ;
--drop sequence CATISSUE_REVIEW_PARAMS_SEQ;
--drop sequence CATISSUE_REPORT_CONTENT_SEQ;
--drop sequence CATISSUE_REPORT_QUEUE_SEQ;
--drop sequence CATISSUE_SEMANTIC_TYPE_SEQ;
--drop sequence CATISSUE_CONCEPT_SEQ;
--drop sequence CATISSUE_CONCEPT_CLASSFCTN_SEQ;

CREATE TABLE CATISSUE_REPORT_TEXTCONTENT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   REPORT_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_IDENTIFIED_REPORT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   DEID_REPORT NUMBER(19,0),
   SCG_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_CONCEPT_REFERENT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   CONCEPT_ID NUMBER(19,0),
   CONCEPT_CLASSIFICATION_ID NUMBER(19,0),
   DEIDENTIFIED_REPORT_ID NUMBER(19,0),
   END_OFFSET NUMBER(19,0),
   IS_MODIFIER NUMBER(1,0),
   IS_NEGATED NUMBER(1,0),
   START_OFFSET NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_REPORT_CONTENT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   REPORT_DATA clob,
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_REVIEW_PARAMS (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   REVIEWER_ROLE VARCHAR(100),
   REPORT_ID NUMBER(19,0),
   EVENT_TIMESTAMP timestamp,
   USER_ID NUMBER(19,0),
   COMMENTS VARCHAR2(4000),
   STATUS VARCHAR(100),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_REPORT_BICONTENT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   REPORT_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_REPORT_SECTION (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   DOCUMENT_FRAGMENT VARCHAR2(4000),
   END_OFFSET INTEGER,
   NAME VARCHAR(100),
   START_OFFSET INTEGER,
   TEXT_CONTENT_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_DEIDENTIFIED_REPORT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   STATUS VARCHAR(100),
   SCG_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_QUARANTINE_PARAMS (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   DEID_REPORT_ID NUMBER(19,0),
   IS_QUARANTINED NUMBER(1),
   EVENT_TIMESTAMP timestamp,
   USER_ID NUMBER(19,0),
   COMMENTS VARCHAR2(4000),
   STATUS VARCHAR(100),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_PATHOLOGY_REPORT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   ACTIVITY_STATUS VARCHAR(100),
   REVIEW_FLAG NUMBER(1),
   SOURCE_ID NUMBER(19,0),
   REPORT_STATUS VARCHAR(100),
   COLLECTION_DATE_TIME timestamp,
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_REPORT_XMLCONTENT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   REPORT_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_REPORT_QUEUE (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   STATUS VARCHAR(50),
   SURGICAL_PATHOLOGY_NUMBER VARCHAR(50),
   PARTICIPANT_NAME VARCHAR(255),
   SITE_NAME VARCHAR(255),
   REPORT_LOADED_DATE DATE,
   REPORT_TEXT clob,
   SPECIMEN_COLL_GRP_ID NUMBER(19,0),
   REPORT_COLLECTION_DATE DATE,
   primary key (IDENTIFIER)
);
CREATE TABLE CATISSUE_REPORT_PARTICIP_REL(
   PARTICIPANT_ID NUMBER(19,0),
   REPORT_ID NUMBER(19,0)
);
CREATE TABLE CATISSUE_CONCEPT (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   CONCEPT_UNIQUE_ID VARCHAR(30),
   NAME VARCHAR2(500),
   SEMANTIC_TYPE_ID NUMBER(19,0),
   primary key (IDENTIFIER)
);

CREATE TABLE CATISSUE_SEMANTIC_TYPE (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   LABEL VARCHAR2(500),
   primary key (IDENTIFIER)
);

CREATE TABLE CATISSUE_CONCEPT_CLASSIFICATN (
   IDENTIFIER NUMBER(19,0) NOT NULL,
   NAME VARCHAR2(500),
   primary key (IDENTIFIER)
);

ALTER TABLE CATISSUE_REPORT_TEXTCONTENT ADD constraint FKD74882FD91092806 foreign key (REPORT_ID) references CATISSUE_PATHOLOGY_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_REPORT_TEXTCONTENT ADD constraint FKD74882FDBC7298A9 foreign key (IDENTIFIER) references CATISSUE_REPORT_CONTENT (IDENTIFIER);
ALTER TABLE CATISSUE_IDENTIFIED_REPORT ADD constraint FK6A2246DCBC7298A9 foreign key (IDENTIFIER) references CATISSUE_PATHOLOGY_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_IDENTIFIED_REPORT ADD constraint FK6A2246DC752DD177 foreign key (DEID_REPORT) references CATISSUE_DEIDENTIFIED_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_IDENTIFIED_REPORT ADD constraint FK6A2246DC91741663 foreign key (SCG_ID) references CATISSUE_SPECIMEN_COLL_GROUP (IDENTIFIER);
ALTER TABLE CATISSUE_CONCEPT_REFERENT ADD constraint FK799CCA7E9F96B363 foreign key (DEIDENTIFIED_REPORT_ID) references CATISSUE_DEIDENTIFIED_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_REVIEW_PARAMS ADD constraint FK5311FFF62206F20F foreign key (USER_ID) references CATISSUE_USER (IDENTIFIER);
ALTER TABLE CATISSUE_REVIEW_PARAMS ADD constraint FK5311FFF691092806 foreign key (REPORT_ID) references CATISSUE_PATHOLOGY_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_REPORT_BICONTENT ADD constraint FK8A9A4EE391092806 foreign key (REPORT_ID) references CATISSUE_PATHOLOGY_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_REPORT_BICONTENT ADD constraint FK8A9A4EE3BC7298A9 foreign key (IDENTIFIER) references CATISSUE_REPORT_CONTENT (IDENTIFIER);
ALTER TABLE CATISSUE_DEIDENTIFIED_REPORT ADD constraint FKCDD0DF7BBC7298A9 foreign key (IDENTIFIER) references CATISSUE_PATHOLOGY_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_DEIDENTIFIED_REPORT ADD constraint FKCDD0DF7B91741663 foreign key (SCG_ID) references CATISSUE_SPECIMEN_COLL_GROUP (IDENTIFIER);
ALTER TABLE CATISSUE_QUARANTINE_PARAMS ADD constraint FK3C12AE3B2206F20F foreign key (USER_ID) references CATISSUE_USER (IDENTIFIER);
ALTER TABLE CATISSUE_QUARANTINE_PARAMS ADD constraint FK3C12AE3B3EEC14E3 foreign key (DEID_REPORT_ID) references CATISSUE_DEIDENTIFIED_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_PATHOLOGY_REPORT ADD constraint FK904EC9F040DCD7BF foreign key (SOURCE_ID) references CATISSUE_SITE (IDENTIFIER);
ALTER TABLE CATISSUE_REPORT_XMLCONTENT ADD constraint FK4597C9F1BC7298A9 foreign key (IDENTIFIER) references CATISSUE_REPORT_CONTENT (IDENTIFIER);
ALTER TABLE CATISSUE_REPORT_XMLCONTENT ADD constraint FK4597C9F191092806 foreign key (REPORT_ID) references CATISSUE_PATHOLOGY_REPORT (IDENTIFIER);
ALTER TABLE CATISSUE_REPORT_QUEUE ADD constraint FK214246228CA560D1 foreign key (SPECIMEN_COLL_GRP_ID) references CATISSUE_SPECIMEN_COLL_GROUP (IDENTIFIER);
ALTER TABLE CATISSUE_CONCEPT ADD constraint FKC1A3C8CC7F0C2C7 foreign key (SEMANTIC_TYPE_ID) references CATISSUE_SEMANTIC_TYPE (IDENTIFIER);
ALTER TABLE CATISSUE_CONCEPT_REFERENT ADD constraint FK799CCA7EA9816272 foreign key (CONCEPT_ID) references CATISSUE_CONCEPT (IDENTIFIER);
ALTER TABLE CATISSUE_CONCEPT_REFERENT ADD constraint FK799CCA7E72C371DD foreign key (CONCEPT_CLASSIFICATION_ID) references CATISSUE_CONCEPT_CLASSIFICATN (IDENTIFIER);

CREATE sequence CATISSUE_CONCEPT_REFERENT_SEQ;
CREATE sequence CATISSUE_PATHOLOGY_REPORT_SEQ;
CREATE sequence CATISSUE_QUARANTINE_PARAMS_SEQ;
CREATE sequence CATISSUE_REPORT_SECTION_SEQ;
CREATE sequence CATISSUE_REVIEW_PARAMS_SEQ;
CREATE sequence CATISSUE_REPORT_CONTENT_SEQ;
CREATE sequence CATISSUE_REPORT_QUEUE_SEQ;
CREATE sequence CATISSUE_SEMANTIC_TYPE_SEQ;
CREATE sequence CATISSUE_CONCEPT_SEQ;
CREATE sequence CATISSUE_CONCEPT_CLASSFCTN_SEQ;

INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL ,'IdentifiedSurgicalPathologyReport','IdentifiedSurgicalPathologyReport Object','edu.wustl.catissuecore.domain.pathology.IdentifiedSurgicalPathologyReport',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL ,'DeidentifiedSurgicalPathologyReport','DeidentifiedSurgicalPathologyReport Object','edu.wustl.catissuecore.domain.pathology.DeidentifiedSurgicalPathologyReport',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL ,'ReportLoaderQueue','ReportLoaderQueue Object','edu.wustl.catissuecore.domain.pathology.ReportLoaderQueue',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL ,'Review Comments','PathologyReportReviewParameter Object','edu.wustl.catissuecore.domain.pathology.PathologyReportReviewParameter',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL ,'Quarantine Comments','QuarantineEventParameter Object','edu.wustl.catissuecore.domain.pathology.QuarantineEventParameter',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;

-- reseting sequence for CSM_PROTECTION_ELEMENT table to correct position
--select CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL from dual;
--select CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL from dual;
--select CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL from dual;
--select CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL from dual;
--select CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL from dual;

INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='IdentifiedSurgicalPathologyReport'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='IdentifiedSurgicalPathologyReport'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='IdentifiedSurgicalPathologyReport'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='DeidentifiedSurgicalPathologyReport'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='DeidentifiedSurgicalPathologyReport'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='DeidentifiedSurgicalPathologyReport'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='ReportLoaderQueue'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='ReportLoaderQueue'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='ReportLoaderQueue'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='Review Comments'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='Review Comments'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='Review Comments'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='Quarantine Comments'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,2,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='Quarantine Comments'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,3,(SELECT PROTECTION_ELEMENT_ID FROM CSM_PROTECTION_ELEMENT WHERE PROTECTION_ELEMENT_NAME='Quarantine Comments'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;

DELETE FROM CATISSUE_QUERY_TABLE_DATA WHERE TABLE_ID=26;
DELETE FROM CATISSUE_INTERFACE_COLUMN_DATA WHERE IDENTIFIER=44;
DELETE FROM CATISSUE_INTERFACE_COLUMN_DATA WHERE IDENTIFIER=45;
DELETE FROM CATISSUE_INTERFACE_COLUMN_DATA WHERE IDENTIFIER=46;
DELETE FROM CATISSUE_TABLE_RELATION WHERE RELATIONSHIP_ID=47;
DELETE FROM CATISSUE_RELATED_TABLES_MAP WHERE FIRST_TABLE_ID=26 AND SECOND_TABLE_ID=35;
UPDATE CATISSUE_INTERFACE_COLUMN_DATA SET COLUMN_NAME='SURGICAL_PATHOLOGY_NUMBER' WHERE IDENTIFIER=215;

INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'edu.wustl.catissuecore.action.ConflictViewAction','edu.wustl.catissuecore.action.ConflictViewAction','edu.wustl.catissuecore.action.ConflictViewAction',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,1,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE PROTECTION_ELEMENT_NAME='edu.wustl.catissuecore.action.ConflictViewAction'),TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;

INSERT INTO CATISSUE_QUERY_TABLE_DATA  SELECT MAX(TABLE_ID)+1, 'CATISSUE_REVIEW_PARAMS', 'Pathology Report Review Parameter', 'PathologyReportReviewParameter', 2,NULL FROM CATISSUE_QUERY_TABLE_DATA ;
INSERT INTO CATISSUE_QUERY_TABLE_DATA  SELECT MAX(TABLE_ID)+1, 'CATISSUE_QUARANTINE_PARAMS', 'Quarantine Event Parameter', 'QuarantineEventParameter', 2,NULL FROM CATISSUE_QUERY_TABLE_DATA ;

-- caTIES Realated Tables - end */

/* Local Extension  */
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'Local Extensions','Local Extensions class','edu.common.dynamicextensions.domain.integration.EntityMap',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'edu.wustl.catissuecore.action.annotations.LoadAnnotationDefinitionAction','edu.wustl.catissuecore.action.annotations.LoadAnnotationDefinitionAction','edu.wustl.catissuecore.action.annotations.LoadAnnotationDefinitionAction',NULL,NULL,1,TO_DATE('2006-11-27','yyyy-mm-dd') FROM dual;

/* Local Extension  */
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,17,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE OBJECT_ID='edu.common.dynamicextensions.domain.integration.EntityMap'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,17,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE OBJECT_ID='edu.wustl.catissuecore.action.annotations.LoadAnnotationDefinitionAction'),TO_DATE('2007-01-04','yyyy-mm-dd') FROM dual;

/*  changes for making Action a secureAction  :kalpana */
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'edu.wustl.catissuecore.action.bulkOperations.BulkTransferEventsAction','edu.wustl.catissuecore.action.bulkOperations.BulkTransferEventsAction','edu.wustl.catissuecore.action.bulkOperations.BulkTransferEventsAction',NULL,NULL,1,TO_DATE('2007-12-25','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'edu.wustl.catissuecore.action.MultipleSpecimenFlexInitAction','edu.wustl.catissuecore.action.MultipleSpecimenFlexInitAction','edu.wustl.catissuecore.action.MultipleSpecimenFlexInitAction',NULL,NULL,1,TO_DATE('2007-12-25','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PROTECTION_ELEMENT SELECT CSM_PROTECTIO_PROTECTION_E_SEQ.NEXTVAL,'edu.wustl.catissuecore.action.bulkOperations.BulkDisposalEventsAction','edu.wustl.catissuecore.action.bulkOperations.BulkDisposalEventsAction','edu.wustl.catissuecore.action.bulkOperations.BulkDisposalEventsAction',NULL,NULL,1,TO_DATE('2007-12-25','yyyy-mm-dd') FROM dual;

INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,19,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE OBJECT_ID='edu.wustl.catissuecore.action.bulkOperations.BulkTransferEventsAction'),TO_DATE('2007-12-25','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,19,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE OBJECT_ID='edu.wustl.catissuecore.action.bulkOperations.BulkDisposalEventsAction'),TO_DATE('2007-12-25','yyyy-mm-dd') FROM dual;
INSERT INTO CSM_PG_PE SELECT CSM_PG_PE_PG_PE_ID_SEQ.NEXTVAL,19,(SELECT PROTECTION_ELEMENT_ID FROM csm_protection_element WHERE OBJECT_ID='edu.wustl.catissuecore.action.MultipleSpecimenFlexInitAction'),TO_DATE('2007-12-25','yyyy-mm-dd') FROM dual;

/* kalpana  end */

/* Supriya :Changes to run Query on SCG in simple search Added metadata related to Abstract SCG.*/

INSERT INTO CATISSUE_QUERY_TABLE_DATA values (92, 'CATISSUE_ABS_SPECI_COLL_GROUP', 'Abstract Specimen Coll Group', 'AbstractScg',2,NULL) ;

UPDATE catissue_interface_column_data SET table_id = 92 WHERE identifier IN (210,211,212,213);

INSERT INTO catissue_interface_column_data (IDENTIFIER,TABLE_ID,COLUMN_NAME,ATTRIBUTE_TYPE) VALUES (331,92,'IDENTIFIER','bigint');

INSERT INTO catissue_table_relation values(131,35,92,NULL);

INSERT INTO CATISSUE_SEARCH_DISPLAY_DATA (RELATIONSHIP_ID, COL_ID, DISPLAY_NAME, DEFAULT_VIEW_ATTRIBUTE,ATTRIBUTE_ORDER) VALUES (131, 210, 'Clinical Diagnosis',1,7);

INSERT INTO CATISSUE_SEARCH_DISPLAY_DATA (RELATIONSHIP_ID, COL_ID, DISPLAY_NAME, DEFAULT_VIEW_ATTRIBUTE,ATTRIBUTE_ORDER) VALUES (131, 211, 'Clinical Status',1,8);

UPDATE CATISSUE_RELATED_TABLES_MAP SET second_table_id = 92 WHERE second_table_id = 35 AND first_table_id=3;

INSERT INTO CATISSUE_RELATED_TABLES_MAP VALUES ( 92 , 35 , 'IDENTIFIER','IDENTIFIER');

/*Supriya end*/

/* TODO Added in next script CSMUpgrade_3_to_3.2 */

commit;


text:
package org.elasticsearch.common.inject;

import org.elasticsearch.common.inject.binder.AnnotatedBindingBuilder;
import org.elasticsearch.common.inject.binder.AnnotatedConstantBindingBuilder;
import org.elasticsearch.common.inject.binder.LinkedBindingBuilder;
import org.elasticsearch.common.inject.matcher.Matcher;
import org.elasticsearch.common.inject.spi.Message;
import org.elasticsearch.common.inject.spi.TypeConverter;
import org.elasticsearch.common.inject.spi.TypeListener;

import java.lang.annotation.Annotation;

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;

/**
 * A support class for {@link Module}s which reduces repetition and results in
 * a more readable configuration. Simply extend this class, implement {@link
 * #configure()}, and call the inherited methods which mirror those found in
 * {@link Binder}. For example:
 *

 *

 * public class MyModule extends AbstractModule {
 *   protected void configure() {
 *     bind(Service.class).to(ServiceImpl.class).in(Singleton.class);
 *     bind(CreditCardPaymentService.class);
 *     bind(PaymentService.class).to(CreditCardPaymentService.class);
 *     bindConstant().annotatedWith(Names.named("port")).to(8080);
 *   }
 * }
 *

 *
 * @author crazybob@google.com (Bob Lee)
 */
public abstract class AbstractModule implements Module {

    Binder binder;

    public final synchronized void configure(Binder builder) {
        checkState(this.binder == null, "Re-entry is not allowed.");

        this.binder = checkNotNull(builder, "builder");
        try {
            configure();
        } finally {
            this.binder = null;
        }
    }

    /**
     * Configures a {@link Binder} via the exposed methods.
     */
    protected abstract void configure();

    /**
     * Gets direct access to the underlying {@code Binder}.
     */
    protected Binder binder() {
        return binder;
    }

    /**
     * @see Binder#bindScope(Class, Scope)
     */
    protected void bindScope(Class<? extends Annotation> scopeAnnotation,
                             Scope scope) {
        binder.bindScope(scopeAnnotation, scope);
    }

    /**
     * @see Binder#bind(Key)
     */
    protected <T> LinkedBindingBuilder<T> bind(Key<T> key) {
        return binder.bind(key);
    }

    /**
     * @see Binder#bind(TypeLiteral)
     */
    protected <T> AnnotatedBindingBuilder<T> bind(TypeLiteral<T> typeLiteral) {
        return binder.bind(typeLiteral);
    }

    /**
     * @see Binder#bind(Class)
     */
    protected <T> AnnotatedBindingBuilder<T> bind(Class<T> clazz) {
        return binder.bind(clazz);
    }

    /**
     * @see Binder#bindConstant()
     */
    protected AnnotatedConstantBindingBuilder bindConstant() {
        return binder.bindConstant();
    }

    /**
     * @see Binder#install(Module)
     */
    protected void install(Module module) {
        binder.install(module);
    }

    /**
     * @see Binder#addError(String, Object[])
     */
    protected void addError(String message, Object... arguments) {
        binder.addError(message, arguments);
    }

    /**
     * @see Binder#addError(Throwable)
     */
    protected void addError(Throwable t) {
        binder.addError(t);
    }

    /**
     * @see Binder#addError(Message)
     * @since 2.0
     */
    protected void addError(Message message) {
        binder.addError(message);
    }

    /**
     * @see Binder#requestInjection(Object)
     * @since 2.0
     */
    protected void requestInjection(Object instance) {
        binder.requestInjection(instance);
    }

    /**
     * @see Binder#requestStaticInjection(Class[])
     */
    protected void requestStaticInjection(Class<?>... types) {
        binder.requestStaticInjection(types);
    }

    /**
     * Adds a dependency from this module to {@code key}. When the injector is
     * created, Guice will report an error if {@code key} cannot be injected.
     * Note that this requirement may be satisfied by implicit binding, such as
     * a public no-arguments constructor.
     *
     * @since 2.0
     */
    protected void requireBinding(Key<?> key) {
        binder.getProvider(key);
    }

    /**
     * Adds a dependency from this module to {@code type}. When the injector is
     * created, Guice will report an error if {@code type} cannot be injected.
     * Note that this requirement may be satisfied by implicit binding, such as
     * a public no-arguments constructor.
     *
     * @since 2.0
     */
    protected void requireBinding(Class<?> type) {
        binder.getProvider(type);
    }

    /**
     * @see Binder#getProvider(Key)
     * @since 2.0
     */
    protected <T> Provider<T> getProvider(Key<T> key) {
        return binder.getProvider(key);
    }

    /**
     * @see Binder#getProvider(Class)
     * @since 2.0
     */
    protected <T> Provider<T> getProvider(Class<T> type) {
        return binder.getProvider(type);
    }

    /**
     * @see Binder#convertToTypes
     * @since 2.0
     */
    protected void convertToTypes(Matcher<? super TypeLiteral<?>> typeMatcher,
                                  TypeConverter converter) {
        binder.convertToTypes(typeMatcher, converter);
    }

    /**
     * @see Binder#currentStage()
     * @since 2.0
     */
    protected Stage currentStage() {
        return binder.currentStage();
    }

    /**
     * @see Binder#getMembersInjector(Class)
     * @since 2.0
     */
    protected <T> MembersInjector<T> getMembersInjector(Class<T> type) {
        return binder.getMembersInjector(type);
    }

    /**
     * @see Binder#getMembersInjector(TypeLiteral)
     * @since 2.0
     */
    protected <T> MembersInjector<T> getMembersInjector(TypeLiteral<T> type) {
        return binder.getMembersInjector(type);
    }

    /**
     * @see Binder#bindListener(org.elasticsearch.common.inject.matcher.Matcher,
     *      org.elasticsearch.common.inject.spi.TypeListener)
     * @since 2.0
     */
    protected void bindListener(Matcher<? super TypeLiteral<?>> typeMatcher,
                                TypeListener listener) {
        binder.bindListener(typeMatcher, listener);
    }
}


text: <script><!--<script></script><script></script>- - ></script>


text:
package main

import (
	"net/http"
	"net/http/httptest"
	"os"
	"testing"

	"gopkg.in/gin-gonic/gin.v1"
)

var tmpArticleList []article

func TestMain(m *testing.M) {
	gin.SetMode(gin.TestMode)

	os.Exit(m.Run())
}

func getRouter(withTemplates bool) *gin.Engine {
	r := gin.Default()
	if withTemplates {
		r.LoadHTMLGlob("templates/*")
	}

	return r
}

func testHTTPResponse(t *testing.T, r *gin.Engine, req *http.Request, f func(w *httptest.ResponseRecorder) bool) {
	w := httptest.NewRecorder()

	r.ServeHTTP(w, req)

	if !f(w) {
		t.Fail()
	}
}


text:
/**
 * Dependencies
 * -----------------------------------------------------------------------------
 */

const autoprefixer = require('autoprefixer');
const babel = require('gulp-babel');
const bs = require('browser-sync');
const changed = require('gulp-changed');
const del = require('del');
const eslint = require('gulp-eslint');
const gulp = require('gulp');
const include = require('gulp-include');
const pug = require('gulp-pug');
const minimist = require('minimist');
const nano = require('gulp-cssnano');
const postcss = require('gulp-postcss');
const rename = require('gulp-rename');
const sass = require('gulp-sass');
const sequence = require('run-sequence');
const uglify = require('gulp-uglify');
const plumber = require('gulp-plumber');
const gutil = require('gulp-util');

/**
 * Set paths
 * -----------------------------------------------------------------------------
 */

const path = {
  build: 'build',
  src: 'src',
};

/**
 * Set build options
 * -----------------------------------------------------------------------------
 */

const options = minimist(process.argv.slice(2), {
  string: ['env'],
  default: {
    env: 'dev',
  },
});

/**
 * Catch stream errors
 * -----------------------------------------------------------------------------
 */

const gulpSrc = gulp.src;

gulp.src = function onError(...args) {
  return gulpSrc
    .apply(gulp, args)
    // Catch errors
    .pipe(plumber(function onError(error) {
      gutil.log(gutil.colors.red(`Error (${error.plugin}):${error.message}`));
      this.emit('end');
    }));
};

/**
 * Default task
 * -----------------------------------------------------------------------------
 */

gulp.task('default', (callback) => sequence(
  ['build'],
  ['server'],
  callback
));

/**
 * Local dev server with live reload
 * -----------------------------------------------------------------------------
 */

gulp.task('server', () => {
  // Create and initialize local server
  bs.create();
  bs.init({
    notify: false,
    server: `./${path.build}`,
    open: 'local',
    ui: false,
  });
  // Watch for build changes and reload browser
  bs.watch(`${path.build}/**/*`).on('change', bs.reload);
  // Watch for source changes and execute associated tasks
  gulp.watch(`./${path.src}/data/**/*`, ['data']);
  gulp.watch(`./${path.src}/fonts/**/*`, ['fonts']);
  gulp.watch(`./${path.src}/images/**/*`, ['images']);
  gulp.watch(`./${path.src}/media/**/*`, ['media']);
  gulp.watch(`./${path.src}/misc/**/*`, ['misc']);
  gulp.watch(`./${path.src}/scripts/**/*.js`, ['scripts']);
  gulp.watch(`./${path.src}/styles/**/*.scss`, ['styles']);
  gulp.watch(`./${path.src}/vendors/*.js`, ['vendors']);
  gulp.watch(`./${path.src}/views/**/*.pug`, ['views']);
});

/**
 * Build static assets
 * -----------------------------------------------------------------------------
 */

gulp.task('build', (callback) => sequence(
  ['clean'],
  ['assets'],
  ['scripts'],
  ['styles'],
  ['vendors'],
  ['views'],
  callback
));

/**
 * Remove build directory
 * -----------------------------------------------------------------------------
 */

gulp.task('clean', () => del('./build'));

/**
 * Assets
 * -----------------------------------------------------------------------------
 */

gulp.task('assets', (callback) => sequence(
  ['data'],
  ['fonts'],
  ['images'],
  ['media'],
  ['misc'],
  callback
));

/**
 * Copy data files
 * -----------------------------------------------------------------------------
 */

gulp.task('data', () => gulp
  // Select files
  .src(`${path.src}/data/**/*`)
  // Check for changes
  .pipe(changed(`${path.build}/data`))
  // Save files
  .pipe(gulp.dest(`${path.build}/data`))
);

/**
 * Copy font files
 * -----------------------------------------------------------------------------
 */

gulp.task('fonts', () => gulp
  // Select files
  .src(`${path.src}/fonts/**/*`)
  // Check for changes
  .pipe(changed(`${path.build}/fonts`))
  // Save files
  .pipe(gulp.dest(`${path.build}/fonts`))
);

/**
 * Copy image files
 * -----------------------------------------------------------------------------
 */

gulp.task('images', () => gulp
  // Select files
  .src(`${path.src}/images/**/*`)
  // Check for changes
  .pipe(changed(`${path.build}/images`))
  // Save files
  .pipe(gulp.dest(`${path.build}/images`))
);

/**
 * Copy media files
 * -----------------------------------------------------------------------------
 */

gulp.task('media', () => gulp
  // Select files
  .src(`${path.src}/media/**/*`)
  // Check for changes
  .pipe(changed(`${path.build}/media`))
  // Save files
  .pipe(gulp.dest(`${path.build}/media`))
);

/**
 * Copy misc files
 * -----------------------------------------------------------------------------
 */

gulp.task('misc', () => gulp
  // Select files
  .src([
    `${path.src}/misc/${options.env}/**/*`,
    `${path.src}/misc/all/**/*`,
  ], {
    dot: true,
  })
  // Check for changes
  .pipe(changed(path.build))
  // Save files
  .pipe(gulp.dest(path.build))
);

/**
 * Build scripts with transpilers
 * -----------------------------------------------------------------------------
 */

gulp.task('scripts', ['scripts-lint'], () => gulp
  // Select files
  .src(`${path.src}/scripts/*.js`)
  // Concatenate includes
  .pipe(include())
  // Transpile
  .pipe(babel())
  // Save unminified file
  .pipe(gulp.dest(`${path.build}/scripts`))
  // Optimize and minify
  .pipe(uglify())
  // Append suffix
  .pipe(rename({
    suffix: '.min',
  }))
  // Save minified file
  .pipe(gulp.dest(`${path.build}/scripts`))
);

/**
 * Lint scripts
 * -----------------------------------------------------------------------------
 */

gulp.task('scripts-lint', () => gulp
  // Select files
  .src(`${path.src}/scripts/**/*.js`)
  // Check for errors
  .pipe(eslint())
  // Format errors
  .pipe(eslint.format())
);

/**
 * Build styles with pre-processors and post-processors
 * -----------------------------------------------------------------------------
 */

gulp.task('styles', () => gulp
  // Select files
  .src(`${path.src}/styles/*.scss`)
  // Compile Sass
  .pipe(sass({
    outputStyle: 'expanded',
  }))
  // Add vendor prefixes
  .pipe(postcss([
    autoprefixer,
  ]))
  // Save unminified file
  .pipe(gulp.dest(`${path.build}/styles`))
  // Optimize and minify
  .pipe(nano())
  // Append suffix
  .pipe(rename({
    suffix: '.min',
  }))
  // Save minified file
  .pipe(gulp.dest(`${path.build}/styles`))
);

/**
 * Bundle vendors
 * -----------------------------------------------------------------------------
 */

gulp.task('vendors', () => gulp
  // Select files
  .src(`${path.src}/vendors/*.js`)
  // Concatenate includes
  .pipe(include({
    includePaths: [
      `${__dirname}/bower_components`,
      `${__dirname}/node_modules`,
    ],
  }))
  // Save files
  .pipe(gulp.dest(`${path.build}/vendors`))
);

/**
 * Build views with pre-processors
 * -----------------------------------------------------------------------------
 */

gulp.task('views', () => gulp
  // Select files
  .src(`${path.src}/views/site/**/*.pug`)
  // Check which files have changed
  .pipe(changed(path.build, {
    extension: '.html',
  }))
  // Compile Pug
  .pipe(pug({
    basedir: `${__dirname}/${path.src}/views`,
    pretty: (options.env === 'dev'),
    data: {
      env: options.env,
    },
  }))
  // Save files
  .pipe(gulp.dest(path.build))
);


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yqclouds.commerce</groupId>
        <artifactId>yqclouds-commerce</artifactId>
        <version>1.0.0-SNAPSHOP</version>
    </parent>
    <artifactId>commerce-core</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>com.yqclouds.services</groupId>
            <artifactId>address-services</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yqclouds.services</groupId>
            <artifactId>currency-services</artifactId>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-java8</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>