text:
<!DOCTYPE html>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="generator" content="ApiGen 2.8.0" />

	<title>Class Doctrine\DBAL\Platforms\MySqlPlatform | seip</title>

	<link rel="stylesheet" type="text/css" media="all" href="resources/style.css?3505392360" />

		Overview

Namespaces

Acme

DemoBundle

Command

Controller

DependencyInjection

EventListener

Form

Proxy

__CG__

Symfony

Component

Security

Acl

Tests

Domain

Core

Tests

Util

Tests

Controller

Twig

Extension

Alpha

Apc

NamespaceCollision

A

B

Namespaced

Assetic

Asset

Iterator

Cache

Exception

Extension

Twig

Factory

Loader

Resource

Worker

Filter

GoogleClosure

Sass

Yui

Util

Bazinga

Bundle

JsTranslationBundle

Command

Controller

DependencyInjection

Compiler

Dumper

Finder

Tests

JsTranslationBundle

Tests

Controller

Finder

Beta

Blameable

Fixture

Document

Entity

ClassesWithParents

ClassLoaderTest

ClassMap

Composer

Autoload

Container14

Doctrine

Bundle

DoctrineBundle

Command

Proxy

Controller

DataCollector

DependencyInjection

Mapping

Tests

DependencyInjection

Twig

FixturesBundle

Command

Common

Annotations

Annotation

Cache

Collections

Expr

DataFixtures

Event

Listener

Exception

Executor

Purger

Inflector

Lexer

Persistence

Event

Mapping

Driver

Proxy

Exception

Reflection

Util

DBAL

Cache

Connections

Driver

DrizzlePDOMySql

IBMDB2

Mysqli

OCI8

PDOIbm

PDOMySql

PDOOracle

PDOPgSql

PDOSqlite

PDOSqlsrv

SQLSrv

Event

Listeners

Id

Logging

Platforms

Keywords

Portability

Query

Expression

Schema

Synchronizer

Visitor

Sharding

ShardChoser

SQLAzure

Schema

Tools

Console

Command

Helper

Types

ORM

Decorator

Event

Id

Internal

Hydration

Mapping

Builder

Driver

Persisters

Proxy

Query

AST

Functions

Exec

Expr

Filter

Repository

Tools

Console

Command

ClearCache

SchemaTool

Helper

Event

Export

Driver

Pagination

Tests

Common

Annotations

Bar

Fixtures

Annotation

Foo

FooBar

Ticket

Doctrine

ORM

Mapping

Cache

Collections

DataFixtures

Executor

TestEntity

TestFixtures

Inflector

Persistence

Mapping

Proxy

Reflection

Dummies

Util

Entity

Repository

Fixtures

Bundles

AnnotationsBundle

Entity

Vendor

AnnotationsBundle

Entity

XmlBundle

Entity

YamlBundle

Entity

Foo

Bar

FOS

RestBundle

Controller

Annotations

Decoder

DependencyInjection

Compiler

EventListener

Examples

Form

Extension

Normalizer

Exception

Request

Response

AllowedMethodsLoader

Routing

Loader

Reader

Tests

Controller

Annotations

Decoder

DependencyInjection

Compiler

EventListener

Fixtures

Controller

Normalizer

Request

Routing

Loader

Util

View

Util

Inflector

View

UserBundle

Command

Controller

CouchDocument

DependencyInjection

Compiler

Doctrine

Document

Entity

Form

DataTransformer

Handler

Model

Type

Mailer

Model

Propel

Security

Tests

DependencyInjection

Doctrine

Model

Security

Util

Util

Validator

Gedmo

Blameable

Mapping

Driver

Event

Adapter

Traits

Exception

IpTraceable

Mapping

Driver

Event

Adapter

Traits

Loggable

Document

MappedSuperclass

Repository

Entity

MappedSuperclass

Repository

Mapping

Driver

Event

Adapter

Mapping

Annotation

Driver

Event

Adapter

Mock

Extension

Encoder

Mapping

Driver

Event

Adapter

Mapping

Event

Adapter

Xml

ReferenceIntegrity

Mapping

Driver

References

Mapping

Driver

Event

Adapter

Sluggable

Handler

Mapping

Driver

Event

Adapter

Util

SoftDeleteable

Filter

ODM

Mapping

Driver

Event

Adapter

Query

TreeWalker

Exec

Traits

Sortable

Entity

Repository

Mapping

Driver

Event

Adapter

Timestampable

Mapping

Driver

Event

Adapter

Traits

Tool

Logging

DBAL

Wrapper

Translatable

Document

MappedSuperclass

Repository

Entity

MappedSuperclass

Repository

Hydrator

ORM

Mapping

Driver

Event

Adapter

Query

TreeWalker

Translator

Document

Entity

Tree

Document

MongoDB

Repository

Entity

MappedSuperclass

Repository

Mapping

Driver

Event

Adapter

Strategy

ODM

MongoDB

ORM

Uploadable

Event

FileInfo

FilenameGenerator

Mapping

Driver

MimeType

Stub

Incenteev

ParameterHandler

Tests

IpTraceable

Fixture

Document

JMS

Parser

Tests

Serializer

Annotation

Builder

Construction

EventDispatcher

Subscriber

Exception

Exclusion

Handler

Metadata

Driver

Naming

Tests

Exclusion

Fixtures

Discriminator

Doctrine

DoctrinePHPCR

Handler

Metadata

Driver

Serializer

EventDispatcher

Subscriber

Naming

Twig

Twig

Util

SerializerBundle

DependencyInjection

Compiler

Serializer

Templating

Tests

DependencyInjection

Fixture

TranslationBundle

Annotation

Command

Controller

DependencyInjection

Compiler

Exception

Logger

Model

Tests

Functional

TestBundle

Controller

Model

Translation

Comparison

Dumper

Extractor

File

Fixture

Fixture

SimpleTest

Controller

Form

Loader

Symfony

Twig

Translation

Comparison

Dumper

Extractor

File

Loader

Symfony

Twig

Util

Knp

Bundle

MenuBundle

DependencyInjection

Compiler

EventListener

Provider

Renderer

Templating

Helper

Tests

DependencyInjection

Compiler

EventListener

Provider

Renderer

Stubs

Child

Menu

Menu

Templating

Menu

Factory

Integration

Silex

Symfony

Iterator

Loader

Matcher

Voter

Provider

Renderer

Silex

Voter

Tests

Factory

Integration

Silex

Iterator

Loader

Matcher

Voter

Provider

Renderer

Silex

Twig

Util

Twig

Util

Loggable

Fixture

Document

Log

Entity

Log

Lunetics

LocaleBundle

Controller

Cookie

DependencyInjection

Compiler

Event

EventListener

Form

Extension

ChoiceList

Type

LocaleGuesser

LocaleInformation

Matcher

Session

Switcher

Templating

Helper

Tests

Controller

DependencyInjection

Compiler

Event

EventListener

Form

Extension

ChoiceList

Type

LocaleGuesser

LocaleInformation

Templating

Helper

Twig

Extension

Validator

Twig

Extension

Validator

Mapping

Fixture

Compatibility

Document

Unmapped

Xml

Yaml

Metadata

Cache

Driver

Tests

Cache

Driver

Fixture

A

B

C

SubDir

T

Fixtures

ComplexHierarchy

Monolog

Formatter

Handler

FingersCrossed

SyslogUdp

Processor

MyProject

Proxies

__CG__

Doctrine

Tests

Common

Util

OtherProject

Proxies

__CG__

Doctrine

Tests

Common

Util

NamespaceCollision

A

B

C

B

Namespaced

Namespaced2

Negotiation

Tests

None

Pequiven

SEIPBundle

Controller

DataFixtures

DependencyInjection

Entity

EventListener

Form

Type

Menu

Template

Developer

Tests

Controller

PHP

PhpCollection

Tests

PhpOption

Tests

Proxies

__CG__

Pequiven

SEIPBundle

Entity

Psr

Log

Test

ReferenceIntegrity

Fixture

Document

ManyNullify

ManyRestrict

OneNullify

OneRestrict

References

Fixture

ODM

MongoDB

ORM

Sensio

Bundle

DistributionBundle

Composer

Configurator

Form

Step

Controller

DependencyInjection

FrameworkExtraBundle

Configuration

DependencyInjection

Compiler

EventListener

Request

ParamConverter

Routing

Security

Templating

Tests

Configuration

EventListener

Fixture

Request

ParamConverter

Routing

Templating

Fixture

BarBundle

Controller

FooBarBundle

Controller

FooBundle

Controller

GeneratorBundle

Command

Helper

Generator

Manipulator

Tests

Command

Generator

Sluggable

Fixture

Doctrine

Document

Handler

Handler

People

Inheritance

Inheritance2

Issue104

Issue116

Issue131

Issue449

Issue633

Issue827

Issue939

MappedSuperclass

SoftDeleteable

Fixture

Document

Entity

Sortable

Fixture

Transport

Stof

DoctrineExtensionsBundle

DependencyInjection

Compiler

EventListener

Uploadable

Symfony

Bridge

Doctrine

CacheWarmer

DataCollector

DataFixtures

DependencyInjection

CompilerPass

Security

UserProvider

ExpressionLanguage

Form

ChoiceList

DataTransformer

EventListener

Type

HttpFoundation

Logger

Security

RememberMe

User

Test

Tests

DataCollector

DataFixtures

DependencyInjection

CompilerPass

ExpressionLanguage

Fixtures

Form

ChoiceList

DataTransformer

Type

HttpFoundation

Logger

Security

User

Validator

Constraints

Validator

Constraints

Monolog

Formatter

Handler

Processor

Tests

Handler

Processor

Propel1

DataCollector

DependencyInjection

Security

UserProvider

Form

ChoiceList

DataTransformer

EventListener

Type

Logger

Security

User

Tests

DataCollector

Fixtures

Form

ChoiceList

DataTransformer

ProxyManager

LazyProxy

Instantiator

PhpDumper

Tests

LazyProxy

Dumper

Instantiator

PhpDumper

Twig

Extension

Form

Node

NodeVisitor

Tests

Extension

Fixtures

Node

NodeVisitor

TokenParser

Translation

TokenParser

Translation

Bundle

AsseticBundle

CacheWarmer

Command

Config

Controller

DependencyInjection

Compiler

EventListener

Exception

Factory

Loader

Resource

Worker

Routing

Templating

Tests

CacheWarmer

Command

Controller

DependencyInjection

Factory

Resource

Templating

TestBundle

Twig

FrameworkBundle

CacheWarmer

Command

Console

Descriptor

Helper

Controller

DataCollector

DependencyInjection

Compiler

EventListener

Fragment

HttpCache

Routing

Templating

Asset

Helper

Loader

Test

Tests

CacheWarmer

Console

Descriptor

Controller

DependencyInjection

Compiler

Fixtures

BaseBundle

Fragment

Functional

app

Bundle

TestBundle

Controller

Routing

Templating

Helper

Fixtures

Loader

Translation

Validator

Translation

Validator

MonologBundle

DependencyInjection

Compiler

Tests

DependencyInjection

Compiler

SecurityBundle

Command

DataCollector

DependencyInjection

Compiler

Security

Factory

UserProvider

EventListener

Security

Templating

Helper

Tests

DependencyInjection

Security

Factory

Functional

app

Bundle

CsrfFormLoginBundle

Controller

Form

FormLoginBundle

Controller

DependencyInjection

Security

Twig

Extension

SwiftmailerBundle

Command

DataCollector

DependencyInjection

Compiler

EventListener

Tests

DependencyInjection

TwigBundle

CacheWarmer

Command

Controller

Debug

DependencyInjection

Compiler

Extension

Loader

Node

Tests

Controller

DependencyInjection

Compiler

Loader

TokenParser

TokenParser

WebProfilerBundle

Controller

DependencyInjection

EventListener

Profiler

Tests

Controller

DependencyInjection

