text:
"""NotebookExporter class"""

# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.

from .exporter import Exporter
import nbformat
from traitlets import Enum, default

class NotebookExporter(Exporter):
    """Exports to an IPython notebook.

    This is useful when you want to use nbconvert's preprocessors to operate on
    a notebook (e.g. to execute it) and then write it back to a notebook file.
    """

    nbformat_version = Enum(list(nbformat.versions),
        default_value=nbformat.current_nbformat,
        help="""The nbformat version to write.
        Use this to downgrade notebooks.
        """
    ).tag(config=True)

    @default('file_extension')
    def _file_extension_default(self):
        return '.ipynb'

    output_mimetype = 'application/json'
    export_from_notebook = "Notebook"

    def from_notebook_node(self, nb, resources=None, **kw):
        nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)
        if self.nbformat_version != nb_copy.nbformat:
            resources['output_suffix'] = '.v%i' % self.nbformat_version
        else:
            resources['output_suffix'] = '.nbconvert'
        output = nbformat.writes(nb_copy, version=self.nbformat_version)
        if not output.endswith("\n"):
            output = output + "\n"
        return output, resources


text:
package org.sakaiproject.sitestats.impl.parser;

import org.apache.commons.digester.Digester;
import org.apache.commons.digester.ObjectCreationFactory;
import org.sakaiproject.sitestats.api.event.EventInfo;
import org.sakaiproject.sitestats.api.parser.EventFactory;
import org.xml.sax.Attributes;

public class EventFactoryImpl implements EventFactory, ObjectCreationFactory {
	public EventInfo createEvent(String eventId) {
		return new EventInfo(eventId);
	}

	public Object createObject(Attributes attributes) throws Exception {
		String eventId = attributes.getValue("eventId");
		String selected = attributes.getValue("selected");
		String anonymous = attributes.getValue("anonymous");

		if(eventId == null){
			throw new Exception("Mandatory eventId attribute not present on event tag.");
		}
		EventInfo eventInfo = new EventInfo(eventId);
		eventInfo.setSelected(Boolean.parseBoolean(selected));
		eventInfo.setAnonymous(Boolean.parseBoolean(anonymous));
		return eventInfo;
	}

	public Digester getDigester() {
		// TODO Auto-generated method stub
		return null;
	}

	public void setDigester(Digester arg0) {
		// TODO Auto-generated method stub

	}

}

redpajama_set_name: RedPajamaGithub


text:
author: dainius
comments: true
date: 2012-08-18 18:11:11+00:00
layout: post
slug: 18-diena-pakuojame-daiktus
title: '18 diena: pakuojame daiktus'
wordpress_id: 192
categories:
- asmeninis tobulėjimas
tags:
- 30 dienų
- motyvacija
- planai
- tobulėjimas
---

Šiandien suplanuotas pakavimas pavyko puikiai - supakavome, ko gero, apie 30% daiktų. Pakuojame namus, kadangi planuose - persikraustymas. šį sykį į didesnį namą ir, tikiuos, ilgesniam laikui.

Rytoj, kaip ir įprasta sekmadieniais - poilsis. šį sykį aktyvesnis - giminės susitikimas. bus daug žmonių ir daug bendravimo.


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- Mnesia Reference Manual</title>

User's Guide
Reference Manual
Release Notes
PDF
Top
Mnesia
Reference Manual
Version 4.13.3

Expand All
Contract All
Table of Contents

mnesia

                  Top of manual page

abort/1

activate_checkpoint/1

activity/2

activity/4

add_table_copy/3

add_table_index/2

all_keys/1

async_dirty/2

backup/1

backup_checkpoint/2

change_config/2

change_table_access_mode/2

change_table_copy_type/3

change_table_load_order/2

change_table_majority/2

clear_table/1

create_schema/1

create_table/2

deactivate_checkpoint/1

del_table_copy/2

del_table_index/2

delete/1

delete/3

delete_object/1

delete_object/3

delete_schema/1

delete_table/1

dirty_all_keys/1

dirty_delete/1

dirty_delete/2

dirty_delete_object/1

dirty_delete_object/2

dirty_first/1

dirty_index_match_object/2

dirty_index_match_object/3

dirty_index_read/3

dirty_last/1

dirty_match_object/1

dirty_match_object/2

dirty_next/2

dirty_prev/2

dirty_read/1

dirty_read/2

dirty_select/2

dirty_slot/2

dirty_update_counter/2

dirty_update_counter/3

dirty_write/1

dirty_write/2

dump_log/0

dump_tables/1

dump_to_textfile/1

error_description/1

ets/2

first/1

foldl/3

foldr/3

force_load_table/1

index_match_object/2

index_match_object/4

index_read/3

info/0

install_fallback/1

install_fallback/1

install_fallback/2

is_transaction/0

last/1

load_textfile/1

lock/2

match_object/1

match_object/3

move_table_copy/3

next/2

prev/2

read/1

read/2

read/3

read_lock_table/1

report_event/1

restore/2

s_delete/1

s_delete_object/1

s_write/1

schema/0

schema/1

select/2

select/4

select/1

set_debug_level/1

set_master_nodes/1

set_master_nodes/2

snmp_close_table/1

snmp_get_mnesia_key/2

snmp_get_next_index/2

snmp_get_row/2

snmp_open_table/2

start/0

stop/0

subscribe/1

sync_dirty/2

sync_log/0

sync_transaction/3

system_info/1

table/1

table_info/2

transaction/2

transform_table/4

transform_table/3

traverse_backup/4

uninstall_fallback/0

uninstall_fallback/1

unsubscribe/1

wait_for_tables/2

wread/1

write/1

write/3

write_lock_table/1

mnesia_frag_hash

                  Top of manual page

init_state/2

add_frag/1

del_frag/1

key_to_frag_number/2

match_spec_to_frag_numbers/2

mnesia_registry

                  Top of manual page

create_table/1

create_table/2

Mnesia Reference Manual

Version 4.13.3

March 14, 2016

Copyright © 1997-2016 Ericsson AB. All Rights Reserved.


text:
<?xml version="1.0"?>
<toolbox>

	 <tool>
	   <key>alternator</key>
	   <scope>application</scope>
	   <class>org.apache.velocity.tools.generic.AlternatorTool</class>
	   <parameter name="auto-alternate" value="true"/>
	 </tool>

	<tool>
		<key>security</key>
		<scope>request</scope>
		<class>com.appeligo.velocity.view.SecurityTool</class>
	</tool>

	<tool>
		<key>logo</key>
		<scope>request</scope>
		<class>com.appeligo.velocity.view.LogoTool</class>
	</tool>
	<tool>
		<key>location</key>
		<scope>request</scope>
		<class>com.appeligo.velocity.view.LocationTool</class>
	</tool>
	<tool>
		<key>link</key>
		<scope>request</scope>
		<class>org.apache.velocity.tools.view.tools.LinkTool</class>
	</tool>

	<tool>
		<key>esc</key>
		<scope>application</scope>
		<class>org.apache.velocity.tools.generic.EscapeTool</class>
	</tool>

	<tool>
		<key>math</key>
		<scope>application</scope>
		<class>org.apache.velocity.tools.generic.MathTool</class>
	</tool>

	 <tool>
	   <key>date</key>
	   <scope>application</scope>
	   <class>org.apache.velocity.tools.generic.DateTool</class>
	   <parameter name="format" value="yyyy-M-d"/>
	 </tool>

</toolbox>


text:
#include <cstddef>

#include <ppapi/c/pp_instance.h>
#include <ppapi/c/pp_var.h>

#include <unistd.h>

#include "Error.h"
#include "Commands.h"
#include "Interfaces.h"

#include "Requests.pb.h"
#include "Responses.pb.h"

extern "C" enum FJS_Error FJS_Dispatch_Init(PP_Instance instance) {
	furious::Response response;
	response.set_id(0);
	response.set_type(furious::Response::INIT);

	const long concurrency = sysconf(_SC_NPROCESSORS_ONLN);
	if (concurrency > 0) {
		furious::InitResponse* initResponse = new furious::InitResponse();
		if (initResponse != NULL) {
			initResponse->set_concurrency(concurrency);
			response.set_allocated_init_response(initResponse);
		}
	}

	const int responseSize = response.ByteSize();
	struct PP_Var responseVar = bufferInterface->Create(static_cast<uint32_t>(responseSize));
	void* requestPointer = bufferInterface->Map(responseVar);
	if (requestPointer != NULL) {
		if (response.SerializeToArray(requestPointer, responseSize)) {
			messagingInterface->PostMessage(instance, responseVar);
		}
		bufferInterface->Unmap(responseVar);
	}
	varInterface->Release(responseVar);
	return FJS_Error_Ok;
}

