/*
 * $Id: MappingInfo.java,v 1.2 2004/09/20 10:26:14 koppy Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 * 
 * Created on 17.07.2004
 *
 * $Log: MappingInfo.java,v $
 * Revision 1.2  2004/09/20 10:26:14  koppy
 * +javadoc Dokumentation
 *
 * Revision 1.1  2004/08/30 14:49:55  koppy
 * Initiale Version der Workflow-Komponente
 *
 */
package vkc.workflow.model;



/**
 * This class represents a java bean
 * to encapsulate infos about a participant mapping.
 * It is primary used in the presentation layer.
 * 
 * @author Andreas Koop
 */
public class MappingInfo {

    private String pkgId = null;
    private String procDefId = null;
    private String participantId = null;	
    private String participantName = null;
    private boolean groupUser;
    private String user = null;
    private String group = null;
    
   
    /**
     * Returns the participant id
     * @return the participant id
     */
    public String getParticipantId() {
        return participantId;
    }
    
    /**
     * Sets the participant id
     * @param participantId participant id
     */
    public void setParticipantId(String participantId) {
        this.participantId = participantId;
    }
    
    
    /**
     * Returns the process definition id
     * this mapping is defined in.
     * @return process definition id
     */
    public String getProcDefId() {
        return procDefId;
    }
    
    /**
     * Sets the process definition id
     * this mapping is defined in.
     * @param defId process definition id
     */
    public void setProcDefId(String defId) {
        procDefId = defId;
    }
  
    /**
     * Returns the package id
     * this mapping is defined in.
     * @return package id
     */
    public String getPkgId() {
        return pkgId;
    }
    
    
    /**
     * Sets the package id this mapping
     * is defined in.
     * @param pkgId package id
     */
    public void setPkgId(String pkgId) {
        this.pkgId = pkgId;
    }
   
    /**
     * Returns the associated group name.
     * @return group name
     */
    public String getGroup() {
        return group;
    }
    
    /**
     * Sets the group name this mapping is associated with.
     * @param group a group name
     */
    public void setGroup(String group) {
        this.group = group;
    }
    
    /**
     * Returns the associated username.
     * @return username
     */
    public String getUser() {
        return user;
    }
    
    /**
     * Sets the username this mapping is associated with.
     * @param user a username
     */
    public void setUser(String user) {
        this.user = user;
    }
    
    /** 
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    public String toString(){
        return "-----MappingInfo"
        	+ "\nprocDefId = " + this.procDefId
        	+ "\nparticipantId = " + this.participantId
        	+ "\nparticipantName = " + this.participantName
        	+ "\nmaps user --> " + this.user
        	+ "\nmaps group --> " + this.group;
    }
    
    /**
     * Returns the participant name, e.g. "project manager"
     * @return the participant name
     */
    public String getParticipantName() {
        return participantName;
    }
    
    /**
     * Sets the participant name
     * @param participantName the participant name
     */
    public void setParticipantName(String participantName) {
        this.participantName = participantName;
    }
    
    /**
     * Indicated whether the participant used in this mapping
     * is a group or a user.
     * 
     * @return true if name indicates a group, false otherwise(user)
     */
    public boolean isGroupUser() {
        return groupUser;
    }
    
    /**
     * Sets whether the participant used in this mapping
     * is a group or a user.
     * @param groupUser true if name indicates a group, false otherwise(user)
     */
    public void setGroupUser(boolean groupUser) {
        this.groupUser = groupUser;
    }
    
    /**
     * Returns an array of <code>MappingInfo</code>-objects.
     * @param i length of the array 
     * @return array of <code>MappingInfo</code>-objects.
     */
    public static MappingInfo[] getEmptyMappings(int i) {
        
        MappingInfo [] mis = new MappingInfo[i];
        for (int j = 0; j < mis.length; j++) {
            mis[j] = new MappingInfo();
        }
        return mis;
    }
}