EventListener

Profiler

Component

BrowserKit

Tests

ClassLoader

Tests

Config

Definition

Builder

Dumper

Exception

Exception

Loader

Resource

Tests

Definition

Builder

Dumper

Fixtures

Configuration

Loader

Resource

Util

Console

Command

Descriptor

Event

Formatter

Helper

Input

Output

Tester

Tests

Command

Descriptor

Fixtures

Formatter

Helper

Input

Output

Tester

CssSelector

Exception

Node

Parser

Handler

Shortcut

Tokenizer

Tests

Node

Parser

Handler

Shortcut

XPath

XPath

Extension

Debug

Exception

FatalErrorHandler

Tests

Exception

FatalErrorHandler

Fixtures

DependencyInjection

Compiler

Dump

Dumper

Exception

Extension

LazyProxy

Instantiator

PhpDumper

Loader

ParameterBag

Tests

Compiler

Dumper

Extension

LazyProxy

Instantiator

PhpDumper

Loader

ParameterBag

DomCrawler

Field

Tests

Field

EventDispatcher

Debug

Tests

ExpressionLanguage

Node

ParserCache

Tests

Node

Filesystem

Exception

Tests

Finder

Adapter

Comparator

Exception

Expression

Iterator

Shell

Tests

Comparator

Expression

FakeAdapter

Iterator

Form

Exception

Extension

Core

ChoiceList

DataMapper

DataTransformer

EventListener

Type

View

Csrf

EventListener

Type

DataCollector

EventListener

Proxy

Type

DependencyInjection

HttpFoundation

Type

Templating

Validator

Constraints

EventListener

Type

Util

ViolationMapper

Guess

Test

Tests

Extension

Core

ChoiceList

DataMapper

DataTransformer

EventListener

Type

Csrf

CsrfProvider

EventListener

Type

DataCollector

Type

HttpFoundation

EventListener

Validator

Constraints

EventListener

Type

Util

ViolationMapper

Fixtures

Guess

Util

Util

HttpFoundation

File

Exception

MimeType

Session

Attribute

Flash

Storage

Handler

Proxy

Tests

File

MimeType

Session

Attribute

Flash

Storage

Handler

Proxy

HttpKernel

Bundle

CacheClearer

CacheWarmer

Config

Controller

DataCollector

Util

Debug

DependencyInjection

Event

EventListener

Exception

Fragment

HttpCache

Log

Profiler

Tests

Bundle

CacheClearer

CacheWarmer

Config

Controller

DataCollector

Debug

DependencyInjection

EventListener

Fixtures

ExtensionAbsentBundle

ExtensionLoadedBundle

DependencyInjection

ExtensionPresentBundle

Command

DependencyInjection

Fragment

HttpCache

Profiler

Mock

Icu

Tests

Intl

Collator

DateFormatter

DateFormat

Exception

Globals

Locale

NumberFormatter

ResourceBundle

Compiler

Reader

Transformer

Rule

Util

Writer

Tests

Collator

Verification

DateFormatter

Verification

Globals

Verification

Locale

Verification

NumberFormatter

Verification

ResourceBundle

Reader

Util

Writer

Util

Util

Locale

Tests

Stub

OptionsResolver

Exception

Tests

Process

Exception

Tests

PropertyAccess

Exception

Routing

Annotation

Exception

Generator

Dumper

Loader

Matcher

Dumper

Tests

Annotation

Fixtures

AnnotatedClasses

Generator

Dumper

Loader

Matcher

Dumper

Security

Acl

Dbal

Domain

Exception

Model

Permission

Tests

Dbal

Domain

Permission

Voter

Voter

Core

Authentication

Provider

RememberMe

Token

Authorization

Voter

Encoder

Event

Exception

Role

Tests

Authentication

Provider

RememberMe

Token

Authorization

Voter

Encoder

Role

User

Util

Validator

Constraints

User

Util

Validator

Constraints

Csrf

Exception

Tests

TokenGenerator

TokenStorage

TokenGenerator

TokenStorage

Http

Authentication

Authorization

EntryPoint

Event

Firewall

Logout

RememberMe

Session

Tests

Authentication

EntryPoint

Firewall

Logout

RememberMe

Session

Tests

Core

Authentication

Token

User

Http

Firewall

Serializer

Encoder

Exception

Normalizer

Tests

Encoder

Fixtures

Normalizer

Stopwatch

Templating

Asset

Helper

Loader

Storage

Tests

Fixtures

Helper

Loader

Storage

Translation

Catalogue

Dumper

Exception

Extractor

Loader

Tests

Catalogue

Dumper

Loader

Writer

Validator

Constraints

Exception

Mapping

Cache

Loader

Tests

Constraints

Fixtures

Mapping

Cache

Loader

Yaml

Exception

Tests

Tecnocreaciones

Bundle

AjaxFOSUserBundle

Controller

DependencyInjection

Compiler

Event

EventListener

Handler

Tests

Controller

InstallBundle

Command

DependencyInjection

Tests

Controller

TemplateBundle

Controller

DependencyInjection

Menu

Template

Developer

Tests

Controller

Vzla

GovernmentBundle

DependencyInjection

Form

Type

Menu

Template

Developer

Model

Tests

Controller

Twig

Extension

TestBundle

Fabpot

FooBundle

Controller

FooBundle

Controller

Sub

Test

Sensio

Cms

FooBundle

Controller

FooBundle

Controller

TestFixtures

Timestampable

Fixture

Document

Tool

Translatable

Fixture

Document

Personal

Issue114

Issue138

Issue165

Issue173

Issue75

Issue922

Personal

Template

Type

Translator

Fixture

Tree

Fixture

Closure

Document

Genealogy

Mock

Repository

Transport

Uploadable

Fixture

Entity

Wrapper

Fixture

Document

Entity

Classes

AbstractPlatform

DB2Platform

DrizzlePlatform

MySqlPlatform

OraclePlatform

PostgreSqlPlatform

SQLAzurePlatform

SqlitePlatform

SQLServer2005Platform

SQLServer2008Platform

SQLServer2012Platform

SQLServerPlatform

	<form id="search">
		<input type="hidden" name="cx" value="" />
		<input type="hidden" name="ie" value="UTF-8" />
		<input type="text" name="q" class="text" />
		<input type="submit" value="Search" />
	</form>

				Overview

				Namespace

Class

				Tree

Class MySqlPlatform

The MySqlPlatform provides the behavior, features and SQL dialect of the
MySQL database platform. This platform represents a MySQL 5.0 or greater
platform that uses the InnoDB storage engine.

			Doctrine\DBAL\Platforms\AbstractPlatform

Doctrine\DBAL\Platforms\MySqlPlatform

		Namespace: Doctrine\DBAL\Platforms

				Author:
				Roman Borschel <roman@code-factory.org>

				Author:
				Benjamin Eberlei <kontakt@beberlei.de>

				Since:
				2.0

		Located at vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php

Methods summary

			 protected
			string

		#
		doModifyLimitQuery( string <var>$query</var>, integer|null <var>$limit</var>, integer|null <var>$offset</var> )

Adds MySQL-specific LIMIT clause to the query 18446744073709551615 is
264−1 maximum of unsigned BIGINT the biggest limit possible

Adds MySQL-specific LIMIT clause to the query 18446744073709551615 is
264−1 maximum of unsigned BIGINT the biggest limit possible

Parameters

<var>$query</var>

string
$query

<var>$limit</var>

integer|null
$limit

<var>$offset</var>

integer|null
$offset

Returns

					string

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::doModifyLimitQuery()

			 public
			string

		#
		getIdentifierQuoteCharacter( )

Gets the character used for identifier quoting.

Gets the character used for identifier quoting.

Returns

					string

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getIdentifierQuoteCharacter()

			 public
			string

		#
		getRegexpExpression( )

Returns the regular expression operator.

Returns the regular expression operator.

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getRegexpExpression()

			 public
			string

		#
		getGuidExpression( )

Returns the global unique identifier expression.

Returns the global unique identifier expression.

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getGuidExpression()

			 public
			string

		#
		getLocateExpression( string <var>$str</var>, string <var>$substr</var>, integer|boolean <var>$startPos</var> = false )

Returns the SQL snippet to get the position of the first occurrence of
substring $substr in string $str.

Returns the SQL snippet to get the position of the first occurrence of
substring $substr in string $str.

Parameters

<var>$str</var>

string
$str Literal string.

<var>$substr</var>

string
$substr Literal string to find.

<var>$startPos</var>

integer|boolean
$startPos Position to start at, beginning of string by default.

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getLocateExpression()

			 public
			string

		#
		getConcatExpression( )

Returns a SQL snippet to concatenate the given expressions.

Returns a SQL snippet to concatenate the given expressions.

Returns

					string

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getConcatExpression()

			 public
			string

		#
		getDateDiffExpression( string <var>$date1</var>, string <var>$date2</var> )

Returns the SQL to calculate the difference in days between the two passed
dates.

Returns the SQL to calculate the difference in days between the two passed
dates.

Parameters

<var>$date1</var>

string
$date1

<var>$date2</var>

string
$date2

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDateDiffExpression()

			 public

		#
		getDateAddHourExpression( mixed <var>$date</var>, mixed <var>$hours</var> )

			 public

		#
		getDateSubHourExpression( mixed <var>$date</var>, mixed <var>$hours</var> )

			 public
			string

		#
		getDateAddDaysExpression( string <var>$date</var>, integer <var>$days</var> )

Returns the SQL to add the number of given days to a date.

Returns the SQL to add the number of given days to a date.

Parameters

<var>$date</var>

string
$date

<var>$days</var>

integer
$days

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDateAddDaysExpression()

			 public
			string

		#
		getDateSubDaysExpression( string <var>$date</var>, integer <var>$days</var> )

Returns the SQL to subtract the number of given days to a date.

Returns the SQL to subtract the number of given days to a date.

Parameters

<var>$date</var>

string
$date

<var>$days</var>

integer
$days

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDateSubDaysExpression()

			 public
			string

		#
		getDateAddMonthExpression( string <var>$date</var>, integer <var>$months</var> )

Returns the SQL to add the number of given months to a date.

Returns the SQL to add the number of given months to a date.

Parameters

<var>$date</var>

string
$date

<var>$months</var>

integer
$months

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDateAddMonthExpression()

			 public
			string

		#
		getDateSubMonthExpression( string <var>$date</var>, integer <var>$months</var> )

Returns the SQL to subtract the number of given months to a date.

Returns the SQL to subtract the number of given months to a date.

Parameters

<var>$date</var>

string
$date

<var>$months</var>

integer
$months

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDateSubMonthExpression()

			 public
			string

		#
		getListDatabasesSQL( )

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getListDatabasesSQL()

			 public
			string

		#
		getListTableConstraintsSQL( string <var>$table</var> )

Parameters

<var>$table</var>

string
$table

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getListTableConstraintsSQL()

			 public
			string

		#
		getListTableIndexesSQL( string <var>$table</var>, string <var>$currentDatabase</var> = null )

Returns the list of indexes for the current database.

Returns the list of indexes for the current database.

Two approaches to listing the table indexes. The information_schema is
preferred, because it doesn't cause problems with SQL keywords such as "order"
or "table".

Parameters

<var>$table</var>

string
$table

<var>$currentDatabase</var>

string
$currentDatabase

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getListTableIndexesSQL()

			 public
			string

		#
		getListViewsSQL( string <var>$database</var> )

Returns the SQL to list all views of a database or user.

Returns the SQL to list all views of a database or user.

Parameters

<var>$database</var>

string
$database

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getListViewsSQL()

			 public
			string

		#
		getListTableForeignKeysSQL( string <var>$table</var>, mixed <var>$database</var> = null )

Parameters

<var>$table</var>

string
$table

<var>$database</var>

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getListTableForeignKeysSQL()

			 public
			string

		#
		getCreateViewSQL( string <var>$name</var>, string <var>$sql</var> )

