text:
class T_CORE_EXPORT TSessionManager
{
public:
    ~TSessionManager();

    TSession findSession(const QByteArray &id);
    bool store(TSession &session);
    bool remove(const QByteArray &id);
    QString storeType() const;
    QByteArray generateId();
    void collectGarbage();

    static TSessionManager &instance();
    static int sessionLifeTime();

private:
    T_DISABLE_COPY(TSessionManager)
    T_DISABLE_MOVE(TSessionManager)
    TSessionManager();
};

#endif // TSESSIONMANAGER_H

redpajama_set_name: RedPajamaGithub


text:
package me.androidbox.busbymovies.moviedetails;

import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.customtabs.CustomTabsIntent;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Priority;
import com.bumptech.glide.load.MultiTransformation;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerFragment;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Optional;
import butterknife.Unbinder;
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
import me.androidbox.busbymovies.R;
import me.androidbox.busbymovies.adapters.MovieActorsAdapter;
import me.androidbox.busbymovies.adapters.MovieTrailerAdapter;
import me.androidbox.busbymovies.adapters.SimilarMovieAdapter;
import me.androidbox.busbymovies.data.MovieFavouritePresenterContract;
import me.androidbox.busbymovies.di.BusbyMoviesMainApplication;
import me.androidbox.busbymovies.models.Actor;
import me.androidbox.busbymovies.models.Cast;
import me.androidbox.busbymovies.models.Movie;
import me.androidbox.busbymovies.models.Movies;
import me.androidbox.busbymovies.models.Results;
import me.androidbox.busbymovies.models.Review;
import me.androidbox.busbymovies.models.Trailer;
import me.androidbox.busbymovies.moviereviews.MovieReviewsDialog;
import me.androidbox.busbymovies.utils.Constants;
import me.androidbox.busbymovies.utils.GlideApp;
import me.androidbox.busbymovies.utils.ImageLoader;
import me.androidbox.busbymovies.utils.MovieImage;
import timber.log.Timber;

/**
 * A simple {@link Fragment} subclass.
 */
