View Javadoc

1   package org.kuali.student.core.atp.document;
2   
3   import java.util.Map;
4   
5   import org.kuali.rice.kns.document.MaintenanceDocument;
6   import org.kuali.rice.kns.maintenance.KualiMaintainableImpl;
7   import org.kuali.student.core.atp.bo.Atp;
8   import org.kuali.student.core.atp.bo.AtpRichText;
9   import org.kuali.student.core.atp.bo.DateRange;
10  import org.kuali.student.core.atp.bo.Milestone;
11  
12  public class AtpMaintainbleImpl extends KualiMaintainableImpl {
13  	private static final long serialVersionUID = 9026116304410006845L;
14  
15  	/**
16  	 * Clear out keys of child collections
17  	 */
18  	@Override
19  	public void processAfterCopy(MaintenanceDocument document, Map<String, String[]> parms) {
20  		super.processAfterCopy(document, parms);
21  
22  		Atp atp = (Atp) document.getNewMaintainableObject().getBusinessObject();
23  
24  		for (DateRange dateRange : atp.getDateRanges()) {
25  			dateRange.setId(null);
26  			
27  			AtpRichText description = dateRange.getDescription();
28  			if (description != null) {
29  				description.setId(null);
30  				dateRange.setDescriptionId(null);
31  			}
32  		}
33  
34  		for (Milestone milestone : atp.getMilestones()) {
35  			milestone.setId(null);
36  			
37  			AtpRichText description = milestone.getDescription();
38  			if (description != null) {
39  				description.setId(null);
40  				milestone.setDescriptionId(null);
41  			}
42  		}
43  		
44  		AtpRichText description = atp.getDescription();
45  		if (description != null) {
46  			description.setId(null);
47  			atp.setDescriptionId(null);
48  		}
49  	}
50  
51  }