text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Pattern fills - samples.</title>

    <link rel="stylesheet" href="patterns.css">

Pattern Fills

        Github:
          http://github.com/iros/patternfills

        Website:
          http://iros.github.io/patternfills

      There are many ways to fill the background of a DOM or SVG element, including using solid colors or gradients. If you want to use a repeating pattern of some kind, the easiest way to do so is to create an SVG document that defines it and use it as a pattern fill. SVG images are typically smaller than bitmap images and remain sharp on high-dpi screens. Unlike CSS3 gradients, SVG images are supported on IE9. (source: http://philbit.com/svgpatterns/#whysvg)

      We are going to be using svg patterns in three ways. Click the following links to see the patterns available and how to use them:

CSS Classnames

SVG URL Fills

Using d3 (which is effectively svg fills)

      See an example using pattern fills:

Old Timey Chart with d3.js

How do SVG Patterns Work?

First an svg pattern needs to be defined. For example
      this pattern generates small circles, each of radius 1px and
      positions them at coordinates 1,1 like so:

      <svg style="padding:10px;" height="100" width="100" class="pattern-swatch">
        <rect style="fill: url(#circles-1) #fff;" x="0" y="0" height="100" width="100">
      </rect></svg>

      This pattern then needs to be compiled. There are two ways generate a compiled version:

1. SVG Pattern Definition:

    To define a pattern that can then be used in svg, one must add it to the defs section of an svg container. Note that the SVG pattern we defined above gets translated into a string.

      This allows us to use the pattern like so:

2. CSS Background Image Url

    To define a pattern that can be used with a classname, one must define a classname where the pattern string is used as the `background-image` url. For example:

      This allows us to use the pattern like so:

What does this library do:

      Patternfills offers several premade patterns that can be used already.
      You can see them in class name form in public/patterns.css.

      For the SVG form of the patterns, you should look at public/sample_svg.html to view the actual compiled pattern svg definitions.

Can I customize the colors?

      Yes! Now you can. For example, all of these patterns were created with
      this library:

Can I use these programatically?

      Yep! If you'd like to use Pattern Fills in your application. You can install patternfills via npm like so:

npm install patternfills

      It comes with an executable that will allow you to produce the CSS classes or the SVG classes and save them to an appropriate file. This might come in handy when you want to integrate patternfills into
      your build process.

          To produce either the css or svg you can run:

          ./bin/patternfills --format=svg|css

          You can provide an alternate source pattern directory. This is
          optional.

          ./bin/patternfills --format=svg|css --source=your/patterns

          You'll want to follow a similar folder organization scheme to ours, so
          be sure to look at src/patterns.

          You can provide a destination file path. Otherwise your output will be piped to stdout.

          ./bin/patternfills --format=svg|css --dest=your/path

How do I add patterns?

      You can see the development instructions in the readme here:
      https://github.com/iros/patternfills/blob/master/README.md#modifyingadding-patterns

Questions?

      Please get in touch via github issues if you have any questions/requests of this project or contact me (@ireneros) via email at irene at bocoup.com.

  <svg height="10" width="10" xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <pattern id="circles-1" patternUnits="userSpaceOnUse" width="10" height="10"> <image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxMCcgaGVpZ2h0PScxMCc+CiAgPHJlY3Qgd2lkdGg9JzEwJyBoZWlnaHQ9JzEwJyBmaWxsPScjZmZmJyAvPgogIDxjaXJjbGUgY3g9IjEiIGN5PSIxIiByPSIxIiBmaWxsPSIjMDAwIi8+Cjwvc3ZnPg==" x="0" y="0" width="10" height="10"> </image> </pattern> </defs> </svg>

       Made with ♥ at Bocoup DataVis by Irene Ros.


text:
package edu.psu.compbio.seqcode.gse.clustering.vectorcluster;

import edu.psu.compbio.seqcode.gse.clustering.PairwiseElementMetric;

public class EuclideanDistance<X extends VectorClusterElement> implements PairwiseElementMetric<X> {
    public EuclideanDistance() {}
    public double evaluate(X e1, X e2) {
        if(e1.dimension() != e2.dimension()) { throw new IllegalArgumentException(); }
        double value = 0.0;

        for(int i = 0; i < e1.dimension(); i++) {
            double s = 0.0;
            if(!e1.isMissingValue(i) && !e2.isMissingValue(i)) {
                s = (e1.getValue(i) - e2.getValue(i));
            }
            value += (s * s);
        }

        value = Math.sqrt(value);
        return value;
    }

}

redpajama_set_name: RedPajamaGithub


text:
package com.google.exposurenotification.privateanalytics.ingestion.pipeline;

import com.google.exposurenotification.privateanalytics.ingestion.model.DataShare;
import java.time.Clock;
import java.util.HashMap;
import java.util.Map;
import org.apache.beam.sdk.metrics.Counter;
import org.apache.beam.sdk.metrics.Metrics;
import org.apache.beam.sdk.transforms.DoFn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** A DoFn that filters data shares in a particular time window */
public class DateFilterFn extends DoFn<DataShare, DataShare> {

  private static final Logger LOG = LoggerFactory.getLogger(DateFilterFn.class);

  private final Map<String, Counter> dateFilterIncluded = new HashMap<>();
  private final Map<String, Counter> dateFilterExcluded = new HashMap<>();

  @ProcessElement
  public void processElement(ProcessContext c) {
    String metricName = c.element().getDataShareMetadata().getMetricName();
    if (!dateFilterIncluded.containsKey(metricName)) {
      dateFilterIncluded.put(
          metricName, Metrics.counter(DateFilterFn.class, "dateFilterIncluded_" + metricName));
      dateFilterExcluded.put(
          metricName, Metrics.counter(DateFilterFn.class, "dateFilterExcluded_" + metricName));
    }

    if (c.element().getCreatedMs() == null || c.element().getCreatedMs() == 0) {
      LOG.warn("Skipping document with no creation timestamp: {}", c.element().getPath());
      return;
    }
    IngestionPipelineOptions options = c.getPipelineOptions().as(IngestionPipelineOptions.class);

    long startTime =
        IngestionPipelineOptions.calculatePipelineStart(
            options.getStartTime(), options.getDuration(), 1, Clock.systemUTC());
    long duration = options.getDuration();

    if (c.element().getCreatedMs() >= startTime * 1000
        && c.element().getCreatedMs() < (startTime + duration) * 1000) {
      LOG.debug("Included: {}", c.element());
      dateFilterIncluded.get(metricName).inc();
      c.output(c.element());
    } else {
      LOG.trace("Excluded: {}", c.element());
      dateFilterExcluded.get(metricName).inc();
    }
  }
}


text:
import { Directionality } from '@angular/cdk/bidi';
import { Platform } from '@angular/cdk/platform';
import { ViewportRuler } from '@angular/cdk/scrolling';
import {
  CDK_TABLE_TEMPLATE,
  CdkTable,
} from '@angular/cdk/table';
import { DOCUMENT } from '@angular/common';
import {
  AfterContentChecked,
  AfterContentInit,
  AfterViewChecked,
  Attribute,
  ChangeDetectionStrategy,
  ChangeDetectorRef,
  Component,
  ContentChildren,
  ElementRef,
  EventEmitter,
  Inject,
  Input,
  IterableDiffers,
  NgZone,
  OnDestroy,
  OnInit,
  Optional,
  Output,
  QueryList,
  Renderer2,
  ViewEncapsulation,
} from '@angular/core';
import { TsWindowService } from '@terminus/ngx-tools/browser';
import {
  debounce,
  untilComponentDestroyed,
} from '@terminus/ngx-tools/utilities';
import {
  defer,
  merge,
  Observable,
  Subscription,
} from 'rxjs';
import {
  pluck,
  switchMap,
  take,
} from 'rxjs/operators';

import {
  TsHeaderCellDirective,
  TsHeaderCellResizeEvent,
} from './cell';
import { TsRowComponent } from './row';

/**
 * The definition for a single column
 */
export interface TsColumn {
  // The column name
  name: string;
  // The desired pixel width as an integer (eg '200')
  width: number;
  // Allow any other data properties the consumer may need
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  [key: string]: any;
}

/**
 * The possible table density settings
 */
export type TsTableDensity
  = 'comfy'
  | 'compact'
;

/**
 * The default debounce delay for column sizing update calls
 */
const COLUMN_DEBOUNCE_DELAY = 100;
const VIEWPORT_DEBOUNCE = 500;

/**
 * The payload for a columns change event
 */
export class TsTableColumnsChangeEvent {
  constructor(
    // The table instance that originated the event
    public table: TsTableComponent,
    // The updated array of columns
    public columns: TsColumn[],
  ) {}
}

// Unique ID for each instance
let nextUniqueId = 0;

/**
 * The primary data table implementation
 *
 * @example
 *  <ts-table
 *               [columns]="myColumns"
 *               [dataSource]="dataSource"
 *               [multiTemplateDataRows]="false"
 *               [trackBy]="myTrackByFn"
 *               (columnsChange)="columnsWereUpdated($event)
 *               #myTable="tsTable"
 *  >
 *               <ng-container tsColumnDef="title">
 *                 <ts-header-cell *tsHeaderCellDef>
 *                   Title
 *                 </ts-header-cell>
 *                 <ts-cell *tsCellDef="let item">
 *                   {{ item.title }}
 *                 </ts-cell>
 *               </ng-container>
 *
 *               <ng-container tsColumnDef="id">
 *                 <ts-header-cell *tsHeaderCellDef>
 *                   ID
 *                 </ts-header-cell>
 *                 <ts-cell *tsCellDef="let item">
 *                   {{ item.id }},
 *                 </ts-cell>
 *               </ng-container>
 *
 *               <ts-header-row *tsHeaderRowDef="myTable.columnNames"></ts-header-row>
 *               <ts-row *tsRowDef="let row; columns: myTable.columnNames;"></ts-row>
 *  </ts-table>
 *
 * <example-url>https://getterminus.github.io/ui-demos-release/components/table</example-url>
 */
@Component({
  selector: 'ts-table, table[ts-table]',
  template: CDK_TABLE_TEMPLATE,
  styleUrls: ['./table.component.scss'],
  host: {
    'class': 'ts-table',
    '[class.ts-table--comfy]': 'density === "comfy"',
    '[class.ts-table--compact]': 'density === "compact"',
    '[id]': 'id',
  },
  providers: [{
    provide: CdkTable,
    useExisting: TsTableComponent,
  }],
  encapsulation: ViewEncapsulation.None,
  changeDetection: ChangeDetectionStrategy.OnPush,
  exportAs: 'tsTable',
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export class TsTableComponent<T = any> extends CdkTable<T> implements
  OnInit,
  AfterViewChecked,
  AfterContentInit,
  AfterContentChecked,
  OnDestroy {
  /**
   * Combined stream of all of the columns resized events
   */
  public readonly columnResizeChanges$: Observable<TsHeaderCellDirective> = defer(() => {
    if (this.headerCells && this.headerCells.length) {
      // TODO: Refactor deprecation
      // eslint-disable-next-line deprecation/deprecation
      return merge<TsHeaderCellResizeEvent>(...this.headerCells.map(cell => cell.resized)).pipe(
        pluck('instance'),
        untilComponentDestroyed(this),
      );
    }

    // If there are any subscribers before `ngAfterViewInit`, the `autocomplete` will be undefined.
    // In that case, return a stream that we'll replace with the real one once everything is in place.
    return this.ngZone.onStable
      .asObservable()
      // TODO: Refactor deprecation
      // eslint-disable-next-line deprecation/deprecation
      .pipe(take(1), switchMap(() => this.columnResizeChanges$));
  });

  /**
   * Create a debounced function to update CDK sticky styles
   */
  public debouncedStickyColumnUpdate = debounce(this.updateStickyColumnStyles, COLUMN_DEBOUNCE_DELAY);

  /**
   * Store the header cell subscription
   */
  private headerCellSubscription!: Subscription;

  /**
   * Store a mutable array of internal column definitions
   */
  private columnsInternal: TsColumn[] = [];

  /**
   * Override the sticky CSS class set by the `CdkTable`
   */
  protected stickyCssClass = 'ts-table--sticky';

  /**
   * Store the stream of viewport changes
   */
  private viewportChange$!: Observable<Event>;

  /**
   * Define the default component ID
   */
  public readonly uid = `ts-table-${nextUniqueId++}`;

  /**
   * Return a simple array of column names
   *
   * Used by {@link TsHeaderRowDefDirective} and {@link TsRowDefDirective}.
   */
  public get columnNames(): string[] {
    return this.columns.map(c => c.name);
  }

  /**
   * Build array of columns to emit out to the consumer
   */
  public get columnsToSendToConsumer(): TsColumn[] {
    const internalColumns = this.getFreshColumnsCopy(this.columnsInternal);
    const userColumns = this.getFreshColumnsCopy();
    const lastIndex = internalColumns.length - 1;
    // Reset the last column width to the consumer defined width
    internalColumns[lastIndex].width = userColumns[lastIndex].width;
    return internalColumns;
  }

  /**
   * Return the width of the element wrapping the table
   */
  public get containerWidth(): number {
    return this.parentElement.offsetWidth;
  }

  /**
   * Determine if the container around the table has overflow (ie the table is scrollable)
   */
  public get hasOverflowX(): boolean {
    return this.parentElement.scrollWidth > this.tableWidth;
  }

  /**
   * Return the parent HTMLElement
   */
  private get parentElement(): HTMLElement {
    return (this.elementRef.nativeElement as HTMLElement).parentNode as HTMLElement;
  }

  /**
   * Determine the remaining space in the table after the columns take up their needed width
   */
  private get remainingTableSpace(): number {
    // NOTE: The outer borders take up 2px so we subtract them here to avoid a 2px overflow.
    const borderOffset = 2;
    const remainingWidth = (this.containerWidth - this.totalWidthOfColumns) - borderOffset;
    return (remainingWidth > 0) ? remainingWidth : 0;
  }

  /**
   * Return the width of the table
   */
  private get tableWidth(): number {
    return this.elementRef.nativeElement.offsetWidth;
  }

  /**
   * Return the total width of all visible columns
   */
  private get totalWidthOfColumns(): number {
    const currentWidths = this.headerCells.map(hc => hc.cellWidth);
    const userWidths = this.columns.map(v => v.width);
    const columnsToReduce = currentWidths.slice();
    // NOTE: Since the last column is never resized by the user, we should use the original size for the last column and the current
    // size for all other columns.
    const lastIndex = userWidths.length - 1;
    columnsToReduce[lastIndex] = this.columns[lastIndex].width;
    return columnsToReduce.reduce((a, b) => a + b, 0);
  }

  /**
   * Access header cells
   */
  @ContentChildren(TsHeaderCellDirective, { descendants: true })
  public headerCells!: QueryList<TsHeaderCellDirective>;

  /**
   * Access child rows
   */
  @ContentChildren(TsRowComponent)
  public rows!: QueryList<TsRowComponent>;

  /**
   * Define the array of columns
   *
   * @param value
   */
  @Input()
  public set columns(value: ReadonlyArray<TsColumn>) {
    // istanbul ignore else
    if (value && (value.length > 0)) {
      this._columns = this.getFreshColumnsCopy(value);
      this.columnsInternal = this.getFreshColumnsCopy(value);
    }
  }
  public get columns(): ReadonlyArray<TsColumn> {
    return this._columns;
  }
  private _columns: TsColumn[] = [];

  /**
   * Define the density of the cells
   */
  @Input()
  public density: TsTableDensity = 'comfy';

  /**
   * Define a custom ID
   *
   * @param value
   */
  @Input()
  public set id(value: string) {
    this._id = value || this.uid;
  }
  public get id(): string {
    return this._id;
  }
  private _id: string = this.uid;

  /**
   * Emit when a column is resized
   *
   * NOTE: This output is not debounce or throttled and may be called repeatedly
   */
  @Output()
  public readonly columnsChange = new EventEmitter<TsTableColumnsChangeEvent>();

  constructor(
    protected platform: Platform,
    protected renderer: Renderer2,
    protected readonly differs: IterableDiffers,
    protected readonly changeDetectorRef: ChangeDetectorRef,
    @Attribute('role') role: string,
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    @Inject(DOCUMENT) public document: any,
    @Optional() protected readonly dir: Directionality,
    public readonly elementRef: ElementRef,
    private ngZone: NgZone,
    private windowService: TsWindowService,
    private viewportRuler: ViewportRuler,
  ) {
    super(differs, changeDetectorRef, elementRef, role, dir, document, platform);
  }

  /**
   * Subscribe to viewport changes
   */
  public ngOnInit(): void {
    super.ngOnInit();

    this.viewportChange$ = this.viewportRuler.change(VIEWPORT_DEBOUNCE).pipe(untilComponentDestroyed(this));
    this.viewportChange$.pipe(untilComponentDestroyed(this)).subscribe(() => {
      this.windowService.nativeWindow.requestAnimationFrame(() => {
        this.updateInternalColumns(this.getFreshColumnsCopy());
        this.columnsChange.emit(new TsTableColumnsChangeEvent(this, this.columnsToSendToConsumer));
      });
    });
  }

  /**
   * Set up header cell changes subscription
   */
  public ngAfterViewChecked(): void {
    this.subscribeToHeaderCellChanges();
  }

  /**
   * Subscribe to column resize events
   */
  public ngAfterContentInit(): void {
    this.columnResizeChanges$
      .subscribe(v => {
        this.updateLastColumnWidth();
        // Update the recorded width for the changed column
        const found = this.columnsInternal.find(column => column.name === v.columnDef.name);
        // istanbul ignore else
        if (found) {
          found.width = v.cellWidth;
        }
        this.columnsChange.emit(new TsTableColumnsChangeEvent(this, this.columnsToSendToConsumer));
      });
  }

  /**
   * NOTE: Must be present for `untilComponentDestroyed`
   */
  public ngOnDestroy(): void {
    this.headerCellSubscription.unsubscribe();
  }

  /**
   * Adjusts the last column of the array to fill any remaining space inside the table
   *
   * NOTE: Due to issues during testing, we have not made this function static.
   *
   * @param columns - The array of columns to adjust
   * @param remainingWidth - The remaining table width to be added to the last column
   * @returns The adjusted array of columns
   */
  private addRemainingSpaceToLastColumn(columns: TsColumn[], remainingWidth: number): TsColumn[] {
    const lastColumn = columns[columns.length - 1];
    lastColumn.width = lastColumn.width + remainingWidth;
    return columns;
  }

  /**
   * Return a fresh clone of the passed in array of columns
   *
   * @param columns - The array of columns to clone
   * @returns The array of fresh columns
   */
  private getFreshColumnsCopy(columns: ReadonlyArray<TsColumn> = this.columns): TsColumn[] {
    return columns.slice().map(c => ({ ...c }));
  }

  /**
   * Set the column widths for all columns passed in
   *
   * @param columns - The array of columns
   */
  private setAllColumnsToDefinedWidths(columns: TsColumn[]): void {
    for (const column of columns) {
      this.setColumnWidthStyle(column.name, column.width, false);
    }
    this.updateStickyCellsIfNeeded();
  }

  /**
   * Set the width for a specific column
   *
   * @param columnName - The name of the column that needs it's width updated
   * @param width - The width to set
   * @param updateStickCells - Whether the sticky cells should be updated
   */
  private setColumnWidthStyle(columnName: string, width: number, updateStickCells = true): void {
    // eslint-disable-next-line no-underscore-dangle
    const columnDirective = this.headerCells.find(cell => cell.columnDef._name === columnName);
    // istanbul ignore else
    if (columnDirective) {
      columnDirective.setColumnWidth(width);

      // istanbul ignore else
      if (updateStickCells) {
        this.updateStickyCellsIfNeeded();
      }
    }
  }

  /**
   * Set up subscription to header cell changes
   */
  private subscribeToHeaderCellChanges(): void {
    if (this.headerCellSubscription) {
      this.headerCellSubscription.unsubscribe();
    }

    this.headerCellSubscription = this.headerCells.changes
      .pipe(untilComponentDestroyed(this))
      .subscribe(() => {
        // 1. Set user widths
        this.setAllColumnsToDefinedWidths(this.getFreshColumnsCopy());
        // 2. Add space to last column as needed
        this.updateLastColumnWidth();
        // 3. Set all widths to internal columns
        this.setAllColumnsToDefinedWidths(this.getFreshColumnsCopy(this.columnsInternal));
        // 4. Alert the consumer
        this.columnsChange.emit(new TsTableColumnsChangeEvent(this, this.columnsToSendToConsumer));

        // Inject the header cell resize element in every cell except the last (last column is not resizable)
        this.headerCells.forEach((headerCellDirective, i) => {
          if (i !== this.headerCells.length - 1) {
            headerCellDirective.injectResizeElement();
          }
        });
      });
  }

  /**
   * Update the internal columns array and set widths
   *
   * @param columns - The array of columns to update
   */
  private updateInternalColumns(columns: TsColumn[]): void {
    // If there is space left over, add all remaining space to the last column
    if (!this.hasOverflowX) {
      columns = this.addRemainingSpaceToLastColumn(columns, this.remainingTableSpace);
    }
    this.columnsInternal = columns;
    this.setAllColumnsToDefinedWidths(this.columnsInternal);
  }

  /**
   * Update the last column's width and update the internal columns
   */
  private updateLastColumnWidth(): void {
    // 1. Determine last column width
    const columns = this.getFreshColumnsCopy();
    const lastIndex = columns.length - 1;
    const lastColumn = columns[lastIndex];
    let newWidth = lastColumn.width;
    if (!this.hasOverflowX) {
      newWidth = lastColumn.width + this.remainingTableSpace;
    }
    // 2. Set the width
    this.setColumnWidthStyle(lastColumn.name, newWidth);
    // 3. Update internal columns
    this.columnsInternal[lastIndex].width = newWidth;
  }

  /**
   * Trigger an update on sticky cells if they exist
   */
  private updateStickyCellsIfNeeded(): void {
    // NOTE: To lessen the thrashing, only call the sticky column updater if there are defined sticky columns
    const stickyCells = this.headerCells.toArray().filter(c => c.columnDef.sticky || c.columnDef.stickyEnd);
    // istanbul ignore else
    if (stickyCells.length) {
      this.debouncedStickyColumnUpdate();
    }
  }
}


text:
namespace extensions {

namespace {

////////////////////////////////////////////////////////////////////////////////
// SettingsApiBubbleDelegate

class SettingsApiBubbleDelegate
    : public ExtensionMessageBubbleController::Delegate {
 public:
  explicit SettingsApiBubbleDelegate(ExtensionService* service,
                                     Profile* profile,
                                     SettingsApiOverrideType type);
  virtual ~SettingsApiBubbleDelegate();

  // ExtensionMessageBubbleController::Delegate methods.
  virtual bool ShouldIncludeExtension(const std::string& extension_id) OVERRIDE;
  virtual void AcknowledgeExtension(
      const std::string& extension_id,
      ExtensionMessageBubbleController::BubbleAction user_action) OVERRIDE;
  virtual void PerformAction(const ExtensionIdList& list) OVERRIDE;
  virtual void OnClose() OVERRIDE;
  virtual base::string16 GetTitle() const OVERRIDE;
  virtual base::string16 GetMessageBody(
      bool anchored_to_browser_action) const OVERRIDE;
  virtual base::string16 GetOverflowText(
      const base::string16& overflow_count) const OVERRIDE;
  virtual base::string16 GetLearnMoreLabel() const OVERRIDE;
  virtual GURL GetLearnMoreUrl() const OVERRIDE;
  virtual base::string16 GetActionButtonLabel() const OVERRIDE;
  virtual base::string16 GetDismissButtonLabel() const OVERRIDE;
  virtual bool ShouldShowExtensionList() const OVERRIDE;
  virtual void LogExtensionCount(size_t count) OVERRIDE;
  virtual void LogAction(
      ExtensionMessageBubbleController::BubbleAction action) OVERRIDE;

 private:
  // Our extension service. Weak, not owned by us.
  ExtensionService* service_;

  // A weak pointer to the profile we are associated with. Not owned by us.
  Profile* profile_;

  // The type of settings override this bubble will report on. This can be, for
  // example, a bubble to notify the user that the search engine has been
  // changed by an extension (or homepage/startup pages/etc).
  SettingsApiOverrideType type_;

  // The ID of the extension we are showing the bubble for.
  std::string extension_id_;

  DISALLOW_COPY_AND_ASSIGN(SettingsApiBubbleDelegate);
};

SettingsApiBubbleDelegate::SettingsApiBubbleDelegate(
    ExtensionService* service,
    Profile* profile,
    SettingsApiOverrideType type)
    : service_(service), profile_(profile), type_(type) {}

SettingsApiBubbleDelegate::~SettingsApiBubbleDelegate() {}

bool SettingsApiBubbleDelegate::ShouldIncludeExtension(
    const std::string& extension_id) {
  ExtensionRegistry* registry = ExtensionRegistry::Get(profile_);
  const Extension* extension =
      registry->GetExtensionById(extension_id, ExtensionRegistry::ENABLED);
  if (!extension)
    return false;  // The extension provided is no longer enabled.

  ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
  if (prefs->HasSettingsApiBubbleBeenAcknowledged(extension_id))
    return false;

  const Extension* override = NULL;
  switch (type_) {
    case extensions::BUBBLE_TYPE_HOME_PAGE:
      override = extensions::GetExtensionOverridingHomepage(profile_);
      break;
    case extensions::BUBBLE_TYPE_STARTUP_PAGES:
      override = extensions::GetExtensionOverridingStartupPages(profile_);
      break;
    case extensions::BUBBLE_TYPE_SEARCH_ENGINE:
      override = extensions::GetExtensionOverridingSearchEngine(profile_);
      break;
  }

  if (!override || override->id() != extension->id())
    return false;

  extension_id_ = extension_id;
  return true;
}

void SettingsApiBubbleDelegate::AcknowledgeExtension(
    const std::string& extension_id,
    ExtensionMessageBubbleController::BubbleAction user_action) {
  if (user_action != ExtensionMessageBubbleController::ACTION_EXECUTE) {
    ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
    prefs->SetSettingsApiBubbleBeenAcknowledged(extension_id, true);
  }
}

void SettingsApiBubbleDelegate::PerformAction(const ExtensionIdList& list) {
  for (size_t i = 0; i < list.size(); ++i) {
    service_->DisableExtension(list[i], Extension::DISABLE_USER_ACTION);
  }
}

void SettingsApiBubbleDelegate::OnClose() {
  ExtensionToolbarModel* toolbar_model = ExtensionToolbarModel::Get(profile_);
  if (toolbar_model)
    toolbar_model->StopHighlighting();
}

base::string16 SettingsApiBubbleDelegate::GetTitle() const {
  switch (type_) {
    case BUBBLE_TYPE_HOME_PAGE:
      return l10n_util::GetStringUTF16(
          IDS_EXTENSIONS_SETTINGS_API_TITLE_HOME_PAGE_BUBBLE);
    case BUBBLE_TYPE_STARTUP_PAGES:
      return l10n_util::GetStringUTF16(
          IDS_EXTENSIONS_SETTINGS_API_TITLE_STARTUP_PAGES_BUBBLE);
    case BUBBLE_TYPE_SEARCH_ENGINE:
      return l10n_util::GetStringUTF16(
          IDS_EXTENSIONS_SETTINGS_API_TITLE_SEARCH_ENGINE_BUBBLE);
  }
  NOTREACHED();
  return base::string16();
}

base::string16 SettingsApiBubbleDelegate::GetMessageBody(
    bool anchored_to_browser_action) const {
  ExtensionRegistry* registry = ExtensionRegistry::Get(profile_);
  const Extension* extension =
      registry->GetExtensionById(extension_id_, ExtensionRegistry::ENABLED);
  const SettingsOverrides* settings =
      extension ? SettingsOverrides::Get(extension) : NULL;
  if (!extension || !settings) {
    NOTREACHED();
    return base::string16();
  }

  bool home_change = settings->homepage != NULL;
  bool startup_change = !settings->startup_pages.empty();
  bool search_change = settings->search_engine != NULL;

  base::string16 body;
  switch (type_) {
    case BUBBLE_TYPE_HOME_PAGE:
      body = l10n_util::GetStringUTF16(
          IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_HOME_PAGE);
      if (startup_change && search_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_AND_SEARCH);
      } else if (startup_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_PAGES);
      } else if (search_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_SEARCH_ENGINE);
      }
      break;
    case BUBBLE_TYPE_STARTUP_PAGES:
      body = l10n_util::GetStringUTF16(
          IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_START_PAGES);
      if (home_change && search_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_AND_SEARCH);
      } else if (home_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_PAGE);
      } else if (search_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_SEARCH_ENGINE);
      }
      break;
    case BUBBLE_TYPE_SEARCH_ENGINE:
      body = l10n_util::GetStringUTF16(
          IDS_EXTENSIONS_SETTINGS_API_FIRST_LINE_SEARCH_ENGINE);
      if (startup_change && home_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_AND_HOME);
      } else if (startup_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_START_PAGES);
      } else if (home_change) {
        body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_SECOND_LINE_HOME_PAGE);
      }
      break;
  }
  if (!body.empty())
    body += l10n_util::GetStringUTF16(
            IDS_EXTENSIONS_SETTINGS_API_THIRD_LINE_CONFIRMATION);
  return body;
}