Parameters

<var>$name</var>

string
$name

<var>$sql</var>

string
$sql

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getCreateViewSQL()

			 public
			string

		#
		getDropViewSQL( string <var>$name</var> )

Parameters

<var>$name</var>

string
$name

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDropViewSQL()

			 protected
			string

		#
		getVarcharTypeDeclarationSQLSnippet( integer <var>$length</var>, boolean <var>$fixed</var> )

Parameters

<var>$length</var>

integer
$length

<var>$fixed</var>

boolean
$fixed

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getVarcharTypeDeclarationSQLSnippet()

			 public
			string

		#
		getClobTypeDeclarationSQL( array <var>$field</var> )

Gets the SQL snippet used to declare a CLOB column type.

TINYTEXT : 2 ^ 8 - 1 = 255

TEXT : 2 ^ 16 - 1 = 65535

MEDIUMTEXT : 2 ^ 24 - 1 = 16777215

LONGTEXT : 2 ^ 32 - 1 = 4294967295

Gets the SQL snippet used to declare a CLOB column type. TINYTEXT : 2 ^ 8 - 1
= 255 TEXT : 2 ^ 16 - 1 = 65535 MEDIUMTEXT : 2 ^ 24 - 1 = 16777215 LONGTEXT : 2
^ 32 - 1 = 4294967295

Parameters

<var>$field</var>

array
$field

Returns

					string

			 public
			string

		#
		getDateTimeTypeDeclarationSQL( array <var>$fieldDeclaration</var> )

Obtains DBMS specific SQL to be used to create datetime fields in statements
like CREATE TABLE.

Obtains DBMS specific SQL to be used to create datetime fields in statements
like CREATE TABLE.

Parameters

<var>$fieldDeclaration</var>

array
$fieldDeclaration

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDateTimeTypeDeclarationSQL()

			 public
			string

		#
		getDateTypeDeclarationSQL( array <var>$fieldDeclaration</var> )

Obtains DBMS specific SQL to be used to create date fields in statements like
CREATE TABLE.

Obtains DBMS specific SQL to be used to create date fields in statements like
CREATE TABLE.

Parameters

<var>$fieldDeclaration</var>

array
$fieldDeclaration

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDateTypeDeclarationSQL()

			 public
			string

		#
		getTimeTypeDeclarationSQL( array <var>$fieldDeclaration</var> )

Obtains DBMS specific SQL to be used to create time fields in statements like
CREATE TABLE.

Obtains DBMS specific SQL to be used to create time fields in statements like
CREATE TABLE.

Parameters

<var>$fieldDeclaration</var>

array
$fieldDeclaration

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getTimeTypeDeclarationSQL()

			 public
			string

		#
		getBooleanTypeDeclarationSQL( array <var>$field</var> )

Returns the SQL snippet that declares a boolean column.

Returns the SQL snippet that declares a boolean column.

Parameters

<var>$field</var>

array
$columnDef

Returns

					string

			 public
			string

		#
		getCollationFieldDeclaration( string <var>$collation</var> )

Obtain DBMS specific SQL code portion needed to set the COLLATION of a field
declaration to be used in statements like CREATE TABLE.

Obtain DBMS specific SQL code portion needed to set the COLLATION of a field
declaration to be used in statements like CREATE TABLE.

Parameters

<var>$collation</var>

string
$collation name of the collation

Returns

					string
DBMS specific SQL code portion needed to set the COLLATION of a field
declaration.

			 public
			boolean

		#
		prefersIdentityColumns( )

Whether the platform prefers identity columns (eg. autoincrement) for ID
generation. Subclasses should override this method to return TRUE if they prefer
identity columns.

Whether the platform prefers identity columns (eg. autoincrement) for ID
generation. Subclasses should override this method to return TRUE if they prefer
identity columns.

MySql prefers "autoincrement" identity columns since sequences can only be
emulated with a table.

Returns

					boolean

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::prefersIdentityColumns()

			 public
			boolean

		#
		supportsIdentityColumns( )

Whether the platform supports identity columns.

Whether the platform supports identity columns.

MySql supports this through AUTO_INCREMENT columns.

Returns

					boolean

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::supportsIdentityColumns()

			 public
			boolean

		#
		supportsInlineColumnComments( )

Whether this platform support to add inline column comments as postfix.

Whether this platform support to add inline column comments as postfix.

Returns

					boolean

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::supportsInlineColumnComments()

			 public
			string

		#
		getListTablesSQL( )

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getListTablesSQL()

			 public
			string

		#
		getListTableColumnsSQL( string <var>$table</var>, string|null <var>$database</var> = null )

Parameters

<var>$table</var>

string
$table

<var>$database</var>

string|null
$database

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getListTableColumnsSQL()

			 public
			string

		#
		getCreateDatabaseSQL( string <var>$name</var> )

Returns the SQL to create a new database.

Returns the SQL to create a new database.

Parameters

<var>$name</var>

string
$database The name of the database that should be created.

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getCreateDatabaseSQL()

			 public
			string

		#
		getDropDatabaseSQL( string <var>$name</var> )

Returns the SQL snippet to drop an existing database.

Returns the SQL snippet to drop an existing database.

Parameters

<var>$name</var>

string
$database The name of the database that should be dropped.

Returns

					string

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDropDatabaseSQL()

			 protected
			array

		#
		_getCreateTableSQL( string <var>$tableName</var>, array <var>$columns</var>, array <var>$options</var> = array() )

Returns the SQL used to create a table.

Returns the SQL used to create a table.

Parameters

<var>$tableName</var>

string
$tableName

<var>$columns</var>

array
$columns

<var>$options</var>

array
$options

Returns

					array

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::_getCreateTableSQL()

			 public
			array

		#
		getAlterTableSQL( Doctrine\DBAL\Schema\TableDiff <var>$diff</var> )

Gets the SQL statements for altering an existing table.

Gets the SQL statements for altering an existing table.

Parameters

<var>$diff</var>

Doctrine\DBAL\Schema\TableDiff
$diff

Returns

					array

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getAlterTableSQL()

			 protected
			array

		#
		getPreAlterTableIndexForeignKeySQL( Doctrine\DBAL\Schema\TableDiff <var>$diff</var> )

Parameters

<var>$diff</var>

Doctrine\DBAL\Schema\TableDiff
$diff

Returns

					array

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getPreAlterTableIndexForeignKeySQL()

			 protected
			string

		#
		getCreateIndexSQLFlags( Doctrine\DBAL\Schema\Index <var>$index</var> )

Adds additional flags for index generation.

Adds additional flags for index generation.

Parameters

<var>$index</var>

Doctrine\DBAL\Schema\Index
$index

Returns

					string

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getCreateIndexSQLFlags()

			 public
			string

		#
		getIntegerTypeDeclarationSQL( array <var>$field</var> )

Returns the SQL snippet that declares a 4 byte integer column.

Returns the SQL snippet that declares a 4 byte integer column.

Parameters

<var>$field</var>

array
$columnDef

Returns

					string

			 public
			string

		#
		getBigIntTypeDeclarationSQL( array <var>$field</var> )

Returns the SQL snippet that declares an 8 byte integer column.

Returns the SQL snippet that declares an 8 byte integer column.

Parameters

<var>$field</var>

array
$columnDef

Returns

					string

			 public
			string

		#
		getSmallIntTypeDeclarationSQL( array <var>$field</var> )

Returns the SQL snippet that declares a 2 byte integer column.

Returns the SQL snippet that declares a 2 byte integer column.

Parameters

<var>$field</var>

array
$columnDef

Returns

					string

			 protected
			string

		#
		_getCommonIntegerTypeDeclarationSQL( array <var>$columnDef</var> )

Returns the SQL snippet that declares common properties of an integer
column.

Returns the SQL snippet that declares common properties of an integer
column.

Parameters

<var>$columnDef</var>

array
$columnDef

Returns

					string

			 public
			string

		#
		getAdvancedForeignKeyOptionsSQL( Doctrine\DBAL\Schema\ForeignKeyConstraint <var>$foreignKey</var> )

Returns the FOREIGN KEY query section dealing with non-standard options as
MATCH, INITIALLY DEFERRED, ON UPDATE, ...

Returns the FOREIGN KEY query section dealing with non-standard options as
MATCH, INITIALLY DEFERRED, ON UPDATE, ...

Parameters

<var>$foreignKey</var>

Doctrine\DBAL\Schema\ForeignKeyConstraint
$foreignKey The foreign key definition.

Returns

					string

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getAdvancedForeignKeyOptionsSQL()

			 public
			string

		#
		getDropIndexSQL( Doctrine\DBAL\Schema\Index|string <var>$index</var>, Doctrine\DBAL\Schema\Table|string <var>$table</var> = null )

Returns the SQL to drop an index from a table.

Returns the SQL to drop an index from a table.

Parameters

<var>$index</var>

Doctrine\DBAL\Schema\Index|string
$index

<var>$table</var>

Doctrine\DBAL\Schema\Table|string
$table

Returns

					string

Throws

					InvalidArgumentException

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDropIndexSQL()

			 protected
			string

		#
		getDropPrimaryKeySQL( string <var>$table</var> )

Parameters

<var>$table</var>

string
$table

Returns

					string

			 public
			string

		#
		getSetTransactionIsolationSQL( integer <var>$level</var> )

Returns the SQL to set the transaction isolation level.

Returns the SQL to set the transaction isolation level.

Parameters

<var>$level</var>

integer
$level

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getSetTransactionIsolationSQL()

			 public
			string

		#
		getName( )

Gets the name of the platform.

Gets the name of the platform.

Returns

					string

			 public
			string

		#
		getReadLockSQL( )

Returns the SQL snippet to append to any SELECT statement which locks rows in
shared read lock.

Returns the SQL snippet to append to any SELECT statement which locks rows in
shared read lock.

Returns

					string

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getReadLockSQL()

			 protected

		#
		initializeDoctrineTypeMappings( )

Lazy load Doctrine Type Mappings.

Lazy load Doctrine Type Mappings.

			 public
			integer

		#
		getVarcharMaxLength( )

Gets the maximum length of a varchar field.

Gets the maximum length of a varchar field.

Returns

					integer

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getVarcharMaxLength()

			 protected
			string

		#
		getReservedKeywordsClass( )

Returns the class name of the reserved keywords list.

Returns the class name of the reserved keywords list.

Returns

					string

Throws

					Doctrine\DBAL\DBALException
If not supported on this platform.

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getReservedKeywordsClass()

			 public
			string

		#
		getDropTemporaryTableSQL( Doctrine\DBAL\Schema\Table|string <var>$table</var> )

Returns the SQL to safely drop a temporary table WITHOUT implicitly
committing an open transaction.

Returns the SQL to safely drop a temporary table WITHOUT implicitly
committing an open transaction.

MySQL commits a transaction implicitly when DROP TABLE is executed, however
not if DROP TEMPORARY TABLE is executed.

Parameters

<var>$table</var>

Doctrine\DBAL\Schema\Table|string
$table

Returns

					string

Overrides

Doctrine\DBAL\Platforms\AbstractPlatform::getDropTemporaryTableSQL()

			 public
			string

		#
		getBlobTypeDeclarationSQL( array <var>$field</var> )

Gets the SQL Snippet used to declare a BLOB column type.

TINYBLOB : 2 ^ 8 - 1 = 255

BLOB : 2 ^ 16 - 1 = 65535

MEDIUMBLOB : 2 ^ 24 - 1 = 16777215

LONGBLOB : 2 ^ 32 - 1 = 4294967295

Gets the SQL Snippet used to declare a BLOB column type. TINYBLOB : 2 ^ 8 - 1
= 255 BLOB : 2 ^ 16 - 1 = 65535 MEDIUMBLOB : 2 ^ 24 - 1 = 16777215 LONGBLOB : 2
^ 32 - 1 = 4294967295