extern "C" enum FJS_Error FJS_Dispatch_Request(PP_Instance instance, const void* requestPointer, size_t requestSize) {
	furious::Request request;
	if (!request.ParseFromArray(requestPointer, requestSize)) {
		return FJS_Error_InvalidProtobuf;
	}

	furious::Request::Type requestType = request.type();
	switch (requestType) {
		case furious::Request_Type_EMPTY_ARRAY:
		{
			const furious::EmptyArrayRequest& emptyArrayRequest = request.empty_array_request();
			const struct FJS_Shape shape = {
				.buffer = const_cast<uint32_t*>(emptyArrayRequest.shape().data()),
				.dimensions = static_cast<uint32_t>(emptyArrayRequest.shape().size())
			};
			return FJS_Execute_CreateEmptyArray(instance,
				emptyArrayRequest.id_out(),
				shape,
				static_cast<enum FJS_DataType>(emptyArrayRequest.data_type()));
		}
		case furious::Request_Type_DATA_ARRAY:
		{
			const furious::DataArrayRequest& dataArrayRequest = request.data_array_request();
			const struct FJS_Shape shape = {
				.buffer = const_cast<uint32_t*>(dataArrayRequest.shape().data()),
				.dimensions = static_cast<uint32_t>(dataArrayRequest.shape().size())
			};
			const struct FJS_Buffer dataBuffer = {
				.pointer = const_cast<void*>(static_cast<const void*>(dataArrayRequest.data_buffer().data())),
				.size = static_cast<uint32_t>(dataArrayRequest.data_buffer().size())
			};
			return FJS_Execute_CreateDataArray(instance,
				dataArrayRequest.id_out(),
				shape,
				static_cast<enum FJS_DataType>(dataArrayRequest.data_type()),
				dataBuffer);
		}
		case furious::Request_Type_CONST_ARRAY:
		{
			const furious::ConstArrayRequest& constArrayRequest = request.const_array_request();
			const struct FJS_Shape shape = {
				.buffer = const_cast<uint32_t*>(constArrayRequest.shape().data()),
				.dimensions = static_cast<uint32_t>(constArrayRequest.shape().size())
			};
			return FJS_Execute_CreateConstArray(instance,
				constArrayRequest.id_out(),
				shape,
				static_cast<enum FJS_DataType>(constArrayRequest.data_type()),
				constArrayRequest.fill_value());
		}
		case furious::Request_Type_IDENTITY_MATRIX:
		{
			const furious::IdentityMatrixRequest& identityMatrixRequest = request.identity_matrix_request();
			return FJS_Execute_CreateIdentityMatrix(instance,
				identityMatrixRequest.id_out(),
				identityMatrixRequest.rows(),
				identityMatrixRequest.columns(),
				identityMatrixRequest.diagonal(),
				static_cast<enum FJS_DataType>(identityMatrixRequest.data_type()));
		}
		case furious::Request_Type_LINSPACE:
		{
			const furious::LinspaceRequest& linspaceRequest = request.linspace_request();
			return FJS_Execute_LinSpace(instance,
				linspaceRequest.id_out(),
				linspaceRequest.start(),
				linspaceRequest.stop(),
				linspaceRequest.samples(),
				linspaceRequest.closed(),
				static_cast<enum FJS_DataType>(linspaceRequest.data_type()));
		}
		case furious::Request_Type_RESHAPE:
		{
			const furious::ReshapeRequest& reshapeRequest = request.reshape_request();
			const FJS_Shape shapeOut = {
				.buffer = const_cast<uint32_t*>(reshapeRequest.shape_out().data()),
				.dimensions = static_cast<uint32_t>(reshapeRequest.shape_out().size())
			};
			return FJS_Execute_ReShape(instance,
				reshapeRequest.id_a(),
				reshapeRequest.id_out(),
				shapeOut);
		}
		case furious::Request_Type_REPEAT:
		{
			const furious::RepeatRequest& repeatRequest = request.repeat_request();
			return FJS_Execute_Repeat(instance,
				repeatRequest.id_a(),
				repeatRequest.id_out(),
				repeatRequest.repeats(),
				repeatRequest.axis());
		}
		case furious::Request_Type_DEALLOCATE:
		{
			const furious::DeallocateRequest& deallocateRequest = request.deallocate_request();
			return FJS_Execute_DeAllocate(instance,
				deallocateRequest.id_a());
		}
		case furious::Request_Type_FETCH:
		{
			struct FJS_Buffer buffer;
			const furious::FetchRequest& fetchRequest = request.fetch_request();
			const enum FJS_Error error = FJS_Execute_Fetch(instance,
				fetchRequest.id_a(),
				&buffer);
			if (error == FJS_Error_Ok) {
				furious::Response response;
				response.set_id(request.id());
				response.set_type(furious::Response::FETCH);

				furious::FetchResponse* fetchResponse = new furious::FetchResponse();
				/* Note: the code is compiled without exception support */
				if (fetchResponse != NULL) {
					fetchResponse->set_data_buffer(buffer.pointer, buffer.size);
					response.set_allocated_fetch_response(fetchResponse);

					const int responseSize = response.ByteSize();
					struct PP_Var responseVar = bufferInterface->Create(static_cast<uint32_t>(responseSize));
					void* requestPointer = bufferInterface->Map(responseVar);
					if (requestPointer != NULL) {
						if (response.SerializeToArray(requestPointer, responseSize)) {
							messagingInterface->PostMessage(instance, responseVar);
						}
						bufferInterface->Unmap(responseVar);
					}
					varInterface->Release(responseVar);
				}
			}
			return error;
		}
		case furious::Request_Type_INFO:
		case furious::Request_Type_BARRIER:
		{
			furious::Response response;
			response.set_id(request.id());
			response.set_type(furious::Response::BARRIER);

			const int responseSize = response.ByteSize();
			struct PP_Var responseVar = bufferInterface->Create(static_cast<uint32_t>(responseSize));
			void* requestPointer = bufferInterface->Map(responseVar);
			if (requestPointer != NULL) {
				if (response.SerializeToArray(requestPointer, responseSize)) {
					messagingInterface->PostMessage(instance, responseVar);
				}
				bufferInterface->Unmap(responseVar);
			}
			varInterface->Release(responseVar);

			return FJS_Error_Ok;
		}
		case furious::Request_Type_BINARY_OPERATION:
		{
			const furious::BinaryOperationRequest& binaryOperationRequest = request.binary_operation_request();
			return FJS_Execute_BinaryOperation(instance,
				static_cast<enum FJS_BinaryOperationType>(binaryOperationRequest.type()),
				binaryOperationRequest.id_a(),
				binaryOperationRequest.id_b(),
				binaryOperationRequest.id_out());
		}
		case furious::Request_Type_BINARY_CONST_OPERATION:
		{
			const furious::BinaryConstOperationRequest& binaryConstOperationRequest = request.binary_const_operation_request();
			return FJS_Execute_BinaryConstOperation(instance,
				static_cast<enum FJS_BinaryConstOperationType>(binaryConstOperationRequest.type()),
				binaryConstOperationRequest.id_a(),
				binaryConstOperationRequest.value_b(),
				binaryConstOperationRequest.id_out());
		}
		case furious::Request_Type_UNARY_OPERATION:
		{
			const furious::UnaryOperationRequest& unaryOperationRequest = request.unary_operation_request();
			return FJS_Execute_UnaryOperation(instance,
				static_cast<enum FJS_UnaryOperationType>(unaryOperationRequest.type()),
				unaryOperationRequest.id_a(),
				unaryOperationRequest.id_out());
		}
		case furious::Request_Type_REDUCTION_OPERATION:
		{
			const furious::ReductionRequest& reductionRequest = request.reduction_request();
			return FJS_Execute_Reduction(instance,
				static_cast<enum FJS_ReductionType>(reductionRequest.type()),
				reductionRequest.id_a(),
				reductionRequest.id_out());
		}
		case furious::Request_Type_AXIS_REDUCTION_OPERATION:
		{
			const furious::AxisReductionRequest& axisReductionRequest = request.axis_reduction_request();
			return FJS_Execute_AxisReduction(instance,
				static_cast<enum FJS_AxisReductionType>(axisReductionRequest.type()),
				axisReductionRequest.id_a(),
				axisReductionRequest.axis(),
				axisReductionRequest.id_out());
		}
		case furious::Request_Type_DOT_OPERATION:
		{
			const furious::DotOperationRequest& dotOperationRequest = request.dot_operation_request();
			return FJS_Execute_DotOperation(instance,
				dotOperationRequest.id_a(),
				dotOperationRequest.id_b(),
				dotOperationRequest.id_out());
		}
		case furious::Request_Type_CHOLESKY_DECOMPOSITION:
		{
			const furious::CholeskyDecompositionRequest& choleskyDecomposition = request.cholesky_decomposition_request();
			return FJS_Execute_CholeskyDecomposition(instance,
				choleskyDecomposition.id_a(),
				choleskyDecomposition.a_type() == furious::TriangularMatrixType::LOWER,
				choleskyDecomposition.id_out());
		}
		case furious::Request_Type_SOLVE_TRIANGULAR:
			const furious::SolveTriangularRequest& solveTriangular = request.solve_triangular_request();
			return FJS_Execute_SolveTriangular(instance,
				solveTriangular.id_a(),
				solveTriangular.id_y(),
				solveTriangular.id_x(),
				solveTriangular.a_type() == furious::TriangularMatrixType::LOWER,
				solveTriangular.a_transposition() == furious::TranspositionType::TRANSPOSE,
				solveTriangular.unit_diagonal());
	}
}


text:
package config

import (
	// token maps
	_ "github.com/blevesearch/bleve/analysis/tokenmap"

	// fragment formatters
	_ "github.com/blevesearch/bleve/search/highlight/format/ansi"
	_ "github.com/blevesearch/bleve/search/highlight/format/html"

	// fragmenters
	_ "github.com/blevesearch/bleve/search/highlight/fragmenter/simple"

	// highlighters
	_ "github.com/blevesearch/bleve/search/highlight/highlighter/ansi"
	_ "github.com/blevesearch/bleve/search/highlight/highlighter/html"
	_ "github.com/blevesearch/bleve/search/highlight/highlighter/simple"

	// char filters
	_ "github.com/blevesearch/bleve/analysis/char/html"
	_ "github.com/blevesearch/bleve/analysis/char/regexp"
	_ "github.com/blevesearch/bleve/analysis/char/zerowidthnonjoiner"

	// analyzers
	_ "github.com/blevesearch/bleve/analysis/analyzer/custom"
	_ "github.com/blevesearch/bleve/analysis/analyzer/keyword"
	_ "github.com/blevesearch/bleve/analysis/analyzer/simple"
	_ "github.com/blevesearch/bleve/analysis/analyzer/standard"
	_ "github.com/blevesearch/bleve/analysis/analyzer/web"

	// token filters
	_ "github.com/blevesearch/bleve/analysis/token/apostrophe"
	_ "github.com/blevesearch/bleve/analysis/token/compound"
	_ "github.com/blevesearch/bleve/analysis/token/edgengram"
	_ "github.com/blevesearch/bleve/analysis/token/elision"
	_ "github.com/blevesearch/bleve/analysis/token/keyword"
	_ "github.com/blevesearch/bleve/analysis/token/length"
	_ "github.com/blevesearch/bleve/analysis/token/lowercase"
	_ "github.com/blevesearch/bleve/analysis/token/ngram"
	_ "github.com/blevesearch/bleve/analysis/token/shingle"
	_ "github.com/blevesearch/bleve/analysis/token/stop"
	_ "github.com/blevesearch/bleve/analysis/token/truncate"
	_ "github.com/blevesearch/bleve/analysis/token/unicodenorm"

	// tokenizers
	_ "github.com/blevesearch/bleve/analysis/tokenizer/exception"
	_ "github.com/blevesearch/bleve/analysis/tokenizer/regexp"
	_ "github.com/blevesearch/bleve/analysis/tokenizer/single"
	_ "github.com/blevesearch/bleve/analysis/tokenizer/unicode"
	_ "github.com/blevesearch/bleve/analysis/tokenizer/web"
	_ "github.com/blevesearch/bleve/analysis/tokenizer/whitespace"

	// date time parsers
	_ "github.com/blevesearch/bleve/analysis/datetime/flexible"
	_ "github.com/blevesearch/bleve/analysis/datetime/optional"

	// languages
	_ "github.com/blevesearch/bleve/analysis/lang/ar"
	_ "github.com/blevesearch/bleve/analysis/lang/bg"
	_ "github.com/blevesearch/bleve/analysis/lang/ca"
	_ "github.com/blevesearch/bleve/analysis/lang/cjk"
	_ "github.com/blevesearch/bleve/analysis/lang/ckb"
	_ "github.com/blevesearch/bleve/analysis/lang/cs"
	_ "github.com/blevesearch/bleve/analysis/lang/el"
	_ "github.com/blevesearch/bleve/analysis/lang/en"
	_ "github.com/blevesearch/bleve/analysis/lang/eu"
	_ "github.com/blevesearch/bleve/analysis/lang/fa"
	_ "github.com/blevesearch/bleve/analysis/lang/fr"
	_ "github.com/blevesearch/bleve/analysis/lang/ga"
	_ "github.com/blevesearch/bleve/analysis/lang/gl"
	_ "github.com/blevesearch/bleve/analysis/lang/hi"
	_ "github.com/blevesearch/bleve/analysis/lang/hy"
	_ "github.com/blevesearch/bleve/analysis/lang/id"
	_ "github.com/blevesearch/bleve/analysis/lang/in"
	_ "github.com/blevesearch/bleve/analysis/lang/it"
	_ "github.com/blevesearch/bleve/analysis/lang/pt"

	// kv stores
	_ "github.com/blevesearch/bleve/index/store/boltdb"
	_ "github.com/blevesearch/bleve/index/store/goleveldb"
	_ "github.com/blevesearch/bleve/index/store/gtreap"
	_ "github.com/blevesearch/bleve/index/store/moss"

	// index types
	_ "github.com/blevesearch/bleve/index/upsidedown"
)


