View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 1.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/ecl1.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.rice.krms.impl.ui;
17  
18  import java.util.Map;
19  
20  import org.kuali.rice.krad.bo.BusinessObject;
21  import org.kuali.rice.krad.bo.PersistableBusinessObject;
22  import org.kuali.rice.krad.document.MaintenanceDocument;
23  import org.kuali.rice.krad.maintenance.Maintainable;
24  import org.kuali.rice.krad.maintenance.MaintainableImpl;
25  import org.kuali.rice.krad.service.BusinessObjectService;
26  import org.kuali.rice.krad.service.KRADServiceLocator;
27  import org.kuali.rice.krad.util.KRADConstants;
28  import org.kuali.rice.krms.impl.repository.AgendaBo;
29  import org.kuali.rice.krms.impl.repository.ContextBo;
30  
31  /**
32   * {@link Maintainable} for the {@link AgendaEditor}
33   * 
34   * @author Kuali Rice Team (rice.collab@kuali.org)
35   *
36   */
37  public class AgendaEditorMaintainable extends MaintainableImpl {
38  	
39  	private static final long serialVersionUID = 1L;
40  
41  	/**
42  	 * @return the boService
43  	 */
44  	public BusinessObjectService getBoService() {
45  		return KRADServiceLocator.getBusinessObjectService();
46  	}
47  
48  	/**
49  	 * {@inheritDoc}
50  	 */
51  	@Override
52  	public void processAfterNew(MaintenanceDocument document,
53  			Map<String, String[]> requestParameters) {
54  
55  		super.processAfterNew(document, requestParameters);
56  		
57  //		if (KRADConstants.MAINTENANCE_NEW_ACTION.equals(maintenanceAction)) {
58  //			String[] agendaIds = requestParameters.get("agendaId");
59  //			if (agendaIds == null || agendaIds.length != 1) { 
60  //				//throw new RiceRuntimeException("one and only one agendaId request parameter may be passed");
61  //			} else {
62  //				// TODO: change this, it makes more sense for MAINTENANCE_EDIT_ACTION
63  //				String agendaId = agendaIds[0];
64  //
65  //				AgendaBo agenda = getBoService().findBySinglePrimaryKey(AgendaBo.class, agendaId);
66  //				String contextId = agenda.getContextId();
67  //
68  //				ContextBo context = getBoService().findBySinglePrimaryKey(ContextBo.class, contextId);
69  //
70  //				AgendaEditor editor = (AgendaEditor) document.getDocumentBusinessObject();
71  //
72  //				editor.setContext(context);
73  //				editor.setAgenda(agenda);
74  //			}
75  //		}
76  		
77  		
78  	}
79  	
80  	/**
81  	 * This overridden method ...
82  	 * 
83  	 * @see org.kuali.rice.krad.maintenance.KualiMaintainableImpl#saveBusinessObject()
84  	 */
85  	@Override
86  	public void saveDataObject() {
87  	    // TODO here's where we can handle persisting our agenda and context
88  	    super.saveDataObject();
89  	}
90  	
91  //	/**
92  //	 * @see org.kuali.rice.krad.maintenance.KualiMaintainableImpl#processAfterNew(org.kuali.rice.krad.document.MaintenanceDocument, java.util.Map)
93  //	 */
94  //	@Override
95  //	public void processAfterNew(MaintenanceDocument document,
96  //			Map<String, String[]> parameters) {
97  //		// TODO gilesp - THIS METHOD NEEDS JAVADOCS
98  //		super.processAfterNew(document, parameters);
99  //		
100 //		EditorDocument editor = (EditorDocument) document.getDocumentBusinessObject();
101 //		
102 //		editor.getContext().setName("new");
103 //	}
104 
105 
106 }