base::string16 SettingsApiBubbleDelegate::GetOverflowText(
    const base::string16& overflow_count) const {
  // Does not have more than one extension in the list at a time.
  NOTREACHED();
  return base::string16();
}

base::string16 SettingsApiBubbleDelegate::GetLearnMoreLabel() const {
  return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}

GURL SettingsApiBubbleDelegate::GetLearnMoreUrl() const {
  return GURL(chrome::kExtensionControlledSettingLearnMoreURL);
}

base::string16 SettingsApiBubbleDelegate::GetActionButtonLabel() const {
  return l10n_util::GetStringUTF16(IDS_EXTENSION_CONTROLLED_RESTORE_SETTINGS);
}

base::string16 SettingsApiBubbleDelegate::GetDismissButtonLabel() const {
  return l10n_util::GetStringUTF16(IDS_EXTENSION_CONTROLLED_KEEP_CHANGES);
}

bool SettingsApiBubbleDelegate::ShouldShowExtensionList() const {
  return false;
}

void SettingsApiBubbleDelegate::LogExtensionCount(size_t count) {
}

void SettingsApiBubbleDelegate::LogAction(
    ExtensionMessageBubbleController::BubbleAction action) {
  switch (type_) {
    case BUBBLE_TYPE_HOME_PAGE:
      UMA_HISTOGRAM_ENUMERATION(
          "ExtensionOverrideBubble.SettingsApiUserSelectionHomePage",
          action,
          ExtensionMessageBubbleController::ACTION_BOUNDARY);
      break;
    case BUBBLE_TYPE_STARTUP_PAGES:
      UMA_HISTOGRAM_ENUMERATION(
          "ExtensionOverrideBubble.SettingsApiUserSelectionStartupPage",
          action,
          ExtensionMessageBubbleController::ACTION_BOUNDARY);
      break;
    case BUBBLE_TYPE_SEARCH_ENGINE:
      UMA_HISTOGRAM_ENUMERATION(
          "ExtensionOverrideBubble.SettingsApiUserSelectionSearchEngine",
          action,
          ExtensionMessageBubbleController::ACTION_BOUNDARY);
      break;
  }
}

}  // namespace