text:
<?xml version="1.0" encoding="UTF-8"?>
<config>
   <sections>
        <payment>
            <groups>
                <bitcredits_bitcoinpayform translate="label" module="paygate">
                    BitCredits.io Bitcoin PayForm
                    <sort_order>670</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>0</show_in_store>
                    <fields>
                        <active translate="label">
                            Enabled
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </active>
                        <title translate="label">
                            Title
                            <frontend_type>text</frontend_type>
                            <sort_order>2</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </title>
                        <api_key translate="label">
                            API Key
                            <frontend_type>text</frontend_type>
                            <sort_order>4</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </api_key>
                        <api_endpoint translate="label">
                            API Endpoint
                            <frontend_type>text</frontend_type>
                            <sort_order>3</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>0</show_in_store>
                        </api_endpoint>
                    </fields>
                </bitcredits_bitcoinpayform>
            </groups>
        </payment>
    </sections>
</config>


text:
<?php

namespace Coyote\Http\Resources\Api;

use Carbon\Carbon;
use Coyote\Http\Resources\UserResource;
use Coyote\User;
use Illuminate\Http\Resources\Json\JsonResource;

/**
 * @property int $id
 * @property Carbon $created_at
 * @property Carbon $updated_at
 * @property User $user
 * @property int $user_id
 * @property string $text
 */
class PostCommentResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return array_merge(
            $this->resource->only(['id', 'text', 'html']),
            [
                'created_at'    => $this->created_at->toIso8601String(),
                'updated_at'    => $this->updated_at->toIso8601String(),
                'user'          => new UserResource($this->whenLoaded('user'))
            ]
        );
    }
}


text:
package com.ascii.mscamplib;

import android.content.Context;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;

public class ReceiptAPI {

	private RequestQueue queue;
	private ReceiptAPIListener listener;
	private final static String RECEIPT_API_URL = "http://ascii.azurewebsites.net/ReceiptBase.aspx";

	public ReceiptAPI(Context context) {
		queue = Volley.newRequestQueue(context);
	}

	public void getReceiptData(ReceiptAPIListener listener) {
		this.listener = listener;
		StringRequest request = new StringRequest(RECEIPT_API_URL, responseSuccessHandler, responseErrorHandler);
		queue.add(request);
	}

	private Response.Listener<String> responseSuccessHandler = new Response.Listener<String>() {
		@Override
		public void onResponse(String response) {
			try {
				ArrayList<Receipt> resList = new ArrayList<>();
				JSONObject responseObject = new JSONObject(response);
				JSONArray receipts = responseObject.getJSONArray("receipts");
				for (int i = 0; i < receipts.length(); ++i) {
					JSONObject receipt = receipts.getJSONObject(i);
					String item = receipt.optString("item");
					String value = receipt.optString("value");
					resList.add(new Receipt(item, value));
				}
				listener.onSuccess(resList);
			} catch (Exception e) {
				listener.onError();
			}
		}
	};

	private Response.ErrorListener responseErrorHandler = new Response.ErrorListener() {
		@Override
		public void onErrorResponse(VolleyError error) {
			listener.onError();
		}
	};
}


text:
ROOT = ../../../..

DIR = Providers/UNIXProviders/SystemSetting

include $(ROOT)/mak/config.mak

LIBRARY = UNIX_SystemSettingProvider

EXTRA_INCLUDES += -I/usr/local/include -I./..

SOURCES = \
	../CIMHelper.cpp \
	UNIX_SystemSettingMain.cpp \
	UNIX_SystemSetting.cpp \
	UNIX_SystemSettingProvider.cpp

ifeq ($(OS), aix)
	SOURCES += UNIX_SystemSetting_AIX.cpp
endif
ifeq ($(OS), darwin)
	SOURCES += UNIX_SystemSetting_DARWIN.cpp
endif
ifeq ($(OS), freebsd)
	SOURCES += UNIX_SystemSetting_FREEBSD.cpp
endif
ifeq ($(OS), hpux)
	SOURCES += UNIX_SystemSetting_HPUX.cpp
endif
ifeq ($(OS), linux)
	SOURCES += UNIX_SystemSetting_LINUX.cpp
endif
ifeq ($(OS), solaris)
	SOURCES += UNIX_SystemSetting_SOLARIS.cpp
endif
ifeq ($(OS), tru64)
	SOURCES += UNIX_SystemSetting_TRU64.cpp
endif
ifeq ($(OS), vms)
	SOURCES += UNIX_SystemSetting_VMS.cpp
endif
ifeq ($(OS), win32)
	SOURCES += UNIX_SystemSetting_WIN32.cpp
endif
ifeq ($(OS), zos)
	SOURCES += UNIX_SystemSetting_ZOS.cpp
endif
ifeq (, $(filter aix,darwin,freebsd,hpux,linux,solaris,tru64,vms,win32,zos $(OS)))

else
	SOURCES += UNIX_SystemSetting_STUB.cpp
endif

EXTRA_LIBRARIES = \
	-lpegprovider \
	-lpegclient \
	-lpegcommon \
	-lpegquerycommon \
	-lpegqueryexpression \
	-lpegcql \
	-lpegwql

EXTRA_LIBRARIES += \
	-pthread \
	-lutil \
	-lgeom \
	-lkvm \
	-lcam

include $(ROOT)/mak/dynamic-library.mak


text:
import subprocess
import sys
import setup_util
import os

def start(args, logfile, errfile):
  setup_util.replace_text('dart/postgresql.yaml', 'host: .*', 'host: ' + args.database_host)
  try:
    #
    # install dart dependencies
    #
    subprocess.check_call('pub upgrade', shell=True, cwd='dart', stderr=errfile, stdout=logfile)
    #
    # start dart servers
    #
    subprocess.Popen('dart server.dart -a 0.0.0.0 -p 8080 -d ' + str(args.max_concurrency) + ' -i ' + str(args.max_threads), shell=True, cwd='dart', stderr=errfile, stdout=logfile)
    return 0
  except subprocess.CalledProcessError:
    return 1

def stop(logfile, errfile):
  #
  # stop dart servers
  #
  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  out, err = p.communicate()
  for line in out.splitlines():
    if 'dart' in line and 'run-tests' not in line and 'run-ci' not in line:
      pid = int(line.split(None, 2)[1])
      os.kill(pid, 15)
  return 0


text:
define([
    './datagrid'
], function (datagrid) {
    var context;

    var exposed = {
        init: function(thisContext){
            context = thisContext;
            context.sandbox.on('datagrid.close', datagrid.close);
            context.sandbox.on('datagrid.open', datagrid.open);
            context.sandbox.on('datagrid.reload', datagrid.reload);
            context.sandbox.on('map.layer.delete', datagrid.reload);
            context.sandbox.on('map.features.plot', datagrid.addData);
            context.sandbox.on('map.features.hide', datagrid.hideFeatures);
            context.sandbox.on('map.features.show', datagrid.showFeatures);
            context.sandbox.on('map.layer.hide', datagrid.hideLayer);
            context.sandbox.on('map.layer.show', datagrid.showLayer);
            context.sandbox.on('data.clear.all', datagrid.clear);
        }
    };

    return exposed;
});


text:
import 'ts-polyfill/lib/es2016-array-include';
import 'ts-polyfill/lib/es2017-object';
import 'ts-polyfill/lib/es2017-string';
import 'ts-polyfill/lib/es2018-async-iterable';   // for-await-of
import 'ts-polyfill/lib/es2018-promise';
import 'ts-polyfill/lib/es2019-array';
import 'ts-polyfill/lib/es2019-object';
import 'ts-polyfill/lib/es2019-string';
import 'ts-polyfill/lib/es2020-string';

import './icons';
import './vue-project';


text:
package org.carlspring.strongbox.net;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;

/**
 * @author mtodorov
 */
public class ConnectionChecker
{

    private ConnectionChecker()
    {
    }

    public static boolean checkServiceAvailability(String host, int port, int timeout)
            throws IOException
    {
        boolean isConnected = false;
        try (Socket socket = new Socket())
        {
            socket.connect(new InetSocketAddress(host, port), timeout);
            isConnected = socket.isConnected();
        }
        catch (SocketException e)
        {
            if (e.getMessage().contains("Connection refused"))
            {
                return false;
            }
        }
        catch (SocketTimeoutException e)
        {
            return false;
        }

        return isConnected;
    }

}


text:
class Message < ActiveRecord::Base
  belongs_to :contact

  def self.unread_messages_size user
    Contact.where(receiver_id: user.id, receiver_saw: false).size
  end

end


text:
package org.insightech.er.editor.model.dbexport.html.page_generator.impl;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.insightech.er.editor.model.ERDiagram;
import org.insightech.er.editor.model.dbexport.html.page_generator.AbstractHtmlReportPageGenerator;
import org.insightech.er.editor.model.diagram_contents.element.node.table.column.NormalColumn;
import org.insightech.er.editor.model.diagram_contents.element.node.view.View;
import org.insightech.er.util.Format;

