<commit_before>/**
 * 
 */
package com.bearingpoint.opencms.workflow2.task;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

import org.apache.commons.logging.Log;
import org.opencms.main.CmsLog;
import org.opencms.util.CmsUUID;

import com.bearingpoint.opencms.workflow2.WorkflowConfiguration;
import com.bearingpoint.opencms.workflow2.WorkflowException;

/**
 * TaskBean
 * <p>
 * Bean for the Tasks in the Workflow GUIs
 * <p>
 * @author David.Trattnig
 * @version 0.2
 * 
 */
public class Task implements Serializable, I_Task {
	
	static final long serialVersionUID = 1L;
	private static final Log LOG = CmsLog.getLog(Task.class);
		

	/**
	 * The resource the task is referring to
	 */
	//private ResourceIdentifier resource=null;
		
	/**
	 * Title of the task
	 */
	private String taskTitle;
		
	/**
	 * List of comments the task is containing
	 */
	private List<TaskComment> comments;
		
	/**
	 * The date the task has been created. 
	 */
	private Calendar createDate;
	
	/** 
	 * user created the task 
	 */
	private CmsUUID userUUID;
	
	/** 
	 * the user group the task is assigned 
	 */
	private CmsUUID projectUUID;
	
	/**
	 * The user the task is assigned to
	 */
	private CmsUUID assignedUserUUID;


    /**
     * Main constructor for creating tasks. 
     * <p>
     * @param resource
     * @param userUUID
     * @param comment
     */	 	
    public Task(CmsUUID projectUUID, CmsUUID userUUID, String title, List<TaskComment> comments) {
    	      
    	this.taskTitle = title;     
        this.createDate = new GregorianCalendar();      
        this.userUUID = userUUID;
        this.projectUUID = projectUUID;
        this.comments = new ArrayList<TaskComment>();
        
        if (comments != null) {
        	for (TaskComment tc : comments) {
        		
        		this.comments.add(tc);
        	}
        }
    }
    
    /**
     * Constructor to create tasks via workflow engine implementation.
     * <p>
     * @param project
     * @param user
     * @param title
     */
    public Task(String project, String user, String title) {
    	
    	if (project!=null && project.length()>0) {
    		this.projectUUID = new CmsUUID(project);
    	}
    	else {
    		this.projectUUID = null;
    	}
    	
    	if (user!=null && user.length()>0) {
    		this.userUUID = new CmsUUID(user);
    	}
    	else {
    		this.userUUID = null;
    	}
    	
    	this.taskTitle = title;
    	this.comments = new ArrayList<TaskComment>();    	
    }
    
    /**
     * Main constructor for creating tasks. 
     * <p>
     * @param resource
     * @param userUUID
     * @param groupUUID
     * @param title of the task
     * @param comment
     */
    public Task(CmsUUID projectUUID, CmsUUID userUUID, String title, String comment) {
    	
    	this(projectUUID, userUUID, title, new ArrayList<TaskComment>());
    	comments.add(new TaskComment(this, userUUID, comment));
    }<commit_msg>fixed date handling<commit_after>/**
 * 
 */
package com.bearingpoint.opencms.workflow2.task;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

import org.apache.commons.logging.Log;
import org.opencms.main.CmsLog;
import org.opencms.util.CmsUUID;

import com.bearingpoint.opencms.workflow2.WorkflowConfiguration;
import com.bearingpoint.opencms.workflow2.WorkflowException;

/**
 * TaskBean
 * <p>
 * Bean for the Tasks in the Workflow GUIs
 * <p>
 * @author David.Trattnig
 * @version 0.2
 * 
 */
public class Task implements Serializable, I_Task {
	
	static final long serialVersionUID = 1L;
	private static final Log LOG = CmsLog.getLog(Task.class);
		

	/**
	 * The resource the task is referring to
	 */
	//private ResourceIdentifier resource=null;
		
	/**
	 * Title of the task
	 */
	private String taskTitle;
		
	/**
	 * List of comments the task is containing
	 */
	private List<TaskComment> comments;
		
	/**
	 * The date the task has been created. 
	 */
	private Calendar createDate;
	
	/** 
	 * user created the task 
	 */
	private CmsUUID userUUID;
	
	/** 
	 * the user group the task is assigned 
	 */
	private CmsUUID projectUUID;
	
	/**
	 * The user the task is assigned to
	 */
	private CmsUUID assignedUserUUID;


    /**
     * Main constructor for creating tasks. 
     * <p>
     * @param resource
     * @param userUUID
     * @param comment
     */	 	
    public Task(CmsUUID projectUUID, CmsUUID userUUID, String title, List<TaskComment> comments) {
    	      
    	this.taskTitle = title;     
        this.createDate = new GregorianCalendar();      
        this.userUUID = userUUID;
        this.projectUUID = projectUUID;
        this.comments = new ArrayList<TaskComment>();
        
        if (comments != null) {
        	for (TaskComment tc : comments) {
        		
        		this.comments.add(tc);
        	}
        }
    }
    
    /**
     * Constructor to create tasks via workflow engine implementation.
     * <p>
     * @param project
     * @param user
     * @param title
     */
    public Task(String project, String user, String title) {
    	
    	if (project!=null && project.length()>0) {
    		this.projectUUID = new CmsUUID(project);
    	}
    	else {
    		this.projectUUID = null;
    	}
    	
    	if (user!=null && user.length()>0) {
    		this.userUUID = new CmsUUID(user);
    	}
    	else {
    		this.userUUID = null;
    	}
    	
    	this.taskTitle = title;
    	this.comments = new ArrayList<TaskComment>();   
    	this.createDate = new GregorianCalendar();
    }
    
    /**
     * Main constructor for creating tasks. 
     * <p>
     * @param resource
     * @param userUUID
     * @param groupUUID
     * @param title of the task
     * @param comment
     */
    public Task(CmsUUID projectUUID, CmsUUID userUUID, String title, String comment) {
    	
    	this(projectUUID, userUUID, title, new ArrayList<TaskComment>());
    	comments.add(new TaskComment(this, userUUID, comment));
    }
{'fraction_non_alphanumeric': 0.10665137614678899, 'fraction_numerical': 0.002621231979030144, 'mean_word_length': 2.39355197331851, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '936852', 'n_tokens_mistral': 1988, 'n_tokens_neox': 1937, 'n_words': 493}