text:
---
title: "Code Conventions"
permalink: /manual/conventions/
author: max@aem.design
comments: true
redirect_from:
  - /manual/process/
---

{% include toc_sticky.html %}

## Philosophy for Conventions

Philosophy of AEM.Design is to empower all developers (FED/BED) to be able to achieve more without having to learn a lot more initially. This means that focus changes to providing a simplified and specific experience that allows continuous learning of AEM and framework features. As more knowledge is gained and existing structures are understood, developers can start update structures as needed.

Major principles that should be considered as you start learning

* Emphases on Content - ensure that as much structure that required is converted into the content so that its changeable post-deployment, this is following [Davids #1 Rule](/archives/davids-model#rule-1-data-first-structure-later-maybe).
* Abstract AEM Knowledge - generalise and abstract AEM specific knowledge into patterns that other developers can use without immediately needing to understand underlying principles.
* Component Grouping and Naming - components should be named concerning their content and AEM purpose, and not about their end-use, see more details in [Component Grouping and Naming](/manual/conventions/#component-grouping-and-naming).
* Component Variants and Badges - ability to represent different structures of component content without having to resort to using CSS to hide available content; see more details in [Component Variants and Badges](/manual/conventions/#component-variants-and-badges).
* Tags Usage - tags in AEM are specifically made to provide a mechanism to create a taxonomy of keywords that allow linking of content together. This capability is beneficial to represent Design Language keywords that contain styling nomenclature.

## Component Grouping and Naming

All components used by authors without exception must be located in their designated component group folders.

```
components
    layout (component group)
        article
```

This structure will ensure that their components are organised and quickly found, additionally grouping provides a segmentation structure that will allow component numbers scale without creating a mess in one folder.

Following is the list of name that should be used for making component groups

| Group          | Name          | Description                                                                                |
|----------------|---------------|--------------------------------------------------------------------------------------------------------------------------|
| Analytics      | analytics     | components for analytics use                                                                                |
| Media          | media         | assets related components, galleries, asset lists, videos etc                                                             |
| Content        | content       | primary components used to store authored content, content from these components is used by other components for display |
| Cloud Services | cloudservices | components for cloud services                                                                                |
| Layout         | layout        | provide layout ability, grouping and structuring of content, contains layout related components                    |
| List           | list          | find pages and show their data in lists                                  |
| Details        | details       | used to create and display custom metadata for different page types                                                      |
| Widgets        | widgets       | used to provide client-side functionality, integrating 3rd party services                                                |
| Commerce       | commerce      | used for Commerce, shopping carts, checkouts, product listing etc. |
| Common         | common        | used for shared components that are available to authors                                                                 |
| Forms          | forms         | used to contain all the components that are used in forms                                                                |
| Template       | template      | used to store all the available Template components that include HTML page structures that are used as a base for authorable templates                                    |
| Workflow       | workflow      | steps that appear in workflow editor                                                                                |

Groups are targeted to be meaningful to Authors when creating new groups consider how to explain component groups to authors.

## Component Variants and Badges

Component Variants are used as a pattern to output different HTML templates for the same component content.

![Component Variants](/assets/images/diagrams/component-variant-example.png)

Every component will have unique fields that are used by authors for content input. Usually, these fields will be tied to a specific visual representation of that content. There are scenarios where you need to be able to output different HTML structure of a component data, to achieve Component Variant pattern is used.

![Component Variants Entity Diagram](/assets/images/diagrams/component-variant-entity-diagram.png)

Each component should have at least one default Variant, and component template should provide a content-driven approach to loading new Variants see [HTL Component Template](/manual/conventions/#htl-component-template) for example. This allows authors to choose from a dropdown list which variant they require.

Additionally Component Variants concepts are applied as a convention to allow a component to control the display of its content in related components. This Variants concept provides a method of describing target output structures that are structured from component fields. This pattern offers a way to remove dependencies of one component on the structure of another component.

![Component Badges](/assets/images/diagrams/component-badge-usage.png)

If a component needs to leverage the content of another component it used Sling selectors to call component with a specific badge name. This also allows abstracting all of the structure into content and create an Author controlled presentation pattern.

## Component Structure

All component must follow consistent patterns that help everyone to understand consistency across components. Following are the conventions that are used for components.

| Node                  | Purpouse                                                                                | Usercase  | Extension |
|-----------------------|-----------------------------------------------------------------------------------------|-----------|-----------|
| _cq_design_dalog      | Authoring dialog that will be used to configure component                               | mandatory | xml       |
| _cq_design            | Primary Authoring fo interacting with component properties                              | mandatory | xml       |
| .content.xml          | component authoring metadata                                                            | mandatory | xml       |
| _cq_editConfig.xml    | component authoring configuration for Editor UI                                         | mandatory | xml       |
| README.md             | readme describing the component which is viewed in the Components Experience in AEM     | mandatory | md        |
| variant.default.<EXT> | default template for display                                                            | mandatory | jsp,html  |
| component.<EXT>       | default boostrap of component                                                           | mandatory | jsp,html  |
| badge.default.<EXT>   | default badge to be used by other components for representing current component content | optional  | jsp,html  |

## Component Client Libs Namespace Convention

Components that have specific clientlibs should have following client libs assigned if they will be loaded by clientlibs in template footer and headers.

Paths of component namespace should be following the location of the component path eg <tenant>.components.<group>.<subfolder>.<component name> with <subfolder> repeating for each subfolder leading up to component folder.

| Namespace                            | Purpose                                                                                |
|--------------------------------------|--------------------------------------------------------------------------------------------------------------|
| <tenant>.components.author           | specifies that this component library should be loaded into global authoring clientlibs                      |
| <tenant>.components.publish          | specifies that this component library should be loaded into global publish clientlibs                        |
| <tenant>.components.<component name> | specific group for the component to be used for specific usage such as component loading its own client libs |

## Component Versioning
Initially, when a component is created, it's acceptable to have the component code to be located under its folder path.

```
components
    layout
        article
            <component structure>
```

Where possible initial component structure should be located in the v1 subfolder, this will also ensure that the evolution of component will require marginally less effort.

```
components
    layout
        article ( sling:resourceSuperType -> v1/article )
            v1
                <component structure>
```

As component version grow, root component should be pointed to the specific version all existing references of component should be using. Not doing this will mean that your content pages will have hard references to component version without any Authoring way of changing that apart from reauthoring the content.

```
components
    layout
        article ( sling:resourceSuperType -> v2/article )
            v1
                article
            v2
                article
```

This will ensure that all existing pages will continue working as expected and will provide a natural upgrade for all component locations. This pattern will also minimise presenting component versions to Authors as there is no simple way to describe difference to authors when they are editing.

## Component Client Libs Modules
Component generic client libs should be located in the component folder.

```
components
    layout
        article
            clientlibs (version agnostic client libs)
                css/
                js/
                css.txt
                js.txt
            v1
                article
                clientlibs (version specific client libs)
                <component structure>
            v2
                article
                clientlibs (version specific client libs)
                <component structure>
```

## JSP Component Template

For ease of understanding component code following sections should be used as reference.

| LABEL                          | Description                     |
|--------------------------------|---------------------------------|
| *** COMPONENT DEPENDECIES ***  | used for describing dependecies |
| *** COMPONENT DECLARATIONS *** |                                 |
| *** COMPONENT LOGIC ***        |                                 |
| *** COMPONENT TEMPLATING ***   |                                 |

Following is a sample for component bootrstap, please remove annotations when using as a template.

```jsp
*** COMPONENT DEPENDECIES ***
<%@ page import="com.google.common.base.Throwables" %>
<%@ include file="/apps/aemdesign/global/global.jsp" %>
<%@ include file="/apps/aemdesign/global/images.jsp" %>
<%@ include file="/apps/aemdesign/global/components.jsp" %>
<%
*** COMPONENT DECLARATIONS ***

    final String DEFAULT_ARIA_ROLE = "article";

    // {
    //   1 required - property name,
    //   2 required - default value,
    //   3 optional - name of component attribute to add value into
    //   4 optional - canonical name of class for handling multivalues, String or Tag
    // }
    Object[][] componentFields = {
        {FIELD_ARIA_ROLE,DEFAULT_ARIA_ROLE, DEFAULT_ARIA_ROLE_ATTRIBUTE},
        {FIELD_VARIANT, DEFAULT_VARIANT},
    };

    ComponentProperties componentProperties = getComponentProperties(
            pageContext,
            componentFields,
            DEFAULT_FIELDS_STYLE,
            DEFAULT_FIELDS_ACCESSIBILITY);

*** COMPONENT LOGIC ***
    componentProperties.put(DEFAULT_BACKGROUND_IMAGE_NODE_NAME,getBackgroundImageRenditions(pageContext));

%>
*** COMPONENT TEMPLATING ***
<c:set var="componentProperties" value="<%= componentProperties %>"/>
<%@ include file="/apps/aemdesign/global/component-background.jsp" %>
<c:choose>
    <c:when test="${componentProperties.variant eq DEFAULT_VARIANT}">
        <%@ include file="variant.default.jsp" %>
    </c:when>
    <c:otherwise>
        <%@ include file="variant.default.jsp" %>
    </c:otherwise>
</c:choose>
<%@include file="/apps/aemdesign/global/component-badge.jsp" %>

```

## HTL Component Template

Following is a sample for component bootrstap

```html
<sly data-sly-use.component="design.aem.models.v2.layout.Article"
     data-sly-use.variant="${component.componentProperties.variantTemplate}"
     data-sly-use.background="aemdesign/global/templates/component-background.html"
     data-sly-use.info="aemdesign/global/templates/component-info.html">

    <!--/* print component background */-->
    <sly data-sly-call="${background.variant @ componentId=component.componentProperties.componentId, assets=component.componentProperties.bgimage.componentBackgroundAssets}"></sly>

    <!--/* print component variant */-->
    <sly data-sly-call="${variant.variant @ componentProperties=component.componentProperties}"></sly>

    <!--/* print component info in edit mode */-->
    <sly data-sly-call="${info.variant @ componentProperties=component.componentProperties, component=component}"></sly>

</sly>
```

## HTL Component WCMUsePojo Class

Following is a reference for component Class that will be backing each HTL component.

```java
package design.aem.models.v2.details;

import com.adobe.cq.sightly.WCMUsePojo;
import design.aem.components.ComponentProperties;
import design.aem.utils.components.TagUtil;
import com.day.cq.i18n.I18n;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PageDetails extends WCMUsePojo {

    private static final Logger LOGGER = LoggerFactory.getLogger(PageDetails.class);

    private ComponentProperties componentProperties = null;
    public ComponentProperties getComponentProperties() {
        return this.componentProperties;
    }

    @Override
    public void activate() throws Exception {

        com.day.cq.i18n.I18n _i18n = new I18n(getRequest());

        //COMPONENT STYLES
        // {
        //   1 required - property name,
        //   2 required - default value,
        //   3 optional - name of component attribute to add value into
        //   4 optional - canonical name of class for handling multivalues, String or Tag
        // }
        Object[][] componentFields = {
            {FIELD_VARIANT, DEFAULT_VARIANT},
        };
        componentProperties = ComponentsUtil.getComponentProperties(
            this,
            componentFields,
            DEFAULT_FIELDS_STYLE,
            DEFAULT_FIELDS_ACCESSIBILITY,
            DEFAULT_FIELDS_ANALYTICS
        );

    }
}

```

## ClientLibs Convention - JavaScript

When writing component-specific API code in Javascript please ensure you encapsulating namespacing, that does not directly depend on external dependencies.

JavaScript for all Component JavaScript code must be divided into:

1. **functions.js** - component functions API, has all of the required static utility functions that will be used by component behaviours. These should only be functions and should not be binding to elements of the page on load events.
2. **behaviour.js** - component binding API, has all of the load events and binding to HTML, uses functions to help with structure and reusable config as required. This is the file that demonstrates how the component is attached to HTML markup.

JS modules should be located as following.

```
components
    layout
        article
            clientlibs (version agnostic client libs)
                css/
                js/
                    functions.js
                    behaviour.js
                css.txt
                js.txt
```

Following is an example of a function used for component.

```javascript
//search - functions
window.AEMDESIGN = window.AEMDESIGN || {"jQuery":{}};
window.AEMDESIGN.components = AEMDESIGN.components || {};
window.AEMDESIGN.components.search = AEMDESIGN.components.search || {};

(function ($, _, ko, log, utils, ns, window, undefined) { //NOSONAR convention for wrapping all modules

    "use strict";
    var _version = "0.1";

    ns.version = function () {
        return _version;
    };

    ns.init = function($el) {
        //INIT CODE
    };

})(AEMDESIGN.jQuery,_,ko, AEMDESIGN.log, AEMDESIGN.utils, AEMDESIGN.components.search, this);
```

Following is an example of behaviours used for component.

```javascript
//search - behaviour
window.AEMDESIGN = window.AEMDESIGN || {"jQuery":{}};
window.AEMDESIGN.components = AEMDESIGN.components || {};
window.AEMDESIGN.components.search = AEMDESIGN.components.search || {};

(function ($, _, ko, utils, log, search, window, undefined) { //NOSONAR convention for wrapping all modules

    $(document).ready(function () {

        $("[data-modules*='search']").each(function() {

            var base = $(this);

            search.init(base);

        });

    });

})(AEMDESIGN.jQuery, _, ko, AEMDESIGN.utils, AEMDESIGN.log, AEMDESIGN.components.search, this); //pass in additional dependencies
```

## ClientLibs Convention - CSS

When writing CSS ensure that component Styles are added under a component namespace. Here is an example

```javascript
[component] .<component name> {
}
```

# Dialog Conventions

Common Tabs for all component - use shared dialogs.

```html
<styleTab
    jcr:primaryType="nt:unstructured"
    jcr:title="Style"
    path="/apps/aemdesign/global/dialog/touch/style/content/items/styleTab"
    resourceType="granite/ui/components/foundation/section"
    sling:resourceType="granite/ui/components/coral/foundation/include"/>
```

Use Tags as a source for your Dropdowns - will ensure that content can be updated later.

```html
<cancelinheritparent
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/select"
    fieldLabel="Cancel Inherit Parent"
    name="./cancelInheritParent"
    emptyOption="{Boolean}true"
    value="">
    <datasource
        jcr:primaryType="nt:unstructured"
        sling:resourceType="aemdesign/components/coral/datasources/tags"
        variant="valuelist"
        path="/content/cq:tags/${(empty tenant.id and empty tenantId) ? 'aemdesign' : (empty tenant.id ? tenantId : tenant.id )}/component-dialog/common/true-false"/>
</cancelinheritparent>
```

Don't use Checkbox fields in dialogs - use Dropdowns so that it's clear what if the user has made a selection and what defaults are

```html
<cancelinheritparent
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/select"
    fieldLabel="Cancel Inherit Parent"
    name="./cancelInheritParent"
    emptyOption="{Boolean}true"
    value="">
...
</cancelinheritparent>
```

Common Component Field Spec - define component fields in an array to use with component helper function ComponentsUtil.getComponentProperties

```java
Object[][] componentFields = {
    {"author", pageAuthorFullName},
    {"authorUrl", pageAuthorEmail},
    {FIELD_VARIANT, DEFAULT_VARIANT}
};
```

Common Component Field Load - this will collect and construct all fields with defaults and select Design/Policy config as defaults.

```java
componentProperties = ComponentsUtil.getComponentProperties(
    this,
    componentFields,
    DEFAULT_FIELDS_STYLE,
    DEFAULT_FIELDS_ACCESSIBILITY);
```

Common Component Field Presets - use globally defined fields spect to collect content from shared tabs in dialog
> For Styles Tabs and Common Fields

```java
//COMPONENT STYLES
// {
//   1 required - property name,
//   2 required - default value,
//   3 optional - name of component attribute to add value into
//   4 optional - canonical name of class for handling multivalues, String or Tag
// }
public static final Object[][] DEFAULT_FIELDS_STYLE = {
    {FIELD_STYLE_COMPONENT_ID, "", "id"},
    {FIELD_STYLE_COMPONENT_THEME, new String[]{}, "class", Tag.class.getCanonicalName()},
    {FIELD_STYLE_COMPONENT_MODIFIERS, new String[]{}, "class", Tag.class.getCanonicalName()},
    {FIELD_STYLE_COMPONENT_MODULES, new String[]{}, "data-modules", Tag.class.getCanonicalName()},
    {FIELD_STYLE_COMPONENT_CHEVRON, new String[]{}, "class", Tag.class.getCanonicalName()},
    {FIELD_STYLE_COMPONENT_ICON, new String[]{}, "class", Tag.class.getCanonicalName()},
    {FIELD_STYLE_COMPONENT_POSITIONX, "", "x"},
    {FIELD_STYLE_COMPONENT_POSITIONY, "", "y"},
    {FIELD_STYLE_COMPONENT_WIDTH, "", "width"},
    {FIELD_STYLE_COMPONENT_HEIGHT, "", "height"},
    {FIELD_STYLE_COMPONENT_SITETHEMECATEGORY, ""},
    {FIELD_STYLE_COMPONENT_SITETHEMECOLOR, ""},
    {FIELD_STYLE_COMPONENT_SITETITLECOLOR, ""},
    {FIELD_STYLE_COMPONENT_BOOLEANATTR, new String[]{}, " ", Tag.class.getCanonicalName()}, //#3" " =do not store content in data attributes
    {FIELD_STYLE_COMPONENT_ANIMATION_ENABLED, false},
    {FIELD_STYLE_COMPONENT_ANIMATION_NAME, StringUtils.EMPTY, "data-aos"},
    {FIELD_STYLE_COMPONENT_ANIMATION_ONCE, StringUtils.EMPTY, "data-aos-once"},
    {FIELD_STYLE_COMPONENT_ANIMATION_EASING, StringUtils.EMPTY, "data-aos-easing"},
    {FIELD_STYLE_COMPONENT_ANIMATION_DELAY, StringUtils.EMPTY, "data-aos-delay"},
    {FIELD_STYLE_COMPONENT_ANIMATION_DURATION, StringUtils.EMPTY, "data-aos-duration"},
};
```

## Dialog Layout

Consistent dialog pattern allow ease of understanding and experience of developing, using and training components to Authors.

![Dialog Layout](/assets/images/diagrams/dialog-convention.png)

## Component Artifacts Alignment

All components must have a matching artifact in related artifacts. This is to ensure consistency and completeness of component delivery.

![Component Artifacts Alignment](/assets/images/diagrams/folder-naming.png)

# Using Tags for Styles

One of the main objectives of AEM.Design is to provide a consistent way of representing Design Languages as a taxonomy of Tags. This provides a mechanism to create Tags taxonomy by designers and then applied to components by authors.

The following image demonstrates the shared Style dialog that is applied to all components.

![Shared Dialog - Styles](/assets/images/dialogs/shared-dialog-styles.png)

Following table describes each available option. Each of the options is defined in a way to be able to easily apply to Design Systems and so that it can be easily understood by Authors.

| Field              | Type | Description                                                      |
|--------------------|------|------------------------------------------------------------------|
| ID                 | text | generates an Id attribute for a component                        |
| Theme              | tags | used to apply style one or a combination of nested components      |
| Modifiers          | tags | used to apply design system tweaks to components                 |
| Module             | tags | used to apply behaviour to component                             |
| Chevron            | tags | used to apply Chevron to a component                             |
| Icon               | tags | used to apply Icon to the component                              |
| Boolean Attributes | tags | used to apply metadata attributes                                |
| Positions          | text | used by Modules for placement of component in parent e.g. Tooltips |
| Size               | text | used to add width and height attributes to component             |

All text fields provide direct input that is added to the component wrapper. All Tag fields allow selecting multiple tags for each filed, which enables flexibility when applying styles.

Technically a component wrapper tag is trying to create the following footprint and it automated by using shared dialogs. This is reference output of share libraries to provide a consistent wrapper for all components.

```html
<div component id="${componentProperties.id}"
    class="${componentProperties.name} ${componentProperties.theme} ${componentProperties.modifier} ${componentProperties.chevron} ${componentProperties.icon}"
    style="width:${componentProperties.width};height:${componentProperties.height};"
    x="${componentProperties.x}" y="${componentProperties.y}"
    data-modules="${componentProperties.modules}"
    ${componentProperties.booleanAttributes}></div>
```

Furthermore using Tags allows storing style related content in a central place which can be updated by authors, using tags also has a benefit of translations and ability to change the actual value of tag class by updating tag entry.

![Tags Authoring](/assets/images/dialogs/tag-authoring-update.png)

These updates to tag authoring UI enable updating and adding values that correspond to CSS names in authoring UI.

## Style Tags Content Generator

Compose project contains all of the CSS, JS and Tag YAML files that describe design being developed. This subproject is compiled and installed into AEM as a standalone package. Tag YAML files is used to specify design language mapping to CSS classes, and during compiling Tags content is generated.

A custom Content Generator is used to generate Tags from YAML file similar to flowing.

```yaml
content/_cq_tags/aemdesign/component-style-icon: &component-style-icon
  feed/atom:
    flat: true
    prefix: 'fa fa-rss'
    title: 'Atom'

  feed/rss:
    flat: true
    prefix: 'fa fa-rss'
    title: 'RSS'

  social:
    prefixes:
      - facebook
      - facebook-f
      - instagram
      - linkedin
      - linkedin-in
      - pinterest-p
      - tumblr
      - tumblr-square
      - twitter
      - youtube
    valueFormat: fab fa-%%prefix%%
    title: '%%prefix_normalised%%'
```

[Reference Tag YAML files](https://github.com/aem-design/aemdesign-aem-support/blob/master/aemdesign-aem-compose/content-generator/config/core/) can be found in your Componse project and will be located in the Compose ```content-generator/config/core``` folder if you have generated using the [AEM.Design Archetype](https://github.com/aem-design/aemdesign-archetype).


text:
date: 2007-09-01
layout: post
title: "Seminar of Prof. Jeffrey Long on October 5th 2007"
---

Prof. Jeffrey Long (University of California, Berkeley) is visiting us October 4 – 7.
Jeff will present a seminar, titled "Hydrogen Storage in Microporous Coordination Solids with Exposed Metal Sites", on Friday, October 5, at 11:15 AM (Lecture Room H2).

Everyone is welcome to join!

redpajama_set_name: RedPajamaGithub


text:
namespace double_conversion {

// The buffer must only contain digits in the range [0-9]. It must not
// contain a dot or a sign. It must not start with '0', and must not be empty.
double Strtod(Vector<const char> buffer, int exponent);

// The buffer must only contain digits in the range [0-9]. It must not
// contain a dot or a sign. It must not start with '0', and must not be empty.
float Strtof(Vector<const char> buffer, int exponent);

}  // namespace double_conversion

#endif  // DOUBLE_CONVERSION_STRTOD_H_


text:
package ru.sfedu.mmcs.portfolio.swing;

import ru.sfedu.mmcs.portfolio.sources.SourceLimits;

public class DataModelLimits extends javax.swing.table.AbstractTableModel {

	private static final long serialVersionUID = 7549728947097223459L;
	protected SourceLimits _data;

	public DataModelLimits(SourceLimits data)
	{
		_data = data;
	}

	@Override
	public int getColumnCount() {
		return _data.getCountVariables() + 2;
	}

	@Override
	public int getRowCount() {
		return _data.getCountLimits();
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		if(columnIndex == 0)
			return _data.getLeftLimit(rowIndex);
		if(columnIndex == _data.getCountVariables() + 1)
			return _data.getRightLimit(rowIndex);
		return _data.getVariable(rowIndex, columnIndex - 1);
	}

	@Override
	public boolean isCellEditable(int row, int column) {
		return true;
	}

	@Override
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public Class getColumnClass(int columnIndex) {
		return Double.class;
	}

	@Override
	public String getColumnName(int column) {
		if(column == 0)
			return "B1";
		else if(column == _data.getCountVariables() + 1)
			return "B2";
		return _data.getName(column - 1);
	}

	@Override
	public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
		if(columnIndex == 0)
			_data.setLimitLeft(rowIndex, (double)aValue);
		else if(columnIndex == _data.getCountVariables() + 1)
			_data.setLimitRight(rowIndex, (double)aValue);
		else
			_data.setVariable(rowIndex, columnIndex - 1, (double)aValue);
		super.setValueAt(aValue, rowIndex, columnIndex);
	}

}


text:
import {RouteFilterContainer} from './route-filters';

export class RouterConfiguration{
  instructions;
  options;
  pipelineSteps;
  unknownRouteConfig;
  title;
  constructor() {
    this.instructions = [];
    this.options = {};
    this.pipelineSteps = [];
  }

  addPipelineStep(name, step) {
    this.pipelineSteps.push({name, step});
  }

  map(route) {
    if (Array.isArray(route)) {
      route.forEach(this.map.bind(this));
      return this;
    }

    return this.mapRoute(route);
  }

  mapRoute(config) {
    this.instructions.push(router => {
      let routeConfigs = [];

      if (Array.isArray(config.route)) {
        for (let i = 0, ii = config.route.length; i < ii; ++i) {
          let current = Object.assign({}, config);
          current.route = config.route[i];
          routeConfigs.push(current);
        }
      } else {
        routeConfigs.push(Object.assign({}, config));
      }

      let navModel;
      for (let i = 0, ii = routeConfigs.length; i < ii; ++i) {
        let routeConfig = routeConfigs[i];
        routeConfig.settings = routeConfig.settings || {};
        if (!navModel) {
          navModel = router.createNavModel(routeConfig);
        }

        router.addRoute(routeConfig, navModel);
      }
    });

    return this;
  }

  mapUnknownRoutes(config) {
    this.unknownRouteConfig = config;
    return this;
  }

  exportToRouter(router) {
    let instructions = this.instructions;
    for (let i = 0, ii = instructions.length; i < ii; ++i) {
      instructions[i](router);
    }

    if (this.title) {
      router.title = this.title;
    }

    if (this.unknownRouteConfig) {
      router.handleUnknownRoutes(this.unknownRouteConfig);
    }

    router.options = this.options;

    let pipelineSteps = this.pipelineSteps;
    if (pipelineSteps.length) {
      if (!router.isRoot) {
        throw new Error('Pipeline steps can only be added to the root router');
      }

      let filterContainer = router.container.get(RouteFilterContainer);
      for (let i = 0, ii = pipelineSteps.length; i < ii; ++i) {
        let {name, step} = pipelineSteps[i];
        filterContainer.addStep(name, step);
      }
    }
  }
}


text:
#include "creationprojet.h"
#include <iostream>

CreationProjet::CreationProjet(QWidget * parent):QDialog(parent)
{

  setWindowTitle("Nouveau Projet");
  setMinimumSize(747,468);
  setMaximumSize(747, 468);

  QLabel *titre = new QLabel(this);
  titre->setText("Nouveau Projet");
  titre->setGeometry(250, 0, 350, 60);
  titre->setStyleSheet("font: 30pt");

  //Selection du film
  QLabel *film_source_titre = new QLabel(this);
  film_source_titre->setText("Film source");
  film_source_titre->setStyleSheet("font: 20pt");
  film_source_titre->setGeometry(20, 90, 150, 25);

  QLabel *emplacement_film = new QLabel(this);
  emplacement_film->setText("Emplacement: ");
  emplacement_film->setGeometry(20, 130, 100, 25);

  chemin_video = new QLineEdit(this);
  chemin_video->setGeometry(130,130,200,25);

  QPushButton *parcourir = new QPushButton(this);
  parcourir->setText("Parcourir");
  parcourir->setGeometry(340, 130, 80, 25);

  probleme_chemin_video = new QLabel(this);
  probleme_chemin_video->setText("Ce répertoire n'existe pas");
  probleme_chemin_video->setVisible(false);
  probleme_chemin_video->setGeometry(430,130,170,25);
  QPalette couleur_texte;
  couleur_texte.setColor(QPalette::WindowText, Qt::red);
  probleme_chemin_video->setPalette(couleur_texte);

  //Projet

  QDir home = QDir::home();
  QString dossier("sans nom");
  QDir nouveau_dossier(home.path() + "/sans nom");
  bool existe = nouveau_dossier.exists();
  int i = 1;
  while(existe){
      nouveau_dossier.setPath(nouveau_dossier.path() + QString::number(i));
      existe = nouveau_dossier.exists();
      if(!existe){
          dossier += QString::number(i);
      }
      i++;
  }

  QLabel *projet_titre = new QLabel(this);
  projet_titre->setText("Projet");
  projet_titre->setStyleSheet("font: 20pt");
  projet_titre->setGeometry(20, 190, 150, 35);

  QLabel *nom_projet_titre = new QLabel(this);
  nom_projet_titre->setText("Nom: ");
  nom_projet_titre->setGeometry(20, 230, 100, 25);

  nom_projet = new QLineEdit(this);
  nom_projet->setGeometry(130,230,200,25);
  nom_projet->setText(dossier);

  probleme_nom_projet = new QLabel(this);
  probleme_nom_projet->setText("Ce répertoire existe déjà");
  probleme_nom_projet->setVisible(false);
  probleme_nom_projet->setGeometry(340,230,170,25);
  couleur_texte.setColor(QPalette::WindowText, Qt::red);
  probleme_nom_projet->setPalette(couleur_texte);

  QLabel *emplacement_projet_titre = new QLabel(this);
  emplacement_projet_titre->setText("Emplacement: ");
  emplacement_projet_titre->setGeometry(20, 265, 100, 25);

  chemin_projet = new QLineEdit(this);
  chemin_projet->setGeometry(130,265,200,25);
  chemin_projet->setText(home.path());

  QPushButton *parcourir_projet = new QPushButton(this);
  parcourir_projet->setText("Parcourir");
  parcourir_projet->setGeometry(340, 265, 80, 25);

  probleme_chemin_projet = new QLabel(this);
  probleme_chemin_projet->setText("Ce répertoire n'existe pas");
  probleme_chemin_projet->setVisible(false);
  probleme_chemin_projet->setGeometry(430,265,170,25);
  couleur_texte.setColor(QPalette::WindowText, Qt::red);
  probleme_chemin_projet->setPalette(couleur_texte);

  //Options

  QLabel *option_titre = new QLabel(this);
  option_titre->setText("Option");
  option_titre->setStyleSheet("font: 20pt");
  option_titre->setGeometry(20, 325, 150, 35);

  QLabel *frequence = new QLabel(this);
  frequence->setText("Fréquence: ");
  frequence->setGeometry(20, 365, 100, 25);

  choix_frequence = new QComboBox(this);
  choix_frequence->setGeometry(130, 365, 45, 25);
  choix_frequence->addItem(QString::fromUtf8("6"));
  choix_frequence->addItem(QString::fromUtf8("8"));
  choix_frequence->addItem(QString::fromUtf8("12"));
  choix_frequence->addItem(QString::fromUtf8("24"));

  QLabel *texte_frequence = new QLabel(this);
  texte_frequence->setText("images par seconde");
  texte_frequence->setGeometry(180, 365, 200, 25);

  //boutons
  QPushButton *annuler = new QPushButton(this);
  annuler->setText(QString::fromUtf8("Annuler"));
  annuler->setGeometry(10, 423, 100, 40);
  connect(annuler, SIGNAL(clicked()), this, SLOT(close()));

  QPushButton *creer = new QPushButton(this);
  creer->setText(QString::fromUtf8("Créer"));
  creer->setGeometry(637, 423, 100, 40);
  connect(creer, SIGNAL(clicked()), this, SLOT(envoyer_informations()));

  connect(parcourir_projet, SIGNAL(clicked()), this, SLOT(parcourir_dossier()));
  connect(parcourir, SIGNAL(clicked()), this, SLOT(parcourir_video()));
}

CreationProjet::~CreationProjet()
{
    delete(nom_projet);
    delete(chemin_video);
    delete(choix_frequence);
    delete(chemin_projet);
    delete(probleme_chemin_projet);
    delete(probleme_nom_projet);
    delete(probleme_chemin_video);
    std::cout<<"jjjj"<<std::endl;

}

void CreationProjet::envoyer_informations(){
    QFile video_dir(chemin_video->text());
    bool chemin_video_existe = video_dir.exists() && !chemin_video->text().isEmpty() ;

    if(!chemin_video_existe){
        probleme_chemin_video->setVisible(true);
    }
    else{
        probleme_chemin_video->setVisible(false);
    }

    //si le nom du dossier du projet a un espace ca ne fonctionne pas
    nom_projet->setText(nom_projet->text().replace(" ", "_"));
    QDir nom_projet_dir(chemin_projet->text() + "/" + nom_projet->text());
    bool nom_projet_existe = !nom_projet_dir.exists() && !nom_projet->text().isEmpty();

    if(!nom_projet_existe){
        probleme_nom_projet->setVisible(true);
    }
    else{
        probleme_nom_projet->setVisible(false);
    }

    QDir chemin_projet_dir(chemin_projet->text());
    bool chemin_projet_existe = chemin_projet_dir.exists() && !chemin_projet->text().isEmpty();

    if(!chemin_projet_existe){
        probleme_chemin_projet->setVisible(true);
    }
    else{
        probleme_chemin_projet->setVisible(false);
    }

    if(chemin_video_existe && chemin_projet_existe && nom_projet_existe){
        QDir dir_projet(chemin_projet->text());
        dir_projet.mkdir(nom_projet->text());
        dir_projet.cd(nom_projet->text());
        QString nouveau_projet = dir_projet.path();

        dir_projet.mkdir("images_video");
        dir_projet.mkdir("dessins");
        dir_projet.mkdir("calque");
        dir_projet.mkdir("dessin_image_film");
        dir_projet.mkdir("videos");
        dir_projet.cd("images_video");
        std::string str = "ffmpeg -i " + chemin_video->text().toStdString()+" -r " + choix_frequence->currentText().toStdString() + " " + dir_projet.path().toStdString() + "/image%03d.png";
        system(str.c_str());
        QFile configuration;
        configuration.setFileName("dwimh.conf");
        configuration.open(QIODevice::WriteOnly);
        configuration.write(choix_frequence->currentText().toStdString().c_str());
        configuration.write("\n" );
        configuration.write(QString::number(5).toStdString().c_str());
        configuration.write("\n" );
        configuration.write(QString::number(1).toStdString().c_str());
        configuration.write("\n" );
        configuration.write(QString::number(10).toStdString().c_str());
        configuration.write("\n" );
        configuration.write(QString::number(0).toStdString().c_str());
        nouveau_projet+="/dwimh.conf";
        configuration.copy(nouveau_projet );
        configuration.remove();
        configuration.close();
        emit information_projet(nom_projet_dir.path(), choix_frequence->currentText());
        close();
    }
}

void CreationProjet::parcourir_dossier(){
    chemin_projet->setText(QFileDialog::getExistingDirectory(this, tr("Open Directoriy"), QDir::home().path(), QFileDialog::ShowDirsOnly));
}

void CreationProjet::parcourir_video(){
    chemin_video->setText(QFileDialog::getOpenFileName(this, tr("Open File"), QDir::home().path(), tr("Videos (*.avi *.mpeg *.mp4)")));
}


text:
package org.jfxvnc.net.rfb.codec.encoder;

public class PointerEvent implements InputEvent {

  private final byte buttonMask;

  private final int xPos;
  private final int yPos;

  public PointerEvent(byte buttonMask, int xPos, int yPos) {
    super();
    this.buttonMask = buttonMask;
    this.xPos = xPos;
    this.yPos = yPos;
  }

  public byte getButtonMask() {
    return buttonMask;
  }

  public int getxPos() {
    return xPos;
  }

  public int getyPos() {
    return yPos;
  }

  @Override
  public String toString() {
    return "PointerEvent [buttonMask=" + buttonMask + ", xPos=" + xPos + ", yPos=" + yPos + "]";
  }

}


text:
package org.apache.hadoop.util;

import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Enumeration;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * This class returns build information about Hadoop components.
 */
@InterfaceAudience.Private
@InterfaceStability.Unstable
public class VersionInfo {
  private static final Log LOG = LogFactory.getLog(VersionInfo.class);

  private Properties info;

  protected VersionInfo(String component) {
    info = new Properties();
    String versionInfoFile = component + "-version-info.properties";
    try {
      InputStream is = Thread.currentThread().getContextClassLoader()
        .getResourceAsStream(versionInfoFile);
      if (is == null) {
        throw new IOException("Resource not found");
      }
      info.load(is);
    } catch (IOException ex) {
      LogFactory.getLog(getClass()).warn("Could not read '" +
        versionInfoFile + "', " + ex.toString(), ex);
    }
  }

  protected String _getVersion() {
    return info.getProperty("version", "Unknown");
  }

  protected String _getRevision() {
    return info.getProperty("revision", "Unknown");
  }

  protected String _getBranch() {
    return info.getProperty("branch", "Unknown");
  }

  protected String _getDate() {
    return info.getProperty("date", "Unknown");
  }

  protected String _getUser() {
    return info.getProperty("user", "Unknown");
  }

  protected String _getUrl() {
    return info.getProperty("url", "Unknown");
  }

  protected String _getSrcChecksum() {
    return info.getProperty("srcChecksum", "Unknown");
  }

  protected String _getBuildVersion(){
    return getVersion() +
      " from " + _getRevision() +
      " by " + _getUser() +
      " source checksum " + _getSrcChecksum();
  }

  protected String _getProtocVersion() {
    return info.getProperty("protocVersion", "Unknown");
  }

  private static VersionInfo COMMON_VERSION_INFO = new VersionInfo("common");
  /**
   * Get the Hadoop version.
   * @return the Hadoop version string, eg. "0.6.3-dev"
   */
  public static String getVersion() {
    return COMMON_VERSION_INFO._getVersion();
  }

  /**
   * Get the subversion revision number for the root directory
   * @return the revision number, eg. "451451"
   */
  public static String getRevision() {
    return COMMON_VERSION_INFO._getRevision();
  }

  /**
   * Get the branch on which this originated.
   * @return The branch name, e.g. "trunk" or "branches/branch-0.20"
   */
  public static String getBranch() {
    return COMMON_VERSION_INFO._getBranch();
  }

  /**
   * The date that Hadoop was compiled.
   * @return the compilation date in unix date format
   */
  public static String getDate() {
    return COMMON_VERSION_INFO._getDate();
  }

  /**
   * The user that compiled Hadoop.
   * @return the username of the user
   */
  public static String getUser() {
    return COMMON_VERSION_INFO._getUser();
  }

  /**
   * Get the subversion URL for the root Hadoop directory.
   */
  public static String getUrl() {
    return COMMON_VERSION_INFO._getUrl();
  }

  /**
   * Get the checksum of the source files from which Hadoop was
   * built.
   **/
  public static String getSrcChecksum() {
    return COMMON_VERSION_INFO._getSrcChecksum();
  }

  /**
   * Returns the buildVersion which includes version,
   * revision, user and date.
   */
  public static String getBuildVersion(){
    return COMMON_VERSION_INFO._getBuildVersion();
  }

  /**
   * Returns the protoc version used for the build.
   */
  public static String getProtocVersion(){
    return COMMON_VERSION_INFO._getProtocVersion();
  }

  public static void main(String[] args) {
    LOG.debug("version: "+ getVersion());
    System.out.println("Hadoop " + getVersion());
    System.out.println("Subversion " + getUrl() + " -r " + getRevision());
    System.out.println("Compiled by " + getUser() + " on " + getDate());
    System.out.println("Compiled with protoc " + getProtocVersion());
    System.out.println("From source with checksum " + getSrcChecksum());
    System.out.println("This command was run using " +
        ClassUtil.findContainingJar(VersionInfo.class));
  }
}


text:
************************
Authors and contributors
************************

The following people have contributed code and/or ideas to the current version
of Viziphant. The institutional affiliations are those at the time of the
contribution, and may not be the current affiliation of a contributor.

* Björn Müller [1]
* Michael Denker [1]
* Robin Gutzen [1]
* Maximilian Kramer [1]
* Regimantas Jurkus [1]
* Alexander Kleinjohann [1]
* Pietro Quaglio [1]
* Alper Yegenoglu [1]
* Danylo Ulianych [1]
* Alessandra Stella [1]
* Peter Bouss [1]
* Cristiano Köhler [1]
* Simon Essink [1]

1. Institute of Neuroscience and Medicine (INM-6), Computational and Systems Neuroscience & Institute for Advanced Simulation (IAS-6), Theoretical Neuroscience, Jülich Research Centre and JARA, Jülich, Germany

If we've somehow missed you off the list we're very sorry - please let us know.


text:
CREATE ROLE UTILS_MERGE_USER!
CREATE ROLE UTILS_MERGE_ADMIN!

GRANT ROLE UTILS_MERGE_USER TO ROLE UTILS_USER!
GRANT ROLE UTILS_MERGE_USER TO ROLE UTILS_MERGE_ADMIN WITH ADMIN OPTION!
GRANT ROLE UTILS_MERGE_ADMIN TO ROLE UTILS_ADMIN WITH ADMIN OPTION!

-- SQLSTATES
-------------------------------------------------------------------------------
-- The following variables define the set of SQLSTATEs raised by the procedures
-- and functions in this module.
-------------------------------------------------------------------------------

CREATE VARIABLE MERGE_NO_KEY_STATE CHAR(5) CONSTANT '90010'!
CREATE VARIABLE MERGE_PARTIAL_KEY_STATE CHAR(5) CONSTANT '90011'!
CREATE VARIABLE MERGE_SAME_TABLE_STATE CHAR(5) CONSTANT '90012'!

GRANT READ ON VARIABLE MERGE_NO_KEY_STATE TO ROLE UTILS_MERGE_USER!
GRANT READ ON VARIABLE MERGE_NO_KEY_STATE TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT READ ON VARIABLE MERGE_PARTIAL_KEY_STATE TO ROLE UTILS_MERGE_USER!
GRANT READ ON VARIABLE MERGE_PARTIAL_KEY_STATE TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT READ ON VARIABLE MERGE_SAME_TABLE_STATE TO ROLE UTILS_MERGE_USER!
GRANT READ ON VARIABLE MERGE_SAME_TABLE_STATE TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!

COMMENT ON VARIABLE MERGE_NO_KEY_STATE
    IS 'The SQLSTATE raised when an attempt is made to AUTO_MERGE to a target without a unique constraint'!

COMMENT ON VARIABLE MERGE_PARTIAL_KEY_STATE
    IS 'The SQLSTATE raised when AUTO_MERGE is run on a key which does not completely exist in the source and target tables'!

COMMENT ON VARIABLE MERGE_SAME_TABLE_STATE
    IS 'The SQLSTATE raised when AUTO_MERGE is run with the same table as source and target'!

-- X_BUILD_INSERT(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE)
-- X_BUILD_MERGE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY)
-- X_BUILD_DELETE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY)
-- X_MERGE_CHECKS(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY)
-------------------------------------------------------------------------------
-- These functions are effectively private utility subroutines for the
-- procedures defined below. They simply generate snippets of SQL given a set
-- of input parameters.
-------------------------------------------------------------------------------

CREATE FUNCTION X_BUILD_INSERT(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128)
)
    RETURNS CLOB(64K)
    SPECIFIC X_BUILD_INSERT
    LANGUAGE SQL
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    READS SQL DATA
BEGIN ATOMIC
    DECLARE COLS CLOB(64K) DEFAULT '';

    FOR D AS
        SELECT
            T.COLNAME AS NAME
        FROM
            SYSCAT.COLUMNS S
            INNER JOIN SYSCAT.COLUMNS T
                ON S.COLNAME = T.COLNAME
        WHERE
            S.TABSCHEMA = SOURCE_SCHEMA
            AND S.TABNAME = SOURCE_TABLE
            AND T.TABSCHEMA = DEST_SCHEMA
            AND T.TABNAME = DEST_TABLE
    DO
        IF COLS <> '' THEN
            SET COLS = COLS || ',';
        END IF;
        SET COLS = COLS || QUOTE_IDENTIFIER(NAME);
    END FOR;

    RETURN
        'INSERT INTO ' || QUOTE_IDENTIFIER(DEST_SCHEMA) || '.' || QUOTE_IDENTIFIER(DEST_TABLE) || ' '
        || '(' || COLS || ') '
        || 'SELECT ' || COLS || ' '
        || 'FROM ' || QUOTE_IDENTIFIER(SOURCE_SCHEMA) || '.' || QUOTE_IDENTIFIER(SOURCE_TABLE);
END!

CREATE FUNCTION X_BUILD_MERGE(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128),
    DEST_KEY VARCHAR(128)
)
    RETURNS CLOB(64K)
    SPECIFIC X_BUILD_MERGE
    LANGUAGE SQL
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    READS SQL DATA
BEGIN ATOMIC
    DECLARE JOIN_CLAUSE CLOB(64K) DEFAULT '';
    DECLARE INSERT_COLS CLOB(64K) DEFAULT '';
    DECLARE INSERT_VALS CLOB(64K) DEFAULT '';
    DECLARE UPDATE_COLS CLOB(64K) DEFAULT '';
    DECLARE UPDATE_VALS CLOB(64K) DEFAULT '';

    FOR D AS
        SELECT
            T.COLNAME AS NAME,
            CASE WHEN K.COLNAME IS NULL
                THEN 'N'
                ELSE 'Y'
            END AS KEY_COL
        FROM
            SYSCAT.COLUMNS S
            INNER JOIN SYSCAT.COLUMNS T
                ON S.COLNAME = T.COLNAME
            INNER JOIN SYSCAT.TABCONST C
                ON T.TABSCHEMA = C.TABSCHEMA
                AND T.TABNAME = C.TABNAME
            LEFT JOIN SYSCAT.KEYCOLUSE K
                ON C.TABSCHEMA = K.TABSCHEMA
                AND C.TABNAME = K.TABNAME
                AND C.CONSTNAME = K.CONSTNAME
                AND T.COLNAME = K.COLNAME
        WHERE
            S.TABSCHEMA = SOURCE_SCHEMA
            AND S.TABNAME = SOURCE_TABLE
            AND T.TABSCHEMA = DEST_SCHEMA
            AND T.TABNAME = DEST_TABLE
            AND C.CONSTNAME = DEST_KEY
            AND C.TYPE IN ('P', 'U')
    DO
        IF D.KEY_COL = 'Y' THEN
            IF JOIN_CLAUSE <> '' THEN
                SET JOIN_CLAUSE = JOIN_CLAUSE || ' AND ';
            END IF;
            SET JOIN_CLAUSE = JOIN_CLAUSE ||
                'S.' || QUOTE_IDENTIFIER(NAME) || ' = ' ||
                'T.' || QUOTE_IDENTIFIER(NAME);
        ELSE
            IF UPDATE_COLS <> '' THEN
                SET UPDATE_COLS = UPDATE_COLS || ',';
                SET UPDATE_VALS = UPDATE_VALS || ',';
            END IF;
            SET UPDATE_COLS = UPDATE_COLS || QUOTE_IDENTIFIER(NAME);
            SET UPDATE_VALS = UPDATE_VALS || 'S.' || QUOTE_IDENTIFIER(NAME);
        END IF;
        IF INSERT_COLS <> '' THEN
            SET INSERT_COLS = INSERT_COLS || ',';
            SET INSERT_VALS = INSERT_VALS || ',';
        END IF;
        SET INSERT_COLS = INSERT_COLS || QUOTE_IDENTIFIER(NAME);
        SET INSERT_VALS = INSERT_VALS || 'S.' || QUOTE_IDENTIFIER(NAME);
    END FOR;

    RETURN
        'MERGE INTO ' || QUOTE_IDENTIFIER(DEST_SCHEMA) || '.' || QUOTE_IDENTIFIER(DEST_TABLE) || ' AS T '
        || 'USING ' || QUOTE_IDENTIFIER(SOURCE_SCHEMA) || '.' || QUOTE_IDENTIFIER(SOURCE_TABLE) || ' AS S '
        || 'ON ' || JOIN_CLAUSE || ' '
        || 'WHEN MATCHED THEN UPDATE SET (' || UPDATE_COLS || ') = (' || UPDATE_VALS || ') '
        || 'WHEN NOT MATCHED THEN INSERT (' || INSERT_COLS || ') VALUES (' || INSERT_VALS || ')';
