View Javadoc

1   /**
2    * Copyright 2004-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.time.clocklog.service;
17  
18  import org.kuali.hr.time.clocklog.ClockLog;
19  import org.kuali.rice.kns.document.MaintenanceDocument;
20  import org.kuali.rice.krad.service.KRADServiceLocator;
21  import org.kuali.rice.krad.util.GlobalVariables;
22  
23  import java.util.Map;
24  
25  public class ClockLogMaintainableImpl extends org.kuali.rice.kns.maintenance.KualiMaintainableImpl {
26  
27  	/**
28  	 * 
29  	 */
30  	private static final long serialVersionUID = 1L;
31  
32  	 @Override
33  	public void processAfterNew(MaintenanceDocument document,
34  			Map<String, String[]> parameters) {		 
35  		super.processAfterNew(document, parameters);
36  	}
37  	 
38  	@Override
39  	public void processAfterPost(MaintenanceDocument document,
40  			Map<String, String[]> parameters) {		
41  		ClockLog clockLog = (ClockLog) document.getDocumentBusinessObject();
42  		clockLog.setUserPrincipalId(GlobalVariables.getUserSession().getPrincipalId());
43  		super.processAfterPost(document, parameters);
44  	}
45  	
46  	@Override
47  	public void processAfterEdit(MaintenanceDocument document,
48  			Map<String, String[]> parameters) {
49  		ClockLog clockLog = (ClockLog) document.getDocumentBusinessObject();
50  		clockLog.setUserPrincipalId(GlobalVariables.getUserSession().getPrincipalId());
51  		super.processAfterEdit(document, parameters);
52  	}
53  	
54  	@Override
55  	public void saveBusinessObject() {
56  		ClockLog clockLog = (ClockLog) this.getBusinessObject();
57  		clockLog.setTkClockLogId(null);
58  		clockLog.setTimestamp(null);
59  		KRADServiceLocator.getBusinessObjectService().save(clockLog);
60  	}
61  
62  }