public class ViewHtmlReportPageGenerator extends
		AbstractHtmlReportPageGenerator {

	public ViewHtmlReportPageGenerator(Map<Object, String> idMap) {
		super(idMap);
	}

	public String getType() {
		return "view";
	}

	@SuppressWarnings("unchecked")
	public List<Object> getObjectList(ERDiagram diagram) {
		return (List) diagram.getDiagramContents().getContents().getViewSet()
				.getList();
	}

	@Override
	public String[] getContentArgs(ERDiagram diagram, Object object)
			throws IOException {
		View view = (View) object;

		String description = Format.null2blank(view.getDescription());

		List<NormalColumn> normalColumnList = view.getExpandedColumns();

		String attributeTable = this.generateAttributeTable(diagram,
				normalColumnList);

		List<NormalColumn> foreignKeyList = new ArrayList<NormalColumn>();
		for (NormalColumn normalColumn : normalColumnList) {
			if (normalColumn.isForeignKey()) {
				foreignKeyList.add(normalColumn);
			}
		}

		String foreignKeyTable = this.generateForeignKeyTable(foreignKeyList);

		String attributeDetailTable = this.generateAttributeDetailTable(
				diagram, normalColumnList);

		return new String[] { Format.null2blank(description),
				Format.null2blank(view.getPhysicalName()),
				Format.null2blank(view.getSql()), attributeTable,
				foreignKeyTable, attributeDetailTable };
	}

	public String getObjectName(Object object) {
		View view = (View) object;

		return view.getName();
	}

	@Override
	public String getObjectSummary(Object object) {
		View view = (View) object;

		return view.getDescription();
	}
}


text:
package com.facebook.buck.rules.args;

import com.facebook.buck.rules.RuleKeyAppendable;
import com.google.common.base.Function;

/**
 * A simple shorthand for {@link Function} and {@link RuleKeyAppendable}, useful when creating
 * anonymous classes.
 */
public interface RuleKeyAppendableFunction<T, F> extends Function<T, F>, RuleKeyAppendable {

}


text:
.inherited-labels .inherited-label {
  margin-right: 5px;
  margin-bottom: 3px;
  padding: 5px 5px 5px 8px;
  display: inline-block;
}
.inherited-labels .inherited-label:hover {
  filter: brightness(110%);
}

.inherited-labels, .overridden-labels {
  padding-left: 28px;
  position: relative;
}

.overridden-labels .icon-override, .inherited-labels .icon-inherit, .overridden-labels .icon-local {
  position: absolute;
  top: 7px;
  left: 1px;
  font-size: 16px;
  color: #666;
  cursor: help;
}

.inherited-labels-inner {
  display: inline-block;
  padding-top: 3px;
}
.inherited-labels button {
  display: inline-block;
  margin-top: -2px;
}


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

    <title></title>

    <button data-action="translate()">Translate</button>


text:
<!doctype html>

		<meta charset="utf-8">

		<title>Red Hat JBoss BPM Suite - Building the Rewards Business Process Workshop</title>

		<meta name="description" content="Online BPM workshop.">
		<meta name="author" content="Eric D. Schabell">

		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<link rel="stylesheet" href="css/reveal.min.css">
		<link rel="stylesheet" href="css/theme/serif.css" id="theme">

		<link rel="stylesheet" href="lib/css/zenburn.css">

Lab 16 - Creating process and task forms

Lab Goal

To create process and task forms needed by the rewards process for submitting and processing by HR department

Rewards form design

We have completed the configuration of our process we need to design our user forms

There are two forms & a sub-form we need:

form to submit initial process

user task form for Approve Reward task

sub-form to define Award object to embed in the other forms

Rewards form design

We start by opening our Rewards process in the designer

We need to pull down the menu-icon shown and click Generate all Forms

Rewards form design

The following forms should be created for you:

rewards.rewards-approval-taskform

ApproveReward-taskform

Note:

if Approve Reward task form not generated, most likely missing Task Name properties

if Task Name property is empty, it will not generate a task form automatically

revisit: User task properties setup in lab 15

Rewards form design

We will start by refining the generated process start form

Click on the rewards.rewards-approval-taskform to open

Rewards form design

The form opens with the tab Add fields by type

By default all variables listed for the process are added

The Award is not yet defined, we will create a sub-form

We need to submit only an employee object, so let's clean this form up

Rewards form design

Cleaning up the generated rewards.rewards-approval-taskform

hover on the outcome item and click on trash icon to remove

hover on the name (name) item, the green one, and click on trash icon to remove

Rewards form design

Cleaning up the generated rewards.rewards-approval-taskform

hover on award item and click the Last (arrow) icon to move to bottom of the form

hover on name item and click on the First (arrow) icon to move to top of the form

Rewards form design

Cleaning up the generated rewards.rewards-approval-taskform

to make the form nicer for our user, we add an HTML title

click on the arrow icon at the top entry HTML label

move the HTML to the top of the form using the First (arrow) icon

Rewards form design

Cleaning up the generated rewards.rewards-approval-taskform

click on the pencil icon for HTML to open the Properties panel

Rewards form design

Cleaning up the generated rewards.rewards-approval-taskform

change text from HTML to: Submit Employee Reward:

Rewards form design

Cleaning up the generated rewards.rewards-approval-taskform

set text size to Heading 2 and SAVE to update form

Rewards form design

Cleaning up the generated rewards.rewards-approval-taskform

now the award item in the form has error message

the message is stating that there is no form generated for the award item

we will have to create this form, called a sub-from

Rewards form design

Creating the Award sub-form

New Item -> Form

Rewards form design

Creating the Award sub-form

fill in name: Award and click on OK

Rewards form design

Creating the Award sub-form

the blank sub-form will open, now we need to add data origins

this will link form data to our model

Rewards form design

Creating the Award sub-form

Id: award

Output Id: award

Render color: Violet

From Data Model: com.redhat.jboss.hr.rewards.Award

Rewards form design

Creating the Award sub-form

click on Add Data Holder to include the award data holder

Rewards form design

Creating the Award sub-form

click on Add fields by origin tab at top of form

click on award plus icon to expand data item

click on right arrow by award to add all data items to form

save form to complete creation sub-form

Rewards form design

Adding the Award sub-form to process start form

go back to the rewards.rewards-approval-taskform to add sub-form

click on Add fields by origin to view form fields

click on award (employee) field pencil icon to open properties editor

Rewards form design

Adding the Award sub-form to process start form

in properties editor, click on Default form field and select Award.form

this links the award (employee) to the Award sub-form

click on SAVE button to complete properties editing

Rewards form design

Creating the Approve Reward user task form

click on Form Definitions -> ApproveReward-taskform to open the user task form

by default it opens to Add fields by type

note the fields need to be adjusted and award (employee) field assigned a sub-form

Rewards form design

Creating the Approve Reward user task form

click on name (employee) field, arrow icon to make this the top field

click on awards (employee) field, arrow icon to make this the bottom field

then click on approval (outcome) field, arrow icon to make this the bottom field

Rewards form design

Creating the Approve Reward user task form

click on award (employee) field pencil icon

in properties editor mark as Read only with check box

note that the Default form is set to our Award.form sub-form, save to complete

Rewards form design

Creating the Approve Reward user task form

need to set the name and dept fields to read only to prevent users from changing data

we only want them to approve (checkbox) or deny by leaving checkbox empty

click on pencil icon to open property editor for name (employee)

check the Read only checkbox and SAVE

repeat for dept (employee)

save user task form and add commit message

Rewards form design

Finished designing task forms

Tools -> Project Editor -> Build & Deploy

Rewards progress

(next up, running the rewards process...)

                            Eric D. Schabell

                            JBoss Technology Evangelist

                            @ericschabell

                            http://schabell.org

JBoss BRMS & BPM Suite Articles

http://schabell.org/search/label/BRMS

http://schabell.org/search/label/BPMS

JBoss BPM Suite Demos

Travel Agency Demo

Generic Loan Demo

Baggage Delivery Demo

JBoss bpmPaaS Demos

bpmPaaS Generic Loan Process in the Cloud

bpmPaaS Travel Agency in the Cloud

JBoss BPM Suite Workshop

Lab 17 - Running the rewards process


text:
package lm.com.framework.mq.activemq;

import java.io.InputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.jms.BytesMessage;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import javax.jms.QueueBrowser;
import javax.jms.StreamMessage;
import javax.jms.TextMessage;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQMessageConsumer;
import org.apache.activemq.ActiveMQMessageProducer;
import org.apache.activemq.ActiveMQSession;
import org.apache.activemq.ActiveMQXAConnectionFactory;
import org.apache.activemq.AsyncCallback;
import org.apache.activemq.BlobMessage;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMapMessage;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTempQueue;
import org.apache.activemq.command.ActiveMQTempTopic;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.jms.pool.PooledConnectionFactory;
import org.apache.activemq.pool.XaPooledConnectionFactory;

import lm.com.framework.StreamUtil;

/**
 * JmsHelper
 *
 * @author mrluo735
 *
 */
public class JmsHelper {
	private ActiveMQConnectionFactory connectionFactory;
	private PooledConnectionFactory pooledConnectionFactory;
	private ActiveMQConnection connection;

	private String brokerUrl = ActiveMQConnection.DEFAULT_BROKER_URL;
	private String userName = ActiveMQConnection.DEFAULT_USER;
	private String password = ActiveMQConnection.DEFAULT_PASSWORD;
	private boolean isXA = false;
	private int xaAckMode = -1;
	private boolean useCompression = true;
	private int maxThreadPoolSize = ActiveMQConnection.DEFAULT_THREAD_POOL_SIZE;

	private boolean enablePooled = true;
	private int maxConnections = 8;
	private int maximumActiveSessionPerConnection = 500;
	private int idleTimeout = 30 * 1000;
	private boolean blockIfSessionPoolIsFull = true;
	private long blockIfSessionPoolIsFullTimeout = -1L;
	private long expiryTimeout = 0l;

	// region 属性
	/**
	 * 获取BrokerUrl
	 *
	 * @return
	 */
	public String getBrokerUrl() {
		return brokerUrl;
	}