END!

CREATE FUNCTION X_BUILD_DELETE(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128),
    DEST_KEY VARCHAR(128)
)
    RETURNS CLOB(64K)
    SPECIFIC X_BUILD_DELETE
    LANGUAGE SQL
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    READS SQL DATA
BEGIN ATOMIC
    DECLARE KEY_COLS CLOB(64K) DEFAULT '';

    FOR D AS
        SELECT
            T.COLNAME AS NAME,
            CASE WHEN K.COLNAME IS NULL
                THEN 'N'
                ELSE 'Y'
            END AS KEY_COL
        FROM
            SYSCAT.COLUMNS S
            INNER JOIN SYSCAT.COLUMNS T
                ON S.COLNAME = T.COLNAME
            INNER JOIN SYSCAT.TABCONST C
                ON T.TABSCHEMA = C.TABSCHEMA
                AND T.TABNAME = C.TABNAME
            INNER JOIN SYSCAT.KEYCOLUSE K
                ON C.TABSCHEMA = K.TABSCHEMA
                AND C.TABNAME = K.TABNAME
                AND C.CONSTNAME = K.CONSTNAME
                AND T.COLNAME = K.COLNAME
        WHERE
            S.TABSCHEMA = SOURCE_SCHEMA
            AND S.TABNAME = SOURCE_TABLE
            AND T.TABSCHEMA = DEST_SCHEMA
            AND T.TABNAME = DEST_TABLE
            AND C.CONSTNAME = DEST_KEY
            AND C.TYPE IN ('P', 'U')
    DO
        IF KEY_COLS <> '' THEN
            SET KEY_COLS = KEY_COLS || ',';
        END IF;
        SET KEY_COLS = KEY_COLS || QUOTE_IDENTIFIER(NAME);
    END FOR;

    RETURN
        'DELETE FROM ' || QUOTE_IDENTIFIER(DEST_SCHEMA) || '.' || QUOTE_IDENTIFIER(DEST_TABLE) || ' '
        || 'WHERE (' || KEY_COLS || ') IN ('
        || 'SELECT ' || KEY_COLS || ' '
        || 'FROM ' || QUOTE_IDENTIFIER(DEST_SCHEMA) || '.' || QUOTE_IDENTIFIER(DEST_TABLE) || ' '
        || 'EXCEPT '
        || 'SELECT ' || KEY_COLS || ' '
        || 'FROM ' || QUOTE_IDENTIFIER(SOURCE_SCHEMA) || '.' || QUOTE_IDENTIFIER(SOURCE_TABLE)
        || ')';