////////////////////////////////////////////////////////////////////////////////
// SettingsApiBubbleController

SettingsApiBubbleController::SettingsApiBubbleController(
    Profile* profile,
    SettingsApiOverrideType type)
    : ExtensionMessageBubbleController(
          new SettingsApiBubbleDelegate(
              ExtensionSystem::Get(profile)->extension_service(),
              profile,
              type),
          profile),
      profile_(profile),
      type_(type) {}

SettingsApiBubbleController::~SettingsApiBubbleController() {}

bool SettingsApiBubbleController::ShouldShow(const std::string& extension_id) {
  ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_);
  if (prefs->HasSettingsApiBubbleBeenAcknowledged(extension_id))
    return false;

  if (!delegate()->ShouldIncludeExtension(extension_id))
    return false;

  // If the browser is showing the 'Chrome crashed' infobar, it won't be showing
  // the startup pages, so there's no point in showing the bubble now.
  if (type_ == BUBBLE_TYPE_STARTUP_PAGES)
    return profile_->GetLastSessionExitType() != Profile::EXIT_CRASHED;

  return true;
}

bool SettingsApiBubbleController::CloseOnDeactivate() {
  // Startup bubbles tend to get lost in the focus storm that happens on
  // startup. Other types should dismiss on focus loss.
  return type_ != BUBBLE_TYPE_STARTUP_PAGES;
}

}  // namespace extensions