	public void setBrokerUrl(String brokerUrl) {
		this.brokerUrl = brokerUrl;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public boolean isXA() {
		return isXA;
	}

	public void setXA(boolean isXA) {
		this.isXA = isXA;
	}

	public int getXaAckMode() {
		return xaAckMode;
	}

	public void setXaAckMode(int xaAckMode) {
		this.xaAckMode = xaAckMode;
	}

	public boolean isUseCompression() {
		return useCompression;
	}

	public void setUseCompression(boolean useCompression) {
		this.useCompression = useCompression;
	}

	public int getMaxThreadPoolSize() {
		return maxThreadPoolSize;
	}

	public void setMaxThreadPoolSize(int maxThreadPoolSize) {
		this.maxThreadPoolSize = maxThreadPoolSize;
	}

	public boolean isEnablePooled() {
		return enablePooled;
	}

	public void setEnablePooled(boolean enablePooled) {
		this.enablePooled = enablePooled;
	}

	public int getMaxConnections() {
		return maxConnections;
	}

	public void setMaxConnections(int maxConnections) {
		this.maxConnections = maxConnections;
	}

	public int getMaximumActiveSessionPerConnection() {
		return maximumActiveSessionPerConnection;
	}

	public void setMaximumActiveSessionPerConnection(int maximumActiveSessionPerConnection) {
		this.maximumActiveSessionPerConnection = maximumActiveSessionPerConnection;
	}

	public int getIdleTimeout() {
		return idleTimeout;
	}

	public void setIdleTimeout(int idleTimeout) {
		this.idleTimeout = idleTimeout;
	}

	public boolean isBlockIfSessionPoolIsFull() {
		return blockIfSessionPoolIsFull;
	}

	public void setBlockIfSessionPoolIsFull(boolean blockIfSessionPoolIsFull) {
		this.blockIfSessionPoolIsFull = blockIfSessionPoolIsFull;
	}

	public long getBlockIfSessionPoolIsFullTimeout() {
		return blockIfSessionPoolIsFullTimeout;
	}

	public void setBlockIfSessionPoolIsFullTimeout(long blockIfSessionPoolIsFullTimeout) {
		this.blockIfSessionPoolIsFullTimeout = blockIfSessionPoolIsFullTimeout;
	}

	public long getExpiryTimeout() {
		return expiryTimeout;
	}

	public void setExpiryTimeout(long expiryTimeout) {
		this.expiryTimeout = expiryTimeout;
	}
	// endregion

	/**
	 * 构造函数
	 */
	public JmsHelper() {
		this(true);
	}

	/**
	 * 构造函数
	 */
	public JmsHelper(boolean enablePooled) {
		this.enablePooled = enablePooled;
		if (this.enablePooled)
			this.createPooledConnectionFactory();
		else
			this.createConnectionFactory();
	}

	/**
	 * 创建连接工厂
	 *
	 * @return
	 */
	private void createConnectionFactory() {
		if (!isXA)
			this.connectionFactory = new ActiveMQConnectionFactory();
		else {
			ActiveMQXAConnectionFactory xaConnectoinFactory = new ActiveMQXAConnectionFactory();
			xaConnectoinFactory.setXaAckMode(this.xaAckMode);
			this.connectionFactory = xaConnectoinFactory;
		}
		this.connectionFactory.setBrokerURL(this.brokerUrl);
		this.connectionFactory.setUserName(this.userName);
		this.connectionFactory.setPassword(this.password);
		this.connectionFactory.setUseCompression(this.useCompression);
		this.connectionFactory.setMaxThreadPoolSize(this.maxThreadPoolSize);
	}

	/**
	 * 创建连接工厂池
	 */
	private void createPooledConnectionFactory() {
		this.createConnectionFactory();
		if (!this.isXA)
			this.pooledConnectionFactory = new PooledConnectionFactory();
		else {
			this.pooledConnectionFactory = new XaPooledConnectionFactory(
					(ActiveMQXAConnectionFactory) this.connectionFactory);
			// ((XaPooledConnectionFactory)pooledConnectionFactory).setTransactionManager();
		}
		this.pooledConnectionFactory.setConnectionFactory(this.connectionFactory);

		this.pooledConnectionFactory.setMaxConnections(maxConnections);
		this.pooledConnectionFactory.setMaximumActiveSessionPerConnection(maximumActiveSessionPerConnection);
		this.pooledConnectionFactory.setIdleTimeout(idleTimeout);
		this.pooledConnectionFactory.setBlockIfSessionPoolIsFull(blockIfSessionPoolIsFull);
		this.pooledConnectionFactory.setBlockIfSessionPoolIsFullTimeout(blockIfSessionPoolIsFullTimeout);
		this.pooledConnectionFactory.setExpiryTimeout(expiryTimeout);
	}

	/**
	 * 关闭连接池
	 */
	public void closePooled() {
		if (this.enablePooled)
			this.pooledConnectionFactory.stop();
	}

	/**
	 * 创建连接
	 *
	 * @return
	 */
	public ActiveMQConnection createConnection() {
		try {
			if (this.connection != null)
				return this.connection;

			if (this.enablePooled) {
				connection = (ActiveMQConnection) this.pooledConnectionFactory.createConnection();
			} else {
				this.createConnectionFactory();
				connection = (ActiveMQConnection) this.connectionFactory.createConnection();
			}
			connection.start();
			return connection;
		} catch (JMSException ex) {
			throw new RuntimeException(ex);
		}
	}

	/**
	 * 重载+1 关闭连接
	 */
	public void closeConnection() {
		this.closeConnection(this.connection);
	}

	/**
	 * 重载+2 关闭连接
	 *
	 * @param connection
	 */
	public void closeConnection(ActiveMQConnection connection) {
		try {
			if (this.connection != null) {
				this.connection.close();
				this.connection = null;
			}
		} catch (JMSException ex) {
			throw new RuntimeException(ex);
		}
	}

	/**
	 * 重载+1 创建目标
	 *
	 * @param name
	 * @param type
	 * @return
	 */
	public boolean createDestination(String name, byte type) {
		return this.createDestination(name, type, false, ActiveMQSession.AUTO_ACKNOWLEDGE);
	}

	/**
	 * 重载+2 创建目标
	 *
	 * @param name
	 * @param type
	 * @param transacted
	 * @param acknowledgeMode
	 * @return
	 */
	public boolean createDestination(String name, byte type, boolean transacted, int acknowledgeMode) {
		ActiveMQSession session = null;
		ActiveMQDestination destination = null;
		ActiveMQMessageProducer producer = null;
		try {
			this.createConnection();
			session = (ActiveMQSession) this.connection.createSession(transacted, acknowledgeMode);
			destination = this.getDestination(name, type);
			if (destination == null)
				return false;
			producer = (ActiveMQMessageProducer) session.createProducer(new ActiveMQQueue(name));
			return true;
		} catch (JMSException ex) {
			return false;
		} finally {
			if (producer != null) {
				try {
					producer.close();
				} catch (JMSException e) {
				}
			}
			if (session != null) {
				try {
					session.close();
				} catch (JMSException e) {
				}
			}
			this.closeConnection();
		}
	}

	/**
	 * 重载+1 同步发送消息
	 *
	 * @param name
	 * @param type
	 * @param content
	 */
	public void sendSync(String name, byte type, String content) {
		try {
			this.send(name, type, content, false, ActiveMQSession.AUTO_ACKNOWLEDGE, 0, 0, 0L, null);
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		}
	}

	/**
	 * 重载+2 同步发送消息
	 *
	 * @param name
	 * @param type
	 * @param content
	 */
	public void sendSync(String name, byte type, byte[] content) {
		try {
			this.send(name, type, content, false, ActiveMQSession.AUTO_ACKNOWLEDGE, 0, 0, 0L, null);
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		}
	}

	/**
	 * 重载+1 异步发送消息
	 *
	 * @param name
	 * @param type
	 * @param content
	 * @param onComplete
	 */
	public void sendAsync(String name, byte type, String content, AsyncCallback onComplete) {
		try {
			this.send(name, type, content, false, ActiveMQSession.AUTO_ACKNOWLEDGE, 0, 0, 0L, onComplete);
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		}
	}

	/**
	 * 重载+2 异步发送消息
	 *
	 * @param name
	 * @param type
	 * @param content
	 * @param onComplete
	 */
	public void sendAsync(String name, byte type, byte[] content, AsyncCallback onComplete) {
		try {
			this.send(name, type, content, false, ActiveMQSession.AUTO_ACKNOWLEDGE, 0, 0, 0L, onComplete);
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		}
	}

	/**
	 * 发送消息
	 *
	 * @param <T>
	 * @param name
	 * @param type
	 * @param content
	 * @param transacted
	 * @param acknowledgeMode
	 * @param deliveryMode
	 * @param priority
	 * @param timeToLive
	 * @param onComplete
	 */
	public <T> void send(String name, byte type, T content, boolean transacted, int acknowledgeMode, int deliveryMode,
			int priority, long timeToLive, AsyncCallback onComplete) {
		ActiveMQSession session = null;
		ActiveMQMessageProducer producer = null;
		try {
			this.createConnection();
			Destination destination = this.getDestination(name, type);
			if (destination == null)
				throw new RuntimeException("destination is null!");

			session = (ActiveMQSession) this.connection.createSession(transacted, acknowledgeMode);
			producer = (ActiveMQMessageProducer) session.createProducer(destination);

			Message message = null;
			if (content instanceof byte[]) { // CommandTypes.ACTIVEMQ_BYTES_MESSAGE
				BytesMessage bytesMessage = session.createBytesMessage();
				bytesMessage.writeBytes((byte[]) content);
				message = bytesMessage;
			} else if (content instanceof Map) { // CommandTypes.ACTIVEMQ_MAP_MESSAGE
				ActiveMQMapMessage mapMessage = (ActiveMQMapMessage) session.createMapMessage();
				mapMessage.getContentMap().putAll((Map<String, Object>) content);
				message = mapMessage;
			} else if (content instanceof Serializable) { // CommandTypes.ACTIVEMQ_OBJECT_MESSAGE
				ObjectMessage objectMessage = session.createObjectMessage((Serializable) content);
				message = objectMessage;
			} else if (content instanceof InputStream) { // CommandTypes.ACTIVEMQ_STREAM_MESSAGE
				StreamMessage streamMessage = session.createStreamMessage();
				streamMessage.writeBytes(StreamUtil.inputStream2Bytes((InputStream) content));
				message = streamMessage;
			} else if (content instanceof String) {
				TextMessage textMessage = session.createTextMessage((String) content);
				message = textMessage;
			} else if (content instanceof InputStream) { // CommandTypes.ACTIVEMQ_BLOB_MESSAGE
				BlobMessage blobMessage = session.createBlobMessage((InputStream) content);
				message = blobMessage;
			} else
				return;
			if (onComplete == null)
				producer.send(message, deliveryMode, priority, timeToLive);
			else
				producer.send(message, onComplete);
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} finally {
			if (producer != null) {
				try {
					producer.close();
				} catch (JMSException e) {
				}
			}
			if (session != null) {
				try {
					session.close();
				} catch (JMSException e) {
				}
			}
			this.closeConnection();
		}
	}

	/**
	 * 重载+1 同步消费消息
	 *
	 * @param name
	 * @param type
	 * @param contentType
	 * @param transacted
	 * @param acknowledgeMode
	 */
	public String consumeSync(String name, byte type) {
		return this.consumeSync(name, type, TextMessage.class, false, ActiveMQSession.AUTO_ACKNOWLEDGE).toString();
	}

	/**
	 * 重载+2 同步消费消息
	 *
	 * @param name
	 * @param type
	 * @param contentType
	 * @param transacted
	 * @param acknowledgeMode
	 */
	public <T> Object consumeSync(String name, byte type, Class<T> contentType, boolean transacted,
			int acknowledgeMode) {
		ActiveMQSession session = null;
		ActiveMQMessageConsumer consumer = null;
		try {
			this.createConnection();
			session = (ActiveMQSession) this.connection.createSession(transacted, acknowledgeMode);
			Destination destination = this.getDestination(name, type);
			if (destination == null)
				throw new RuntimeException("destination is null!");

			consumer = (ActiveMQMessageConsumer) session.createConsumer(destination);
			ActiveMQMessage message = (ActiveMQMessage) consumer.receive(6000);
			return message.getContent();
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} finally {
			if (consumer != null) {
				try {
					consumer.close();
				} catch (JMSException e) {
				}
			}
			if (session != null) {
				try {
					session.close();
				} catch (JMSException e) {
				}
			}
			this.closeConnection();
		}
	}

	/**
	 * 异步消费消息
	 *
	 * @param name
	 * @param type
	 * @param transacted
	 * @param acknowledgeMode
	 * @param listener
	 */
	public ActiveMQMessageConsumer consumeAsync(String name, byte type, boolean transacted, int acknowledgeMode,
			MessageListener listener) {
		ActiveMQSession session = null;
		ActiveMQMessageConsumer consumer = null;
		try {
			this.createConnection();
			session = (ActiveMQSession) this.connection.createSession(transacted, acknowledgeMode);
			Destination destination = this.getDestination(name, type);
			if (destination == null)
				throw new RuntimeException("destination is null!");

			consumer = (ActiveMQMessageConsumer) session.createConsumer(destination);
			consumer.setMessageListener(listener);
			// consumer.commit();
			return consumer;
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} finally {
		}
	}

	/**
	 * 浏览消息内容
	 *
	 * @param name
	 */
	public List<Object> brower(String name) {
		List<Object> list = new ArrayList<Object>();

		ActiveMQSession session = null;
		QueueBrowser browser = null;
		try {
			this.createConnection();
			session = (ActiveMQSession) this.connection.createSession(false, ActiveMQSession.AUTO_ACKNOWLEDGE);
			browser = session.createBrowser(new ActiveMQQueue(name));
			while (browser.getEnumeration().hasMoreElements()) {
				Object object = browser.getEnumeration().nextElement();
				list.add(object);
			}
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} finally {
			if (browser != null) {
				try {
					browser.close();
				} catch (JMSException e) {
				}
			}
			if (session != null) {
				try {
					session.close();
				} catch (JMSException e) {
				}
			}
			this.closeConnection();
		}
		return list;
	}

	/**
	 * 获取目标
	 *
	 * @param name
	 * @param type
	 * @return
	 */
	private ActiveMQDestination getDestination(String name, byte type) {
		switch (type) {
			case ActiveMQDestination.QUEUE_TYPE:
				return new ActiveMQQueue(name);
			case ActiveMQDestination.TOPIC_TYPE:
				return new ActiveMQTopic(name);
			case ActiveMQDestination.TEMP_QUEUE_TYPE:
				return new ActiveMQTempQueue(name);
			case ActiveMQDestination.TEMP_TOPIC_TYPE:
				return new ActiveMQTempTopic(name);
			default:
				return null;
		}
	}
}


text:
namespace extensions {

namespace bluetooth = api::bluetooth;

// A struct storing a Bluetooth socket and the extension that added it.
struct ExtensionBluetoothSocketRecord {
  std::string extension_id;
  scoped_refptr<device::BluetoothSocket> socket;
};

// A struct storing a Bluetooth profile and the extension that added it.
struct ExtensionBluetoothProfileRecord {
  std::string extension_id;
  device::BluetoothProfile* profile;
};

ExtensionBluetoothEventRouter::ExtensionBluetoothEventRouter(Profile* profile)
    : send_discovery_events_(false),
      responsible_for_discovery_(false),
      profile_(profile),
      adapter_(NULL),
      num_event_listeners_(0),
      next_socket_id_(1),
      weak_ptr_factory_(this) {
  DCHECK(profile_);
  registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
                 content::Source<Profile>(profile_));
}

ExtensionBluetoothEventRouter::~ExtensionBluetoothEventRouter() {
  if (adapter_.get()) {
    adapter_->RemoveObserver(this);
    adapter_ = NULL;
  }
  DLOG_IF(WARNING, socket_map_.size() != 0)
      << "Bluetooth sockets are still open.";
  socket_map_.clear();

  for (BluetoothProfileMap::iterator iter = bluetooth_profile_map_.begin();
       iter != bluetooth_profile_map_.end();
       ++iter) {
    iter->second.profile->Unregister();
  }
}

bool ExtensionBluetoothEventRouter::IsBluetoothSupported() const {
  return adapter_.get() ||
         device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable();
}

void ExtensionBluetoothEventRouter::GetAdapter(
    const device::BluetoothAdapterFactory::AdapterCallback& callback) {
  if (adapter_.get()) {
    callback.Run(scoped_refptr<device::BluetoothAdapter>(adapter_));
    return;
  }

  device::BluetoothAdapterFactory::GetAdapter(callback);
}

void ExtensionBluetoothEventRouter::OnListenerAdded() {
  num_event_listeners_++;
  InitializeAdapterIfNeeded();
}

void ExtensionBluetoothEventRouter::OnListenerRemoved() {
  if (num_event_listeners_ > 0)
    num_event_listeners_--;
  MaybeReleaseAdapter();
}

int ExtensionBluetoothEventRouter::RegisterSocket(
    const std::string& extension_id,
    scoped_refptr<device::BluetoothSocket> socket) {
  // If there is a socket registered with the same fd, just return it's id
  for (SocketMap::const_iterator i = socket_map_.begin();
      i != socket_map_.end(); ++i) {
    if (i->second.socket.get() == socket.get())
      return i->first;
  }
  int return_id = next_socket_id_++;
  ExtensionBluetoothSocketRecord record = { extension_id, socket };
  socket_map_[return_id] = record;
  return return_id;
}

bool ExtensionBluetoothEventRouter::ReleaseSocket(int id) {
  SocketMap::iterator socket_entry = socket_map_.find(id);
  if (socket_entry == socket_map_.end())
    return false;
  socket_map_.erase(socket_entry);
  return true;
}

void ExtensionBluetoothEventRouter::AddProfile(
    const std::string& uuid,
    const std::string& extension_id,
    device::BluetoothProfile* bluetooth_profile) {
  DCHECK(!HasProfile(uuid));
  ExtensionBluetoothProfileRecord record = { extension_id, bluetooth_profile };
  bluetooth_profile_map_[uuid] = record;
}

void ExtensionBluetoothEventRouter::RemoveProfile(const std::string& uuid) {
  BluetoothProfileMap::iterator iter = bluetooth_profile_map_.find(uuid);
  if (iter != bluetooth_profile_map_.end()) {
    device::BluetoothProfile* bluetooth_profile = iter->second.profile;
    bluetooth_profile_map_.erase(iter);
    bluetooth_profile->Unregister();
  }
}

bool ExtensionBluetoothEventRouter::HasProfile(const std::string& uuid) const {
  return bluetooth_profile_map_.find(uuid) != bluetooth_profile_map_.end();
}

device::BluetoothProfile* ExtensionBluetoothEventRouter::GetProfile(
    const std::string& uuid) const {
  BluetoothProfileMap::const_iterator iter = bluetooth_profile_map_.find(uuid);
  if (iter != bluetooth_profile_map_.end())
    return iter->second.profile;

  return NULL;
}

scoped_refptr<device::BluetoothSocket>
ExtensionBluetoothEventRouter::GetSocket(int id) {
  SocketMap::iterator socket_entry = socket_map_.find(id);
  if (socket_entry == socket_map_.end())
    return NULL;
  return socket_entry->second.socket;;
}

void ExtensionBluetoothEventRouter::SetResponsibleForDiscovery(
    bool responsible) {
  responsible_for_discovery_ = responsible;
}

bool ExtensionBluetoothEventRouter::IsResponsibleForDiscovery() const {
  return responsible_for_discovery_;
}

void ExtensionBluetoothEventRouter::SetSendDiscoveryEvents(bool should_send) {
  // At the transition into sending devices, also send past devices that
  // were discovered as they will not be discovered again.
  if (should_send && !send_discovery_events_) {
    for (DeviceList::const_iterator i = discovered_devices_.begin();
        i != discovered_devices_.end(); ++i) {
      DispatchDeviceEvent(extensions::event_names::kBluetoothOnDeviceDiscovered,
                          **i);
    }
  }

  send_discovery_events_ = should_send;
}

void ExtensionBluetoothEventRouter::DispatchDeviceEvent(
    const std::string& event_name, const bluetooth::Device& device) {
  scoped_ptr<base::ListValue> args(new base::ListValue());
  args->Append(device.ToValue().release());
  scoped_ptr<Event> event(new Event(event_name, args.Pass()));
  ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent(event.Pass());
}

void ExtensionBluetoothEventRouter::DispatchConnectionEvent(
    const std::string& extension_id,
    const std::string& uuid,
    const device::BluetoothDevice* device,
    scoped_refptr<device::BluetoothSocket> socket) {
  if (!HasProfile(uuid))
    return;

  int socket_id = RegisterSocket(extension_id, socket);
  api::bluetooth::Socket result_socket;
  api::bluetooth::BluetoothDeviceToApiDevice(*device, &result_socket.device);
  result_socket.profile.uuid = uuid;
  result_socket.id = socket_id;

  scoped_ptr<base::ListValue> args(new base::ListValue());
  args->Append(result_socket.ToValue().release());
  scoped_ptr<Event> event(new Event(
      bluetooth::OnConnection::kEventName, args.Pass()));
  ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
      extension_id, event.Pass());
}