public class MovieDetailViewImp
        extends
        Fragment
        implements
        MovieDetailViewContract,
        StartMovieTrailerListener,
        MovieFavouritePresenterContract.DbOperationsListener {

    public static final String TAG = MovieDetailViewImp.class.getSimpleName();
    public static final String MOVIE_ID_KEY = "movie_id_key";

    private Unbinder mUnbinder;
    private MovieTrailerAdapter mMovieTrailerAdapter;
    private Results<Review> mReviewList;
    private Results<Trailer> mTrailerList;
    private Movie mMovie;
    private BottomSheetBehavior<FrameLayout> mBottomSheetBehavior;
    private int mMovieId;

    private SimilarMovieAdapter similarMovieAdapter;
    @Inject MovieActorsAdapter movieActorsAdapter;
    @Inject MovieDetailPresenterContract<MovieDetailViewContract> mMovieDetailPresenterImp;
    @Inject
    MovieFavouritePresenterContract mMovieFavouritePresenterContact;
    @Inject ImageLoader imageLoader;

    @BindView(R.id.ivBackdropPoster) ImageView mIvBackdropPoster;
    @BindView(R.id.tvTagLine) TextView mTvTagLine;
    @BindView(R.id.ivThumbnail) ImageView mIvThumbnail;
    @BindView(R.id.tvTitle) TextView mTvTitle;
    @BindView(R.id.tvRelease) TextView mTvRelease;
    @BindView(R.id.rbVoteAverage) RatingBar mRbVoteAverage;
    @BindView(R.id.tvSynopsis) TextView mTvSynopsis;
    @BindView(R.id.content) FrameLayout mContent;
    @BindView(R.id.tvHomepage) TextView mTvHomepage;
    @BindView(R.id.tvRuntime) TextView mTvRuntime;
    @BindView(R.id.svMovieFooter) ScrollView mSvMovieFooter;
    @BindView(R.id.tvVoteAverage) TextView mTvVoteAverage;
    @BindView(R.id.tool_bar) Toolbar mToolBar;
    @BindView(R.id.tvTrailers) TextView mTvTrailers;
    @BindView(R.id.tvReviews) TextView mTvReviews;
    @BindView(R.id.rvMovieActors) RecyclerView rvMovieActors;
    @BindView(R.id.rvSimilarMovies) RecyclerView mRvSimilarMovies;
    @BindView(R.id.youtubeFragmentContainer) FrameLayout mYoutubeFragmentContainer;
    @Nullable @BindView(R.id.ivPlayTrailer) ImageView mIvPlayTrailer;
    @Nullable @BindView(R.id.fabMovieFavourite) FloatingActionButton mFabMovieFavourite;
    @Nullable @BindView(R.id.bottomSheet) FrameLayout mBottomSheet;
    @Nullable @BindView(R.id.rvTrailerList) RecyclerView mRvTrailerList;

    public MovieDetailViewImp() {
        // Required empty public constructor
    }

    /* Factory Method */
    public static MovieDetailViewImp newInstance(int movieId) {
        final Bundle args = new Bundle();
        args.putInt(MOVIE_ID_KEY, movieId);

        MovieDetailViewImp movieDetailViewImp = new MovieDetailViewImp();
        movieDetailViewImp.setArguments(args);

        return movieDetailViewImp;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        final View view = inflater.inflate(R.layout.movie_detail_view, container, false);

        mUnbinder = ButterKnife.bind(MovieDetailViewImp.this, view);

        ((BusbyMoviesMainApplication)getActivity().getApplication())
                .getMovieDetailComponent(MovieDetailViewImp.this)
                .inject(MovieDetailViewImp.this);

        setupToolBar();
        setupBottomSheet();
        setupActorAdapter();
        setupSimilarMoviesRecyclerView();

        return view;
    }

    private void setupSimilarMoviesRecyclerView() {
        similarMovieAdapter = new SimilarMovieAdapter();
        mRvSimilarMovies.setHasFixedSize(true);
        mRvSimilarMovies.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
        mRvSimilarMovies.setAdapter(similarMovieAdapter);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        final Bundle args = getArguments();
        if(args != null) {
            mMovieId = args.getInt(MOVIE_ID_KEY, -1);
            Timber.d("onActivityCreated %d", mMovieId);

            if(mMovieDetailPresenterImp != null) {
                if(mMovieId != -1) {
                    mMovieDetailPresenterImp.attachView(MovieDetailViewImp.this);
                    mMovieDetailPresenterImp.requestMovieActors(mMovieId);
                    mMovieDetailPresenterImp.getSimilarMovies(mMovieId);

                    /* Check if we are getting a movie favourite */
                    mMovieFavouritePresenterContact.hasMovieAsFavourite(mMovieId);
                }
                else {
                    Timber.e("Invalid movie id '-1'");
                }
            }
            else {
                Timber.e("mMovieDetailPresenterImp == null");
            }
        }
    }

    private void setupActorAdapter() {
        final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
        rvMovieActors.setLayoutManager(linearLayoutManager);
        rvMovieActors.setHasFixedSize(true);
        rvMovieActors.setAdapter(movieActorsAdapter);
    }

    private void setupBottomSheet() {
        if(mBottomSheet != null) {
            mBottomSheetBehavior = BottomSheetBehavior.from(mBottomSheet);
            mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        }
    }

    @Override
    public void onStartMovieTrailer(String key, FrameLayout youtubeFragmentContainer, ImageView ivPlayerTrailerItem) {
//        setupYoutubePlayerTrailer(key, youtubeFragmentContainer, ivPlayerTrailerItem);
    }

    private void loadMovieTrailers(Results<Trailer> trailerList) {
        if(trailerList.getResults().size() > 0) {
            String trailerCount = trailerList.getResults().size() + " Trailer(s)";
            mTvTrailers.setText(trailerCount);

            mRvTrailerList.setHasFixedSize(true);
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
            mRvTrailerList.setLayoutManager(linearLayoutManager);

            mMovieTrailerAdapter = new MovieTrailerAdapter(trailerList, MovieDetailViewImp.this);
            mRvTrailerList.setAdapter(mMovieTrailerAdapter);

            mTrailerList = trailerList;
        }
        else {
            mTrailerList = trailerList;
            String trailerCount = trailerList.getResults().size() + " Trailer(s)";
            mTvTrailers.setText(trailerCount);

            Timber.d("There are no trailers to load");
        }
    }

    @SuppressWarnings("unused")
    @Optional
    @OnClick(R.id.ivPlayTrailer)
    public void playIntoMovieTrailer() {
        Timber.d("requestStartMovieTrailer");
        if(mTrailerList.getResults().size() > 0) {
        /* Only play the header movie trailer in portrait mode as the landscape version has not room */
            if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
                setupYoutubePlayer(mMovieTrailerAdapter.getTrailerFromPosition(0).getKey());
            }
        }
        else {
            Toast.makeText(getActivity(), "There are not trailers for this movie yet", Toast.LENGTH_LONG).show();
        }
    }

    private void isAlreadyBeenFavourited() {
        /* Check that the movie is not already in the database */
        mMovieFavouritePresenterContact.hasMovieAsFavourite(mMovie.getId());
    }

    private boolean isFlaggedAsFavourite(FloatingActionButton floatingActionButton) {
        Timber.d("isFlaggedAsFavourite %s", floatingActionButton.getTag().toString());
        return floatingActionButton.getTag().toString().equals("true");
    }

    private void addMovieAsFavourite(FloatingActionButton floatingActionButton) {
        floatingActionButton.setTag("true");
        Timber.d("AddMovieAsFavourite %s", floatingActionButton.getTag().toString());
    }

    private void removeMovieAsFavourite(FloatingActionButton floatingActionButton) {
        Timber.d("removeMovieAsFavourite %s", floatingActionButton.getTag().toString());
        floatingActionButton.setTag("false");
    }

    private void animateAddingFavourite() {
        final Animator animator = AnimatorInflater.loadAnimator(getActivity(), R.animator.save_favourite_movie);
        animator.setTarget(mFabMovieFavourite);
        mFabMovieFavourite.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.primary)));
        animator.start();

    }

    @SuppressWarnings("unused")
    @OnClick(R.id.fabMovieFavourite)
    public void addFavouriteMovie(FloatingActionButton floatingActionButton) {
        Timber.d("addFavouriteMovie");

        Animator animator = AnimatorInflater.loadAnimator(getActivity(), R.animator.save_favourite_movie);
        animator.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {
                Timber.d("onAnimationStart");
                if(isFlaggedAsFavourite(floatingActionButton)) {
                    floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.accent)));
                }
                else {
                    floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(getActivity(), R.color.primary)));
                }
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                Timber.d("onAnimationEnd");
                /* Either save or remove the movie from the database */
                if(isFlaggedAsFavourite(floatingActionButton)) {
                    /* remove from database */
                    removeMovieAsFavourite(floatingActionButton);
                    mMovieFavouritePresenterContact.deleteFavouriteMovie(mMovie.getId());
                }
                else {
                    /* Add to database */
                    addMovieAsFavourite(floatingActionButton);
                    final Movie favouriteMovie = new Movie(
                            mMovie.getId(),
                            mMovie.getPoster_path(),
                            mMovie.getOverview(),
                            mMovie.getRelease_date(),
                            mMovie.getTitle(),
                            mMovie.getBackdrop_path(),
                            mMovie.getVote_average(),
                            mMovie.getVote_count(),
                            mMovie.getTagline(),
                            mMovie.getHomepage(),
                            mMovie.getRuntime());

                    mMovieFavouritePresenterContact.insertFavouriteMovie(favouriteMovie);
                }
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });

        animator.setTarget(floatingActionButton);
        animator.start();
    }

    @SuppressWarnings("unused")
    @OnClick(R.id.fabTrailers)
    public void openTrailers() {
        if(mTrailerList != null) {
            if (mTrailerList.getResults().size() > 0) {
                if (mBottomSheet != null) {
                    if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
                        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                        Timber.d("STATE_EXPANDED");
                    }
                    else {
                        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                        Timber.d("STATE_COLLAPSED");
                    }
                }
            }
            else {
                Toast.makeText(getActivity(), "There are not trailers for this movie yet", Toast.LENGTH_LONG).show();
            }
        }
        else {
            Toast.makeText(getActivity(), "Service not available please try again later", Toast.LENGTH_LONG).show();
        }
    }

    @SuppressWarnings("unused")
    @OnClick(R.id.fabReviews)
    public void openReviews() {
        if(mReviewList == null) {
            Timber.e(TAG, "mReviewList == null");
            Toast.makeText(getActivity(), "Service unavailable. Try again", Toast.LENGTH_SHORT).show();
            return;
        }

        if(mReviewList.getResults().size() > 0) {
            FragmentManager fragmentManager = getFragmentManager();
            MovieReviewsDialog movieReviewsDialog = MovieReviewsDialog.newInstance(mReviewList);
            movieReviewsDialog.show(fragmentManager, MovieReviewsDialog.class.getSimpleName());
        }
        else {
            Toast.makeText(getActivity(), "There are no reviews for this movie yet", Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public void failedToGetMovieTrailers(String errorMessage) {
        Timber.e("failedToGetMovieTrailers %s", errorMessage);
    }

    @Override
    public void receivedMovieTrailers(Results<Trailer> trailerList) {
        loadMovieTrailers(trailerList);
    }

    private void setupYoutubePlayer(String key) {
        final YouTubePlayerFragment youTubePlayerFragment = YouTubePlayerFragment.newInstance();
        getFragmentManager().beginTransaction()
                .add(R.id.youtubeFragmentContainer, youTubePlayerFragment)
                .commit();

        youTubePlayerFragment.initialize(Constants.YOUTUBE_API_KEY, new YouTubePlayer.OnInitializedListener() {
            @Override
            public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
                Timber.d("onInitializationSuccess");

                youTubePlayer.setPlaybackEventListener(new YouTubePlayer.PlaybackEventListener() {
                    @Override
                    public void onPlaying() {
                        mYoutubeFragmentContainer.setVisibility(View.VISIBLE);
                        mToolBar.setVisibility(View.INVISIBLE);
                        mIvPlayTrailer.setVisibility(View.INVISIBLE);

                        Timber.d("onPlaying");
                    }

                    @Override
                    public void onPaused() {
                        Timber.d("onPaused");
                    }

                    @Override
                    public void onStopped() {
                        Timber.d("onStopped");
                        mToolBar.setVisibility(View.VISIBLE);
                        mIvPlayTrailer.setVisibility(View.VISIBLE);
                        mYoutubeFragmentContainer.setVisibility(View.INVISIBLE);
                    }

                    @Override
                    public void onBuffering(boolean b) {
                        Timber.d("onBuffering %b", b);
                    }

                    @Override
                    public void onSeekTo(int i) {
                        Timber.d("onSeekTo %d", i);
                    }
                });

                /* Start playing the youtube video */
                youTubePlayer.loadVideo(key);
            }

            @Override
            public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
                Timber.e("Failed to initialize %s", youTubeInitializationResult.toString());
            }
        });
    }

    @Override
    public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
        super.onViewStateRestored(savedInstanceState);
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    }

    private void setupToolBar() {
        final AppCompatActivity appCompatActivity = (AppCompatActivity)getActivity();
        appCompatActivity.setSupportActionBar(mToolBar);
        appCompatActivity.getSupportActionBar().setDisplayShowHomeEnabled(true);
        appCompatActivity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        appCompatActivity.getSupportActionBar().setDisplayShowTitleEnabled(false);
        appCompatActivity.getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_back_white_24dp);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        mUnbinder.unbind();
        if(mMovieDetailPresenterImp != null) {
            mMovieDetailPresenterImp.detachView();
        }
    }

    @Override
    public void displayMovieDetails(Movie movie) {
        Timber.d("displayMovieDetails");
        mMovie = movie;

        mTvTagLine.setText(movie.getTagline());
        mTvTitle.setText(movie.getTitle());

        final String movieDate = mMovieDetailPresenterImp.getMovieFormattedDate(movie.getRelease_date(), Constants.FORMAT_MOVIE_DATE);
        mTvRelease.setText(movieDate);

        mTvSynopsis.setText(movie.getOverview());
        mRbVoteAverage.setRating(mMovieDetailPresenterImp.getVoteAverage(movie.getVote_average()));
        mTvHomepage.setText(movie.getHomepage());

        final String runningTime = "Running time " + movie.getRuntime() + " minutes";
        mTvRuntime.setText(runningTime);

        mTvVoteAverage.setText(String.valueOf(movie.getVote_average()));
        Timber.d("movie.getVote_average %f", movie.getVote_average());

        GlideApp.with(getActivity())
                .load(MovieImage.build(movie.getPoster_path(), MovieImage.ImageSize.w92))
                .into(mIvThumbnail);

/*
        Glide.with(MovieDetailViewImp.this)
                .load(MovieImage.build(movie.getPoster_path(), MovieImage.ImageSize.w92))
    //            .bitmapTransform(new RoundedCornersTransformation(getActivity(), 16, 4, RoundedCornersTransformation.CornerType.ALL))
                .into(mIvThumbnail);
*/

        /* Bind the data */
        GlideApp.with(MovieDetailViewImp.this)
                .load(MovieImage.build(movie.getBackdrop_path(), MovieImage.ImageSize.w500))
                .into(mIvBackdropPoster);
    }

    @Override
    public void displayErrorFailedToGetMovie(String errMessage) {
        Toast.makeText(getActivity(), "Failed to get Movie " + errMessage, Toast.LENGTH_LONG).show();
    }

    /* Open the movie homepage using chrome custom tabs */
    @SuppressWarnings("unused")
    @OnClick(R.id.tvHomepage)
    public void openHomePage() {
        if(URLUtil.isValidUrl(mTvHomepage.getText().toString())) {
            final CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
            final Bitmap backButton = BitmapFactory.decodeResource(getResources(), R.drawable.ic_arrow_back_white_24dp);
            builder.setToolbarColor(ContextCompat.getColor(getActivity(), R.color.primary));
            builder.setCloseButtonIcon(backButton);
            builder.setShowTitle(true);

            builder.setStartAnimations(getActivity(), R.anim.slide_in_right, R.anim.slide_out_left);
            builder.setExitAnimations(getActivity(), R.anim.slide_in_left, R.anim.slide_out_right);

            final CustomTabsIntent customTabsIntent = builder.build();
            customTabsIntent.launchUrl(getActivity(), Uri.parse(mTvHomepage.getText().toString()));
        }
        else {
            Toast.makeText(getActivity(), "Invalid URL", Toast.LENGTH_LONG).show();
            Timber.e("Invalid URL %s", mTvHomepage.getText().toString());
        }
    }

    @Override
    public void receivedMovieReviews(Results<Review> reviews) {
        Timber.d("receiveMovieReviews: %d", reviews.getResults().size());
        String reviewCount = reviews.getResults().size() + " Review(s)";
        mTvReviews.setText(reviewCount);
        mReviewList = reviews;
    }

    @Override
    public void onGetMovieFavouriteFailure(String errorMessage) {
        Timber.e("onGetMovieFavouriteFailure %s", errorMessage);
        Toast.makeText(getActivity(), "Cannnot retrive favourite movie", Toast.LENGTH_LONG).show();
    }

    @Override
    public void onGetMovieFavouriteSuccess(Movie favourite) {
        Timber.d("onGetMovieFavouriteSuccess %d", favourite.getId());
        mMovie = favourite;

        mTvTagLine.setText(favourite.getTagline());
        mTvTitle.setText(favourite.getTitle());

        final String movieDate = mMovieDetailPresenterImp.getMovieFormattedDate(favourite.getRelease_date(), Constants.FORMAT_MOVIE_DATE);
        mTvRelease.setText(movieDate);

        mTvSynopsis.setText(favourite.getOverview());
        mRbVoteAverage.setRating(mMovieDetailPresenterImp.getVoteAverage(favourite.getVote_average()));
        mTvHomepage.setText(favourite.getHomepage());

        final String runningTime = "Running time " + favourite.getRuntime() + " minutes";
        mTvRuntime.setText(runningTime);

        mTvVoteAverage.setText(String.valueOf(favourite.getVote_average()));
        Timber.d("movie.getVote_average %f", favourite.getVote_average());

        GlideApp.with(MovieDetailViewImp.this)
                .load(MovieImage.build(favourite.getPoster_path(), MovieImage.ImageSize.w185))
                .transform(new MultiTransformation<>(
                        new RoundedCornersTransformation(16, 4, RoundedCornersTransformation.CornerType.ALL),
                        new jp.wasabeef.glide.transformations.BlurTransformation(5, 2)))
                .priority(Priority.NORMAL)
                .into(mIvThumbnail);

        /* Bind the data */
        GlideApp.with(MovieDetailViewImp.this)
                .load(MovieImage.build(favourite.getBackdrop_path(), MovieImage.ImageSize.w500))
                .priority(Priority.HIGH)
                .into(mIvBackdropPoster);

    }

    @Override
    public void failedToReceiveMovieReviews(String errorMessage) {
        Timber.e("failedToReceiveMovieReviews %s", errorMessage);
    }

    @Override
    public void onInsertFavouriteSuccess() {
        Timber.d("onInsertFavouriteSuccess");
    }

    @Override
    public void onInsertFavouriteFailure(String errorMessage) {
        Timber.e("onInsertFavouriteFailure %s", errorMessage);
    }

    @Override
    public void onDeleteFavouriteMovieSuccess(int rowDeletedId) {
        Timber.d("onDeleteFavouriteMovieSuccess %d", rowDeletedId);
    }

    @Override
    public void onDeleteFavouriteMovieFailure(String errorMessage) {
        Timber.e("onDeleteFavouriteMovieFailure: %s", errorMessage);
    }

    @Override
    public void onHasMovieFavouriteSuccess(int movieId, boolean isFavourite) {
        if(isFavourite) {
            Timber.d("onMovieFavouriteSuccess %d", movieId);
            addMovieAsFavourite(mFabMovieFavourite);
            animateAddingFavourite();
            /* Populate the views from the database */
            mMovieFavouritePresenterContact.getMovieFavourite(movieId);
            mMovieDetailPresenterImp.requestMovieTrailer(movieId);
            mMovieDetailPresenterImp.requestMovieReviews(movieId);
        }
        else {
            Timber.d("onMovieFavouriteSuccess %d", movieId);
            mMovieDetailPresenterImp.getMovieDetail(movieId);
            mMovieDetailPresenterImp.requestMovieTrailer(movieId);
            mMovieDetailPresenterImp.requestMovieReviews(movieId);
        }
    }

    @Override
    public void onHasMovieFavouriteFailure(String errorMessage) {
        Timber.d("onHasMovieFavouriteFailure %s", errorMessage);
    }

    @Override
    public void failedToReceiveMovieActors(String errorMessage) {
        Timber.d(errorMessage);
        Toast.makeText(getActivity(), "Failed to get movie actors", Toast.LENGTH_LONG).show();
    }

    @Override
    public void successToReceiveMovieActors(Cast<Actor> actorList) {
        movieActorsAdapter.populateActors(actorList);
    }

    @Override
    public void failedToGetSimilarMovies(String errorMessage) {
        Timber.e("FailedToGetSimilarMovies: %s", errorMessage);

    }

    @Override
    public void successToGetSimilarMovies(Results<Movies> similarMovies) {
        Timber.d("successToGetSimilarMovies: %d", similarMovies.getResults().size());
        similarMovieAdapter.loadAdapter(similarMovies);
    }
}