END!

CREATE PROCEDURE X_INSERT_CHECKS(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128)
)
    SPECIFIC X_INSERT_CHECKS
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL ASSERT_TABLE_EXISTS(SOURCE_SCHEMA, SOURCE_TABLE);
    CALL ASSERT_TABLE_EXISTS(DEST_SCHEMA, DEST_TABLE);

    -- Check source and target are distinct
    IF SOURCE_SCHEMA = DEST_SCHEMA THEN
        IF SOURCE_TABLE = DEST_TABLE THEN
            CALL SIGNAL_STATE(MERGE_SAME_TABLE_STATE,
                'Source and destination tables cannot be the same');
        END IF;
    END IF;
END!

CREATE PROCEDURE X_MERGE_CHECKS(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128),
    DEST_KEY VARCHAR(128)
)
    SPECIFIC X_MERGE_CHECKS
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL X_INSERT_CHECKS(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE);

    -- Check all columns of the destination key are present in the source table
    IF (
        SELECT COUNT(*)
        FROM SYSCAT.KEYCOLUSE
        WHERE
            TABSCHEMA = DEST_SCHEMA
            AND TABNAME = DEST_TABLE
            AND CONSTNAME = DEST_KEY
        ) <> (
        SELECT COUNT(*)
        FROM
            SYSCAT.KEYCOLUSE K
            INNER JOIN SYSCAT.COLUMNS C
                ON K.COLNAME = C.COLNAME
        WHERE
            K.TABSCHEMA = DEST_SCHEMA
            AND K.TABNAME = DEST_TABLE
            AND K.CONSTNAME = DEST_KEY
            AND C.TABSCHEMA = SOURCE_SCHEMA
            AND C.TABNAME = SOURCE_TABLE
        ) THEN
        CALL SIGNAL_STATE(MERGE_PARTIAL_KEY_STATE,
            'All fields of constraint ' || DEST_KEY ||
            ' must exist in the source and the target tables');
    END IF;