void ExtensionBluetoothEventRouter::AdapterPresentChanged(
    device::BluetoothAdapter* adapter, bool present) {
  if (adapter != adapter_.get()) {
    DVLOG(1) << "Ignoring event for adapter " << adapter->GetAddress();
    return;
  }
  DispatchAdapterStateEvent();
}

void ExtensionBluetoothEventRouter::AdapterPoweredChanged(
    device::BluetoothAdapter* adapter, bool has_power) {
  if (adapter != adapter_.get()) {
    DVLOG(1) << "Ignoring event for adapter " << adapter->GetAddress();
    return;
  }
  DispatchAdapterStateEvent();
}

void ExtensionBluetoothEventRouter::AdapterDiscoveringChanged(
    device::BluetoothAdapter* adapter, bool discovering) {
  if (adapter != adapter_.get()) {
    DVLOG(1) << "Ignoring event for adapter " << adapter->GetAddress();
    return;
  }

  if (!discovering) {
    send_discovery_events_ = false;
    responsible_for_discovery_ = false;
    discovered_devices_.clear();
  }

  DispatchAdapterStateEvent();
}

void ExtensionBluetoothEventRouter::DeviceAdded(
    device::BluetoothAdapter* adapter,
    device::BluetoothDevice* device) {
  if (adapter != adapter_.get()) {
    DVLOG(1) << "Ignoring event for adapter " << adapter->GetAddress();
    return;
  }

  bluetooth::Device* extension_device =
      new bluetooth::Device();
  bluetooth::BluetoothDeviceToApiDevice(
      *device, extension_device);
  discovered_devices_.push_back(extension_device);

  if (!send_discovery_events_)
    return;

  DispatchDeviceEvent(extensions::event_names::kBluetoothOnDeviceDiscovered,
                      *extension_device);
}

