UpdateSearchIndexClickListener.java

  1. /*
  2.  * Copyright 2010-2025 James Pether Sörling
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *   http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  *
  16.  *  $Id$
  17.  *  $HeadURL$
  18. */
  19. package com.hack23.cia.web.impl.ui.application.views.pageclicklistener;

  20. import com.hack23.cia.service.api.action.admin.UpdateSearchIndexRequest;
  21. import com.vaadin.ui.Button.ClickEvent;
  22. import com.vaadin.ui.Button.ClickListener;
  23. import com.vaadin.ui.Notification;

  24. /**
  25.  * The Class UpdateSearchIndexClickListener.
  26.  *
  27.  * @see UpdateSearchIndexClickEvent
  28.  */
  29. public class UpdateSearchIndexClickListener extends AbstractClickListener implements ClickListener {

  30.     /** The Constant serialVersionUID. */
  31.     private static final long serialVersionUID = 1L;

  32.     /** The Constant UPDATE_SEARCH_INDEX_STARTED. */
  33.     private static final String UPDATE_SEARCH_INDEX_STARTED = "Update Search Index Started";

  34.     /** The service request. */
  35.     private final UpdateSearchIndexRequest serviceRequest;

  36.     /**
  37.      * Instantiates a new update search index click listener.
  38.      *
  39.      * @param serviceRequest the service request
  40.      */
  41.     public UpdateSearchIndexClickListener(final UpdateSearchIndexRequest serviceRequest) {
  42.         super();
  43.         this.serviceRequest = serviceRequest;
  44.     }

  45.     @Override
  46.     public final void buttonClick(final ClickEvent event) {
  47.         getApplicationManager().asyncService(serviceRequest);
  48.         showNotification(UPDATE_SEARCH_INDEX_STARTED, "desc", Notification.Type.HUMANIZED_MESSAGE);
  49.     }
  50. }