END!

-- AUTO_INSERT(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE)
-- AUTO_INSERT(SOURCE_TABLE, DEST_TABLE)
-------------------------------------------------------------------------------
-- The AUTO_INSERT procedure inserts all data from SOURCE_TABLE into DEST_TABLE
-- by means of an automatically generated INSERT statement covering all columns
-- common to both tables.
--
-- If SOURCE_SCHEMA and DEST_SCHEMA are not specified they default to the
-- current schema.
-------------------------------------------------------------------------------

CREATE PROCEDURE AUTO_INSERT(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128)
)
    SPECIFIC AUTO_INSERT1
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    DECLARE DML CLOB(64K) DEFAULT '';

    CALL X_INSERT_CHECKS(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE);
    SET DML = X_BUILD_INSERT(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE);
    EXECUTE IMMEDIATE DML;
END!

CREATE PROCEDURE AUTO_INSERT(
    SOURCE_TABLE VARCHAR(128),
    DEST_TABLE VARCHAR(128)
)
    SPECIFIC AUTO_INSERT2
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL AUTO_INSERT(CURRENT SCHEMA, SOURCE_TABLE, CURRENT SCHEMA, DEST_TABLE);
END!

GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_INSERT1 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_INSERT2 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_INSERT1 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_INSERT2 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!