void ExtensionBluetoothEventRouter::InitializeAdapterIfNeeded() {
  if (!adapter_.get()) {
    GetAdapter(base::Bind(&ExtensionBluetoothEventRouter::InitializeAdapter,
                          weak_ptr_factory_.GetWeakPtr()));
  }
}

void ExtensionBluetoothEventRouter::InitializeAdapter(
    scoped_refptr<device::BluetoothAdapter> adapter) {
  if (!adapter_.get()) {
    adapter_ = adapter;
    adapter_->AddObserver(this);
  }
}

void ExtensionBluetoothEventRouter::MaybeReleaseAdapter() {
  if (adapter_.get() && num_event_listeners_ == 0) {
    adapter_->RemoveObserver(this);
    adapter_ = NULL;
  }
}

void ExtensionBluetoothEventRouter::DispatchAdapterStateEvent() {
  api::bluetooth::AdapterState state;
  PopulateAdapterState(*adapter_.get(), &state);

  scoped_ptr<base::ListValue> args(new base::ListValue());
  args->Append(state.ToValue().release());
  scoped_ptr<Event> event(new Event(
      bluetooth::OnAdapterStateChanged::kEventName,
      args.Pass()));
  ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent(event.Pass());
}

void ExtensionBluetoothEventRouter::CleanUpForExtension(
    const std::string& extension_id) {
  // Remove all profiles added by the extension.
  BluetoothProfileMap::iterator profile_iter = bluetooth_profile_map_.begin();
  while (profile_iter != bluetooth_profile_map_.end()) {
    ExtensionBluetoothProfileRecord record = profile_iter->second;
    if (record.extension_id == extension_id) {
      bluetooth_profile_map_.erase(profile_iter++);
      record.profile->Unregister();
    } else {
      profile_iter++;
    }
  }

  // Remove all sockets opened by the extension.
  SocketMap::iterator socket_iter = socket_map_.begin();
  while (socket_iter != socket_map_.end()) {
    int socket_id = socket_iter->first;
    ExtensionBluetoothSocketRecord record = socket_iter->second;
    socket_iter++;
    if (record.extension_id == extension_id) {
      ReleaseSocket(socket_id);
    }
  }
}

void ExtensionBluetoothEventRouter::Observe(
    int type,
    const content::NotificationSource& source,
    const content::NotificationDetails& details) {
  switch (type) {
    case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
      extensions::UnloadedExtensionInfo* info =
          content::Details<extensions::UnloadedExtensionInfo>(details).ptr();
      CleanUpForExtension(info->extension->id());
      break;
    }
  }
}

}  // namespace extensions


text:
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) > [puppeteer](./puppeteer.md) > [Protocol](./puppeteer.protocol.md) > [Audits](./puppeteer.protocol.audits.md) > [InspectorIssueDetails](./puppeteer.protocol.audits.inspectorissuedetails.md) > [mixedContentIssueDetails](./puppeteer.protocol.audits.inspectorissuedetails.mixedcontentissuedetails.md)

## Protocol.Audits.InspectorIssueDetails.mixedContentIssueDetails property

<b>Signature:</b>

```typescript
mixedContentIssueDetails?: MixedContentIssueDetails;
```


text:
/**
 */
package com.rockwellcollins.atc.resolute.resolute;

import org.eclipse.emf.ecore.EObject;

import org.osate.aadl2.NamedElement;

/**
 *
 * A representation of the model object 'Arg'.
 *
 *
 *

 * The following features are supported:
 *

 *
{@link com.rockwellcollins.atc.resolute.resolute.Arg#getType Type}

 *

 *

 *
 * @see com.rockwellcollins.atc.resolute.resolute.ResolutePackage#getArg()
 * @model
 * @generated
 */
public interface Arg extends EObject, NamedElement
{
  /**
   * Returns the value of the 'Type' containment reference.
   *
   *

   * If the meaning of the 'Type' containment reference isn't clear,
   * there really should be more of a description here...
   *

   *
   * @return the value of the 'Type' containment reference.
   * @see #setType(Type)
   * @see com.rockwellcollins.atc.resolute.resolute.ResolutePackage#getArg_Type()
   * @model containment="true"
   * @generated
   */
  Type getType();

  /**
   * Sets the value of the '{@link com.rockwellcollins.atc.resolute.resolute.Arg#getType Type}' containment reference.
   *
   *
   * @param value the new value of the 'Type' containment reference.
   * @see #getType()
   * @generated
   */
  void setType(Type value);

} // Arg


text:
<?php
namespace Concrete\Core\Permission\Registry;

use Concrete\Core\Permission\Registry\Entry\Access\EntryInterface;
use Concrete\Core\Permission\Registry\Entry\Access\AccessEntryInterface;

interface AccessRegistryInterface extends RegistryInterface
{

    /**
     * @return EntryInterface[]
     */
    function getEntries();

    /**
     * @return EntryInterface[]
     */
    function getEntriesToRemove();

}


text:
package com.owera.xaps.dbi;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.owera.common.db.ConnectionProvider;
import com.owera.common.db.NoAvailableConnectionException;
import com.owera.common.log.Logger;
import com.owera.xaps.dbi.InsertOrUpdateStatement.Field;

public class Triggers {
	private static Logger logger = new Logger();
	private Map<String, Trigger> nameMap;
	private Map<Integer, Trigger> idMap;
	private Unittype unittype;

	public Triggers(Map<Integer, Trigger> idMap, Map<String, Trigger> nameMap, Unittype unittype) {
		this.idMap = idMap;
		this.nameMap = nameMap;
		this.unittype = unittype;
	}

	public Unittype getUnittype() {
		return unittype;
	}

	public Trigger getById(Integer id) {
		return idMap.get(id);
	}

	public Trigger getByName(String name) {
		return nameMap.get(name);
	}

	public Trigger[] getTriggers() {
		Trigger[] triggers = nameMap.values().toArray(new Trigger[] {});
		return triggers;
	}

	@Override
	public String toString() {
		return "Contains " + nameMap.size() + " triggers";
	}

