Changeset 343

Show
Ignore:
Timestamp:
04/23/02 11:52:05 (10 years ago)
Author:
team4
Message:

*** empty log message ***

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-0_71-bugfixes/Rapla/src/org/rapla/gui/ReservationController.java

    r292 r343  
    143143    } 
    144144 
     145    public Allocation copyAllocation(Allocation allocation) throws RaplaException { 
     146        Reservation reservation = allocation.getReservation(); 
     147        Appointment appointment = allocation.getAppointment(); 
     148        Allocation copy = context.getFacade().newAllocation(appointment); 
     149        // copy resources 
     150        Resource[] resources = allocation.getResources(); 
     151        for (int i=0;i<resources.length;i++)  
     152            copy.addResource(resources[i]); 
     153        return copy; 
     154    } 
     155 
     156 
    145157    public void pasteAllocation(Reservation reservation 
    146158                                ,Allocation allocation 
     
    150162            throw new RaplaException(config.getString("error.paste_in_different_semester_not_supported")); 
    151163        } 
    152         TimeZone timeZone = allocation.getAppointment().getTimeZone(); 
    153         allocation.move(adjustDate(start,semester,timeZone) 
     164        Allocation copy = copyAllocation(allocation);    
     165        TimeZone timeZone = copy.getAppointment().getTimeZone(); 
     166        copy.move(adjustDate(start,semester,timeZone) 
    154167                        ,timeZone); 
    155168        Reservation mutableReservation = (Reservation)context.getFacade().editObject(reservation); 
    156         mutableReservation.addAllocation(allocation); 
     169        mutableReservation.addAllocation(copy); 
    157170        save(mutableReservation); 
    158171    }