COMMENT ON SPECIFIC PROCEDURE AUTO_INSERT1
    IS 'Automatically inserts data from SOURCE_TABLE into DEST_TABLE'!
COMMENT ON SPECIFIC PROCEDURE AUTO_INSERT2
    IS 'Automatically inserts data from SOURCE_TABLE into DEST_TABLE'!

-- AUTO_MERGE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY)
-- AUTO_MERGE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE)
-- AUTO_MERGE(SOURCE_TABLE, DEST_TABLE, DEST_KEY)
-- AUTO_MERGE(SOURCE_TABLE, DEST_TABLE)
-------------------------------------------------------------------------------
-- The AUTO_MERGE procedure performs an "upsert", or combined insert and update
-- of all data from SOURCE_TABLE into DEST_TABLE by means of an automatically
-- generated MERGE statement.
--
-- The DEST_KEY parameter specifies the name of the unique key to use for
-- identifying rows in the destination table. If specified, it must be the name
-- of a unique key or primary key which covers columns which exist in both the
-- source and destination tables. If omitted, it defaults to the name of the
-- primary key of the destination table.
--
-- If SOURCE_SCHEMA and DEST_SCHEMA are not specified they default to the
-- current schema.
-------------------------------------------------------------------------------

CREATE PROCEDURE AUTO_MERGE(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128),
    DEST_KEY VARCHAR(128)
)
    SPECIFIC AUTO_MERGE1
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    DECLARE DML CLOB(64K) DEFAULT '';

    CALL X_MERGE_CHECKS(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY);
    SET DML = X_BUILD_MERGE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY);
    EXECUTE IMMEDIATE DML;
END!

CREATE PROCEDURE AUTO_MERGE(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128)
)
    SPECIFIC AUTO_MERGE2
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL AUTO_MERGE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, (
        SELECT CONSTNAME
        FROM SYSCAT.TABCONST
        WHERE TABSCHEMA = DEST_SCHEMA
        AND TABNAME = DEST_TABLE
        AND TYPE = 'P'));
END!

CREATE PROCEDURE AUTO_MERGE(
    SOURCE_TABLE VARCHAR(128),
    DEST_TABLE VARCHAR(128),
    DEST_KEY VARCHAR(128)
)
    SPECIFIC AUTO_MERGE3
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL AUTO_MERGE(CURRENT SCHEMA, SOURCE_TABLE, CURRENT SCHEMA, DEST_TABLE, DEST_KEY);
END!

CREATE PROCEDURE AUTO_MERGE(
    SOURCE_TABLE VARCHAR(128),
    DEST_TABLE VARCHAR(128)
)
    SPECIFIC AUTO_MERGE4
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL AUTO_MERGE(CURRENT SCHEMA, SOURCE_TABLE, CURRENT SCHEMA, DEST_TABLE, (
        SELECT CONSTNAME
        FROM SYSCAT.TABCONST
        WHERE TABSCHEMA = CURRENT SCHEMA
        AND TABNAME = DEST_TABLE
        AND TYPE = 'P'));
END!

GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_MERGE1 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_MERGE2 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_MERGE3 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_MERGE4 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_MERGE1 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_MERGE2 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_MERGE3 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_MERGE4 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!

