Class MAssignmentSlot

java.lang.Object
org.compiere.model.MAssignmentSlot
All Implemented Interfaces:
Comparator<Object>

public class MAssignmentSlot extends Object implements Comparator<Object>
Assignment Slot. Display Information about Assignment Slot.
Version:
$Id: MAssignmentSlot.java,v 1.2 2006/07/30 00:51:03 jjanke Exp $
Author:
Jorg Janke
  • Field Details

    • STATUS_NotAvailable

      public static final int STATUS_NotAvailable
      Not Available Code
      See Also:
    • STATUS_UnAvailable

      public static final int STATUS_UnAvailable
      Un-Available Code
      See Also:
    • STATUS_NonBusinessDay

      public static final int STATUS_NonBusinessDay
      Non-business Code
      See Also:
    • STATUS_NotInSlotDay

      public static final int STATUS_NotInSlotDay
      Not in slot day Code
      See Also:
    • STATUS_NotInSlotTime

      public static final int STATUS_NotInSlotTime
      Not in slot time Code
      See Also:
    • STATUS_NotConfirmed

      public static final int STATUS_NotConfirmed
      Not confirmed Assignment Code
      See Also:
    • STATUS_Confirmed

      public static final int STATUS_Confirmed
      Confirmed Assignment Code
      See Also:
    • STATUS_TimeSlot

      public static final int STATUS_TimeSlot
      Open Time Slot Code
      See Also:
    • DISPLAY_ALL

      public static final int DISPLAY_ALL
      toString displays everything
      See Also:
    • DISPLAY_TIME_FROM

      public static final int DISPLAY_TIME_FROM
      toString displays formatted time from
      See Also:
    • DISPLAY_TIME_FROM_TO

      public static final int DISPLAY_TIME_FROM_TO
      toString displays formatted time from-to
      See Also:
    • DISPLAY_DATETIME_FROM_TO

      public static final int DISPLAY_DATETIME_FROM_TO
      toString displays formatted day time from-to
      See Also:
    • DISPLAY_NAME

      public static final int DISPLAY_NAME
      toString displays name
      See Also:
    • DISPLAY_NAME_DESCRIPTION

      public static final int DISPLAY_NAME_DESCRIPTION
      toString displays name and optional description
      See Also:
    • DISPLAY_FULL

      public static final int DISPLAY_FULL
      toString displays formatted all info
      See Also:
  • Constructor Details

    • MAssignmentSlot

      public MAssignmentSlot()
      Comparator Constructor
    • MAssignmentSlot

      public MAssignmentSlot(Timestamp startTime, Timestamp endTime)
      Time slot Constructor
      Parameters:
      startTime - start time
      endTime - end time
    • MAssignmentSlot

      public MAssignmentSlot(long startTime, long endTime)
      Time slot Constructor
      Parameters:
      startTime - start time in millisecond
      endTime - end time in millisecond
    • MAssignmentSlot

      public MAssignmentSlot(Timestamp startTime, Timestamp endTime, String name, String description, int status)
      Non Assignment Constructor
      Parameters:
      startTime - start time
      endTime - end time
      name - name
      description - description
      status - status
    • MAssignmentSlot

      public MAssignmentSlot(MResourceAssignment assignment)
      Assignment Constructor
      Parameters:
      assignment - MAssignment
  • Method Details

    • setStatus

      public void setStatus(int status)
      Set Status
      Parameters:
      status - STATUS_..
    • getStatus

      public int getStatus()
      Get Status
      Returns:
      STATUS_..
    • isAssignment

      public boolean isAssignment()
      Is this Slot an Assignment?
      Returns:
      true if this slot is an assignment
    • getColor

      public Color getColor(boolean background)
      Get Color for Status
      Parameters:
      background - true if background - or foreground
      Returns:
      Color
    • getStartTime

      public Timestamp getStartTime()
      Get Start time
      Returns:
      start time
    • setStartTime

      public void setStartTime(Timestamp startTime)
      Set Start time
      Parameters:
      startTime - start time, if null use current time
    • getEndTime

      public Timestamp getEndTime()
      Get End time
      Returns:
      end time
    • setEndTime

      public void setEndTime(Timestamp endTime)
      Set End time
      Parameters:
      endTime - end time, if null use start time
    • setMAssignment

      public void setMAssignment(MResourceAssignment assignment)
      Set Assignment
      Parameters:
      assignment - MAssignment
    • getMAssignment

      public MResourceAssignment getMAssignment()
      Get Assugnment
      Returns:
      assignment
    • setName

      public void setName(String name)
      Set Name
      Parameters:
      name - name
    • getName

      public String getName()
      Get Name
      Returns:
      name
    • setDescription

      public void setDescription(String description)
      Set Description
      Parameters:
      description - description
    • getDescription

      public String getDescription()
      Get Description
      Returns:
      description
    • setY

      public void setY(int yStart, int yEnd)
      Set Y position
      Parameters:
      yStart - zero based Y start index
      yEnd - zero based Y end index
    • getYStart

      public int getYStart()
      Get Y start position
      Returns:
      zero based Y start index
    • getYEnd

      public int getYEnd()
      Get Y end position
      Returns:
      zero based Y end index
    • setX

      public void setX(int xPos, int xMax)
      Set X position
      Parameters:
      xPos - zero based X position index
      xMax - number of parallel columns
    • getXPos

      public int getXPos()
      Get X position
      Returns:
      zero based X position index
    • getXMax

      public int getXMax()
      Get max X columns
      Returns:
      number of max parallel columns
    • setLanguage

      public void setLanguage(Language language)
      Set Language
      Parameters:
      language - language
    • setDisplay

      public void setDisplay(int displayMode)
      Set Display Mode of toString()
      Parameters:
      displayMode - DISPLAY_
    • toString

      public String toString()
      String representation
      Overrides:
      toString in class Object
      Returns:
      info
    • getInfoTimeFrom

      public String getInfoTimeFrom()
      Get Info with Time From
      Returns:
      info 00:00
    • getInfoTimeFromTo

      public String getInfoTimeFromTo()
      Get Info with Time From-To
      Returns:
      info 00:00 - 01:00
    • getInfoDateTimeFromTo

      public String getInfoDateTimeFromTo()
      Get Info with Date and Time From-To
      Returns:
      info 12/12/01 00:00 - 01:00 or 12/12/01 00:00 - 12/13/01 01:00
    • getInfoNameDescription

      public String getInfoNameDescription()
      Get Info with Name and optional Description
      Returns:
      Name (Description)
    • getInfo

      public String getInfo()
      Get Info with Date, Time From-To Name Description
      Returns:
      12/12/01 00:00 - 01:00: Name (Description)
    • inSlot

      public boolean inSlot(Timestamp time, boolean endTime)
      Returns true if time is between start and end Time. Date part is ignored.
      
        Example:
        - Slots: 0:00-9:00 - 9:00-10:00 - 10:00-11:00 - ...
        - inSlot (9:00, false) -> 1		//	start time
        - inSlot (10:00, true) -> 1		//	end time
        
      Parameters:
      time - time of the day
      endTime - if true, the slot end time is included
      Returns:
      true if within slot
    • compare

      public int compare(Object o1, Object o2)
      Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      Specified by:
      compare in interface Comparator<Object>
      Parameters:
      o1 - the first object to be compared.
      o2 - the second object to be compared.
      Returns:
      a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
      Throws:
      ClassCastException - if the arguments' types prevent them from being compared by this Comparator.
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this Comparator.
      Specified by:
      equals in interface Comparator<Object>
      Overrides:
      equals in class Object
      Parameters:
      obj - the reference object with which to compare.
      Returns:
      true only if the specified object is also a comparator and it imposes the same ordering as this comparator.
      See Also:
    • hashCode

      public int hashCode()
      HashCode of MAssignmentSlot
      Overrides:
      hashCode in class Object
      Returns:
      hash code of startTime+endTime+status+name+description