text:
import { fetchEntitiesIfCan } from './entities'

// define and export grids actions constants
export const MOVE_PRE_FETCHED = 'MOVE_PRE_FETCHED'
export const CHANGE_SORT = 'CHANGE_SORT'
export const RESET_GRID = 'RESET_GRID'

/**
 * Action to move all pre fetched to items on the grid.
 * @param  {String} grid Name of grid that will be updated
 * @return {Object}      Payload for the action
 */
export const movePreFetched = grid => ({
  type: MOVE_PRE_FETCHED,
  grid
})

/**
 * Action to change the sort of the grid.
 * @param  {String} grid Name of grid that will be updated
 * @param  {String} sort Sort type to change
 * @return {Object}      Payload for the action
 */
const changeSort = (grid, sort) => ({
  type: CHANGE_SORT,
  grid,
  sort
})

/**
 * Action to reset the grid.
 * @param  {String} grid Name of grid that will be reseted
 * @return {Object}      Payload for the action
 */
const resetGrid = grid => ({
  type: RESET_GRID,
  grid
})

/**
 * Action to change the sort of the visible grid.
 * @param  {String}   sort The new sort type of visible grid
 * @return {Function}      A function that will get executed by the Redux Thunk middleware
 */
export const sortVisibleGridBy = sort => (dispatch, getState) => {
  // get current state
  const state = getState()

  // get visible grid from state
  const grid = state.app.visibleGrid

  // tells the app to reset the grid
  dispatch(resetGrid(grid))

  // tells the app to change the sort of grid
  dispatch(changeSort(grid, sort))

  // tells the app to fetch entities for the grid
  dispatch(fetchEntitiesIfCan(grid))
}


text:
using System;

namespace EmsApi.Dto.V2
{
    /// <summary>
    /// A date+time range that defines an EMS System maintenance window.
    /// </summary>
    public class MaintenanceWindow
    {
        /// <summary>
        /// The start of the next maintenance window or the start of the current maintenance window if we are currently
        /// within one.
        /// </summary>
        public DateTime StartUtc { get; set; }

        /// <summary>
        /// The end of the next maintenance window.
        /// </summary>
        public DateTime EndUtc { get; set; }
    }
}


text:
class Profile;

namespace ash {
namespace edu_coexistence {

// The first google3 cl number that is sent through a policy which is mapped
// to |ash::prefs::kEduCoexistenceToSVersion|. All version numbers sent
// will be greater than or equal to |kMinTOSVersionNumber|.
extern const char kMinTOSVersionNumber[];

// Used to store the gaia id and corresponding accepted terms of
// service version number. The user is the child account but the parent is the
// one who accepts the terms of service.
struct UserConsentInfo {
  UserConsentInfo(const std::string& gaia_id, const std::string& version);
  std::string edu_account_gaia_id;
  std::string edu_coexistence_tos_version;
};

// Returns true if `lhs_version` as a version int is less than
// the version int of `rhs_version`.
// If any of the version strings is invalid, returns false.
bool IsConsentVersionLessThan(const std::string& lhs_version,
                              const std::string& rhs_version);

// Used by EduCoexistenceLoginHandler to insert/update the stored
// UserConsentInfo when the user completes adding their secondary edu account.
// If the account already exists in user's pref, then its accepted tos will be
// updated. Otherwise, a new entry will be created.
// The pref that is used to store the UserConsentInfo is defined in:
// |ash::prefs::kEduCoexistenceToSAcceptedVersion|
// Unlike |SetUserConsentInfoListForProfile| this doesn't overwrite the entire
// stored UserConsentInfo list; it instead updates it.
void UpdateAcceptedToSVersionPref(Profile* profile,
                                  const UserConsentInfo& user_consent_info);

// Overwrites the stored UserConsentInfo to be |user_consent_info_list|.
void SetUserConsentInfoListForProfile(
    Profile* profile,
    const std::vector<UserConsentInfo>& user_consent_info_list);

// Returns the list of UserConsentInfo stored in
// |ash::prefs::kEduCoexistenceToSAcceptedVersion|.
std::vector<UserConsentInfo> GetUserConsentInfoListForProfile(Profile* profile);

// |profile| is the Primary user profile which is the family link user.
std::string GetAcceptedToSVersion(Profile* profile,
                                  const std::string& secondary_edu_gaia_id);

}  // namespace edu_coexistence
}  // namespace ash