COMMENT ON SPECIFIC PROCEDURE AUTO_MERGE1
    IS 'Automatically inserts/updates ("upserts") data from SOURCE_TABLE into DEST_TABLE based on DEST_KEY'!
COMMENT ON SPECIFIC PROCEDURE AUTO_MERGE2
    IS 'Automatically inserts/updates ("upserts") data from SOURCE_TABLE into DEST_TABLE based on DEST_KEY'!
COMMENT ON SPECIFIC PROCEDURE AUTO_MERGE3
    IS 'Automatically inserts/updates ("upserts") data from SOURCE_TABLE into DEST_TABLE based on DEST_KEY'!
COMMENT ON SPECIFIC PROCEDURE AUTO_MERGE4
    IS 'Automatically inserts/updates ("upserts") data from SOURCE_TABLE into DEST_TABLE based on DEST_KEY'!

-- AUTO_DELETE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY)
-- AUTO_DELETE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE)
-- AUTO_DELETE(SOURCE_TABLE, DEST_TABLE, DEST_KEY)
-- AUTO_DELETE(SOURCE_TABLE, DEST_TABLE)
-------------------------------------------------------------------------------
-- The AUTO_DELETE procedure deletes rows from DEST_TABLE that do not exist
-- in SOURCE_TABLE. This procedure is intended to be used after the AUTO_MERGE
-- procedure has been used to upsert from SOURCE to DEST.
--
-- The DEST_KEY parameter specifies the name of the unique key to use for
-- identifying rows in the destination table. If specified, it must be the name
-- of a unique key or primary key which covers columns which exist in both the
-- source and destination tables. If omitted, it defaults to the name of the
-- primary key of the destination table.
--
-- If SOURCE_SCHEMA and DEST_SCHEMA are not specified they default to the
-- current schema.
-------------------------------------------------------------------------------

CREATE PROCEDURE AUTO_DELETE(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128),
    DEST_KEY VARCHAR(128)
)
    SPECIFIC AUTO_DELETE1
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    DECLARE DML CLOB(64K) DEFAULT '';

    CALL X_MERGE_CHECKS(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY);
    SET DML = X_BUILD_DELETE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, DEST_KEY);
    EXECUTE IMMEDIATE DML;
END!

CREATE PROCEDURE AUTO_DELETE(
    SOURCE_SCHEMA VARCHAR(128),
    SOURCE_TABLE VARCHAR(128),
    DEST_SCHEMA VARCHAR(128),
    DEST_TABLE VARCHAR(128)
)
    SPECIFIC AUTO_DELETE2
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL AUTO_DELETE(SOURCE_SCHEMA, SOURCE_TABLE, DEST_SCHEMA, DEST_TABLE, (
        SELECT CONSTNAME
        FROM SYSCAT.TABCONST
        WHERE TABSCHEMA = DEST_SCHEMA
        AND TABNAME = DEST_TABLE
        AND TYPE = 'P'));
END!

CREATE PROCEDURE AUTO_DELETE(
    SOURCE_TABLE VARCHAR(128),
    DEST_TABLE VARCHAR(128),
    DEST_KEY VARCHAR(128)
)
    SPECIFIC AUTO_DELETE3
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL AUTO_DELETE(CURRENT SCHEMA, SOURCE_TABLE, CURRENT SCHEMA, DEST_TABLE, DEST_KEY);
END!

CREATE PROCEDURE AUTO_DELETE(
    SOURCE_TABLE VARCHAR(128),
    DEST_TABLE VARCHAR(128)
)
    SPECIFIC AUTO_DELETE4
    MODIFIES SQL DATA
    NOT DETERMINISTIC
    NO EXTERNAL ACTION
    LANGUAGE SQL
BEGIN ATOMIC
    CALL AUTO_DELETE(CURRENT SCHEMA, SOURCE_TABLE, CURRENT SCHEMA, DEST_TABLE, (
        SELECT CONSTNAME
        FROM SYSCAT.TABCONST
        WHERE TABSCHEMA = CURRENT SCHEMA
        AND TABNAME = DEST_TABLE
        AND TYPE = 'P'));
END!

GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_DELETE1 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_DELETE2 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_DELETE3 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_DELETE4 TO ROLE UTILS_MERGE_USER!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_DELETE1 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_DELETE2 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_DELETE3 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!
GRANT EXECUTE ON SPECIFIC PROCEDURE AUTO_DELETE4 TO ROLE UTILS_MERGE_ADMIN WITH GRANT OPTION!

COMMENT ON SPECIFIC PROCEDURE AUTO_DELETE1
    IS 'Automatically removes data from DEST_TABLE that doesn''t exist in SOURCE_TABLE, based on DEST_KEY'!
COMMENT ON SPECIFIC PROCEDURE AUTO_DELETE2
    IS 'Automatically removes data from DEST_TABLE that doesn''t exist in SOURCE_TABLE, based on DEST_KEY'!
COMMENT ON SPECIFIC PROCEDURE AUTO_DELETE3
    IS 'Automatically removes data from DEST_TABLE that doesn''t exist in SOURCE_TABLE, based on DEST_KEY'!
COMMENT ON SPECIFIC PROCEDURE AUTO_DELETE4
    IS 'Automatically removes data from DEST_TABLE that doesn''t exist in SOURCE_TABLE, based on DEST_KEY'!

-- vim: set et sw=4 sts=4:


text:
using base::android::AttachCurrentThread;
using base::android::ConvertUTF8ToJavaString;
using base::android::ConvertUTF16ToJavaString;
using base::android::ScopedJavaLocalRef;
using content::ColorChooser;
using content::RenderWidgetHostView;
using content::WebContents;
using content::WebContentsDelegate;
using content::WebContentsUnresponsiveState;

namespace web_contents_delegate_android {

WebContentsDelegateAndroid::WebContentsDelegateAndroid(JNIEnv* env, jobject obj)
    : weak_java_delegate_(env, obj) {
}

WebContentsDelegateAndroid::~WebContentsDelegateAndroid() {
}

ScopedJavaLocalRef<jobject>
WebContentsDelegateAndroid::GetJavaDelegate(JNIEnv* env) const {
  return weak_java_delegate_.get(env);
}

// ----------------------------------------------------------------------------
// WebContentsDelegate methods
// ----------------------------------------------------------------------------

ColorChooser* WebContentsDelegateAndroid::OpenColorChooser(
      WebContents* source,
      SkColor color,
      const std::vector<content::ColorSuggestion>& suggestions)  {
  return new ColorChooserAndroid(source, color, suggestions);
}

// OpenURLFromTab() will be called when we're performing a browser-intiated
// navigation. The most common scenario for this is opening new tabs (see
// RenderViewImpl::decidePolicyForNavigation for more details).
WebContents* WebContentsDelegateAndroid::OpenURLFromTab(
    WebContents* source,
    const content::OpenURLParams& params) {
  const GURL& url = params.url;
  WindowOpenDisposition disposition = params.disposition;

  if (!source || (disposition != WindowOpenDisposition::CURRENT_TAB &&
                  disposition != WindowOpenDisposition::NEW_FOREGROUND_TAB &&
                  disposition != WindowOpenDisposition::NEW_BACKGROUND_TAB &&
                  disposition != WindowOpenDisposition::OFF_THE_RECORD)) {
    NOTIMPLEMENTED();
    return NULL;
  }

  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return WebContentsDelegate::OpenURLFromTab(source, params);

  if (disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB ||
      disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB ||
      disposition == WindowOpenDisposition::OFF_THE_RECORD) {
    JNIEnv* env = AttachCurrentThread();
    ScopedJavaLocalRef<jstring> java_url =
        ConvertUTF8ToJavaString(env, url.spec());
    ScopedJavaLocalRef<jstring> extra_headers =
            ConvertUTF8ToJavaString(env, params.extra_headers);
    ScopedJavaLocalRef<jobject> post_data;
    if (params.uses_post && params.post_data)
      post_data = params.post_data->ToJavaObject(env);
    Java_WebContentsDelegateAndroid_openNewTab(
        env, obj, java_url, extra_headers, post_data,
        static_cast<int>(disposition), params.is_renderer_initiated);
    return NULL;
  }

  // content::OpenURLParams -> content::NavigationController::LoadURLParams
  content::NavigationController::LoadURLParams load_params(url);
  load_params.referrer = params.referrer;
  load_params.frame_tree_node_id = params.frame_tree_node_id;
  load_params.redirect_chain = params.redirect_chain;
  load_params.transition_type = params.transition;
  load_params.extra_headers = params.extra_headers;
  load_params.should_replace_current_entry =
      params.should_replace_current_entry;
  load_params.is_renderer_initiated = params.is_renderer_initiated;

  if (params.uses_post) {
    load_params.load_type = content::NavigationController::LOAD_TYPE_HTTP_POST;
    load_params.post_data = params.post_data;
  }

  source->GetController().LoadURLWithParams(load_params);

  return source;
}

void WebContentsDelegateAndroid::NavigationStateChanged(
    WebContents* source, content::InvalidateTypes changed_flags) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_navigationStateChanged(env, obj,
                                                         changed_flags);
}

void WebContentsDelegateAndroid::VisibleSecurityStateChanged(
    WebContents* source) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_visibleSSLStateChanged(env, obj);
}

void WebContentsDelegateAndroid::ActivateContents(WebContents* contents) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_activateContents(env, obj);
}

void WebContentsDelegateAndroid::LoadingStateChanged(WebContents* source,
    bool to_different_document) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  Java_WebContentsDelegateAndroid_loadingStateChanged(env, obj,
                                                      to_different_document);
}

void WebContentsDelegateAndroid::LoadProgressChanged(WebContents* source,
                                                     double progress) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_notifyLoadProgressChanged(env, obj, progress);
}

void WebContentsDelegateAndroid::RendererUnresponsive(
    WebContents* source,
    const WebContentsUnresponsiveState& unresponsive_state) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_rendererUnresponsive(env, obj);
}

void WebContentsDelegateAndroid::RendererResponsive(WebContents* source) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_rendererResponsive(env, obj);
}

bool WebContentsDelegateAndroid::ShouldCreateWebContents(
    content::WebContents* web_contents,
    content::SiteInstance* source_site_instance,
    int32_t route_id,
    int32_t main_frame_route_id,
    int32_t main_frame_widget_route_id,
    WindowContainerType window_container_type,
    const GURL& opener_url,
    const std::string& frame_name,
    const GURL& target_url,
    const std::string& partition_id,
    content::SessionStorageNamespace* session_storage_namespace) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return true;
  ScopedJavaLocalRef<jstring> java_url =
      ConvertUTF8ToJavaString(env, target_url.spec());
  return Java_WebContentsDelegateAndroid_shouldCreateWebContents(env, obj,
                                                                 java_url);
}

bool WebContentsDelegateAndroid::OnGoToEntryOffset(int offset) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return true;
  return Java_WebContentsDelegateAndroid_onGoToEntryOffset(env, obj, offset);
}

void WebContentsDelegateAndroid::WebContentsCreated(
    WebContents* source_contents,
    int opener_render_process_id,
    int opener_render_frame_id,
    const std::string& frame_name,
    const GURL& target_url,
    WebContents* new_contents) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;

  ScopedJavaLocalRef<jobject> jsource_contents;
  if (source_contents)
    jsource_contents = source_contents->GetJavaWebContents();
  ScopedJavaLocalRef<jobject> jnew_contents;
  if (new_contents)
    jnew_contents = new_contents->GetJavaWebContents();

  Java_WebContentsDelegateAndroid_webContentsCreated(
      env, obj, jsource_contents, opener_render_process_id,
      opener_render_frame_id,
      base::android::ConvertUTF8ToJavaString(env, frame_name),
      base::android::ConvertUTF8ToJavaString(env, target_url.spec()),
      jnew_contents);
}

