package com.collabnet.ctf.events.custom.events;

import com.vasoftware.sf.common.logger.Logger;
import com.vasoftware.sf.events.EventHandler60;

public class ProjectCreationEventListener extends EventHandler60 {

    private static final Logger log = Logger.getLogger(ProjectCreationEventListener.class);
    /**
     * This method is called when the event needs to be processed. At this
     * point, the original and updated data, the event context and the session
     * key should be available to the event handler. If information needs to be
     * passed back to the user the addSuccessMessage and addErrorMessage calls
     * should be used.
     *
     * @throws Exception If something bad happening while processing the event.
     */
    @Override
    public void processEvent() throws Exception {
        info("Type: " + getEventContext().getType());
        info("Operation: " + getEventContext().getOperation());
        info("ProjectId: " + getEventContext().getProjectId());
        info("Comment: " + getEventContext().getComment());
        info("UserName: " + getEventContext().getUsername());
        info("Original Data Class: " + getOriginalData().getClass().toString());
        info("Updated Data Class: " + getUpdatedData().getClass().toString());
        sendEmail("John Doe", "john@org.net", "John Doe", "john@org.com",
                "Project Created", "Hi, Project created successfully", null);
        info("One Time Token: " + getOneTimeToken());
        info("Integrated App Shared Key: " + getIntegratedAppSharedKey());
    }
}