Parameters

<var>$field</var>

array
$field

Returns

					string

Methods inherited from Doctrine\DBAL\Platforms\AbstractPlatform

			__construct(),
			_getAlterTableIndexForeignKeySQL(),
			_getTransactionIsolationLevelSQL(),
			appendLockHint(),
			canEmulateSchemas(),
			convertBooleans(),
			createSavePoint(),
			fixSchemaElementName(),
			getAcosExpression(),
			getAlterSequenceSQL(),
			getAvgExpression(),
			getBetweenExpression(),
			getBitAndComparisonExpression(),
			getBitOrComparisonExpression(),
			getCheckDeclarationSQL(),
			getColumnCharsetDeclarationSQL(),
			getColumnCollationDeclarationSQL(),
			getColumnComment(),
			getColumnDeclarationListSQL(),
			getColumnDeclarationSQL(),
			getCommentOnColumnSQL(),
			getCosExpression(),
			getCountExpression(),
			getCreateConstraintSQL(),
			getCreateForeignKeySQL(),
			getCreateIndexSQL(),
			getCreatePrimaryKeySQL(),
			getCreateSequenceSQL(),
			getCreateTableSQL(),
			getCreateTemporaryTableSnippetSQL(),
			getCurrentDateSQL(),
			getCurrentTimeSQL(),
			getCurrentTimestampSQL(),
			getCustomTypeDeclarationSQL(),
			getDateFormatString(),
			getDateTimeFormatString(),
			getDateTimeTzFormatString(),
			getDateTimeTzTypeDeclarationSQL(),
			getDecimalTypeDeclarationSQL(),
			getDefaultTransactionIsolationLevel(),
			getDefaultValueDeclarationSQL(),
			getDoctrineTypeComment(),
			getDoctrineTypeMapping(),
			getDropConstraintSQL(),
			getDropForeignKeySQL(),
			getDropSequenceSQL(),
			getDropTableSQL(),
			getDummySelectSQL(),
			getEmptyIdentityInsertSQL(),
			getEventManager(),
			getFloatDeclarationSQL(),
			getForUpdateSQL(),
			getForeignKeyBaseDeclarationSQL(),
			getForeignKeyDeclarationSQL(),
			getForeignKeyReferentialActionSQL(),
			getGuidTypeDeclarationSQL(),
			getInExpression(),
			getIndexDeclarationSQL(),
			getIndexFieldDeclarationListSQL(),
			getIsNotNullExpression(),
			getIsNullExpression(),
			getLengthExpression(),
			getListSequencesSQL(),
			getListUsersSQL(),
			getLowerExpression(),
			getLtrimExpression(),
			getMaxExpression(),
			getMaxIdentifierLength(),
			getMd5Expression(),
			getMinExpression(),
			getModExpression(),
			getNotExpression(),
			getNowExpression(),
			getPiExpression(),
			getPostAlterTableIndexForeignKeySQL(),
			getReservedKeywordsList(),
			getRoundExpression(),
			getRtrimExpression(),
			getSQLResultCasing(),
			getSequenceNextValSQL(),
			getSinExpression(),
			getSqlCommentEndString(),
			getSqlCommentStartString(),
			getSqrtExpression(),
			getSubstringExpression(),
			getSumExpression(),
			getTemporaryTableName(),
			getTemporaryTableSQL(),
			getTimeFormatString(),
			getTrimExpression(),
			getTruncateTableSQL(),
			getUniqueConstraintDeclarationSQL(),
			getUniqueFieldDeclarationSQL(),
			getUpperExpression(),
			getVarcharDefaultLength(),
			getVarcharTypeDeclarationSQL(),
			getWildcards(),
			getWriteLockSQL(),
			hasDoctrineTypeMappingFor(),
			hasNativeGuidType(),
			initializeCommentedDoctrineTypes(),
			isCommentedDoctrineType(),
			markDoctrineTypeCommented(),
			modifyLimitQuery(),
			onSchemaAlterTable(),
			onSchemaAlterTableAddColumn(),
			onSchemaAlterTableChangeColumn(),
			onSchemaAlterTableRemoveColumn(),
			onSchemaAlterTableRenameColumn(),
			prefersSequences(),
			quoteIdentifier(),
			quoteSingleIdentifier(),
			registerDoctrineTypeMapping(),
			releaseSavePoint(),
			rollbackSavePoint(),
			setEventManager(),
			supportsAlterTable(),
			supportsCommentOnStatement(),
			supportsCreateDropDatabase(),
			supportsForeignKeyConstraints(),
			supportsForeignKeyOnUpdate(),
			supportsGettingAffectedRows(),
			supportsIndexes(),
			supportsLimitOffset(),
			supportsPrimaryConstraints(),
			supportsReleaseSavepoints(),
			supportsSavepoints(),
			supportsSchemas(),
			supportsSequences(),
			supportsTransactions(),
			supportsViews()

Constants summary

		integer

				LENGTH_LIMIT_TINYTEXT

		255

			#

		integer

				LENGTH_LIMIT_TEXT

		65535

			#

		integer

				LENGTH_LIMIT_MEDIUMTEXT

		16777215

			#

		integer

				LENGTH_LIMIT_TINYBLOB

		255

			#

		integer

				LENGTH_LIMIT_BLOB

		65535

			#

		integer

				LENGTH_LIMIT_MEDIUMBLOB

		16777215

			#

Constants inherited from Doctrine\DBAL\Platforms\AbstractPlatform

			CREATE_FOREIGNKEYS,
			CREATE_INDEXES,
			TRIM_BOTH,
			TRIM_LEADING,
			TRIM_TRAILING,
			TRIM_UNSPECIFIED

Properties inherited from Doctrine\DBAL\Platforms\AbstractPlatform

			<var>$_eventManager</var>,
			<var>$_keywords</var>,
			<var>$doctrineTypeComments</var>,
			<var>$doctrineTypeMapping</var>

		seip API documentation generated by ApiGen 2.8.0


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
var LabelRole = {
  relatedConcepts: [{
    module: 'HTML',
    concept: {
      name: 'label'
    }
  }],
  type: 'structure'
};

exports.default = LabelRole;

redpajama_set_name: RedPajamaGithub


text:
Softwares to drive Softbank Pepper with Microsoft Xbox One Kinect Sensor