void WebContentsDelegateAndroid::CloseContents(WebContents* source) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_closeContents(env, obj);
}

void WebContentsDelegateAndroid::MoveContents(WebContents* source,
                                              const gfx::Rect& pos) {
  // Do nothing.
}

bool WebContentsDelegateAndroid::DidAddMessageToConsole(
    WebContents* source,
    int32_t level,
    const base::string16& message,
    int32_t line_no,
    const base::string16& source_id) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return WebContentsDelegate::DidAddMessageToConsole(source, level, message,
                                                       line_no, source_id);
  ScopedJavaLocalRef<jstring> jmessage(ConvertUTF16ToJavaString(env, message));
  ScopedJavaLocalRef<jstring> jsource_id(
      ConvertUTF16ToJavaString(env, source_id));
  int jlevel = WEB_CONTENTS_DELEGATE_LOG_LEVEL_DEBUG;
  switch (level) {
    case logging::LOG_VERBOSE:
      jlevel = WEB_CONTENTS_DELEGATE_LOG_LEVEL_DEBUG;
      break;
    case logging::LOG_INFO:
      jlevel = WEB_CONTENTS_DELEGATE_LOG_LEVEL_LOG;
      break;
    case logging::LOG_WARNING:
      jlevel = WEB_CONTENTS_DELEGATE_LOG_LEVEL_WARNING;
      break;
    case logging::LOG_ERROR:
      jlevel = WEB_CONTENTS_DELEGATE_LOG_LEVEL_ERROR;
      break;
    default:
      NOTREACHED();
  }
  return Java_WebContentsDelegateAndroid_addMessageToConsole(
      env, GetJavaDelegate(env), jlevel, jmessage, line_no, jsource_id);
}

// This is either called from TabContents::DidNavigateMainFramePostCommit() with
// an empty GURL or responding to RenderViewHost::OnMsgUpateTargetURL(). In
// Chrome, the latter is not always called, especially not during history
// navigation. So we only handle the first case and pass the source TabContents'
// url to Java to update the UI.
void WebContentsDelegateAndroid::UpdateTargetURL(WebContents* source,
                                                 const GURL& url) {
  if (!url.is_empty())
    return;
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  ScopedJavaLocalRef<jstring> java_url =
      ConvertUTF8ToJavaString(env, source->GetURL().spec());
  Java_WebContentsDelegateAndroid_onUpdateUrl(env, obj, java_url);
}

void WebContentsDelegateAndroid::HandleKeyboardEvent(
    WebContents* source,
    const content::NativeWebKeyboardEvent& event) {
  jobject key_event = event.os_event;
  if (key_event) {
    JNIEnv* env = AttachCurrentThread();
    ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
    if (obj.is_null())
      return;
    Java_WebContentsDelegateAndroid_handleKeyboardEvent(env, obj, key_event);
  }
}

bool WebContentsDelegateAndroid::TakeFocus(WebContents* source, bool reverse) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return WebContentsDelegate::TakeFocus(source, reverse);
  return Java_WebContentsDelegateAndroid_takeFocus(env, obj, reverse);
}

void WebContentsDelegateAndroid::ShowRepostFormWarningDialog(
    WebContents* source) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj);
}

ScopedJavaLocalRef<jobject>
WebContentsDelegateAndroid::GetContentVideoViewEmbedder() {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return ScopedJavaLocalRef<jobject>();

  return Java_WebContentsDelegateAndroid_getContentVideoViewEmbedder(env, obj);
}

bool WebContentsDelegateAndroid::ShouldBlockMediaRequest(const GURL& url) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return false;
  ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec());
  return Java_WebContentsDelegateAndroid_shouldBlockMediaRequest(env, obj, j_url);
}

void WebContentsDelegateAndroid::EnterFullscreenModeForTab(
    WebContents* web_contents,
    const GURL& origin) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_toggleFullscreenModeForTab(env, obj, true);
}

void WebContentsDelegateAndroid::ExitFullscreenModeForTab(
    WebContents* web_contents) {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return;
  Java_WebContentsDelegateAndroid_toggleFullscreenModeForTab(env, obj, false);
}

bool WebContentsDelegateAndroid::IsFullscreenForTabOrPending(
    const WebContents* web_contents) const {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
  if (obj.is_null())
    return false;
  return Java_WebContentsDelegateAndroid_isFullscreenForTabOrPending(env, obj);
}

void WebContentsDelegateAndroid::ShowValidationMessage(
    WebContents* web_contents,
    const gfx::Rect& anchor_in_root_view,
    const base::string16& main_text,
    const base::string16& sub_text) {
  RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView();
  if (rwhv) {
    validation_message_bubble_.reset(
        new ValidationMessageBubbleAndroid(rwhv->GetRenderWidgetHost(),
                                           anchor_in_root_view,
                                           main_text,
                                           sub_text));
  }
}

void WebContentsDelegateAndroid::HideValidationMessage(
    WebContents* web_contents) {
  validation_message_bubble_.reset();
}

void WebContentsDelegateAndroid::MoveValidationMessage(
    WebContents* web_contents,
    const gfx::Rect& anchor_in_root_view) {
  if (!validation_message_bubble_)
    return;
  RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView();
  if (rwhv) {
    validation_message_bubble_->SetPositionRelativeToAnchor(
        rwhv->GetRenderWidgetHost(), anchor_in_root_view);
  }
}

void WebContentsDelegateAndroid::RequestAppBannerFromDevTools(
    content::WebContents* web_contents) {
}

}  // namespace web_contents_delegate_android


text:
#ifndef ALITOFCALPADZ_H
#define ALITOFCALPADZ_H

//////////////////////////////////////////////////////////////////
//              class for TOF calibration:: PadZ                //
//////////////////////////////////////////////////////////////////

//_____________________________________________________________

#include "TObject.h"

class TBrowser;
class AliTOFGeometry;
class AliTOFChannel;

class AliTOFCalPadZ: public TObject
{
 public:
  AliTOFCalPadZ();
  AliTOFCalPadZ(AliTOFChannel *ch);
  AliTOFCalPadZ(AliTOFGeometry *geom);
  AliTOFCalPadZ(AliTOFGeometry *geom,AliTOFChannel *ch);
  AliTOFCalPadZ(const AliTOFCalPadZ &source); // copy constructor
  AliTOFCalPadZ& operator=(const AliTOFCalPadZ &source); // ass. op.
  virtual ~AliTOFCalPadZ();
  Int_t NpadX()const {return fNpadX;}
  void Browse(TBrowser *b);
  Bool_t IsFolder() const{return kTRUE;}
private:
  Int_t fNpadX;    // number of TOF pads X

  AliTOFGeometry *fGeom;    // AliTOFgeometry pointer
  AliTOFChannel *fCh; //array of AliTOFChannel storing calib parameters
  ClassDef(AliTOFCalPadZ,1)
};

#endif //AliTOFPadZ


text:
package ee.cone.c4ui.dep

import ee.cone.c4actor.dep.request.ContextIdRequestProtocol
import ee.cone.c4actor.dep._
import ee.cone.c4actor.dep_impl.AskByPKsApp
import ee.cone.c4actor._
import ee.cone.c4gate.SessionDataProtocol.U_RawSessionData
import ee.cone.c4gate.deep_session.DeepSessionDataProtocol.{U_RawRoleData, U_RawUserData}
import ee.cone.c4proto.Protocol

trait SessionAttrAskUtility {
  def sessionAttrAskFactory: SessionAttrAskFactoryApi
}

trait CurrentTimeAskUtility {
  def currentTimeAskFactory: CurrentTimeAskFactoryApi
}

trait SessionAttrAskMix extends SessionAttrAskUtility with CommonRequestUtilityApi with AskByPKsApp with AskByPKFactoryApp with ProtocolsApp with DepFactoryApp{

  override def protocols: List[Protocol] = ContextIdRequestProtocol :: super.protocols

  def qAdapterRegistry: QAdapterRegistry

  def defaultModelRegistry: DefaultModelRegistry

  def modelAccessFactory: ModelAccessFactory

  def idGenUtil: IdGenUtil

  private lazy val rawDataAsk: AskByPK[U_RawSessionData] = askByPKFactory.forClass(classOf[U_RawSessionData])
  private lazy val userDataAsk: AskByPK[U_RawUserData] = askByPKFactory.forClass(classOf[U_RawUserData])
  private lazy val roleDataAsk: AskByPK[U_RawRoleData] = askByPKFactory.forClass(classOf[U_RawRoleData])

  override def askByPKs: List[AbstractAskByPK] = rawDataAsk :: userDataAsk :: roleDataAsk :: super.askByPKs

  def sessionAttrAskFactory: SessionAttrAskFactoryApi = SessionAttrAskFactoryImpl(qAdapterRegistry, defaultModelRegistry, modelAccessFactory, commonRequestUtilityFactory, rawDataAsk, userDataAsk, roleDataAsk, idGenUtil, depFactory)
}

trait CurrentTimeAskMix extends CurrentTimeAskUtility {
  def currentTimeAskFactory: CurrentTimeAskFactoryApi = CurrentTimeAskFactoryImpl
}


text:
const { expect }           = require('chai');
const Promise              = require('pinkie');
const browserStackProvider = require('../../');

describe('Browser names', function () {
    before(function () {
        this.timeout(20000);

        return browserStackProvider
            .init();
    });

    after(function () {
        return browserStackProvider
            .dispose();
    });

    it('Should return list of common browsers and devices', function () {
        const IS_AUTOMATE = process.env['BROWSERSTACK_USE_AUTOMATE'] && process.env['BROWSERSTACK_USE_AUTOMATE'] !== '0';

        const REST_BROWSER_NAMES = [
            'chrome@51.0:OS X Mavericks',
            'firefox@45.0:OS X Yosemite',
            'safari@9.1:OS X El Capitan',
            'ie@9.0:Windows 7',
            'ie@10.0:Windows 8',
            'ie@11.0:Windows 8.1',
            'edge@15.0:Windows 10',
            'iPhone SE@11',
            'iPhone XR@12',
            'Google Nexus 6@6.0'
        ];

        const AUTOMATE_BROWSER_NAMES = [
            'chrome@51.0:OS X Mavericks',
            'firefox@45.0:OS X Yosemite',
            'safari@9.1:OS X El Capitan',
            'ie@9.0:Windows 7',
            'ie@10.0:Windows 8',
            'ie@11.0:Windows 8.1',
            'edge@15.0:Windows 10',
            'iPhone 7@10',
            'iPhone SE@11',
            'iPhone XR@12',
            'Google Nexus 6@6.0'
        ];

        return browserStackProvider
            .getBrowserList()
            .then(function (list) {
                expect(list).to.include.members(IS_AUTOMATE ? AUTOMATE_BROWSER_NAMES : REST_BROWSER_NAMES);
            });
    });

    it('Should validate browser names', function () {
        var browserNameResults = {
            'chrome':             true,
            'safari':             true,
            'opera:windows':      true,
            'firefox:os x':       true,
            'edge':               true,
            'ie@9.0:Windows 7':   true,
            'ie@10.0:Windows 8':  true,
            'ie@11.0:Windows 10': true,
            'iPhone SE':          true,
            'Google Nexus 5':     true,
            'ie@5.0':             false,
            'ie@11:os x':         false
        };

        const browserNames = Object.keys(browserNameResults);

        var validationPromises = browserNames
            .map(function (browserName) {
                return browserStackProvider.isValidBrowserName(browserName);
            });

        return Promise
            .all(validationPromises)
            .then(function (results) {
                const expectedResults = Object.values(browserNameResults);

                for (let i = 0; i < results.length; i++)
                    expect(results[i]).eql(expectedResults[i], 'invalid result for ' + browserNames[i]);
            });
    });

    it("Should not return the 'beta' browser version if the version is not specified", () => {
        const capability = browserStackProvider._generateBasicCapabilities('chrome');

        expect(capability['browser_version']).to.not.include('beta');
    });
});


