Package org.andromda.timetracker.domain

Examples of org.andromda.timetracker.domain.Timecard


     */
    protected java.lang.Long handleCreateTimecard(org.andromda.timetracker.vo.TimecardVO timecardVO)
        throws java.lang.Exception
    {
        // Create new timecard from timecardVO
        Timecard timecard = Timecard.Factory.newInstance();
        getTimecardDao().timecardVOToEntity(timecardVO, timecard, true);

        // Set submitter and approver associations
        timecard.setSubmitter(getPersonDao().findByUsername(timecardVO.getSubmitterName()));
        timecard.setApprover(getPersonDao().findByUsername(timecardVO.getApproverName()));

        // Set allocations
        TimeAllocationVO allocations[] = timecardVO.getAllocations();
        for (int i=0; i<allocations.length; i++) {
            // Create TimeAllocation from TimeAllocationVO
            TimeAllocationVO allocationVO = allocations[i];
            TimeAllocation allocation = TimeAllocation.Factory.newInstance();
            getTimeAllocationDao().timeAllocationVOToEntity(allocationVO, allocation, true);

            // Connect to timecard
            timecard.addTimeAllocation(allocation);

            // Connect to task
            allocation.setTask(getTaskDao().load(allocationVO.getTaskId()));
        }

        // Create the timecard
        getTimecardDao().create(timecard);
        return timecard.getId();
    }
View Full Code Here

TOP

Related Classes of org.andromda.timetracker.domain.Timecard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.