#endif  // CHROME_BROWSER_ASH_CHILD_ACCOUNTS_EDU_COEXISTENCE_TOS_STORE_UTILS_H_


text:
package org.apereo.cas.configuration.model.support.saml.sps;

import org.apereo.cas.configuration.support.RequiresModule;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

/**
 * This is {@link SamlServiceProviderProperties}.
 *
 * @author Misagh Moayyed
 * @since 5.0.0
 */
@RequiresModule(name = "cas-server-support-saml-sp-integrations")
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class SamlServiceProviderProperties implements Serializable {

    private static final long serialVersionUID = 8602328179113963081L;
    /**
     * Settings related to ConcurSolutions acting as a SAML service provider.
     */
    private ConcurSolutions concurSolutions = new ConcurSolutions();
    /**
     * Settings related to Qualtrics acting as a SAML service provider.
     */
    private Qualtrics qualtrics = new Qualtrics();
    /**
     * Settings related to Emma acting as a SAML service provider.
     */
    private Emma emma = new Emma();
    /**
     * Settings related to CrashPlan acting as a SAML service provider.
     */
    private CrashPlan crashPlan = new CrashPlan();
    /**
     * Settings related to SafariOnline acting as a SAML service provider.
     */
    private SafariOnline safariOnline = new SafariOnline();
    /**
     * Settings related to TopHat acting as a SAML service provider.
     */
    private TopHat topHat = new TopHat();
    /**
     * Settings related to DocuSign acting as a SAML service provider.
     */
    private DocuSign docuSign = new DocuSign();
    /**
     * Settings related to PagerDuty acting as a SAML service provider.
     */
    private PagerDuty pagerDuty = new PagerDuty();
    /**
     * Settings related to JIRA acting as a SAML service provider.
     */
    private Jira jira = new Jira();
    /**
     * Settings related to PollEverywhere acting as a SAML service provider.
     */
    private PollEverywhere pollEverywhere = new PollEverywhere();
    /**
     * Settings related to Hipchat acting as a SAML service provider.
     */
    private Hipchat hipchat = new Hipchat();
    /**
     * Settings related to Gitlab acting as a SAML service provider.
     */
    private Gitlab gitlab = new Gitlab();
    /**
     * Settings related to Dropbox acting as a SAML service provider.
     */
    private Dropbox dropbox = new Dropbox();
    /**
     * Settings related to Workday acting as a SAML service provider.
     */
    private Workday workday = new Workday();
    /**
     * Settings related to SA Manage acting as a SAML service provider.
     */
    private SAManage saManage = new SAManage();
    /**
     * Settings related to Salesforce acting as a SAML service provider.
     */
    private Salesforce salesforce = new Salesforce();
    /**
     * Settings related to ServiceNow acting as a SAML service provider.
     */
    private ServiceNow serviceNow = new ServiceNow();
    /**
     * Settings related to Box acting as a SAML service provider.
     */
    private Box box = new Box();
    /**
     * Settings related to NetPartner acting as a SAML service provider.
     */
    private NetPartner netPartner = new NetPartner();
    /**
     * Settings related to Webex acting as a SAML service provider.
     */
    private Webex webex = new Webex();
    /**
     * Settings related to Office365 acting as a SAML service provider.
     */
    private Office365 office365 = new Office365();
    /**
     * Settings related to InCommon acting as a SAML service provider.
     */
    private InCommon inCommon = new InCommon();
    /**
     * Settings related to ZOOM acting as a SAML service provider.
     */
    private Zoom zoom = new Zoom();
    /**
     * Settings related to Evernote acting as a SAML service provider.
     */
    private Evernote evernote = new Evernote();
    /**
     * Settings related to Asana acting as a SAML service provider.
     */
    private Asana asana = new Asana();
    /**
     * Settings related to Gartner acting as a SAML service provider.
     */
    private Gartner gartner = new Gartner();
    /**
     * Settings related to Tableu acting as a SAML service provider.
     */
    private Tableau tableau = new Tableau();
    /**
     * Settings related to WebAdvisor acting as a SAML service provider.
     */
    private WebAdvisor webAdvisor = new WebAdvisor();
    /**
     * Settings related to OpenAthens acting as a SAML service provider.
     */
    private OpenAthens openAthens = new OpenAthens();
    /**
     * Settings related to ArcGIS acting as a SAML service provider.
     */
    private ArcGIS arcGIS = new ArcGIS();
    /**
     * Settings related to BenefitFocus acting as a SAML service provider.
     */
    private BenefitFocus benefitFocus = new BenefitFocus();
    /**
     * Settings related to Adobe Cloud acting as a SAML service provider.
     */
    private AdobeCloud adobeCloud = new AdobeCloud();
    /**
     * Settings related to Academic Works acting as a SAML service provider.
     */
    private AcademicWorks academicWorks = new AcademicWorks();
    /**
     * Settings related to Easy IEP acting as a SAML service provider.
     */
    private EasyIep easyIep = new EasyIep();
    /**
     * Settings related to InfiniteCampus acting as a SAML service provider.
     */
    private InfiniteCampus infiniteCampus = new InfiniteCampus();
    /**
     * Settings related to SecuringTheHuman acting as a SAML service provider.
     */
    private SecuringTheHuman sansSth = new SecuringTheHuman();
    /**
     * Settings related to Slack acting as a SAML service provider.
     */
    private Slack slack = new Slack();
    /**
     * Settings related to Zendesk acting as a SAML service provider.
     */
    private Zendesk zendesk = new Zendesk();
    /**
     * Settings related to Bynder acting as a SAML service provider.
     */
    private Bynder bynder = new Bynder();
    /**
     * Settings related to Famis acting as a SAML service provider.
     */
    private Famis famis = new Famis();
    /**
     * Settings related to Sunshine state ed/release alliance acting as a SAML service provider.
     */
    private SunshineStateEdResearchAlliance sserca = new SunshineStateEdResearchAlliance();
    /**
     * Settings related to EverBridge acting as a SAML service provider.
     */
    private EverBridge everBridge = new EverBridge();
    /**
     * Settings related to CherWell acting as a SAML service provider.
     */
    private CherWell cherWell = new CherWell();
    /**
     * Settings related to CherWell acting as a SAML service provider.
     */
    private Egnyte egnyte = new Egnyte();
    /**
     * Settings related to CherWell acting as a SAML service provider.
     */
    private NewRelic newRelic = new NewRelic();
    /**
     * Settings related to Yuja acting as a SAML service provider.
     */
    private Yuja yuja = new Yuja();
    /**
     * Settings related to Confluence acting as a SAML service provider.
     */
    private Confluence confluence = new Confluence();
    /**
     * Settings related to Zimbra acting as a SAML service provider.
     */
    private Zimbra zimbra = new Zimbra();
    /**
     * Settings related to Symplicity acting as a SAML service provider.
     */
    private Symplicity symplicity = new Symplicity();
    /**
     * Settings related to AppDynamics acting as a SAML service provider.
     */
    private AppDynamics appDynamics = new AppDynamics();
    /**
     * Settings related to Amazon acting as a SAML service provider.
     */
    private Amazon amazon = new Amazon();
    /**
     * Settings related to BlackBaud acting as a SAML service provider.
     */
    private BlackBaud blackBaud = new BlackBaud();
    /**
     * Settings related to GiveCampus acting as a SAML service provider.
     */
    private GiveCampus giveCampus = new GiveCampus();
    /**
     * Settings related to WarpWire acting as a SAML service provider.
     */
    private WarpWire warpWire = new WarpWire();
    /**
     * Settings related to RocketChat acting as a SAML service provider.
     */
    private RocketChat rocketChat = new RocketChat();
    /**
     * Settings related to ArmsSoftware acting as a SAML service provider.
     */
    private ArmsSoftware armsSoftware = new ArmsSoftware();
    /**
     * Settings related to Academic HealthPlans acting as a SAML service provider.
     */
    private AcademicHealthPlans academicHealthPlans = new AcademicHealthPlans();
    /**
     * Settings related to NeoGov acting as a SAML service provider.
     */
    private NeoGov neoGov = new NeoGov();
    /**
     * Settings related to Cranium Cafe acting as a SAML service provider.
     */
    private CraniumCafe craniumCafe = new CraniumCafe();
    /**
     * Settings related to CCC acting as a SAML service provider.
     */
    private CaliforniaCommunityColleges cccco = new CaliforniaCommunityColleges();

    @Getter
    private enum CommonAttributeNames {
        /**
         * Attribute name.
         */
        EDU_PERSON_PRINCIPAL_NAME("eduPersonPrincipalName"),
        /**
         * Attribute name.
         */
        EDU_PERSON_PRIMARY_AFFILIATION("eduPersonPrimaryAffiliation"),
        /**
         * Attribute name.
         */
        EDU_PERSON_AFFILIATION("eduPersonAffiliation"),
        /**
         * Attribute name.
         */
        EDU_PERSON_SCOPED_AFFILIATION("eduPersonScopedAffiliation"),
        /**
         * Attribute name.
         */
        GIVEN_NAME("givenName"),
        /**
         * Attribute name.
         */
        DISPLAY_NAME("displayName"),
        /**
         * Attribute name.
         */
        SURNAME("surname"),
        /**
         * Attribute name.
         */
        UID("uid"),
        /**
         * Attribute name.
         */
        COMMON_NAME("commonName"),
        /**
         * Attribute name.
         */
        USERNAME("username"),
        /**
         * Attribute name.
         */
        FIRST_NAME("firstName"),
        /**
         * Attribute name.
         */
        LAST_NAME("lastName"),
        /**
         * Attribute name.
         */
        SN("sn"),
        /**
         * Attribute name.
         */
        CN("cn"),
        /**
         * Attribute name.
         */
        MAIL("mail"),
        /**
         * Attribute name.
         */
        EMPLOYEE_NUMBER("employeeNumber"),
        /**
         * Attribute name.
         */
        STUDENT_ID("studentId"),
        /**
         * Attribute name.
         */
        IMMUTABLE_ID("ImmutableID"),

        /**
         * Attribute name.
         */
        EMAIL("email");

        /**
         * Attribute name.
         */
        private final String attributeName;

        CommonAttributeNames(final String name) {
            this.attributeName = name;
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Dropbox extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -8275173711355379058L;

        public Dropbox() {
            setNameIdAttribute(CommonAttributeNames.MAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Box extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -5320292115253509284L;

        public Box() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.FIRST_NAME.getAttributeName(),
                CommonAttributeNames.LAST_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class SAManage extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -8695176237527302883L;

        public SAManage() {
            setNameIdAttribute(CommonAttributeNames.MAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Workday extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 3484810792914261584L;

        public Workday() {
            setSignAssertions(true);
            setSignResponses(true);
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Famis extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 4685484530782109454L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Salesforce extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 4685484530782109454L;

        public Salesforce() {
            addAttributes(CommonAttributeNames.MAIL.getAttributeName(), CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class ServiceNow extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 4329681021653966734L;

        public ServiceNow() {
            addAttributes(CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class NetPartner extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 5262806306575955633L;

        public NetPartner() {
            setNameIdAttribute(CommonAttributeNames.STUDENT_ID.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Office365 extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 5878458463269060163L;

        public Office365() {
            setNameIdAttribute("objectGUID");
            addAttributes("IDPEmail", CommonAttributeNames.IMMUTABLE_ID.getAttributeName());
            setSignResponses(false);
            setSignAssertions(true);
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class WebAdvisor extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 8449304623099588610L;

        public WebAdvisor() {
            addAttributes(CommonAttributeNames.UID.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Webex extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 1957066095836617091L;

        public Webex() {
            setNameIdAttribute(CommonAttributeNames.EMAIL.getAttributeName());
            addAttributes(CommonAttributeNames.FIRST_NAME.getAttributeName(), CommonAttributeNames.LAST_NAME.getAttributeName());
            setSignResponses(false);
            setSignAssertions(true);
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Tableau extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -2426590644028989950L;

        public Tableau() {
            addAttributes(CommonAttributeNames.USERNAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Zoom extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -4877129302021248398L;

        public Zoom() {
            setNameIdAttribute(CommonAttributeNames.MAIL.getAttributeName());
            addAttributes(CommonAttributeNames.MAIL.getAttributeName(),
                CommonAttributeNames.SN.getAttributeName(), CommonAttributeNames.GIVEN_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class ArcGIS extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 2976006720801066953L;

        public ArcGIS() {
            setNameIdAttribute("arcNameId");
            addAttributes(CommonAttributeNames.MAIL.getAttributeName(), CommonAttributeNames.GIVEN_NAME.getAttributeName(), "arcNameId");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class InCommon extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6336757169059216490L;

        /**
         * InCommon metadata should
         * be available here.
         */
        public InCommon() {
            addAttributes(CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Evernote extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -1333379518527897627L;

        public Evernote() {
            setNameIdAttribute(CommonAttributeNames.EMAIL.getAttributeName());
            setNameIdFormat("emailAddress");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Asana extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 6392492484052314295L;

        public Asana() {
            setNameIdAttribute(CommonAttributeNames.EMAIL.getAttributeName());
            setNameIdFormat("emailAddress");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class OpenAthens extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 7295249577313928465L;

        public OpenAthens() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(), CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class BenefitFocus extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6518570556068267724L;

        public BenefitFocus() {
            setNameIdAttribute("benefitFocusUniqueId");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class AdobeCloud extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -5466434234795577247L;

        public AdobeCloud() {
            addAttributes(CommonAttributeNames.FIRST_NAME.getAttributeName(), CommonAttributeNames.LAST_NAME.getAttributeName(),
                CommonAttributeNames.EMAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class AcademicWorks extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 5855725238963607605L;

        public AcademicWorks() {
            addAttributes(CommonAttributeNames.DISPLAY_NAME.getAttributeName(), CommonAttributeNames.EMAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class EasyIep extends AbstractSamlSPProperties {

        private static final long serialVersionUID = 6177866628049579956L;

        public EasyIep() {
            addAttributes("employeeId");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class InfiniteCampus extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -9023417844664430533L;

        public InfiniteCampus() {
            addAttributes("employeeId");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class SecuringTheHuman extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -1688194227471468248L;

        public SecuringTheHuman() {
            addAttributes(CommonAttributeNames.FIRST_NAME.getAttributeName(), CommonAttributeNames.LAST_NAME.getAttributeName(),
                CommonAttributeNames.EMAIL.getAttributeName(), "scopedUserId", "department", "reference");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Slack extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -1996859011579246804L;

        public Slack() {
            setNameIdFormat("persistent");
            addAttributes("User.Email", "User.Username", "first_name", "last_name");
            setNameIdAttribute("employeeId");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Zendesk extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -4668960591734555087L;

        public Zendesk() {
            setNameIdFormat("emailAddress");
            setNameIdAttribute("email");
            addAttributes("organization", "tags", "phone", "role");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Bynder extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -3168960591734555088L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class CherWell extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -3168960591734555088L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class NewRelic extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -3268960591734555088L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Yuja extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -1168960591734555088L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Symplicity extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -3178960591734555088L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Egnyte extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -3168760591734555088L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class EverBridge extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -5168960591734555088L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class SunshineStateEdResearchAlliance extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -5558960591734555088L;
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Gartner extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public Gartner() {
            addAttributes("urn:oid:2.5.4.42", "urn:oid:2.5.4.4", "urn:oid:0.9.2342.19200300.100.1.3");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Gitlab extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public Gitlab() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(), "last_name", "first_name", "name");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Hipchat extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public Hipchat() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(), "last_name", "first_name", "title");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class AppDynamics extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public AppDynamics() {
            addAttributes("User.OpenIDName", "User.email", "User.fullName", "AccessControl", "Groups-Membership");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Amazon extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public Amazon() {
            setSignAssertions(true);
            setSignResponses(false);
            addAttributes("awsRoles", "awsRoleSessionName");
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class PollEverywhere extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public PollEverywhere() {
            setSignAssertions(true);
            setSignResponses(false);
            setNameIdAttribute(CommonAttributeNames.EMAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class ConcurSolutions extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public ConcurSolutions() {
            setSignAssertions(true);
            setSignResponses(false);
            setNameIdAttribute(CommonAttributeNames.EMAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class BlackBaud extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public BlackBaud() {
            setSignAssertions(true);
            setSignResponses(false);
            addAttributes(CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName(), CommonAttributeNames.EMAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class GiveCampus extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public GiveCampus() {
            setSignAssertions(true);
            setSignResponses(false);
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName(),
                CommonAttributeNames.DISPLAY_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class RocketChat extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public RocketChat() {
            setSignAssertions(true);
            setSignResponses(false);
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.CN.getAttributeName(),
                CommonAttributeNames.USERNAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class WarpWire extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public WarpWire() {
            setSignAssertions(true);
            setSignResponses(false);
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName(),
                CommonAttributeNames.EMPLOYEE_NUMBER.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_SCOPED_AFFILIATION.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class ArmsSoftware extends AbstractSamlSPProperties {

        private static final long serialVersionUID = -6141931806328699054L;

        public ArmsSoftware() {
            setEntityIds(List.of("https://sso.armssoftware.com/sp/shibboleth"));

            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.UID.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class AcademicHealthPlans extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public AcademicHealthPlans() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName(),
                CommonAttributeNames.STUDENT_ID.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class NeoGov extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public NeoGov() {
            setEntityIds(List.of("https://login.neogov.com/"));
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.IMMUTABLE_ID.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class CraniumCafe extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public CraniumCafe() {
            setEntityIds(List.of("https://my.craniumcafe.com/login/saml2"));
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_SCOPED_AFFILIATION.getAttributeName(),
                CommonAttributeNames.STUDENT_ID.getAttributeName(),
                CommonAttributeNames.DISPLAY_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class CaliforniaCommunityColleges extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public CaliforniaCommunityColleges() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.UID.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName(),
                CommonAttributeNames.COMMON_NAME.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_PRIMARY_AFFILIATION.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_SCOPED_AFFILIATION.getAttributeName(),
                CommonAttributeNames.DISPLAY_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Confluence extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public Confluence() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.UID.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName(),
                CommonAttributeNames.DISPLAY_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Jira extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public Jira() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.UID.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName(),
                CommonAttributeNames.DISPLAY_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class CrashPlan extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public CrashPlan() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class DocuSign extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public DocuSign() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName(),
                CommonAttributeNames.EMPLOYEE_NUMBER.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class SafariOnline extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public SafariOnline() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName(),
                CommonAttributeNames.EMPLOYEE_NUMBER.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_AFFILIATION.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class PagerDuty extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public PagerDuty() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Zimbra extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public Zimbra() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class TopHat extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public TopHat() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Emma extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public Emma() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName());
        }
    }

    @RequiresModule(name = "cas-server-support-saml-sp-integrations")
    @Getter
    @Setter
    @Accessors(chain = true)
    public static class Qualtrics extends AbstractSamlSPProperties {
        private static final long serialVersionUID = -6141931806328699054L;

        public Qualtrics() {
            addAttributes(CommonAttributeNames.EMAIL.getAttributeName(),
                CommonAttributeNames.SURNAME.getAttributeName(),
                CommonAttributeNames.EDU_PERSON_PRINCIPAL_NAME.getAttributeName(),
                CommonAttributeNames.EMPLOYEE_NUMBER.getAttributeName(),
                CommonAttributeNames.GIVEN_NAME.getAttributeName());
        }
    }
}


text:
module Blorgh
  class Post < ActiveRecord::Base
  	has_many :comments
  	attr_accessor :author_name
	belongs_to :author, class_name: "User".to_s

	before_save :set_author

	private
	  def set_author
	    self.author = User.find_or_create_by(name: author_name)
	  end
  end
end


text:
[![Build Status][ico-travis]][link-travis]
[![StyleCI][ico-styleci]][link-styleci]
[![ScrutinizerCI][ico-scrutinizer]][link-scrutinizer]
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)

## Requirements
This package requires PHP 7.0 or higher.

## Installation

You can install the package via composer:

``` bash
$ composer require tzurbaev/laravel-achievements
```

## Documentation

## Change log

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## Testing

``` bash
$ vendor/bin/phpunit
```

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Security

If you discover any security related issues, please email zurbaev@gmail.com instead of using the issue tracker.

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

[ico-version]: https://poser.pugx.org/tzurbaev/laravel-achievements/version?format=flat
[ico-license]: https://poser.pugx.org/tzurbaev/laravel-achievements/license?format=flat
[ico-travis]: https://api.travis-ci.org/tzurbaev/laravel-achievements.svg?branch=master
[ico-styleci]: https://styleci.io/repos/95869727/shield?branch=master&style=flat
[ico-scrutinizer]: https://scrutinizer-ci.com/g/tzurbaev/laravel-achievements/badges/quality-score.png?b=master

[link-packagist]: https://packagist.org/packages/tzurbaev/laravel-achievements
[link-travis]: https://travis-ci.org/tzurbaev/laravel-achievements
[link-styleci]: https://styleci.io/repos/95869727
[link-scrutinizer]: https://scrutinizer-ci.com/g/tzurbaev/laravel-achievements/
[link-author]: https://github.com/tzurbaev


text:
/*****************************************************************************
  * MetaWatch.java                                                            *
  * MetaWatch                                                                 *
  * Main activity with menu                                                            *
  *                                                                           *
  *                                                                           *
  *****************************************************************************/

package org.metawatch.manager;

import org.metawatch.manager.MetaWatchService.Preferences;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.webkit.WebView;

public class MetaWatch extends Activity {

	public static final String TAG = "MetaWatch";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        setTitle(getString(R.string.app_name));
    }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.menu, menu);
	    return true;
	}

	@Override
	protected void onStart() {
		super.onStart();

		MetaWatchService.loadPreferences(this);

		if (Preferences.idleMusicControls)
			Protocol.enableMediaButtons();
		//else
			//Protocol.disableMediaButtons();

		if (Preferences.idleReplay)
			Protocol.enableReplayButton();
		//else
			//Protocol.disableReplayButton();

		Protocol.configureMode();
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
	    case R.id.start:
	    	startService();
	        return true;
	    case R.id.stop:
	    	stopService();
	        return true;
	    case R.id.test:
	    	startActivity(new Intent(this, Test.class));
	        return true;
	    case R.id.settings:
	    	startActivity(new Intent(this, Settings.class));
	        return true;
	    case R.id.about:
	    	showAbout();
	        return true;
	    case R.id.exit:
	    	exit();
	        return true;
	    default:
	        return super.onOptionsItemSelected(item);
	    }
	}

	void startService() {
		startService(new Intent(this, MetaWatchService.class));
	}

    void stopService() {
    	stopService(new Intent(this, MetaWatchService.class));
    }

    void exit() {
    	System.exit(0);
    }

    void showAbout() {

    	WebView webView = new WebView(this);
		String html = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><title>About</title>" +
						"
MetaWatch
" +
						"
Version " + Utils.getVersion(this) + ".
" +
						"
© Copyright 2011 Meta Watch Ltd.
" +
						"";
        webView.loadData(html, "text/html", "utf-8");

        new AlertDialog.Builder(this).setView(webView).setCancelable(true).setPositiveButton("OK", new DialogInterface.OnClickListener() {
			//@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		}).show();
    }

}


text:
package de.atomfrede.github.karaoke.server.entity;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;

import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.MatcherAssert.assertThat;

public class SongsTest {

    @Test
    public void assertThatSongAreAdded() {

        Songs songs = new Songs();

        Song killerQueen = new Song().setInterpreter("Queen").setTitle("Killerqueen");
        Song yourSong = new Song().setInterpreter("Elton John").setTitle("Your Song");

        List<Song> listOfSongs = Arrays.asList(killerQueen, yourSong);

        songs.setSongs(listOfSongs);

        assertThat(songs.getSongs(), hasItems(killerQueen, yourSong));
    }
}


text:
<?php

// src/Admin/AdminBundle/Controller/CSVController.php

namespace Suppliercheck\AdminBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Suppliercheck\AdminBundle\Helper\CSVTypes;
use Ddeboer\DataImport\Reader\CsvReader;
use Ddeboer\DataImport\Source\StreamSource;
use Ddeboer\DataImport\Workflow;
use Ddeboer\DataImport\Writer\DoctrineWriter;

class CSVController extends Controller
{

    public function importFileAction(Request $request) {

    	// Create and configure the reader
    	$file = new \SplFileObject('directly.csv',"r");

    	//$file->setFlags(SplFileObject::READ_CSV);
    	$csvReader = new CsvReader($file, "," );
    	var_dump($csvReader);

    	// Tell the reader that the first row in the CSV file contains column headers
    	$csvReader->setHeaderRowNumber(0);

    	// Create the workflow from the reader
    	$workflow = new Workflow($csvReader);

    	// Create a writer: you need Doctrine's EntityManager.
    	$em=$this->getDoctrine()->getManager();
    	$doctrineWriter = new DoctrineWriter($em, 'SuppliercheckAdminBundle:Product');
    	$workflow->addWriter($doctrineWriter);
    	$doctrineWriter->setTruncate(false);

    	//$entityMetadata=$em->getClassMetadata('AdminAdminBundle:Product');
    	//$entityMetadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_AUTO);

    	// Process the workflow
    	$workflow->process();

		//var_dump($workflow);
        return $this->render('SuppliercheckAdminBundle:Default:csv_import.html.twig');
    }

}


text:
// Template Source: Enum.java.tt
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All Rights Reserved.  Licensed under the MIT License.  See License in the project root for license information.
// ------------------------------------------------------------------------------

package com.microsoft.graph.models;

/**
 * The Enum User Flow Type.
*/
public enum UserFlowType
{
    /**
    * sign Up
    */
    SIGN_UP,
    /**
    * sign In
    */
    SIGN_IN,
    /**
    * sign Up Or Sign In
    */
    SIGN_UP_OR_SIGN_IN,
    /**
    * password Reset
    */
    PASSWORD_RESET,
    /**
    * profile Update
    */
    PROFILE_UPDATE,
    /**
    * resource Owner
    */
    RESOURCE_OWNER,
    /**
    * unknown Future Value
    */
    UNKNOWN_FUTURE_VALUE,
    /**
    * For UserFlowType values that were not expected from the service
    */
    UNEXPECTED_VALUE
}


text:
    <mat-spinner *ngIf="isLoadingResults"></mat-spinner>

      GitHub's API rate limit has been reached. It will be reset in one minute.

    <ng-container matColumnDef="number">
      #
      {{ row.number }}
    </ng-container>

    <ng-container matColumnDef="title">
      Title
      {{ row.title }}
    </ng-container>

    <ng-container matColumnDef="state">
      State
      {{ row.state }}
    </ng-container>

    <ng-container matColumnDef="created">

        Created

      {{ row.created_at | date }}
    </ng-container>

  <mat-paginator [length]="resultsLength" [pageSize]="30">
  </mat-paginator>


text:
namespace content {
class BrowserContext;
class RenderViewHostTestEnabler;
class WebContents;

// A helper class to create test web contents (tabs) for unit tests, without
// inheriting from RenderViewTestHarness. Can create web contents, and will
// clean up after itself upon destruction. Owns all created web contents.
// A few notes:
// - Works well allocated on the stack, because it should be destroyed before
//   associated browser context.
// - Doesn't play nice with web contents created any other way (because of
//   the implementation of RenderViewHostTestEnabler). But if you are creating
//   web contents already, what do you need this for? ;)
// TODO(devlin): The API is currently a bit sparse; there may need to be methods
// to, e.g., delete/close a web contents, access existing web contents, etc.
// These can be added as-needed.
class TestWebContentsFactory {
 public:
  TestWebContentsFactory();
  ~TestWebContentsFactory();

  // Creates a new WebContents with the given |context|, and returns it.
  // Ownership remains with the TestWebContentsFactory.
  WebContents* CreateWebContents(BrowserContext* context);

 private:
  // The test factory (and friends) for creating test web contents.
  scoped_ptr<RenderViewHostTestEnabler> rvh_enabler_;

  // The vector of web contents that this class created.
  ScopedVector<WebContents> web_contents_;

  DISALLOW_COPY_AND_ASSIGN(TestWebContentsFactory);
};

}  // namespace content

#endif  // CONTENT_PUBLIC_TEST_TEST_WEB_CONTENTS_FACTORY_H_


text:
namespace ChilliSource
{
	namespace Rendering
	{
		CS_DEFINE_NAMEDTYPE(AngularAccelerationParticleAffectorDef);
		//----------------------------------------------------------------
		//----------------------------------------------------------------
		AngularAccelerationParticleAffectorDef::AngularAccelerationParticleAffectorDef(ParticlePropertyUPtr<f32> in_angularAccelerationProperty)
			: m_angularAccelerationProperty(std::move(in_angularAccelerationProperty))
		{
		}
		//----------------------------------------------------------------
		//----------------------------------------------------------------
		AngularAccelerationParticleAffectorDef::AngularAccelerationParticleAffectorDef(const Json::Value& in_paramsJson, const LoadedDelegate& in_asyncDelegate)
		{
			//Angular Acceleration
			Json::Value jsonValue = in_paramsJson.get("AngularAccelerationProperty", Json::nullValue);
			CS_ASSERT(jsonValue.isNull() == false, "No angular acceleration property provided.");
			m_angularAccelerationProperty = ParticlePropertyFactory::CreateProperty<f32>(jsonValue);

			//call the loaded delegate if required.
			if (in_asyncDelegate != nullptr)
			{
				in_asyncDelegate(this);
			}
		}
		//----------------------------------------------------------------
		//----------------------------------------------------------------
		bool AngularAccelerationParticleAffectorDef::IsA(Core::InterfaceIDType in_interfaceId) const
		{
			return (ParticleAffectorDef::InterfaceID == in_interfaceId || AngularAccelerationParticleAffectorDef::InterfaceID == in_interfaceId);
		}
		//----------------------------------------------------------------
		//----------------------------------------------------------------
		ParticleAffectorUPtr AngularAccelerationParticleAffectorDef::CreateInstance(Core::dynamic_array<Particle>* in_particleArray) const
		{
			return ParticleAffectorUPtr(new AngularAccelerationParticleAffector(this, in_particleArray));
		}
		//----------------------------------------------------------------
		//----------------------------------------------------------------
		const ParticleProperty<f32>* AngularAccelerationParticleAffectorDef::GetAngularAccelerationProperty() const
		{
			return m_angularAccelerationProperty.get();
		}
	}
}


text:
package com.founder.fix.fixflow.core.impl.bpmn.behavior;

import org.eclipse.bpmn2.CatchEvent;
import org.eclipse.bpmn2.ThrowEvent;
import org.eclipse.bpmn2.impl.MessageEventDefinitionImpl;

import com.founder.fix.fixflow.core.runtime.ExecutionContext;

public class MessageEventDefinitionBehavior extends MessageEventDefinitionImpl {

	@Override
	public void catchExecute(ExecutionContext executionContext, CatchEvent event) {
		// TODO Auto-generated method stub
		super.catchExecute(executionContext, event);
	}

	@Override
	public void throwExecute(ExecutionContext executionContext, ThrowEvent event) {
		// TODO Auto-generated method stub
		super.throwExecute(executionContext, event);
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE locale SYSTEM "../../../../../lib/pkp/dtd/locale.dtd">

<!--
  * plugins/generic/announcementFeed/locale/ro_RO/locale.xml
  *
  * Copyright (c) 2003-2013 John Willinsky
  * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
  *
  * Localization strings for the ro_RO (Română) locale.
  * KOSSON FECIT
  -->

<locale name="ro_RO" full_name="Română">
	<message key="plugins.generic.announcementfeed.displayName">Modul pentru fluxuri</message>
	<message key="plugins.generic.announcementfeed.description">Acest modul produce agregare web de tip RSS/Atom pentru anunţurile din cadrul revistei.</message>
	<message key="plugins.generic.announcementfeed.settings">Setări</message>
	<message key="plugins.generic.announcementfeed.settings.all">Afişează linkuri la fluxuri pe toate paginile revistei.</message>
	<message key="plugins.generic.announcementfeed.settings.homepage">Afişează linkuri la fluxuri doar pe prima pagină şi pagina pentru anunţuri.</message>
	<message key="plugins.generic.announcementfeed.settings.announcement">Afişează linkuri la fluxuri doar pe pagina anunţurilor.</message>
	<message key="plugins.generic.announcementfeed.settings.recentAnnouncements1">Limitează fluxurile la</message>
	<message key="plugins.generic.announcementfeed.settings.recentAnnouncements2">cele mai recente anunţuri.</message>
	<message key="plugins.generic.announcementfeed.settings.recentItemsRequired">introdu un număr întreg pozitiv pentru cele mai recente anunţuri.</message>
	<message key="plugins.generic.announcementfeed.atom.altText">logo pentru Atom</message>
	<message key="plugins.generic.announcementfeed.rss1.altText">logo pentru RSS1</message>
	<message key="plugins.generic.announcementfeed.rss2.altText">logo pentru RSS2</message>
</locale>


text:
Display an alert message when a graphic is clicked.

![](screenshot.png)

## Use case

A user may wish to select a graphic on a map to view relevant information about it.

## How to use the sample

Select a graphic to identify it. You will see an alert message displayed.

## How it works

1. Create a `GraphicsOverlay` and add it to the `MapView`.
2. Add a `Graphic` along with a `SimpleFillSymbol` to the graphics overlay.
3. Create a `Point` from the location clicked on the map view by the user from the `mouseClicked` signal on the `MapView`.
4. Identify the graphic on the map view with `identifyGraphicsOverlay(graphicsOverlay, mouse.x, mouse.y, tolerance, returnPopupsOnly, max results)`.

## Relevant API

* Graphic
* GraphicsOverlay
* MapView

## Tags

graphics, identify


text:
/*M*
//  PVCS:
//      $Workfile:   ipmild.c  $
//      $Revision:   1.0  $
//      $Modtime:   23 Feb 2005 15:20:14  $
//      $Author:   arcress at users.sourceforge.net  $
//
//  This implements support for the /dev/ldipmi native interface from
//  the LanDesk IPMI driver.
//  Requires linking with libldipmi.a, or equivalent.
//
//  02/23/05 ARC - created, but stubbed out, since the
//                 LanDesk libipmiapi.a isn't clean yet.
 *M*/
/*----------------------------------------------------------------------*
The BSD License

Copyright (c) 2005, Intel Corporation
Copyright (c) 2009 Kontron America, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  a.. Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
  b.. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  c.. Neither the name of Intel Corporation nor the names of its contributors
      may be used to endorse or promote products derived from this software
      without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *----------------------------------------------------------------------*/

#ifdef LINUX
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "ipmicmd.h"   /* for uchar, NCMDS */
// #define uchar    unsigned char
#define MAX_NO_OF_RETRIES       3

// Request structure provided to SendTimedImbpRequest()
#pragma pack(1)
typedef struct {
        uchar   cmdType;        // IMB command
        uchar   rsSa;           // command destination address
        uchar   busType;        // not used
        uchar   netFn;          // IMB command class (network function)
        uchar   rsLun;          // subsystem on destination
        uchar * data;           // command body
        int     dataLength;     // body size
} IMBPREQUESTDATA;
#pragma pack()

#ifdef LINK_LANDESK
/* typedef enum { 0, 1, 2, 3, 4, 5, 6 } ACCESN_STATUS; */
/* Note that this routine name conflicts with ia_ imb routine. */
extern int SendTimedImbpRequest (
        IMBPREQUESTDATA *reqPtr,
        int             timeOut,
        uchar *          respDataPtr,
        int *           respDataLen,
        uchar *          completionCode);
extern int initIPMI();
extern int termIPMI();
static int ipmi_timeout_ld = 100000;  /*100 * 1000 ms = 100 sec */
#endif

extern FILE *fperr;  /*defined in ipmicmd.c*/
extern FILE *fpdbg;  /*defined in ipmicmd.c*/
extern ipmi_cmd_t ipmi_cmds[NCMDS];
#ifdef LINK_LANDESK
static int ipmi_fd = -1;
#endif

int ipmi_open_ld(char fdebugcmd)
{
    int rc = -1;
#ifdef TEST
    char *pdev;

    if (ipmi_fd != -1) return(0);
    pdev = "/dev/ldipmi";
    ipmi_fd = open(pdev, O_RDWR);
    if (ipmi_fd == -1) {
	if (fdebugcmd) printf("ipmi_open_ld: cannot open %s\n",pdev);
	pdev = "/dev/ldipmi/0";
        ipmi_fd = open(pdev, O_RDWR);
    }
#endif
#ifdef  LINK_LANDESK
    rc = initIPMI();
    if (rc != 0) {
	if (fdebugcmd) printf("ipmi_open_ld: cannot open ldipmi, rc=%d errno=%d\n",rc,errno);
	return(-1);
    }
    ipmi_fd = 1;  /*show that open was ok*/
    if (fdebugcmd) printf("ipmi_open_ld: successfully opened ldipmi\n");
#endif
    return(rc);
}

int ipmi_close_ld(void)
{
    int rc = 0;
#ifdef  LINK_LANDESK
    if (ipmi_fd != -1) {
	termIPMI();
	ipmi_fd = -1;
    }
#endif
    return(rc);
}

int ipmicmd_ld( uchar cmd, uchar netfn, uchar lun, uchar sa, uchar bus,
		uchar *pdata, int sdata, uchar *presp, int *sresp,
		uchar *pcc, char fdebugcmd)
{
#ifdef  LINK_LANDESK
   IMBPREQUESTDATA requestData;
   int status = 0;
   uchar * pc;
   int sz, i;

   requestData.cmdType	= cmd;
   requestData.rsSa	= sa;
   requestData.busType	= bus;
   requestData.netFn	= netfn;
   requestData.rsLun	= lun;
   requestData.dataLength = sdata;
   requestData.data       = pdata;

   if (fdebugcmd) {
          sz = sizeof(IMBPREQUESTDATA);
          pc = (uchar *)&requestData.cmdType;
          fprintf(fpdbg,"ipmicmd_ld: request (len=%d): ",sz);
          for (i = 0; i < sz; i++) fprintf(fpdbg,"%02x ",pc[i]);
          fprintf(fpdbg,"\n");
          pc = requestData.data;
          sz = requestData.dataLength;
          fprintf(fpdbg,"  req.data=%p, dlen=%d: ", pc, sz);
          for (i = 0; i < sz; i++) fprintf(fpdbg,"%02x ",pc[i]);
          fprintf(fpdbg,"\n");
        }

   if (ipmi_fd == -1) {
	status = ipmi_open_ld(fdebugcmd);
	if (status != 0) return(status);
   }

   {
	   sz = *sresp;  /* note that sresp must be pre-set */
	   memset(presp, 0, sz);
           for ( i =0 ; i < MAX_NO_OF_RETRIES; i++)
	   {
		*sresp = sz;   /* retries may need to re-init *sresp */
		if((status =SendTimedImbpRequest(&requestData,
				ipmi_timeout_ld, presp, sresp,
				pcc)) == 0 ) {
			break;
			}
		if (fdebugcmd)   // only gets here if error
	          fprintf(fpdbg,"ipmi_cmd_ld: sendImbRequest error status=%x, ccode=%x\n",
                            (uint)status, *pcc);
	   }
   }

    if (fdebugcmd) {  /* if debug, show both good and bad statuses */
	    fprintf(fpdbg,"ipmi_cmd_ld: sendImbRequest status=%x, ccode=%x\n",
                      (uint)status, *pcc);
            if (status == 0) {
               uchar * pc; int sz;
               sz = *sresp;
               pc = (uchar *)presp;
               fprintf(fpdbg,"ipmi_cmd_ld: response (len=%d): ",sz);
               for (i = 0; i < sz; i++) fprintf(fpdbg,"%02x ",pc[i]);
               fprintf(fpdbg,"\n");
            }
        }

    return(status);
#else
    return(-1);
#endif
} /* end ipmicmd_ld() */

int ipmi_cmdraw_ld( uchar cmd, uchar netfn, uchar lun, uchar sa, uchar bus,
		uchar *pdata, int sdata, uchar *presp, int *sresp,
		uchar *pcc, char fdebugcmd)
{
    int rc;
    rc = ipmicmd_ld(cmd, netfn, lun, sa, bus,
                        pdata,sdata,presp,sresp,pcc,fdebugcmd);
    return(rc);
}

int ipmi_cmd_ld(ushort cmd, uchar *pdata, int sdata, uchar *presp,
                int *sresp, uchar *pcc, char fdebugcmd)
{
    int rc, i;

    for (i = 0; i < NCMDS; i++) {
       if (ipmi_cmds[i].cmdtyp == cmd) break;
    }
    if (i >= NCMDS) {
        fprintf(fperr, "ipmi_cmd_ld: Unknown command %x\n",cmd);
        return(-1);
        }
    if (cmd >= CMDMASK) cmd = cmd & CMDMASK;  /* unmask it */
    rc = ipmicmd_ld(cmd, ipmi_cmds[i].netfn, ipmi_cmds[i].lun,
                        ipmi_cmds[i].sa, ipmi_cmds[i].bus,
                        pdata,sdata,presp,sresp,pcc,fdebugcmd);
    return(rc);
}

#ifdef LINK_LANDESK
/* define extra stuff that the LanDesk library needs */
void * _Unwind_Resume(void *context)
{
   printf("called Unwind_Resume\n");
   return(NULL);
}

int  __gxx_personality_v0(void *a)
{
   return(0);
}

#endif

#endif


text:
require_relative '../value_set'
require_relative '../basic_instruction'

module DCPU16
  module Instructions
    class Ife < BasicInstruction
      def initialize
        @opcode = 0xc
      end

      def execute(emulator)
        b = ValueSet.get emulator, @b, @next_word_b
        a = ValueSet.get emulator, @a, @next_word_a
        if a != b
          emulator.skip_instruction
        end
      end
    end
  end
end


text:
%Random sampling analog to pAnalysis to determine significance interval
%if below is commented, must pre-assign img1 and img2
%img1 = input('First img ');
%img2 = input('Second img ');

img1 = cleanImgs(img1);

%find optimum threshold for img2
gamma = 1.2;
while gamma <= 1.5
    testBound = mean(mean(cleanImg2(img2, gamma)))/mean(mean(cleanImg2(img2, gamma+0.1)));
    if testBound > 5
        img2 = cleanImg2(img2, gamma+0.1);
        break
    elseif gamma > 1.4
        gamma = 1.2;
        img2 = cleanImg2(img2, gamma);
        break
    else
        gamma = gamma + 0.1;
    end
end

plaqueStats = getRegionProps(img2);

nullImg = zeros(size(img2));
centers = [];
[rmax, cmax] = size(img1);
theta = (0 : 0.1 : 2*pi);
rad = 50;

%determine valid centroids (clean this code up)
centers = findCenters(rmax, cmax, rad, plaqueStats);

%resample centroids using random values for each x,y to generate random
%distribution of points = size(centers)
sizeCenters = size(centers);
RandNormIm1Int = zeros(1, 20);

for itt =1:20
    for r =1:sizeCenters(1)
        x = rand*(cmax-102);
        y = rand*(rmax-102);
        i = 1;
        while i <= r
            if pdist2([x+51, y+51], [centers(i, 1), centers(i, 2)]) < (rad*1.5)
                x = rand*(cmax-102);
                y = rand*(rmax-102);
                i = 1;
            elseif i < r
                i = i+1;
            elseif i == r
                centers(r,:) = [x+51, y+51];
                break
            end
        end
    end

    %{
    compute average img1 expression from boundaries defined by img2
    object centroids and a circle of radius = (rad)px
    %}

    img1avgs = zeros(1, (sizeCenters(1)));
    %img2avgs = zeros(1, (sizeCenters(1)));

    %compute mean Img1 expression within circles centered on plaques
    for c =1:sizeCenters(1)
        A = nullImg;
        for x=round((centers(c, 1)-rad)):round((centers(c, 1)+rad))
            for y=round((centers(c, 2)-rad)):round((centers(c, 2)+rad))
                if sqrt((x-centers(c, 1))^2 + (y-centers(c, 2))^2) < rad
                    A(y, x) = 1;
                end
            end
        end
        avg1 = regionprops(A, img1, 'MeanIntensity');
        %avg2 = regionprops(A, img2, 'MeanIntensity');
        img1avgs(c) = avg1.MeanIntensity;
        %img2avgs(c) = avg2.MeanIntensity;
    end

    %Img1 object expression per plaque area within a circular region (rad=50)
    normImg1Avgs = img1avgs./(mean(mean(img1)));
    RandNormIm1Int(itt) = mean(normImg1Avgs);
end