	/**
	 * Add or change history in the trigger_release table.
	 *
	 * @param history
	 * @param xaps
	 * @throws SQLException
	 * @throws NoAvailableConnectionException
	 */
	public void addOrChangeHistory(TriggerRelease history, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		SQLException sqlex = null;
		try {
			if (history.getId() == null) {
				DynamicStatement ds = new DynamicStatement();
				ds.addSqlAndArguments("trigger_id, ", history.getTrigger().getId());
				ds.addSqlAndIntegerArgs("no_events, ", history.getNoEvents());
				ds.addSqlAndIntegerArgs("no_events_pr_unit, ", history.getNoEventsPrUnit());
				ds.addSqlAndIntegerArgs("no_units, ", history.getNoUnits());
				ds.addSqlAndArguments("first_event_timestamp, ", history.getFirstEventTms());
				ds.addSqlAndArguments("release_timestamp", history.getReleaseTms());
				// Do not specify sent_timestamp, this is only done in UPDATE (from Monitor-server)
				ds.setSql("INSERT INTO trigger_release (" + ds.getSql() + ") VALUES (" + ds.getQuestionMarks() + ")");
				ps = ds.makePreparedStatement(c, "id");
				ps.setQueryTimeout(60);
				ps.executeUpdate();
				ResultSet gk = ps.getGeneratedKeys();
				if (gk.next())
					history.setId(gk.getInt(1));
			} else {
				// Can only update sent_timestamp - the other fields should not be touched
				DynamicStatement ds = new DynamicStatement();
				ds.addSqlAndArguments("UPDATE trigger_release SET sent_timestamp = ? WHERE id = ?", history.getSentTms(), history.getId());
				ps = ds.makePreparedStatement(c);
				ps.setQueryTimeout(60);
				ps.executeUpdate();
			}
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	public TriggerRelease readLatestTriggerRelease(Trigger trigger, Date from, Date to, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		List<TriggerRelease> history = readTriggerReleases(trigger, from, to, xaps, 1);
		if (history.size() > 0)
			return history.get(0);
		return null;
	}

	public List<TriggerRelease> readTriggerReleases(Trigger trigger, Date from, Date to, XAPS xaps, Integer limit) throws SQLException, NoAvailableConnectionException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		SQLException sqlex = null;
		try {
			List<TriggerRelease> thList = new ArrayList<TriggerRelease>();
			DynamicStatement ds = new DynamicStatement();
			ds.addSql("SELECT tr.id, tr.trigger_id, tr.no_events, tr.no_events_pr_unit, tr.no_units, tr.first_event_timestamp, tr.release_timestamp, tr.sent_timestamp ");
			ds.addSqlAndArguments("FROM trigger_release tr, trigger_ t WHERE tr.release_timestamp >= ? AND tr.release_timestamp < ? ", from, to);
			if (trigger != null)
				ds.addSqlAndArguments("AND tr.trigger_id = ? ", trigger.getId());
			ds.addSqlAndArguments("AND tr.trigger_id = t.id AND t.unit_type_id = ? ", unittype.getId());
			ds.addSql("ORDER BY tr.release_timestamp DESC");
			if (limit != null)
				ds.addSql(" LIMIT " + limit);
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			rs = ps.executeQuery();
			while (rs.next()) {
				Integer id = rs.getInt("id");
				Integer triggerId = rs.getInt("trigger_id");
				Integer noEvents = rs.getInt("no_events");
				Integer noEventsPrUnit = rs.getInt("no_events_pr_unit");
				Integer noUnits = rs.getInt("no_units");
				Date firstEventTms = rs.getTimestamp("first_event_timestamp");
				Date releaseTms = rs.getTimestamp("release_timestamp");
				Date sentTms = rs.getTimestamp("sent_timestamp");
				TriggerRelease th = new TriggerRelease(getById(triggerId), noEvents, noEventsPrUnit, noUnits, firstEventTms, releaseTms, sentTms);
				th.setId(id);
				thList.add(th);
			}
			return thList;
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (rs != null)
				rs.close();
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	/**
	 * Add TriggerEvent to trigger_event table. This execution is not logged (like addOrChangeTrigger())
	 * because this is a method supposed to be more efficient and cost less for the system. It will
	 * be run by the Syslog- and TR-069 server. Not necessary with any permission checks.
	 *
	 * @param event
	 * @param xaps
	 * @throws SQLException
	 * @throws NoAvailableConnectionException
	 */
	public void addEvent(TriggerEvent event, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		try {
			DynamicStatement ds = new DynamicStatement();
			ds.addSqlAndArguments("trigger_id, ", event.getTrigger().getId());
			ds.addSqlAndArguments("timestamp_, ", event.getTms());
			ds.addSqlAndArguments("unit_id", event.getUnitId());
			ds.setSql("INSERT INTO trigger_event (" + ds.getSql() + ") VALUES (" + ds.getQuestionMarks() + ")");
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			ps.executeUpdate();
		} catch (SQLException sqle) {
			// Ignore SQLExceptions, the likely source of such an exception is
			// if shell/web has deleted the trigger involved within the past 1000 ms,
			// and the cache in the syslog server (running this method) has not
			// been updated.
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, null);
		}
	}

	public int deleteHistory(Date upUntil, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		return deleteHistory(null, upUntil, xaps);
	}

	public int deleteHistory(Integer triggerId, Date upUntil, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		SQLException sqlex = null;
		try {
			DynamicStatement ds = new DynamicStatement();
			if (triggerId == null)
				ds.addSqlAndArguments("DELETE FROM trigger_release WHERE release_timestamp < ?", upUntil);
			else
				ds.addSqlAndArguments("DELETE FROM trigger_release WHERE trigger_id = ? and release_timestamp < ?", triggerId, upUntil);
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			return ps.executeUpdate();
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	public int deleteEvents(Date upUntil, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		return deleteEvents(null, upUntil, xaps);
	}

	/**
	 * Delete old triggerEvents. Run by Core server, to make a smaller table to work on.
	 *
	 * @param triggerId
	 * @param upUntil
	 * @param xaps
	 * @return
	 * @throws SQLException
	 * @throws NoAvailableConnectionException
	 */
	public int deleteEvents(Integer triggerId, Date upUntil, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		SQLException sqlex = null;
		try {
			DynamicStatement ds = new DynamicStatement();
			if (triggerId == null)
				ds.addSqlAndArguments("DELETE FROM trigger_event WHERE timestamp_ < ?", upUntil);
			else
				ds.addSqlAndArguments("DELETE FROM trigger_event WHERE trigger_id = ? and timestamp_ < ?", triggerId, upUntil);
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			return ps.executeUpdate();
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	/**
	 * Count number of events for each unitid for a trigger within a specified time frame. This result can also
	 * return the total number of event for a trigger within a specified time frame.
	 *
	 * @param triggerId
	 * @param from
	 * @param to
	 * @param xaps
	 * @return
	 * @throws SQLException
	 * @throws NoAvailableConnectionException
	 */
	public Map<String, Integer> countEventsPrUnit(Integer triggerId, Date from, Date to, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		SQLException sqlex = null;
		Map<String, Integer> unitMap = new HashMap<String, Integer>();
		try {
			DynamicStatement ds = new DynamicStatement();
			ds.addSqlAndArguments("SELECT unit_id, COUNT(*) FROM trigger_event WHERE trigger_id = ? AND timestamp_ >= ? AND timestamp_ < ? GROUP BY unit_id", triggerId, from, to);
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			rs = ps.executeQuery();
			int totalCounter = 0;
			while (rs.next()) {
				String unitId = rs.getString("unit_id");
				Integer count = rs.getInt(2);
				totalCounter += count;
				unitMap.put(unitId, count);
			}
			unitMap.put("TEC-TotalEventsCounter", totalCounter);
			return unitMap;
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	public Date getFirstEventTms(Integer triggerId, Date from, Date to, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		SQLException sqlex = null;
		try {
			DynamicStatement ds = new DynamicStatement();
			ds.addSqlAndArguments("SELECT timestamp_ FROM trigger_event WHERE trigger_id = ? AND timestamp_ >= ? AND timestamp_ < ? ORDER BY timestamp_ ASC LIMIT 1", triggerId, from, to);
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			rs = ps.executeQuery();
			if (rs.next())
				return rs.getTimestamp("timestamp_");
			else
				return null;
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	/**
	 * Count number of unique unit ids for a trigger within a time frame.
	 *
	 * @param triggerId
	 * @param from
	 * @param to
	 * @param xaps
	 * @return
	 * @throws SQLException
	 * @throws NoAvailableConnectionException
	 */
	public Integer countUnits(Integer triggerId, Date from, Date to, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		SQLException sqlex = null;
		try {
			DynamicStatement ds = new DynamicStatement();
			ds.addSqlAndArguments("SELECT COUNT(DISTINCT(unit_id)) FROM trigger_event WHERE trigger_id = ? AND timestamp_ >= ? AND timestamp_ < ?", triggerId, from, to);
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			rs = ps.executeQuery();
			if (rs.next())
				return rs.getInt(1);
			else
				return 0;
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	public void addOrChangeTrigger(Trigger trigger, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		if (!xaps.getUser().isUnittypeAdmin(unittype.getId()))
			throw new IllegalArgumentException("Not allowed action for this user");
		trigger.validate();
		addOrChangeTriggerImpl(trigger, xaps);
		nameMap.put(trigger.getName(), trigger);
		idMap.put(trigger.getId(), trigger);
		if (trigger.getOldName() != null) {
			nameMap.remove(trigger.getOldName());
			trigger.setOldName(null);
		}
	}

	private int deleteTriggerImpl(Trigger trigger, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, false);
		SQLException sqlex = null;
		try {
			DynamicStatement ds = new DynamicStatement();
			ds.addSqlAndArguments("DELETE FROM trigger_event WHERE trigger_id = ?", trigger.getId());
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			ps.executeUpdate();
			ds = new DynamicStatement();
			ds.addSqlAndArguments("DELETE FROM trigger_release WHERE trigger_id = ?", trigger.getId());
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			ps.executeUpdate();
			ds = new DynamicStatement();
			ds.addSqlAndArguments("DELETE FROM trigger_ WHERE id = ?", trigger.getId());
			ps = ds.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			int rowsDeleted = ps.executeUpdate();
			c.commit();
			c.setAutoCommit(true);
			if (xaps.getDbi() != null)
				xaps.getDbi().publishDelete(trigger, trigger.getUnittype());
			logger.notice("Deleted trigger " + trigger.getName());
			return rowsDeleted;
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	/**
	 * The first time this method is run, the flag is set. The second time this
	 * method is run, the parameter is removed from the name- and id-Map.
	 *
	 * @throws com.owera.common.db.NoAvailableConnectionException
	 *
	 * @throws java.sql.SQLException
	 */
	public int deleteTrigger(Trigger trigger, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		if (trigger.getChildren().size() > 0)
			throw new IllegalArgumentException("This trigger is a composite trigger with \"child\" triggers. Remove child triggers before deleting this trigger");
		if (!xaps.getUser().isUnittypeAdmin(unittype.getId()))
			throw new IllegalArgumentException("Not allowed action for this user");
		int rowsDeleted = deleteTriggerImpl(trigger, xaps);
		nameMap.remove(trigger.getName());
		idMap.remove(trigger.getId());
		if (trigger.getParent() != null)
			trigger.getParent().removeChild(trigger);
		return rowsDeleted;
	}

	private void addOrChangeTriggerImpl(Trigger trigger, XAPS xaps) throws SQLException, NoAvailableConnectionException {
		PreparedStatement ps = null;
		Connection c = ConnectionProvider.getConnection(xaps.connectionProperties, true);
		SQLException sqlex = null;
		try {
			InsertOrUpdateStatement ious = new InsertOrUpdateStatement("trigger_", new Field("id", trigger.getId()));
			ious.addField(new Field("name", trigger.getName()));
			ious.addField(new Field("description", trigger.getDescription()));
			ious.addField(new Field("trigger_type", trigger.getTriggerType()));
			ious.addField(new Field("notify_type", trigger.getNotifyType()));
			ious.addField(new Field("active", trigger.isActive() ? 1 : 0));
			ious.addField(new Field("unit_type_id", trigger.getUnittype().getId()));
			//			if (trigger.getGroup() != null)
			//				ious.addField(new Field("group_id", trigger.getGroup().getId()));
			ious.addField(new Field("eval_period_minutes", trigger.getEvalPeriodMinutes()));
			ious.addField(new Field("notify_interval_hours", trigger.getNotifyIntervalHours()));
			if (trigger.getScript() != null)
				ious.addField(new Field("filestore_id", trigger.getScript().getId()));
			else
				ious.addField(new Field("filestore_id", (Integer) null));
			if (trigger.getParent() != null)
				ious.addField(new Field("parent_trigger_id", trigger.getParent().getId()));
			else
				ious.addField(new Field("parent_trigger_id", (Integer) null));
			ious.addField(new Field("to_list", trigger.getToList()));
			if (trigger.getSyslogEvent() != null)
				ious.addField(new Field("syslog_event_id", trigger.getSyslogEvent().getId()));
			else
				ious.addField(new Field("syslog_event_id", (Integer) null));
			ious.addField(new Field("no_events", trigger.getNoEvents()));
			ious.addField(new Field("no_events_pr_unit", trigger.getNoEventsPrUnit()));
			ious.addField(new Field("no_units", trigger.getNoUnits()));
			ps = ious.makePreparedStatement(c);
			ps.setQueryTimeout(60);
			ps.executeUpdate();
			if (ious.isInsert()) {
				ResultSet gk = ps.getGeneratedKeys();
				if (gk.next())
					trigger.setId(gk.getInt(1));
				logger.notice("Inserted trigger " + trigger.getName());
				if (xaps.getDbi() != null)
					xaps.getDbi().publishAdd(trigger, trigger.getUnittype());
			} else {
				if (trigger.isSyslogEventChanged()) { // delete all trigger_events for this trigger
					deleteEvents(trigger.getId(), new Date(), xaps);
					trigger.setSyslogEventChangeCompleted();
				}
				logger.notice("Updated trigger " + trigger.getName());
				if (xaps.getDbi() != null)
					xaps.getDbi().publishChange(trigger, trigger.getUnittype());
			}
		} catch (SQLException sqle) {
			sqlex = sqle;
			throw sqle;
		} finally {
			if (ps != null)
				ps.close();
			if (c != null)
				ConnectionProvider.returnConnection(c, sqlex);
		}
	}

	protected Map<String, Trigger> getNameMap() {
		return nameMap;
	}

	protected Map<Integer, Trigger> getIdMap() {
		return idMap;
	}

	public List<Trigger> getTopLevelTriggers() {
		Trigger[] allTriggers = getTriggers();
		List<Trigger> topLevelTriggers = new ArrayList<Trigger>();
		for (Trigger t : allTriggers) {
			if (t.getParent() == null)
				topLevelTriggers.add(t);
		}
		return topLevelTriggers;
	}

}


text:
import { IFunctionRouteHandler } from 'wherehows-web/typings/ember-cli-mirage';

export const getDatasetHealth = function(this: IFunctionRouteHandler, { db: { healths } }: any) {
  return {
    health: this.serialize(healths[0])
  };
};