## Detail
使い方含めた詳細については個人ページで紹介しています。
[http://www.baku-dreameater.net/archives/3951](http://www.baku-dreameater.net/archives/3951)


text:
package com.maximka.taskmanager.ui.base;

import android.os.Bundle;
import android.support.annotation.CallSuper;
import android.support.annotation.DrawableRes;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.annimon.stream.Optional;
import com.maximka.taskmanager.ui.activity.FloatingActionButtonOwner;
import com.maximka.taskmanager.utils.Assertion;

public abstract class BaseFragment<T extends BasePresenter> extends Fragment {
    private View mRootView;
    @NonNull private Optional<T> mPresenterOpt = Optional.empty();

    @LayoutRes
    protected abstract int getLayoutResId();

    @DrawableRes
    protected abstract int getFloatingButtonIcon();

    protected abstract View.OnClickListener getOnFloatingButtonClickListener();

    protected abstract boolean showToolbarBackArrow();

    @NonNull
    protected abstract T createPresenter();

    @CallSuper
    @NonNull
    @Override
    public View onCreateView(@NonNull final LayoutInflater inflater,
                             @Nullable final ViewGroup container,
                             @Nullable final Bundle savedInstanceState) {
        mRootView = inflater.inflate(getLayoutResId(), container, false);
        Assertion.nonNull(mRootView);

        final Optional<AppCompatActivity> activity = Optional.of((AppCompatActivity) getActivity());

        activity.map(AppCompatActivity::getSupportActionBar)
                .ifPresent(actionBar -> actionBar.setDisplayHomeAsUpEnabled(showToolbarBackArrow()));

        activity.map(FloatingActionButtonOwner.class::cast)
                .ifPresent(owner -> owner.setUpFloatingButton(getFloatingButtonIcon(),
                                                              getOnFloatingButtonClickListener()));

        return mRootView;
    }

    @CallSuper
    @Override
    public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        mPresenterOpt = Optional.of(createPresenter());
        mPresenterOpt.get().init();
    }

    @CallSuper
    @Override
    public void onDestroyView() {
        mPresenterOpt.get().onViewDestroyed();
        mPresenterOpt = Optional.empty();

        super.onDestroyView();
    }

    @NonNull
    protected T getPresenter() {
        return mPresenterOpt.orElseThrow(() ->
                new IllegalStateException("Call getPresenter() after onViewCreated"));
    }

    protected Optional<String> getStringArgument(@NonNull final String argKey) {
        Assertion.nonNull(argKey);

        return Optional.ofNullable(getArguments())
                       .map(bundle -> bundle.getString(argKey));
    }

    protected void showToast(@StringRes final int messageResId) {
        Toast.makeText(getActivity(), messageResId, Toast.LENGTH_LONG)
                .show();
    }

    protected void showSnack(@StringRes final int messageResId) {
        Snackbar.make(mRootView, messageResId, Snackbar.LENGTH_LONG)
                .show();
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Syst. mycol. (Lundae) 2(1): 8 (1822)

#### Original name
Morchella deliciosa var. deliciosa

### Remarks
null


text:
/**
 * @author Kyle Zeller
 * This class provides a way to store and access all of the exoplanet objects in an efficient manner.
 */

import java.util.ArrayList;

public class HashAlgorithm<K,V> {

    /**
     * @author Kyle Zeller
     * The constructor calls HT() to initialize the size of the HashTable.
     */
    HashAlgorithm() {
        this.HT();
    }

    static class Entry<K,V> {
        final K key;
        V value;
        Entry<K,V> next;
        int hash;

        /**
         *Creates the key / value pairs
         * @param k is the unique identification value that the object has
         * @param v is the Exoplanet object
         * @param n is the Entry tuple
         * @param h is the unique hashing value to the unique key that was given
         */
        Entry(K k, V v, Entry<K,V> n, int h) {
            key = k;
            value = v;
            next = n;
            hash = h;
        }
    }

    /*tab.length should always be a power of 2*/
    Entry<K,V>[] tab;

    private final int INIT_SIZE = 16;

    /**
     * Initializes the size of the HashTable.
     */
    private void HT() {
        tab = new Entry[INIT_SIZE];    // selected to be a good starting size
    }

    /**
     *
     * Looks for a key already present in the hash table
     */
    public boolean containsKey(K key){
        int h = hashCode(key);
        Entry<K,V>[] t = tab;
        int i = h & (tab.length-1);
        for (Entry<K,V> e = t[i]; e != null; e=e.next){
            //see if there is a match
            if (e.hash == h && key.equals(e.key))
                return true;
        }
        return false;
    }

    /**
     * Retrieves an Exoplanet from the given key in the hash table
     * @param s is a key that will be used to access it's respective exoplanet object
     * @return returns an exoplanet object corresponding to the key given
     */
    public V getValue(K s) {
        //update --- handle collisions
        int h = hashCode(s);
        Entry<K,V>[] t = tab;
        int i = h & (tab.length-1);

        for (Entry<K,V> e = t[i]; e != null; e = e.next){
            //get the value from the end of the list
            if (e.hash == h && s.equals(e.key)){
                return e.value;
            }
        }

        return null;
    }

    /**
     * Retrieves all the keys in the hash table
     * @return returns the keys in the hash table
     */
    public ArrayList<K> keySet(){
        ArrayList<K> temp = new ArrayList<K>();

        //look for the values on the tuple array
        for (int k = 0; k < tab.length; ++k){
            //check to see if there is ALREADY a value at this key
            if (tab[k] != null){
                //add all the values on the linked list (including the first one)
                for (Entry<K,V> e = tab[k]; e != null; e = e.next){
                    temp.add(e.key);
                }
            }
        }

        return temp;
    }

    /**
     * Clears everything in the hash table
     */
    public void clear() {   // remove all tuples
        //look for the values on the tuple array
        for (int k = 0; k < tab.length; ++k){
            //check to see if there is ALREADY a value at this key
            if (tab[k] != null){
                //remove all the values on the linked list (including the first one)
                tab[k] = null;
            }
        }
    }

    /**
     * Determines how many exoplanet objects are currently being stored in the hashtable
     * @return returns the amount of exoplanet objects currently stored in the hashtable
     */
    public int size() {
        int count = 0;

        //look for the values on the tuple array
        for (int k = 0; k < tab.length; ++k){
            //check to see if there is ALREADY a value at this key
            if (tab[k] != null){
                //count all the values on the linked list (including the first one)
                for (Entry<K,V> e = tab[k]; e != null; e = e.next){
                    count++;
                }
            }
        }

        return count;
    }

    /**
     * Checks to see if there is nothing in the hashtable
     * @return returns true if the hashtable is empty
     */
    public boolean isEmpty() {
        return this.size() == 0;
    }

    int count = 0;

    /**
     * Adds an Exoplanet to the hash table
     * @param key is the unique identification value that the object has
     * @param value is the exoplanet that is going to be stored
     */
    public void put(K key, V value){
        //update
        int h = hashCode(key);
        Entry<K,V>[] t = tab;
        int i = h & (tab.length-1);

        for (Entry<K,V> e = t[i]; e != null; e = e.next){
            //check to see if there is ALREADY a value at this key
            if (e.hash == h && key.equals(e.key)){
                //lengthen the list
                e.value = value;
                return;
            }
        }

        //handle collisions
        //add --- make a new entry for a key, value tuple
        Entry<K,V> p = new Entry(key, value, t[i], h);
        t[i] = p;

        //resize --- the array
        int n = t.length;
        int c = ++count;
        //check if the size is smaller than the threshold
        if ((c/(float)t.length) < 0.75)
            return;

        //double the size of the array
        int newN = n << 1;
        Entry<K,V>[] newTab = new Entry[newN];

        for (int k = 0; k < n; ++k){
            Entry<K,V> e;
            while ((e = t[k]) != null){ // add to the linked list
                t[k] = e.next;
                int j = e.hash & (newN - 1);
                e.next = newTab[j];
                newTab[j] = e;
            }
            // add to the tuple array
            tab = newTab;
        }
    }

    /**
     * Removes an Exoplanet at the specified key
     * @param key is the unique identification value that the object has
     */
    public void remove(K key){
        //update --- handle collisions
        int h = hashCode(key);
        Entry<K,V>[] t = tab;
        int i = h & (tab.length-1);
        Entry<K,V> pred = null;
        Entry<K,V> p = t[i];

        while (p != null) {
            if (p.hash == h && key.equals(p.key)) {
                if (pred == null)
                    t[i] = p.next;
                else
                    pred.next = p.next;
                --count;
                return;
            }
            pred = p;
            p = p.next;
        }

        //remove --- remove an entry for a key, value tuple
        t[i] = null;

        //resize --- the array
        int n = t.length;
        int c = ++count;
        //check if the size is greater than the threshold
        if ((c/(float)t.length) > 0.25)
            return;

        //halve the size of the array
        int newN = n >>> 1;
        Entry<K,V>[] newTab = new Entry[newN];

        for (int k = 0; k < n; ++k){
            Entry<K,V> e;
            while ((e = t[k]) != null){ // add to the linked list
                t[k] = e.next;
                int j = e.hash & (newN - 1);
                e.next = newTab[j];
                newTab[j] = e;
            }
            // add to the tuple array
            tab = newTab;
        }
    }

    /**
     * Creates a unique hash value for the given
     * @param s is the unique identification value that the object has
     * @return returns the unique hashing value to the unique key that was given
     */
    private int hashCode(K s){
        char[] info = (s.toString()).toCharArray();

        int temp, i;
        for (temp = i = 0; i < (s.toString()).length(); ++i) {
            temp += info[i];
            temp += (temp << 10);
            temp ^= (temp >>> 6);
        }
        temp += (temp << 3);
        temp ^= (temp >>> 11);
        temp += (temp << 15);
        return temp;
    }
}


text:
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.android_webview.nonembedded;

import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import androidx.test.filters.SmallTest;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import org.chromium.android_webview.common.SafeModeController;
import org.chromium.base.FileUtils;
import org.chromium.base.PathUtils;
import org.chromium.base.test.BaseRobolectricTestRunner;

import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

/** Test AwComponentUpdateService's behavior when Safe Mode Reset is applied. */
@RunWith(BaseRobolectricTestRunner.class)
public class AwComponentUpdateServiceSafeModeTest {
    private static final String TEST_FILE = "testManifest.json";
    private File mDirectory;
    private AwComponentUpdateService mComponentUpdateService;

    @Mock
    private SafeModeController mMockSafeModeController;

    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
        mComponentUpdateService = new AwComponentUpdateService();
        PathUtils.setPrivateDataDirectorySuffix("webview", "WebView");
        mDirectory = new File(PathUtils.getDataDirectory(), "components/cus/");
        if (!mDirectory.exists()) {
            Assert.assertTrue(mDirectory.mkdirs());
        }

        mMockSafeModeController = mock(SafeModeController.class);
        SafeModeController.setInstanceForTests(mMockSafeModeController);
    }

    @After
    public void tearDown() {
        Assert.assertTrue("Failed to delete " + mDirectory.getAbsolutePath(),
                FileUtils.recursivelyDeleteFile(mDirectory, null));
        SafeModeController.setInstanceForTests(null);
    }

    @Test
    @SmallTest
    public void testComponentUpdaterResetDeletesDownloadedConfigs() throws IOException {
        File cusFile = new File(mDirectory, TEST_FILE);
        Assert.assertTrue(
                "Failed to create test file " + cusFile.getAbsolutePath(), cusFile.createNewFile());

        final String componentUpdaterResetActionId =
                new ComponentUpdaterResetSafeModeAction().getId();
        Set<String> actions = new HashSet<>();
        actions.add(componentUpdaterResetActionId);
        when(mMockSafeModeController.queryActions(anyString())).thenReturn(actions);
        when(mMockSafeModeController.isSafeModeEnabled(anyString())).thenReturn(true);

        Assert.assertFalse(mComponentUpdateService.maybeStartUpdates(false));

        File[] cusFiles = mDirectory.listFiles();
        Assert.assertNull(cusFiles);
    }
}


text:
module Data.Unique (
   -- * Unique objects
   Unique,		-- instance (Eq, Ord)
   newUnique, 		-- :: IO Unique
   hashUnique 		-- :: Unique -> Int
 ) where

import Prelude

import Control.Concurrent.MVar
import System.IO.Unsafe (unsafePerformIO)

#ifdef __GLASGOW_HASKELL__
import GHC.Base
import GHC.Num 	( Integer(..) )
#endif

-- | An abstract unique object.  Objects of type 'Unique' may be
-- compared for equality and ordering and hashed into 'Int'.
newtype Unique = Unique Integer deriving (Eq,Ord)

uniqSource :: MVar Integer
uniqSource = unsafePerformIO (newMVar 0)
{-# NOINLINE uniqSource #-}

-- | Creates a new object of type 'Unique'.  The value returned will
-- not compare equal to any other value of type 'Unique' returned by
-- previous calls to 'newUnique'.  There is no limit on the number of
-- times 'newUnique' may be called.
newUnique :: IO Unique
newUnique = do
   val <- takeMVar uniqSource
   let next = val+1
   putMVar uniqSource next
   return (Unique next)

-- | Hashes a 'Unique' into an 'Int'.  Two 'Unique's may hash to the
-- same value, although in practice this is unlikely.  The 'Int'
-- returned makes a good hash key.
hashUnique :: Unique -> Int
#ifdef __GLASGOW_HASKELL__
hashUnique (Unique (S# i))   = I# i
hashUnique (Unique (J# s d)) | s ==# 0#  = 0
			     | otherwise = I# (indexIntArray# d 0#)
#else
hashUnique (Unique u) = fromInteger (u `mod` (toInteger (maxBound :: Int) + 1))
#endif


text:
 [](#skip-navbar_top "Skip navigation links")

<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

Overview
Package
 Class
Use
Tree
Deprecated
Index
Help

 PREV CLASS   NEXT CLASS
FRAMES    NO FRAMES
All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD

------------------------------------------------------------------------

org.apache.struts.taglib.html.md
 Class OptionsCollectionTag
-----------------------------

    java.lang.Object
      javax.servlet.jsp.tagext.TagSupport
          org.apache.struts.taglib.html.md.OptionsCollectionTag

**All Implemented Interfaces:**
[Serializable](http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html.md?is-external=true "class or interface in java.io"), [IterationTag](http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/IterationTag.html?is-external=true "class or interface in javax.servlet.jsp.tagext"), [Tag](http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html?is-external=true "class or interface in javax.servlet.jsp.tagext")

**Direct Known Subclasses:**
[NestedOptionsCollectionTag](../../../../../org/apache/struts/taglib/nested.html.md/NestedOptionsCollectionTag.html "class in org.apache.struts.taglib.nested.html")

------------------------------------------------------------------------

    public class OptionsCollectionTag

extends [TagSupport](http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html.md?is-external=true "class or interface in javax.servlet.jsp.tagext")

Tag for creating multiple \<select\> options from a collection. The collection may be part of the enclosing form, or may be independent of the form. Each element of the collection must expose a 'label' and a 'value', the property names of which are configurable by attributes of this tag.

The collection may be an array of objects, a Collection, an Enumeration, an Iterator, or a Map.

**NOTE** - This tag requires a Java2 (JDK 1.2 or later) platform.

**Since:**
Struts 1.1

**Version:**
$Rev: 471754 $ $Date: 2004-11-03 14:20:47 -0500 (Wed, 03 Nov 2004) $

**See Also:**
[Serialized Form](../../../../../serialized-form.html.md#org.apache.struts.taglib.html.OptionsCollectionTag)

------------------------------------------------------------------------

**Field Summary**

`protected  boolean`

` filter`
           Should the label values be filtered for HTML sensitive characters?

`protected  String`

` label`
           The name of the bean property containing the label.

`protected static MessageResources`

` messages`
           The message resources for this package.

`protected  String`

` name`
           The name of the bean containing the values collection.

`protected  String`

` property`
           The name of the property to use to build the values collection.

`protected  String`

` value`
           The name of the bean property containing the value.

| **Fields inherited from class javax.servlet.jsp.tagext.[TagSupport](http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html.md?is-external=true "class or interface in javax.servlet.jsp.tagext")** |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id, pageContext`                                                                                |

| **Fields inherited from interface javax.servlet.jsp.tagext.[IterationTag](http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/IterationTag.html.md?is-external=true "class or interface in javax.servlet.jsp.tagext")** |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `EVAL_BODY_AGAIN`                                                                                |

| **Fields inherited from interface javax.servlet.jsp.tagext.[Tag](http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/Tag.html.md?is-external=true "class or interface in javax.servlet.jsp.tagext")** |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`                                                                                |

| **Constructor Summary**   |
|---------------------------|
| ` OptionsCollectionTag()`
                            |

**Method Summary**

`protected  void`

` addOption(StringBuffer sb, String label, String value, boolean matched)`
           Add an option element to the specified StringBuffer based on the specified parameters.

` int`

` doStartTag()`
           Process the start of this tag.

` boolean`

` getFilter()`

`protected  Iterator`

` getIterator(Object collection)`
           Return an iterator for the options collection.

` String`

` getLabel()`

` String`

` getName()`

` String`

` getProperty()`

` String`

` getStyle()`

` String`

` getStyleClass()`

` String`

` getValue()`

` void`

` release()`
           Release any acquired resources.

` void`

` setFilter(boolean filter)`

` void`

` setLabel(String label)`

` void`

` setName(String name)`

` void`

` setProperty(String property)`

` void`

` setStyle(String style)`

` void`

` setStyleClass(String styleClass)`

` void`

` setValue(String value)`

| **Methods inherited from class javax.servlet.jsp.tagext.[TagSupport](http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html.md?is-external=true "class or interface in javax.servlet.jsp.tagext")** |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue`                                                                           |

| **Methods inherited from class java.lang.[Object](http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html.md?is-external=true "class or interface in java.lang")** |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`                                                                          |

**Field Detail**

### messages

    protected static MessageResources messages

The message resources for this package.

------------------------------------------------------------------------

### filter

    protected boolean filter

Should the label values be filtered for HTML sensitive characters?

------------------------------------------------------------------------

### label

    protected String label

The name of the bean property containing the label.

------------------------------------------------------------------------

### name

    protected String name

The name of the bean containing the values collection.

------------------------------------------------------------------------

### property

    protected String property

The name of the property to use to build the values collection.

------------------------------------------------------------------------

### value

    protected String value

The name of the bean property containing the value.

**Constructor Detail**

### OptionsCollectionTag

    public OptionsCollectionTag()

**Method Detail**

### getFilter

    public boolean getFilter()

------------------------------------------------------------------------

### setFilter

    public void setFilter(boolean filter)

------------------------------------------------------------------------

### getLabel

    public String getLabel()

------------------------------------------------------------------------

### setLabel

    public void setLabel(String label)

------------------------------------------------------------------------

### getName

    public String getName()

------------------------------------------------------------------------

### setName

    public void setName(String name)

------------------------------------------------------------------------

### getProperty

    public String getProperty()

------------------------------------------------------------------------

### setProperty

    public void setProperty(String property)

------------------------------------------------------------------------

### getStyle

    public String getStyle()

------------------------------------------------------------------------

### setStyle

    public void setStyle(String style)

------------------------------------------------------------------------

### getStyleClass

    public String getStyleClass()

------------------------------------------------------------------------

### setStyleClass

    public void setStyleClass(String styleClass)

------------------------------------------------------------------------

### getValue

    public String getValue()

------------------------------------------------------------------------

### setValue

    public void setValue(String value)

------------------------------------------------------------------------

### doStartTag

    public int doStartTag()
                   throws JspException

Process the start of this tag.

**Specified by:**
`doStartTag` in interface `Tag`

**Overrides:**
`doStartTag` in class `TagSupport`

**Throws:**
`JspException` - if a JSP exception has occurred

------------------------------------------------------------------------

### release

    public void release()

Release any acquired resources.

**Specified by:**
`release` in interface `Tag`

**Overrides:**
`release` in class `TagSupport`

------------------------------------------------------------------------

### addOption

    protected void addOption(StringBuffer sb,
                             String label,
                             String value,
                             boolean matched)

Add an option element to the specified StringBuffer based on the specified parameters.

Note that this tag specifically does not support the `styleId` tag attribute, which causes the HTML `id` attribute to be emitted. This is because the HTML specification states that all "id" attributes in a document have to be unique. This tag will likely generate more than one `option` element element, but it cannot use the same `id` value. It's conceivable some sort of mechanism to supply an array of `id` values could be devised, but that doesn't seem to be worth the trouble.

**Parameters:**
`sb` - StringBuffer accumulating our results

`value` - Value to be returned to the server for this option

`label` - Value to be shown to the user for this option

`matched` - Should this value be marked as selected?

------------------------------------------------------------------------

### getIterator

    protected Iterator getIterator(Object collection)
                            throws JspException

Return an iterator for the options collection.

**Parameters:**
`collection` - Collection to be iterated over

**Throws:**
`JspException` - if an error occurs

------------------------------------------------------------------------

 [](#skip-navbar_bottom "Skip navigation links")

<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

Overview
Package
 Class
Use
Tree
Deprecated
Index
Help

 PREV CLASS   NEXT CLASS
FRAMES    NO FRAMES
All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD

------------------------------------------------------------------------

Copyright © 2000-2008 [Apache Software Foundation](http://www.apache.org/). All Rights Reserved.


text:
package com.cognizant.devops.platformdal.healthutil;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.cognizant.devops.platformcommons.config.ApplicationConfigProvider;
import com.cognizant.devops.platformcommons.constants.AgentCommonConstant;
import com.cognizant.devops.platformcommons.constants.PlatformServiceConstants;
import com.cognizant.devops.platformcommons.constants.ServiceStatusConstants;
import com.cognizant.devops.platformcommons.core.util.JsonUtils;
import com.cognizant.devops.platformcommons.core.util.SystemStatus;
import com.cognizant.devops.platformcommons.dal.elasticsearch.ElasticSearchDBHandler;
import com.cognizant.devops.platformcommons.dal.neo4j.GraphDBHandler;
import com.cognizant.devops.platformcommons.dal.neo4j.GraphResponse;
import com.cognizant.devops.platformcommons.dal.neo4j.NodeData;
import com.cognizant.devops.platformcommons.exception.InsightsCustomException;
import com.cognizant.devops.platformdal.agentConfig.AgentConfig;
import com.cognizant.devops.platformdal.agentConfig.AgentConfigDAL;
import com.cognizant.devops.platformdal.dal.PostgresMetadataHandler;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

public class HealthUtil {
	static Logger log = LogManager.getLogger(HealthUtil.class);
	private static final String VERSION = "version";
	private static final String HOST_ENDPOINT = "endPoint";
	private static final String AGENT_NODES = "agentNodes";
	private static final String HEALTH_STATUS = "healthStatus";
	private static final String LAST_RUN_TIME = "lastRunTime";

	/**
	 * Method to fetch Client Response for Services and components
	 *
	 * @param hostEndPoint
	 * @param apiUrl
	 * @param displayType
	 * @param serviceType
	 * @param isRequiredAuthentication
	 * @param username
	 * @param password
	 * @param authToken
	 * @return JsonObject
	 */
	public JsonObject getClientResponse(String hostEndPoint, String apiUrl, String displayType, String serviceType,
			boolean isRequiredAuthentication, String username, String password, String authToken) {
		JsonObject returnResponse = null;
		String strResponse = "";
		JsonObject json = null;
		String version = "";
		String serviceResponse;
		//ElasticSearchDBHandler apiCallElasticsearch = new ElasticSearchDBHandler();
		try {

			serviceResponse = getServiceResponse(isRequiredAuthentication,apiUrl,username, password, authToken);

			if (serviceResponse != null && !("").equalsIgnoreCase(serviceResponse)) {
				strResponse = "Response successfully recieved from " + apiUrl;
				log.info("response: {} ",serviceResponse);
				if (serviceType.equalsIgnoreCase(ServiceStatusConstants.NEO4J)) {
					json = JsonUtils.parseStringAsJsonObject(serviceResponse);
					version = json.get("neo4j_version").getAsString();
					String totalDBSize = getNeo4jDBSize(hostEndPoint, username, password, authToken);
					returnResponse = buildSuccessResponse(strResponse, hostEndPoint, displayType, version);
					returnResponse.addProperty("totalDBSize", totalDBSize);
				} else if (serviceType.equalsIgnoreCase(ServiceStatusConstants.RABBITMQ)) {
					json = JsonUtils.parseStringAsJsonObject(serviceResponse);
					version = "RabbitMq version " + json.get("rabbitmq_version").getAsString() + "\n Erlang version "
							+ json.get("erlang_version").getAsString();
					returnResponse = buildSuccessResponse(strResponse, hostEndPoint, displayType, version);
				} else if (serviceType.equalsIgnoreCase(ServiceStatusConstants.ES)) {
					returnResponse = getESResponse(json,serviceResponse,strResponse, hostEndPoint, displayType);

				} else if (serviceType.equalsIgnoreCase(ServiceStatusConstants.PGSQL)) {
					hostEndPoint = ApplicationConfigProvider.getInstance().getPostgre().getInsightsDBUrl();
					PostgresMetadataHandler pgdbHandler = new PostgresMetadataHandler();
					version = pgdbHandler.getPostgresDBVersion();
					returnResponse = buildSuccessResponse(strResponse, hostEndPoint, displayType, version);
				} else if (serviceType.equalsIgnoreCase(ServiceStatusConstants.GRAFANA)
						|| serviceType.equalsIgnoreCase(ServiceStatusConstants.LOKI)
						|| serviceType.equalsIgnoreCase(ServiceStatusConstants.VAULT)
						) {
					json = JsonUtils.parseStringAsJsonObject(serviceResponse);
					version = json.get(VERSION).getAsString();
					returnResponse = buildSuccessResponse(strResponse, hostEndPoint, displayType, version);
				} else if (serviceType.equalsIgnoreCase(ServiceStatusConstants.PROMTAIL)) {
					version = "";
					returnResponse = buildSuccessResponse(strResponse, hostEndPoint, displayType, version);
				} else if (serviceType.equalsIgnoreCase(ServiceStatusConstants.H2O)) {
					returnResponse = getH2oResponse(json,serviceResponse,strResponse, hostEndPoint, displayType);

				}
			} else {
				strResponse = "Response not received from service " + apiUrl;
				returnResponse = buildFailureResponse(strResponse, hostEndPoint, displayType, version);
			}
		} catch (Exception e) {
			log.error("Error while capturing health check at {} ",apiUrl, e);
			log.error(e.getMessage());
			strResponse = "Error while capturing health check at " + apiUrl;
			returnResponse = buildFailureResponse(strResponse, hostEndPoint, displayType, version);
		}
		return returnResponse;
	}

	private JsonObject getESResponse(JsonObject json, String serviceResponse,
			String strResponse, String hostEndPoint, String displayType) {

		String version = "";
		JsonObject response = null;

		json = JsonUtils.parseStringAsJsonObject(serviceResponse);
		JsonObject versionElasticsearch = (JsonObject) json.get(VERSION);
		if (versionElasticsearch != null) {
			version = versionElasticsearch.get("number").getAsString();
		}
		response = buildSuccessResponse(strResponse, hostEndPoint, displayType, version);

		return response;

	}
	private JsonObject getH2oResponse(JsonObject json, String serviceResponse,
			String strResponse, String hostEndPoint, String displayType) {
		String version = "";
		JsonObject response = null;

		json = JsonUtils.parseStringAsJsonObject(serviceResponse);
		JsonArray entries = json.getAsJsonArray("entries");
		for (JsonElement entry : entries) {
			JsonObject entryJson = entry.getAsJsonObject();
			String entryName = entryJson.get("name").getAsString();
			if(entryName.equalsIgnoreCase("Build project version")) {
				version = entryJson.get("value").getAsString();
			}
		}

		response = buildSuccessResponse(strResponse, hostEndPoint, displayType, version);
		return response;
	}

	private String getServiceResponse(boolean isRequiredAuthentication, String apiUrl, String username, String password, String authToken) throws InsightsCustomException {

		String response;
		ElasticSearchDBHandler apiCallElasticsearch = new ElasticSearchDBHandler();

		if (isRequiredAuthentication) {
			response = SystemStatus.jerseyGetClientWithAuthentication(apiUrl, username, password, authToken);
		} else {
			response = apiCallElasticsearch.search(apiUrl);
		}

		return response;
	}

	/**
	 * Method to build Success Response
	 *
	 * @param message
	 * @param apiUrl
	 * @param type
	 * @param version
	 * @return JsonObject
	 */
	public JsonObject buildSuccessResponse(String message, String apiUrl, String type, String version) {
		JsonObject jsonResponse = new JsonObject();
		jsonResponse.addProperty(PlatformServiceConstants.STATUS, PlatformServiceConstants.SUCCESS);
		jsonResponse.addProperty(PlatformServiceConstants.MESSAGE, message);
		jsonResponse.addProperty(HOST_ENDPOINT, apiUrl);
		jsonResponse.addProperty(ServiceStatusConstants.TYPE, type);
		jsonResponse.addProperty(VERSION, version);
		return jsonResponse;
	}

	/**
	 * Method to build Failure Response
	 *
	 * @param message
	 * @param apiUrl
	 * @param type
	 * @param version
	 * @return JsonObject
	 */
	public JsonObject buildFailureResponse(String message, String apiUrl, String type, String version) {
		JsonObject jsonResponse = new JsonObject();
		jsonResponse.addProperty(PlatformServiceConstants.STATUS, PlatformServiceConstants.FAILURE);
		jsonResponse.addProperty(PlatformServiceConstants.MESSAGE, message);
		jsonResponse.addProperty(HOST_ENDPOINT, apiUrl);
		jsonResponse.addProperty(ServiceStatusConstants.TYPE, type);
		jsonResponse.addProperty(VERSION, version);
		return jsonResponse;
	}

	/**
	 * Method to fetch status of Components
	 *
	 * @param serviceType
	 * @return JsonObject
	 */
	public JsonObject getComponentStatus(String serviceType) {
		JsonObject returnObject = null;
		try {
			if (serviceType.equalsIgnoreCase("PlatformEngine")) {
				returnObject = getServiceResponse("HEALTH:ENGINE", 1);
			} else if (serviceType.equalsIgnoreCase("PlatformWebhookSubscriber")) {
				returnObject = getServiceResponse("HEALTH:WEBHOOKSUBSCRIBER", 1);
			} else if (serviceType.equalsIgnoreCase("PlatformWebhookEngine")) {
				returnObject = getServiceResponse("HEALTH:WEBHOOKENGINE", 1);
			} else if (serviceType.equalsIgnoreCase("PlatformAuditEngine")) {
				returnObject = getServiceResponse("HEALTH:AUDITENGINE", 1);
			} else if (serviceType.equalsIgnoreCase("PlatformDataArchivalEngine")) {
				returnObject = getServiceResponse("HEALTH:DATAARCHIVALENGINE", 1);
			} else if (serviceType.equalsIgnoreCase("PlatformWorkflow")) {
				returnObject = getServiceResponse("HEALTH:INSIGHTS_WORKFLOW", 1);
			} else if (serviceType.equalsIgnoreCase("PlatformService")) {
				returnObject = getServiceResponse("HEALTH:INSIGHTS_PLATFORMSERVICE", 1);
			}else if (serviceType.equalsIgnoreCase("Agents")) {
				returnObject = getAgentResponse("HEALTH:LATEST",100);
			}
		} catch (Exception e) {
			log.error(e.getMessage());
		}
		return returnObject;
	}

	/**
	 * Method to load Health Data
	 *
	 * @param label
	 * @param agentId
	 * @param limitOfRow
	 * @return GraphResponse
	 */
	public GraphResponse loadHealthData(String label, String agentId, int limitOfRow) {

		String query = "";

		if (agentId.equalsIgnoreCase("")) {
			query = "MATCH (n:" + label
					+ ") where n.inSightsTime IS NOT NULL RETURN n order by n.inSightsTime DESC LIMIT " + limitOfRow;
		} else if (!agentId.equalsIgnoreCase("")) {
			String queueName = getAgentHealthQueueName(agentId);
			// To handle case where Agent delete from Postgres but data present in Neo4j
			if (queueName == null) {
				queueName = label;
			}
			query = "MATCH (n:" + queueName + ") where n.inSightsTime IS NOT NULL and n.agentId ='" + agentId
					+ "' RETURN n order by n.inSightsTime DESC LIMIT " + limitOfRow;
		}
		log.info("query  ====== {} ", query);
		GraphResponse graphResponse = null;
		try {
			GraphDBHandler dbHandler = new GraphDBHandler();
			graphResponse = dbHandler.executeCypherQuery(query);
		} catch (Exception e) {
			log.error(e.getMessage());
			graphResponse = new GraphResponse();
		}
		return graphResponse;
	}

	/**
	 * Method to build Agent Response
	 *
	 * @param status
	 * @param message
	 * @param graphResponse
	 * @return JsonObject
	 */
	private JsonObject buildAgentResponse(String status, String message, GraphResponse graphResponse) {
		String toolcategory = "";
		String toolName = "";
		String insightTimeX = "";
		String agentstatus = "";
		String agentId = "";
		JsonObject jsonResponse = new JsonObject();
		JsonArray agentNode = new JsonArray();
		if (status.equalsIgnoreCase(PlatformServiceConstants.SUCCESS)) {

			jsonResponse.addProperty(ServiceStatusConstants.TYPE, ServiceStatusConstants.AGENTS);

			Iterator<NodeData> agentnodeIterator = graphResponse.getNodes().iterator();
			while (agentnodeIterator.hasNext()) {
				NodeData node = agentnodeIterator.next();
				toolcategory = node.getPropertyMap().get(AgentCommonConstant.CATEGORY);
				toolName = node.getPropertyMap().get(AgentCommonConstant.TOOLNAME);
				if (node.getPropertyMap().containsKey(AgentCommonConstant.AGENTID)) {
					agentId = node.getPropertyMap().get(AgentCommonConstant.AGENTID);
				} else {
					agentId = "";
				}
				agentstatus = node.getPropertyMap().get(PlatformServiceConstants.STATUS);
				insightTimeX = node.getPropertyMap().get(PlatformServiceConstants.INSIGHTSTIMEX);
				JsonObject jsonResponse2 = new JsonObject();
				jsonResponse2.addProperty(PlatformServiceConstants.INSIGHTSTIMEX, insightTimeX);
				jsonResponse2.addProperty(AgentCommonConstant.TOOLNAME, toolName);
				jsonResponse2.addProperty(AgentCommonConstant.AGENTID, agentId);
				jsonResponse2.addProperty(PlatformServiceConstants.INSIGHTSTIMEX, insightTimeX);
				jsonResponse2.addProperty(PlatformServiceConstants.STATUS, agentstatus);
				jsonResponse2.addProperty(AgentCommonConstant.CATEGORY, toolcategory);
				agentNode.add(jsonResponse2);
			}
			jsonResponse.add(AGENT_NODES, agentNode);
		} else {
			jsonResponse.addProperty(PlatformServiceConstants.STATUS, PlatformServiceConstants.FAILURE);
			jsonResponse.addProperty(PlatformServiceConstants.MESSAGE, message);
			jsonResponse.addProperty(AgentCommonConstant.CATEGORY, toolcategory);
			jsonResponse.addProperty(ServiceStatusConstants.TYPE, ServiceStatusConstants.AGENTS);
			jsonResponse.addProperty(AgentCommonConstant.TOOLNAME, toolName);
			jsonResponse.addProperty(PlatformServiceConstants.INSIGHTSTIMEX, insightTimeX);
			jsonResponse.addProperty(VERSION, "");
			jsonResponse.add(AGENT_NODES, agentNode);
		}

		return jsonResponse;
	}

	/**
	 * Method to get Neo4h DB size
	 *
	 * @param hostEndPoint
	 * @param username
	 * @param password
	 * @param authToken
	 * @return String
	 */
	private String getNeo4jDBSize(String hostEndPoint, String username, String password, String authToken) {
		long totalStoreSize = 0L;
		String returnSize = "";
		try {
			if(ApplicationConfigProvider.getInstance().getGraph().getVersion().contains("4.")) {
				GraphDBHandler dbHandler = new GraphDBHandler();
				String storeSizeQuery = "CALL apoc.monitor.store() YIELD logSize, totalStoreSize RETURN sum(logSize+totalStoreSize)";
				JsonObject storeSizeResponse = dbHandler.executeCypherQueryForJsonResponse(storeSizeQuery);
				log.debug("Neo4j database store size Response ====== {} ",storeSizeResponse);
				JsonArray dataArray = storeSizeResponse.get("results").getAsJsonArray().get(0).getAsJsonObject().get("data").getAsJsonArray();
				totalStoreSize = dataArray.get(0).getAsJsonObject().get("row").getAsJsonArray().get(0).getAsLong();
			} else {
				String apiUrlForSize = hostEndPoint
						+ "/db/manage/server/jmx/domain/org.neo4j/instance%3Dkernel%230%2Cname%3DStore+sizes";
				String serviceNeo4jResponse = SystemStatus.jerseyGetClientWithAuthentication(apiUrlForSize, username,
						password, authToken);
				log.debug("serviceNeo4jResponse ====== {} ",serviceNeo4jResponse);

				JsonElement object = JsonUtils.parseString(serviceNeo4jResponse);
				if (object.isJsonArray()) {
					totalStoreSize = getTotalStoreSize(object);
				}
			}

			log.debug(" info totalStoreSize  ==== {}",totalStoreSize);
			if (totalStoreSize > 0) {
				returnSize = humanReadableByteCount(totalStoreSize, Boolean.FALSE);
			}
		} catch (Exception e) {
			log.error(e.getMessage());
			log.error(" Error while geeting neo4j Size");
		}
		return returnSize;
	}

	private long getTotalStoreSize(JsonElement object) {
		long totalStoreSize = 0L;
		if (object.getAsJsonArray().get(0).getAsJsonObject().get("attributes").isJsonArray()) {
			JsonArray beans = object.getAsJsonArray().get(0).getAsJsonObject().get("attributes")
					.getAsJsonArray();
			for (JsonElement jsonElement : beans) {
				if (jsonElement.getAsJsonObject().get("name").getAsString()
						.equalsIgnoreCase("TotalStoreSize")) {
					totalStoreSize = jsonElement.getAsJsonObject().get("value").getAsLong();
				}
			}
		}
		return totalStoreSize;
	}
	/**
	 * Method to generate Human Readable byte count
	 *
	 * @param bytes
	 * @param si
	 * @return String
	 */
	public static String humanReadableByteCount(long bytes, boolean si) {
		int unit = si ? 1000 : 1024;
		if (bytes < unit)
			return bytes + " B";
		int exp = (int) (Math.log(bytes) / Math.log(unit));
		String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
		return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
	}

	/**
	 * Method to get Agent Health Queue name
	 *
	 * @param agentId
	 * @return String
	 */
	public String getAgentHealthQueueName(String agentId) {
		String healthRoutingKey = null;
		try {
			AgentConfigDAL agentConfigDal = new AgentConfigDAL();
			AgentConfig agentConfig = agentConfigDal.getAgentConfigurations(agentId);
			JsonObject config = JsonUtils.parseStringAsJsonObject(agentConfig.getAgentJson());
			JsonObject json = config.get("publish").getAsJsonObject();
			healthRoutingKey = json.get("health").getAsString().replace(".", ":");
		} catch (Exception e) {
			log.error(" No DB record found for agentId {} ", agentId);
		}
		return healthRoutingKey;
	}

	/**
	 * Method to get Service Response
	 *
	 * @param labels
	 * @param noOfRows
	 * @return JsonObject
	 */
	private JsonObject getServiceResponse(String labels,int noOfRows) {
		String successResponse = "";
		String version = "";
		String status = "";
		JsonObject returnObject = null;
		GraphResponse graphResponse = loadHealthData(labels,"", noOfRows);
		if (graphResponse != null) {
			if (!graphResponse.getNodes().isEmpty()) {
				successResponse = graphResponse.getNodes().get(0).getPropertyMap().get("message");
				version = graphResponse.getNodes().get(0).getPropertyMap().get(VERSION);
				status = graphResponse.getNodes().get(0).getPropertyMap().get("status");
				if (status.equalsIgnoreCase(PlatformServiceConstants.SUCCESS)) {
					returnObject = buildSuccessResponse(successResponse, "-",
							ServiceStatusConstants.SERVICE, version);
				} else {
					returnObject = buildFailureResponse(successResponse, "-",
							ServiceStatusConstants.SERVICE, version);
				}
			} else {
				successResponse = "Node list is empty in response not received from Neo4j";
				returnObject = buildFailureResponse(successResponse, "-",
						ServiceStatusConstants.SERVICE, version);
			}
		} else {
			successResponse = "Response not received from Neo4j";
			returnObject = buildFailureResponse(successResponse, "-", ServiceStatusConstants.SERVICE,
					version);
		}
		return returnObject;
	}

	/**
	 * Method to fetch response of Agents
	 *
	 * @param labels
	 * @param noOfRows
	 * @return JsonObject
	 */
	private JsonObject getAgentResponse(String labels, int noOfRows) {
		String successResponse = "";
		String status = "";
		GraphResponse graphResponse = loadHealthData(labels, "", noOfRows);
		if (graphResponse != null) {
			if (!graphResponse.getNodes().isEmpty()) {
				status = PlatformServiceConstants.SUCCESS;
			} else {
				successResponse = "Node list is empty in response not received from Neo4j";
				status = PlatformServiceConstants.FAILURE;
			}
		} else {
			successResponse = "Response not received from Neo4j";
			status = PlatformServiceConstants.FAILURE;
		}
		log.debug("message {} ", successResponse);
		return buildAgentResponse(status, successResponse, graphResponse);
	}

	/**
	 * Method to fetch data component HTML
	 *
	 * @return String
	 */
	public JsonObject getDataComponentStatus() {
		JsonObject dataComponentStatus = new JsonObject();
		try {
			JsonObject grafanaStatus = getComponentStatusResponse(ServiceStatusConstants.GRAFANA);
			dataComponentStatus.add(ServiceStatusConstants.GRAFANA, grafanaStatus);
			JsonObject postgreStatus = getComponentStatusResponse(ServiceStatusConstants.PGSQL);
			dataComponentStatus.add(ServiceStatusConstants.PGSQL, postgreStatus);
			JsonObject neo4jStatus = getComponentStatusResponse(ServiceStatusConstants.NEO4J);
			dataComponentStatus.add(ServiceStatusConstants.NEO4J, neo4jStatus);
			JsonObject rabbitMqStatus = getComponentStatusResponse(ServiceStatusConstants.RABBITMQ);
			dataComponentStatus.add(ServiceStatusConstants.RABBITMQ, rabbitMqStatus);
			String pythonVersion = getPythonVersion();
			if(pythonVersion != null && pythonVersion.length() != 0) {
				JsonObject pythonStatus= new JsonObject();
				pythonStatus.addProperty("status", "success");
				pythonStatus.addProperty("message", "");
				pythonStatus.addProperty("type", ServiceStatusConstants.OTHERS);
				pythonStatus.addProperty("endpoint", "");
				pythonStatus.addProperty( VERSION, pythonVersion.substring(7));
				dataComponentStatus.add(ServiceStatusConstants.PYTHON, pythonStatus);
			}
			if(ServiceStatusConstants.ES_HOST != null && !ServiceStatusConstants.ES_HOST.isEmpty() ) {
				JsonObject esStatus = getComponentStatusResponse(ServiceStatusConstants.ES);
				dataComponentStatus.add(ServiceStatusConstants.ES, esStatus);
			}
			if(ServiceStatusConstants.LOKI_HOST != null && !ServiceStatusConstants.LOKI_HOST.isEmpty() ) {
				JsonObject lokiStatus = getComponentStatusResponse(ServiceStatusConstants.LOKI);
				dataComponentStatus.add(ServiceStatusConstants.LOKI, lokiStatus);
			}
			if(ServiceStatusConstants.PROMTAIL_HOST != null && !ServiceStatusConstants.PROMTAIL_HOST.isEmpty() ) {
				JsonObject promtailStatus = getComponentStatusResponse(ServiceStatusConstants.PROMTAIL);
				dataComponentStatus.add(ServiceStatusConstants.PROMTAIL, promtailStatus);
			}
			if(ServiceStatusConstants.VAULT_HOST != null && !ServiceStatusConstants.VAULT_HOST.isEmpty() ) {
				JsonObject vaultStatus = getComponentStatusResponse(ServiceStatusConstants.VAULT);
				dataComponentStatus.add(ServiceStatusConstants.VAULT, vaultStatus);
			}
			if(ServiceStatusConstants.H2O_HOST != null && !ServiceStatusConstants.H2O_HOST.isEmpty() ) {
				JsonObject h2oStatus = getComponentStatusResponse(ServiceStatusConstants.H2O);
				dataComponentStatus.add(ServiceStatusConstants.H2O, h2oStatus);
			}

		} catch (Exception e) {
			log.error("Worlflow Detail ==== Error creating HTML body for data components");
		}
		log.debug(" dataComponentStatus {} ", dataComponentStatus);
		return dataComponentStatus;

	}

	/**
	 * Method to fetch Service HTML
	 *
	 * @return String
	 */
	public JsonObject getServiceStatus() {
		JsonObject serviceStatus = new JsonObject();
		try {

			JsonObject jsonPlatformServiceStatus = getComponentStatus("PlatformService");
			serviceStatus.add(ServiceStatusConstants.PLATFORM_SERVICE, jsonPlatformServiceStatus);
			JsonObject jsonPlatformEngineStatus = getComponentStatus("PlatformEngine");
			serviceStatus.add(ServiceStatusConstants.PLATFORM_ENGINE, jsonPlatformEngineStatus);
			JsonObject jsonPlatformWorkflowStatus = getComponentStatus("PlatformWorkflow");
			serviceStatus.add(ServiceStatusConstants.PLATFORM_WORKFLOW, jsonPlatformWorkflowStatus);
		} catch (Exception e) {
			log.error("Worlflow Detail ==== Error creating HTML body for services");
		}
		log.debug(" serviceStatus {} ", serviceStatus);
		return serviceStatus;

	}

	/**
	 * Method to get health status of all agents
	 *
	 * @return JsonObject
	 */
	public JsonObject getAgentsStatus() {
		return getComponentStatus("Agents");
	}

	public JsonObject getRegisteredAgentsAndHealth() throws InsightsCustomException {
		AgentConfigDAL agentConfigDAL = new AgentConfigDAL();
		JsonObject agentDetails = new  JsonObject();
		JsonArray agentNodes = new JsonArray();
		try {
			List<AgentConfig> agentConfigList = agentConfigDAL.getAllDataAgentConfigurations();
			for (AgentConfig agentConfig : agentConfigList) {
				JsonObject node = new JsonObject();
				node.addProperty("toolName", agentConfig.getToolName());
				node.addProperty("agentId", agentConfig.getAgentKey());
				JsonObject agentHealthNode = getAgentHealth(node, agentConfig.getAgentKey());
				if(agentHealthNode.has(LAST_RUN_TIME)) {
					node.addProperty(LAST_RUN_TIME,agentHealthNode.get(LAST_RUN_TIME).getAsString());
				} else {
					node.addProperty(LAST_RUN_TIME, "");
				}
				if(agentHealthNode.has(HEALTH_STATUS)) {
					node.addProperty(HEALTH_STATUS,agentHealthNode.get(HEALTH_STATUS).getAsString());
				} else {
					node.addProperty(HEALTH_STATUS,"");
				}
				agentNodes.add(node);
			}
			agentDetails.add(AGENT_NODES, agentNodes);
		} catch (Exception e) {
			log.error("Error getting all agent config ", e);
			throw new InsightsCustomException(e.toString());
		}
		return agentDetails;
	}

	public JsonObject getAgentHealth(JsonObject agentJson, String agentId) {
		GraphDBHandler graphDBHandler = new GraphDBHandler();
		JsonObject response;
		try {
			response = graphDBHandler.executeCypherQueryForJsonResponse("MATCH (n:HEALTH:LATEST) where n.agentId='"+agentId+"' return n order by n.inSightsTime desc limit 1");
			JsonArray responseArray = response.get("results").getAsJsonArray();
			JsonArray responseData = responseArray.get(0).getAsJsonObject().get("data").getAsJsonArray();
			if(responseData.size() > 0) {
				agentJson.addProperty(LAST_RUN_TIME, responseData.get(0).getAsJsonObject().get("row").getAsJsonArray().get(0).getAsJsonObject().get(PlatformServiceConstants.INSIGHTSTIMEX).getAsString());
				agentJson.addProperty(HEALTH_STATUS, responseData.get(0).getAsJsonObject().get("row").getAsJsonArray().get(0).getAsJsonObject().get(PlatformServiceConstants.STATUS).getAsString());
			}
		} catch (Exception e) {
			log.error("Error getting agent health ", e);
		}

		return agentJson;
	}

	private String getPythonVersion() {
		StringBuilder version = new StringBuilder();
		try {
			Process process;
			process = Runtime.getRuntime().exec("python -V");
			BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
			String line;
			while((line = in.readLine()) != null) {
				version.append(line);
			}
			process.destroy();
		} catch (IOException e) {
			log.error("Error getting python versions ", e);
		}
		return version.toString();
	}

	private JsonObject getComponentStatusResponse(String componentName) {
		JsonObject response;

		String username = null;
		String password = null;
		String authToken = null;
		String hostEndPoint = "";
		String apiUrl = "";
		String componentType = "";
		Boolean isAuthRequired = false;

		switch (componentName) {
		case ServiceStatusConstants.PGSQL:
			hostEndPoint = ServiceStatusConstants.POSTGRESQL_HOST;
			apiUrl = hostEndPoint;
			componentType = ServiceStatusConstants.DB;
			break;
		case ServiceStatusConstants.NEO4J:
			hostEndPoint = ServiceStatusConstants.NEO4J_HOST;
			if(ApplicationConfigProvider.getInstance().getGraph().getVersion().contains("3.5")) {
				apiUrl = hostEndPoint + "/db/data/";
			}else {
				apiUrl = hostEndPoint;
			}
			componentType = ServiceStatusConstants.DB;
			isAuthRequired = true;
			authToken = ApplicationConfigProvider.getInstance().getGraph().getAuthToken();
			break;
		case ServiceStatusConstants.RABBITMQ:
			hostEndPoint = ServiceStatusConstants.RABBIT_MQ;
			apiUrl = hostEndPoint + "/api/overview";
			componentType = ServiceStatusConstants.DB;
			isAuthRequired = true;
			username = ApplicationConfigProvider.getInstance().getMessageQueue().getUser();
			password = ApplicationConfigProvider.getInstance().getMessageQueue().getPassword();
			break;
		case ServiceStatusConstants.GRAFANA:
			hostEndPoint = ServiceStatusConstants.GRAFANA_HOST;
			apiUrl = hostEndPoint + "/api/health";
			componentType = ServiceStatusConstants.OTHERS;
			break;
		case ServiceStatusConstants.ES:
			hostEndPoint = ServiceStatusConstants.ES_HOST;
			apiUrl = hostEndPoint;
			componentType = ServiceStatusConstants.OTHERS;
			break;
		case ServiceStatusConstants.LOKI:
			hostEndPoint = ServiceStatusConstants.LOKI_HOST;
			apiUrl = hostEndPoint + "/loki/api/v1/status/buildinfo";
			componentType = ServiceStatusConstants.OTHERS;
			break;
		case ServiceStatusConstants.PROMTAIL:
			hostEndPoint = ServiceStatusConstants.PROMTAIL_HOST;
			apiUrl = hostEndPoint + "/ready";
			componentType = ServiceStatusConstants.OTHERS;
			break;
		case ServiceStatusConstants.VAULT:
			hostEndPoint = ServiceStatusConstants.VAULT_HOST;
			apiUrl = hostEndPoint + "/sys/health";
			componentType = ServiceStatusConstants.OTHERS;
			break;
		case ServiceStatusConstants.H2O:
			hostEndPoint = ServiceStatusConstants.H2O_HOST;
			apiUrl = hostEndPoint + "/3/About";
			componentType = ServiceStatusConstants.OTHERS;
			break;
		default:
			break;
		}

		response = getClientResponse(hostEndPoint, apiUrl, componentType,
				componentName, isAuthRequired, username, password, authToken);

		return response;
	}

}