text:
@interface UIColor (Project)

#pragma mark - bar

+ (UIColor *)navigationBarTitleTextColor;

+ (UIColor *)navigationBarBackgroundColor;

+ (UIColor *)tabBarTitleTextColor;

+ (UIColor *)tabBarBackgroundColor;

#pragma mark - text

+ (UIColor *)labelSubtitleTextColor;

+ (UIColor *)labelTitleTextColor;

+ (UIColor *)textFieldTextColor;

+ (UIColor *)textFieldPlaceholderTextColor;

+ (UIColor *)textViewTextColor;

+ (UIColor *)textViewPlaceholderTextColor;

#pragma mark - button

+ (UIColor *)buttonTitleTextColor;

+ (UIColor *)buttonNormalBackgroundColor;

+ (UIColor *)buttonHighlightBackgroundColor;

+ (UIColor *)buttonSelectedBackgroundColor;

#pragma mark - other

+ (UIColor *)viewBackgroundColor;

+ (UIColor *)badgeBackgroundColor;

@end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Hoodie</title>
    <link rel="stylesheet" type="text/css" href="style.css">

Well done, you made it!

Hoodie is now running a local server.

You are seeing this because your app has no public/ folder.

But don't worry, we're here to get you started!

Get going with Hoodie

 Your first step should be creating a public folder inside your project folder.

Next up, just create your index.html inside that public directory.

We're almost here: Paste this into your index.html just before your closing tag for the body:  <script src="hoodie/client.js"></script>

        This is necessary for your own javascript files to pick up the hoodie methods.
        Now handle it just like you would handle your frontend project, hoodie won't get in your way.

 Setup your asset folders and create your .css and .js files.

 You'll need to restart the Hoodie server so it servers assets from your app's public folder

If you want to learn more, check out the  documentation (work-in-progress).

Happy coding! 🐶


text:
/**
 * @fileoverview Helper class for testing the password UI element.
 */

goog.provide('firebaseui.auth.ui.element.PasswordTestHelper');
goog.setTestOnly('firebaseui.auth.ui.element.PasswordTestHelper');

goog.require('firebaseui.auth.soy2.strings');
goog.require('firebaseui.auth.ui.element');
goog.require('firebaseui.auth.ui.element.ElementTestHelper');
goog.require('goog.dom');
goog.require('goog.dom.forms');
goog.require('goog.events.KeyCodes');

goog.scope(function() {
var element = firebaseui.auth.ui.element;

/** @constructor */
element.PasswordTestHelper = function() {
  element.PasswordTestHelper.base(this, 'constructor', 'Password');
};
goog.inherits(element.PasswordTestHelper, element.ElementTestHelper);

/** @override */
element.PasswordTestHelper.prototype.resetState = function() {
  element.setValid(this.component.getPasswordElement(), true);
  goog.dom.forms.setValue(this.component.getPasswordElement(), '');
  element.hide(this.component.getPasswordErrorElement());
};

/** @private */
element.PasswordTestHelper.prototype.testGetPasswordElement_ = function() {
  assertNotNull(this.component.getPasswordElement());
};

/** @private */
element.PasswordTestHelper.prototype.testGetPasswordErrorElement_ = function() {
  var e = this.component.getPasswordErrorElement();
  assertNotNull(e);
  assertFalse(element.isShown(e));
};

/** @private */
element.PasswordTestHelper.prototype.testCheckAndGetPasswordEmpty_ =
    function() {
  assertNull(this.component.checkAndGetPassword());
  this.checkInputInvalid(this.component.getPasswordElement());
  this.checkErrorShown(
      this.component.getPasswordErrorElement(),
      firebaseui.auth.soy2.strings.errorMissingPassword().toString());
};

/** @private */
element.PasswordTestHelper.prototype.testCheckAndGetPassword_ = function() {
  goog.dom.forms.setValue(this.component.getPasswordElement(), 'Password');
  assertEquals('Password', this.component.checkAndGetPassword());
  this.checkInputValid(this.component.getPasswordElement());
  this.checkErrorHidden(this.component.getPasswordErrorElement());
};

/** @private */
element.PasswordTestHelper.prototype.testOnPasswordChange_ = function() {
  var error = this.component.getPasswordErrorElement();
  var password = this.component.getPasswordElement();

  // Empty password, show error.
  assertNull(this.component.checkAndGetPassword());
  this.checkInputInvalid(this.component.getPasswordElement());
  this.checkErrorShown(
      this.component.getPasswordErrorElement(),
      firebaseui.auth.soy2.strings.errorMissingPassword().toString());

  // Emulate that a 'P' is typed in.
  goog.dom.forms.setValue(password, 'P');
  this.fireInputEvent(password, goog.events.KeyCodes.P);
  this.checkInputValid(this.component.getPasswordElement());
  this.checkErrorHidden(this.component.getPasswordErrorElement());

  // Emulate that the 'P' is deleted so the password is empty again.
  // There should not be error shown since we don't set error message when
  // password changes.
  goog.dom.forms.setValue(password, '');
  this.fireInputEvent(password, goog.events.KeyCodes.P);
  this.checkInputValid(this.component.getPasswordElement());
  this.checkErrorHidden(this.component.getPasswordErrorElement());
};
});


text:
#include <aws/inspector2/model/Counts.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace Inspector2
{
namespace Model
{

Counts::Counts() :
    m_count(0),
    m_countHasBeenSet(false),
    m_groupKey(GroupKey::NOT_SET),
    m_groupKeyHasBeenSet(false)
{
}

Counts::Counts(JsonView jsonValue) :
    m_count(0),
    m_countHasBeenSet(false),
    m_groupKey(GroupKey::NOT_SET),
    m_groupKeyHasBeenSet(false)
{
  *this = jsonValue;
}

Counts& Counts::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("count"))
  {
    m_count = jsonValue.GetInt64("count");

    m_countHasBeenSet = true;
  }

  if(jsonValue.ValueExists("groupKey"))
  {
    m_groupKey = GroupKeyMapper::GetGroupKeyForName(jsonValue.GetString("groupKey"));

    m_groupKeyHasBeenSet = true;
  }

  return *this;
}

JsonValue Counts::Jsonize() const
{
  JsonValue payload;

  if(m_countHasBeenSet)
  {
   payload.WithInt64("count", m_count);

  }

  if(m_groupKeyHasBeenSet)
  {
   payload.WithString("groupKey", GroupKeyMapper::GetNameForGroupKey(m_groupKey));
  }

  return payload;
}

} // namespace Model
} // namespace Inspector2
} // namespace Aws


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.unibi.cebitec.bibiserv</groupId>
    <artifactId>BiBiGrid</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>

    <modules>
        <module>bibigrid-core</module>
        <module>bibigrid-gui</module>
    </modules>

    <properties>
        <java.version>1.8</java.version>
    </properties>
</project>


text:
"""
Views which allow users to create and activate accounts.

"""

from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.db.models import get_model

from registration.forms import RegistrationForm
from registration.models import RegistrationProfile

try:
    RFC = settings.REGISTRATION_FORM_CLASS.split('.')
    _temp = __import__(".".join(RFC[:-1]), globals(), locals(), [RFC[-1]], -1)
    registration_form_class = getattr(_temp, RFC[-1])
    del RFC, _temp
except AttributeError:
    from registration.forms import RegistrationForm as registration_form_class

def activate(request, activation_key,
             template_name='registration/activate.html',
             extra_context=None):
    """
    Activate a ``user_model``'s account from an activation key, if their key
    is valid and hasn't expired.

    By default, use the template ``registration/activate.html``; to
    change this, pass the name of a template as the keyword argument
    ``template_name``.

    **Required arguments**

    ``activation_key``
       The activation key to validate and use for activating the
       ``user_model``.

    **Optional arguments**

    ``extra_context``
        A dictionary of variables to add to the template context. Any
        callable object in this dictionary will be called to produce
        the end result which appears in the context.

    ``template_name``
        A custom template to use.

    **Context:**

    ``account``
        The ``User`` object corresponding to the account, if the
        activation was successful. ``False`` if the activation was not
        successful.

    ``expiration_days``
        The number of days for which activation keys stay valid after
        registration.

    Any extra variables supplied in the ``extra_context`` argument
    (see above).

    **Template:**

    registration/activate.html or ``template_name`` keyword argument.

    """
    activation_key = activation_key.lower() # Normalize before trying anything with it.
    account = RegistrationProfile.objects.activate_user(activation_key)
    if extra_context is None:
        extra_context = {}
    context = RequestContext(request)
    for key, value in extra_context.items():
        context[key] = callable(value) and value() or value
    return render_to_response(template_name,
                              { 'account': account,
                                'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS },
                              context_instance=context)

def register(request, success_url=None,
             form_class=registration_form_class,
             template_name='registration/registration_form.html',
             extra_context=None):
    """
    Allow a new user to register an account.

    Following successful registration, issue a redirect; by default,
    this will be whatever URL corresponds to the named URL pattern
    ``registration_complete``, which will be
    ``/accounts/register/complete/`` if using the included URLConf. To
    change this, point that named pattern at another URL, or pass your
    preferred URL as the keyword argument ``success_url``.

    By default, the form given by the ``REGISTRATION_FORM_CLASS``
    setting will be used as the registration form, with
    ``registration.forms.RegistrationForm` used if this is not defined.
    as the registration form; to change this, pass a different form
    class as the ``form_class`` keyword argument. The form class you
    specify must have a method ``save`` which will create and return
    the new ``user_model``.

    By default, use the template
    ``registration/registration_form.html``; to change this, pass the
    name of a template as the keyword argument ``template_name``.

    **Required arguments**

    None.

    **Optional arguments**

    ``form_class``
        The form class to use for registration.

    ``extra_context``
        A dictionary of variables to add to the template context. Any
        callable object in this dictionary will be called to produce
        the end result which appears in the context.

    ``success_url``
        The URL to redirect to on successful registration.

    ``template_name``
        A custom template to use.

    **Context:**

    ``form``
        The registration form.

    Any extra variables supplied in the ``extra_context`` argument
    (see above).

    **Template:**

    registration/registration_form.html or ``template_name`` keyword
    argument.

    """
    if request.method == 'POST':
        form = form_class(data=request.POST, files=request.FILES)
        if form.is_valid():
            new_user = form.save()
            # success_url needs to be dynamically generated here; setting a
            # a default value using reverse() will cause circular-import
            # problems with the default URLConf for this application, which
            # imports this file.
            return HttpResponseRedirect(success_url or reverse('registration_complete'))
    else:
        form = form_class()

    if extra_context is None:
        extra_context = {}
    context = RequestContext(request)
    for key, value in extra_context.items():
        context[key] = callable(value) and value() or value
    return render_to_response(template_name,
                              { 'form': form },
                              context_instance=context)


text:
/**
 *
 * Support package for declarative transaction configuration,
 * with XML schema being the primary configuration format.
 *
 */
package org.springframework.transaction.config;