text:
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.activiti.engine.impl.persistence.entity.GroupEntity">

  <!-- GROUP INSERT -->

  <insert id="insertGroup" parameterType="org.activiti.engine.impl.persistence.entity.GroupEntity">
    insert into ${prefix}ACT_ID_GROUP (ID_, REV_, NAME_, TYPE_)
    values (
      #{id ,jdbcType=VARCHAR},
      1,
      #{name ,jdbcType=VARCHAR},
      #{type ,jdbcType=VARCHAR}
    )
  </insert>

  <!-- GROUP UPDATE -->

  <update id="updateGroup" parameterType="org.activiti.engine.impl.persistence.entity.GroupEntity">
    update ${prefix}ACT_ID_GROUP set
      REV_ = #{revisionNext ,jdbcType=INTEGER},
      NAME_ = #{name ,jdbcType=VARCHAR},
      TYPE_ = #{type ,jdbcType=VARCHAR}
    where ID_ = #{id}
       and REV_ = #{revision}
  </update>

  <!-- GROUP DELETE -->

  <delete id="deleteGroup" parameterType="string">
    delete from ${prefix}ACT_ID_GROUP where ID_ = #{groupId}
  </delete>

  <!-- GROUP RESULTMAP -->

  <resultMap id="groupResultMap" type="org.activiti.engine.impl.persistence.entity.GroupEntity">
    <id property="id" column="ID_" jdbcType="VARCHAR" />
    <result property="revision" column="REV_" jdbcType="INTEGER" />
    <result property="name" column="NAME_" jdbcType="VARCHAR" />
    <result property="type" column="TYPE_" jdbcType="VARCHAR" />
  </resultMap>

  <!-- GROUP SELECT -->

  <select id="selectGroupById" parameterType="string" resultMap="groupResultMap">
    select * from ${prefix}ACT_ID_GROUP where ID_ = #{id}
  </select>

  <select id="selectGroupsByUserId" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="groupResultMap">
  	${limitBefore}
    select g.*
    from ${prefix}ACT_ID_GROUP g, ${prefix}ACT_ID_MEMBERSHIP membership
    where g.ID_ = membership.GROUP_ID_
      and membership.USER_ID_ = #{parameter}
    ${limitAfter}
  </select>

  <select id="selectGroupsByUserIdAndGroupType" parameterType="org.activiti.engine.impl.db.ListQueryParameterObject" resultMap="groupResultMap">
  	${limitBefore}
    select g.*
    from ${prefix}ACT_ID_GROUP g, ${prefix}ACT_ID_MEMBERSHIP membership
    where g.ID_ = membership.GROUP_ID_
      and membership.USER_ID_ = #{parameter.userId}
      <if test="groupType != null">
         and g.TYPE_ = #{parameter.groupType}
      </if>
    ${limitAfter}
  </select>

  <select id="selectGroupByQueryCriteria" parameterType="org.activiti.engine.impl.GroupQueryImpl" resultMap="groupResultMap">
  	${limitBefore}
    select G.*
    <include refid="selectGroupByQueryCriteriaSql" />
    <if test="orderBy != null">
      order by ${orderBy}
    </if>
    ${limitAfter}
  </select>

   <select id="selectGroupCountByQueryCriteria" parameterType="org.activiti.engine.impl.GroupQueryImpl" resultType="long">
    select count(G.ID_)
    <include refid="selectGroupByQueryCriteriaSql" />
  </select>

  <sql id="selectGroupByQueryCriteriaSql">
    from ${prefix}ACT_ID_GROUP G
    <if test="userId != null">
      inner join ${prefix}ACT_ID_MEMBERSHIP M on G.ID_ = M.GROUP_ID_
      inner join ${prefix}ACT_ID_USER U on M.USER_ID_ = U.ID_
    </if>
    <where>
      <if test="id != null">
        G.ID_ = #{id}
      </if>
      <if test="name != null">
        and G.NAME_ = #{name}
      </if>
      <if test="nameLike != null">
        and G.NAME_ like #{nameLike}
      </if>
      <if test="type != null">
        and G.TYPE_ = #{type}
      </if>
      <if test="userId != null">
        and U.ID_ = #{userId}
      </if>
      <if test="procDefId != null">
        and exists (select ID_ from ${prefix} ACT_RU_IDENTITYLINK where PROC_DEF_ID_ = #{procDefId} and GROUP_ID_=G.ID_ )
      </if>

    </where>
  </sql>

</mapper>


text:
package si.um.ii.swrools;

import java.lang.annotation.Annotation;
import java.lang.reflect.*;
import java.util.*;
import java.util.Map.Entry;

import si.um.ii.swrools.exceptions.MaterializationException;
import si.um.ii.swrools.util.NameHelper;

/**
 * @author Rok
 * @param <T>
 *
 */
@SuppressWarnings("unchecked")
class Materializer<T extends OWLThing> {

	private Class<T> cls;

	public Materializer(Class<T> c) throws MaterializationException {
		if (c == null) {
			throw new IllegalArgumentException();
		}

		cls = c;
		if (!cls.isInterface()) {
			throw new MaterializationException(c.getName() + " is not an Interface!");
		}
	}

	public Materializer(String className) throws MaterializationException {
		try {
			cls = (Class<T>) Class.forName(className);
			if (!cls.isInterface()) {
				throw new MaterializationException(className + " is not an Interface!");
			}
		} catch (ClassNotFoundException e) {
			throw new MaterializationException(e);
		}
	}

	private Class<? extends OWLThingImpl> getImplementationClass(Class<? extends OWLThing> cls) throws MaterializationException {
		try {
			String className = null;

			if (cls.isAnnotationPresent(OWLEquivalentClass.class)) {
				List<String> ids = new ArrayList<>();
				for (String uri : cls.getAnnotation(OWLEquivalentClass.class).id()) {
					ids.add(NameHelper.getNameFromUri(uri));
				}
				className = NameHelper.concatName(cls.getSimpleName(), ids);
			} else {
				className = cls.getSimpleName();
			}

			String fcName = NameHelper.getImplementationClassName(cls.getPackage().getName(), className);

			return (Class<? extends OWLThingImpl>) Class.forName(fcName);
		} catch (ClassNotFoundException e) {
			throw new MaterializationException(e);
		}
	}

	public <U extends OWLThing> void setProperty(String objPropId, OWLThing obj, Collection<U> individuals, Class<?> targetCls)
			throws MaterializationException {
		for (Method m : cls.getMethods()) {
			if (m.isAnnotationPresent(OWLObjectProperty.class) && m.getAnnotation(OWLObjectProperty.class).id().equals(objPropId)) {
				try {
					OWLCollection<U> col = (OWLCollection<U>) m.invoke(obj);
					col.addAll(individuals);
					break;
				} catch (ReflectiveOperationException e) {
					throw new MaterializationException(e);
				}
			}
		}
	}

	private <U extends OWLThing> void createSubPropertyObservers(OWLThing obj) throws MaterializationException {
		for (Method m : cls.getMethods()) {
			if (m.isAnnotationPresent(OWLSubPropertyOf.class)) {
				try {
					OWLCollection<U> col = (OWLCollection<U>) m.invoke(obj);
					if (col.isSubProperty()) {
						String superUri = m.getAnnotation(OWLSubPropertyOf.class).id();

						String methodName = "get" + NameHelper.getUpperCamelCase(NameHelper.getNameFromUri(superUri));
						Method targetMethod = cls.getMethod(methodName);

						OWLCollection<?> superCol = (OWLCollection<?>) targetMethod.invoke(obj);
						col.addObserver(superCol);
					}
				} catch (ReflectiveOperationException e) {
					throw new MaterializationException(e);
				}
			}
		}
	}

	public <U extends OWLThing> U createInstance(String id) throws MaterializationException {
		try {
			U instance = null;
			if (cls.isAssignableFrom(OWLThingImpl.class)) {
				instance = (U) cls.getConstructor(String.class).newInstance(id);
			} else {
				instance = (U) getImplementationClass(cls).getConstructor(String.class).newInstance(id);
			}

			initializeProperties(instance);
			createSubPropertyObservers(instance);

			return instance;
		} catch (ReflectiveOperationException e) {
			throw new MaterializationException(e);
		}
	}

	private <U extends OWLThing> void initializeProperties(U instance) throws NoSuchFieldException, IllegalAccessException {
		for (Method m : cls.getMethods()) {
			if (m.isAnnotationPresent(OWLObjectProperty.class)) {
				Field colField = instance.getClass().getDeclaredField(NameHelper.getLowerCamelCase(m.getName().substring(3)));
				colField.setAccessible(true);

				OWLCollection<U> col = new OWLCollection<U>(m.getAnnotation(OWLObjectProperty.class).id(), instance);
				col.setSymmetric(m.isAnnotationPresent(OWLSymmetricProperty.class));
				col.setTransitive(m.isAnnotationPresent(OWLTransitiveProperty.class));
				col.setInverse(m.isAnnotationPresent(OWLInverseOf.class));
				col.setFunctional(m.isAnnotationPresent(OWLFunctionalProperty.class));
				col.setReflexive(m.isAnnotationPresent(OWLReflexiveProperty.class));
				col.setIrreflexive(m.isAnnotationPresent(OWLIrreflexiveProperty.class));

				col.setSubProperty(m.isAnnotationPresent(OWLSubPropertyOf.class));

				colField.set(instance, col);
			}
		}
	}

	public Collection<String> getDatatypeProperties() throws MaterializationException {
		return getProperties(OWLDatatypeProperty.class);
	}

	public Collection<String> getObjectProperties() throws MaterializationException {
		return getProperties(OWLObjectProperty.class);
	}

	private Collection<String> getProperties(Class<? extends Annotation> prop) throws MaterializationException {
		ArrayList<String> ids = new ArrayList<String>();

		for (Method m : cls.getMethods()) {
			if (m.isAnnotationPresent(prop)) {
				Annotation objectProperty = m.getAnnotation(prop);

				try {
					Method am = objectProperty.getClass().getMethod("id");
					ids.add((String) am.invoke(objectProperty));

				} catch (ReflectiveOperationException e) {
					throw new MaterializationException(e);
				}
			}
		}

		return ids;
	}

	public Class<?> getReturnType(String id) throws MaterializationException {
		for (Method m : cls.getMethods()) {
			if (m.isAnnotationPresent(OWLObjectProperty.class)) {
				OWLObjectProperty objectProperty = m.getAnnotation(OWLObjectProperty.class);
				if (objectProperty.id().equals(id)) {
					Type returnType = m.getGenericReturnType();

					if (returnType instanceof ParameterizedType) {
						Type colType = ((ParameterizedType) returnType).getActualTypeArguments()[0];

						if (colType instanceof WildcardType) {
							return (Class<?>) ((WildcardType) colType).getUpperBounds()[0];
						}
						return (Class<?>) colType;
					}
					return (Class<?>) returnType;
				}
			}
		}
		throw new MaterializationException("Method with OWLObjectProperty(id=\"" + id + "\") not found.");
	}

	public void setValue(OWLThing instance, String datatypeURI, String value) throws MaterializationException {
		try {
			String getMethod = "get" + NameHelper.getUpperCamelCase(NameHelper.getNameFromUri(datatypeURI));
			Class<?> returnType = cls.getMethod(getMethod).getReturnType();

			String setMethod = "s" + getMethod.substring(1);

			Class<?> paramType = returnType;

			if (paramType.isPrimitive()) {
				paramType = primitiveMap.get(returnType);
			}

			Object realValue = paramType.getConstructor(new Class[] { String.class }).newInstance(value);
			cls.getMethod(setMethod, returnType).invoke(instance, realValue);
		} catch (ReflectiveOperationException e) {
			throw new MaterializationException(e);
		}
	}

	public Collection<Entry<String, Object>> getDatatypeValues(OWLThing instance) throws MaterializationException {
		ArrayList<Entry<String, Object>> list = new ArrayList<Entry<String, Object>>();

		Collection<String> datatypes = getDatatypeProperties();

		for (String dt : datatypes) {
			// get datatype value from field
			list.add(new AbstractMap.SimpleEntry<String, Object>(dt, getValue(dt, instance)));
		}

		return list;
	}

	private Object getValue(String datatypeURI, Object instance) throws MaterializationException {
		String methodName = "get" + NameHelper.getUpperCamelCase(NameHelper.getNameFromUri(datatypeURI));

		try {
			Method m = cls.getMethod(methodName);
			return m.invoke(instance);
		} catch (ReflectiveOperationException e) {
			throw new MaterializationException(e);
		}
	}

	public static void addObserver(OWLCollection<? extends OWLThing> sender, OWLThing instance, ObjectPropertyType type) {
		Class<? extends OWLThing> implClass = instance.getClass();
		Class<?> owlThingInterface = implClass.getInterfaces()[0];

		switch (type) {
			case INVERSE:
				for (Method m : owlThingInterface.getMethods()) {
					if (m.isAnnotationPresent(OWLInverseOf.class) && m.getAnnotation(OWLInverseOf.class).id().equals(sender.getName())) {
						try {
							OWLCollection<OWLThing> col = (OWLCollection<OWLThing>) m.invoke(instance);
							sender.addObserver(col);
						} catch (ReflectiveOperationException e) {
							throw new RuntimeException(e);
						}
						break;
					}
				}
				break;
			case TRANSITIVE:
				for (Method m : owlThingInterface.getMethods()) {
					if (m.isAnnotationPresent(OWLTransitiveProperty.class)
							&& m.getAnnotation(OWLObjectProperty.class).id().equals(sender.getName())) {
						try {
							OWLCollection<OWLThing> col = (OWLCollection<OWLThing>) m.invoke(instance);
							((OWLCollection<OWLThing>) sender).addAll(col); // Add all existing
							// instances
							col.addObserver(sender);
						} catch (ReflectiveOperationException e) {
							throw new RuntimeException(e);
						}
						break;
					}
				}
				break;
			case SYMMETRIC:
				for (Method m : owlThingInterface.getMethods()) {
					if (m.isAnnotationPresent(OWLSymmetricProperty.class)
							&& m.getAnnotation(OWLObjectProperty.class).id().equals(sender.getName())) {
						try {
							OWLCollection<OWLThing> col = (OWLCollection<OWLThing>) m.invoke(instance);
							sender.addObserver(col);
						} catch (ReflectiveOperationException e) {
							throw new RuntimeException(e);
						}
						break;
					}
				}
				break;
		}
	}

	public void copyFields(OWLThing from, T to) throws MaterializationException {
		for (Class<?> i : from.getClass().getInterfaces()) {
			if (!OWLThing.class.isAssignableFrom(i)) {
				continue;
			}

			for (Method m : i.getMethods()) {
				if (m.isAnnotationPresent(OWLDatatypeProperty.class)) {
					try {
						Method setMethod = to.getClass().getMethod("set" + m.getName().substring(3), m.getReturnType());
						setMethod.invoke(to, m.invoke(from));
					} catch (ReflectiveOperationException e) {
						throw new MaterializationException(e);
					}
				}
			}
		}
	}

	public void copyCollections(OWLThing from, T to) throws MaterializationException {
		for (Class<?> i : from.getClass().getInterfaces()) {
			if (!OWLThing.class.isAssignableFrom(i)) {
				continue;
			}

			for (Method m : i.getMethods()) {
				if (m.isAnnotationPresent(OWLObjectProperty.class)) {
					try {
						String fieldName = NameHelper.getLowerCamelCase(m.getName().substring(3));

						Field fieldFrom = from.getClass().getDeclaredField(fieldName);
						fieldFrom.setAccessible(true);

						Field fieldTo = to.getClass().getDeclaredField(fieldName);
						fieldTo.setAccessible(true);

						Field parent = OWLCollection.class.getDeclaredField("parent");
						parent.setAccessible(true);

						OWLCollection<?> val = (OWLCollection<?>) fieldFrom.get(from);
						parent.set(val, to);
						fieldTo.set(to, val);

					} catch (ReflectiveOperationException e) {
						throw new MaterializationException(e);
					}
				}
			}
		}
	}

	/**
	 * Mapiranje primitivnih tipov v razrede http://www.xinotes.org/notes/note/1330/
	 */
	private static Map<Class<?>, Class<?>> primitiveMap = new HashMap<>();
	static {
		primitiveMap.put(boolean.class, Boolean.class);
		primitiveMap.put(byte.class, Byte.class);
		primitiveMap.put(char.class, Character.class);
		primitiveMap.put(short.class, Short.class);
		primitiveMap.put(int.class, Integer.class);
		primitiveMap.put(long.class, Long.class);
		primitiveMap.put(float.class, Float.class);
		primitiveMap.put(double.class, Double.class);
	}
}


text:
package org.apache.sling.auth.xing.login;

import aQute.bnd.annotation.ProviderType;
import org.apache.jackrabbit.api.security.user.User;
import org.apache.sling.auth.xing.api.XingUserManager;

@ProviderType
public interface XingLoginUserManager extends XingUserManager {

    String getHash(User user);

}


text:
package com.spring.demo.test;

public class test {

}


text:
const spawn = require('cross-spawn');
const { resolveBin } = require('../utils/path-resolver');
const { getPreset } = require('../utils/preset');
const { getUserConfigFile } = require('../utils/env');

const eslint = resolveBin('eslint');

module.exports = function lintEs(env, presetApi, options) {
	const presetName = presetApi.getUserConfig(['preset'], '@talend/scripts-preset-react-lib');
	const preset = getPreset(presetName);
	const eslintConfigPath =
		getUserConfigFile([
			'.eslintrc.js',
			'.eslintrc.yaml',
			'.eslintrc.yml',
			'.eslintrc.json',
			'.eslintrc',
		]) || preset.getEslintConfigurationPath(presetApi);
	const args = ['--config', eslintConfigPath, '--ext', '.js,.ts,.tsx', './src', ...options];

	// https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
	if (process.env.CI && process.env.GITHUB_ACTIONS) {
		if (!options.includes('-o')) {
			args.push('-o', 'eslint-report.json');
		}
		if (!options.includes('--format')) {
			args.push('--format', 'json');
		}
	}
	return spawn.sync(eslint, args, {
		stdio: 'inherit',
		env,
	});
};


text:
module Clusters
  module Platforms
    class Kubernetes < ActiveRecord::Base
      include Gitlab::Kubernetes
      include ReactiveCaching
      include EnumWithNil
      include AfterCommitQueue

      RESERVED_NAMESPACES = %w(gitlab-managed-apps).freeze

      self.table_name = 'cluster_platforms_kubernetes'
      self.reactive_cache_key = ->(kubernetes) { [kubernetes.class.model_name.singular, kubernetes.id] }

      belongs_to :cluster, inverse_of: :platform_kubernetes, class_name: 'Clusters::Cluster'

      attr_encrypted :password,
        mode: :per_attribute_iv,
        key: Settings.attr_encrypted_db_key_base_truncated,
        algorithm: 'aes-256-cbc'

      attr_encrypted :token,
        mode: :per_attribute_iv,
        key: Settings.attr_encrypted_db_key_base_truncated,
        algorithm: 'aes-256-cbc'

      before_validation :enforce_namespace_to_lower_case
      before_validation :enforce_ca_whitespace_trimming

      validates :namespace,
        allow_blank: true,
        length: 1..63,
        format: {
          with: Gitlab::Regex.kubernetes_namespace_regex,
          message: Gitlab::Regex.kubernetes_namespace_regex_message
        }

      validates :namespace, exclusion: { in: RESERVED_NAMESPACES }

      validate :no_namespace, unless: :allow_user_defined_namespace?

      # We expect to be `active?` only when enabled and cluster is created (the api_url is assigned)
      validates :api_url, url: true, presence: true
      validates :token, presence: true

      validate :prevent_modification, on: :update

      after_save :clear_reactive_cache!
      after_update :update_kubernetes_namespace

      alias_attribute :ca_pem, :ca_cert

      delegate :project, to: :cluster, allow_nil: true
      delegate :enabled?, to: :cluster, allow_nil: true
      delegate :managed?, to: :cluster, allow_nil: true
      delegate :allow_user_defined_namespace?, to: :cluster, allow_nil: true
      delegate :kubernetes_namespace, to: :cluster

      alias_method :active?, :enabled?

      enum_with_nil authorization_type: {
        unknown_authorization: nil,
        rbac: 1,
        abac: 2
      }

      default_value_for :authorization_type, :rbac

      def actual_namespace
        if namespace.present?
          namespace
        else
          default_namespace
        end
      end

      def predefined_variables(project:)
        Gitlab::Ci::Variables::Collection.new.tap do |variables|
          variables.append(key: 'KUBE_URL', value: api_url)

          if ca_pem.present?
            variables
              .append(key: 'KUBE_CA_PEM', value: ca_pem)
              .append(key: 'KUBE_CA_PEM_FILE', value: ca_pem, file: true)
          end

          if kubernetes_namespace = cluster.kubernetes_namespaces.has_service_account_token.find_by(project: project)
            variables.concat(kubernetes_namespace.predefined_variables)
          elsif cluster.project_type?
            # From 11.5, every Clusters::Project should have at least one
            # Clusters::KubernetesNamespace, so once migration has been completed,
            # this 'else' branch will be removed. For more information, please see
            # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22433
            variables
              .append(key: 'KUBE_URL', value: api_url)
              .append(key: 'KUBE_TOKEN', value: token, public: false)
              .append(key: 'KUBE_NAMESPACE', value: actual_namespace)
              .append(key: 'KUBECONFIG', value: kubeconfig, public: false, file: true)
          end
        end
      end

      # Constructs a list of terminals from the reactive cache
      #
      # Returns nil if the cache is empty, in which case you should try again a
      # short time later
      def terminals(environment)
        with_reactive_cache do |data|
          pods = filter_by_label(data[:pods], app: environment.slug)
          terminals = pods.flat_map { |pod| terminals_for_pod(api_url, actual_namespace, pod) }.compact
          terminals.each { |terminal| add_terminal_auth(terminal, terminal_auth) }
        end
      end

      # Caches resources in the namespace so other calls don't need to block on
      # network access
      def calculate_reactive_cache
        return unless enabled? && project && !project.pending_delete?

        # We may want to cache extra things in the future
        { pods: read_pods }
      end

      def kubeclient
        @kubeclient ||= build_kube_client!
      end

      private

      def kubeconfig
        to_kubeconfig(
          url: api_url,
          namespace: actual_namespace,
          token: token,
          ca_pem: ca_pem)
      end

      def default_namespace
        kubernetes_namespace&.namespace.presence || fallback_default_namespace
      end

      # DEPRECATED
      #
      # On 11.4 Clusters::KubernetesNamespace was introduced, this model will allow to
      # have multiple namespaces per project. This method will be removed after migration
      # has been completed.
      def fallback_default_namespace
        return unless project

        slug = "#{project.path}-#{project.id}".downcase
        Gitlab::NamespaceSanitizer.sanitize(slug)
      end

      def build_kube_client!
        raise "Incomplete settings" unless api_url
        raise "No namespace" if cluster.project_type? && actual_namespace.empty? # can probably remove this line once we remove #actual_namespace

        unless (username && password) || token
          raise "Either username/password or token is required to access API"
        end

        Gitlab::Kubernetes::KubeClient.new(
          api_url,
          auth_options: kubeclient_auth_options,
          ssl_options: kubeclient_ssl_options,
          http_proxy_uri: ENV['http_proxy']
        )
      end

      # Returns a hash of all pods in the namespace
      def read_pods
        kubeclient = build_kube_client!

        kubeclient.get_pods(namespace: actual_namespace).as_json
      rescue Kubeclient::ResourceNotFoundError
        []
      end

      def kubeclient_ssl_options
        opts = { verify_ssl: OpenSSL::SSL::VERIFY_PEER }

        if ca_pem.present?
          opts[:cert_store] = OpenSSL::X509::Store.new
          opts[:cert_store].add_cert(OpenSSL::X509::Certificate.new(ca_pem))
        end

        opts
      end

      def kubeclient_auth_options
        { bearer_token: token }
      end

      def terminal_auth
        {
          token: token,
          ca_pem: ca_pem,
          max_session_time: Gitlab::CurrentSettings.terminal_max_session_time
        }
      end

      def enforce_namespace_to_lower_case
        self.namespace = self.namespace&.downcase
      end

      def enforce_ca_whitespace_trimming
        self.ca_pem = self.ca_pem&.strip
        self.token = self.token&.strip
      end

      def no_namespace
        if namespace
          errors.add(:namespace, 'only allowed for project cluster')
        end
      end

      def prevent_modification
        return unless managed?

        if api_url_changed? || token_changed? || ca_pem_changed?
          errors.add(:base, _('Cannot modify managed Kubernetes cluster'))
          return false
        end

        true
      end

      def update_kubernetes_namespace
        return unless namespace_changed?

        run_after_commit do
          ClusterConfigureWorker.perform_async(cluster_id)
        end
      end
    end
  end
end


text:
Welcome To GrowPod

    <button class="button" id="login" on-click="signInWithGoogle('login')">
      Login
    </button>

    <button class="button" id="signup" on-click="signInWithGoogle('signup')">
      Sign up
    </button>

<ng-template #newUserForm>
  <mat-card class="mat-elevation-z8 form">
    <mat-card-title>
      Tell us a little more about yourself!
    </mat-card-title>

    <mat-card-content>
      <form [formGroup]="userGroup">
        <mat-form-field appearance="fill">
          <input
            matInput
            placeholder="Zipcode"
            [(ngModel)]="zipCode"
            formControlName="zipCodeValidator"
          />
          <mat-error
            *ngIf="userGroup.controls.zipCodeValidator.hasError('required')"
          >
            Zipcode is required
          </mat-error> </mat-form-field
        >

        <mat-form-field appearance="fill">
          <textarea
            matInput
            placeholder="Bio"
            [(ngModel)]="bio"
            formControlName="bioValidator"
          ></textarea>
          <mat-error
            *ngIf="userGroup.controls.bioValidator.hasError('required')"
          >
            Biography is required
          </mat-error> </mat-form-field
        >

        <mat-form-field appearance="fill">
          <mat-label>Are you joining or creating a garden?</mat-label>
          <mat-select formControlName="gardenValidator">
            <mat-option value="option">Joining</mat-option>
            <mat-option value="option">Creating</mat-option>
          </mat-select>
          <mat-error
            *ngIf="userGroup.controls.gardenValidator.hasError('required')"
          >
            Please select an option
          </mat-error>
        </mat-form-field>

        <button
          mat-button
          class="button"
          id="createAccount"
          on-click="buildUserProfile()"
        >
          Create Account
        </button>
      </form></mat-card-content
    ></mat-card
  >
</ng-template>