/*
 * Copyright 2017 EPAM Systems
 *
 * This file is part of EPAM Report Portal.
 * https://github.com/reportportal/service-api
 *
 * Report Portal is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Report Portal is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Report Portal.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

package com.epam.ta.reportportal.core.events.activity;

import com.epam.ta.reportportal.core.events.ActivityEvent;
import com.epam.ta.reportportal.entity.Activity;
import com.epam.ta.reportportal.entity.ActivityDetails;

import java.time.LocalDateTime;

/**
 * @author Pavel Bortnik
 */
public class ProjectIndexEvent implements ActivityEvent {

	private final Long projectId;
	private final String projectName;
	private final Long userId;
	private final boolean indexing;

	public ProjectIndexEvent(Long projectId, String projectName, Long userId, boolean indexing) {
		this.projectId = projectId;
		this.projectName = projectName;
		this.userId = userId;
		this.indexing = indexing;
	}

	@Override
	public Activity toActivity() {
		Activity activity = new Activity();
		activity.setCreatedAt(LocalDateTime.now());
		activity.setAction(indexing ? ActivityAction.GENERATE_INDEX.getValue() : ActivityAction.DELETE_INDEX.getValue());
		activity.setEntity(Activity.Entity.PROJECT);
		activity.setProjectId(projectId);
		activity.setUserId(userId);
		activity.setDetails(new ActivityDetails(projectName));
		return activity;
	}
}

@@ -1132,30 +1132,24 @@
 %7B%0A%0A%09private 
-final 
 Long project
@@ -1161,22 +1161,16 @@
 private 
-final 
 String p
@@ -1190,22 +1190,16 @@
 private 
-final 
 Long use
@@ -1216,14 +1216,8 @@
 ate 
-final 
 bool
@@ -1231,16 +1231,50 @@
 exing;%0A%0A
+%09public ProjectIndexEvent() %7B%0A%09%7D%0A%0A
 %09public 
@@ -1424,16 +1424,16 @@
 ctName;%0A
-
 %09%09this.u
@@ -1480,16 +1480,541 @@
 ng;%0A%09%7D%0A%0A
+%09public Long getProjectId() %7B%0A%09%09return projectId;%0A%09%7D%0A%0A%09public void setProjectId(Long projectId) %7B%0A%09%09this.projectId = projectId;%0A%09%7D%0A%0A%09public String getProjectName() %7B%0A%09%09return projectName;%0A%09%7D%0A%0A%09public void setProjectName(String projectName) %7B%0A%09%09this.projectName = projectName;%0A%09%7D%0A%0A%09public Long getUserId() %7B%0A%09%09return userId;%0A%09%7D%0A%0A%09public void setUserId(Long userId) %7B%0A%09%09this.userId = userId;%0A%09%7D%0A%0A%09public boolean isIndexing() %7B%0A%09%09return indexing;%0A%09%7D%0A%0A%09public void setIndexing(boolean indexing) %7B%0A%09%09this.indexing = indexing;%0A%09%7D%0A%0A
 %09@Overri

Add default controller and getters and setters