View Javadoc

1   /*
2    * Copyright 2009 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    * 
7    * http://www.osedu.org/licenses/ECL-2.0
8    * 
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  package org.kuali.student.common.ui.server.gwt;
16  
17  import java.util.ArrayList;
18  import java.util.List;
19  
20  import org.kuali.student.common.ui.client.service.MetadataRpcService;
21  import org.kuali.student.r1.common.assembly.data.Metadata;
22  import org.kuali.student.r1.common.assembly.dictionary.MetadataServiceImpl;
23  
24  import com.google.gwt.user.server.rpc.RemoteServiceServlet;
25  
26  @Deprecated
27  public class MetadataRpcGwtServlet extends RemoteServiceServlet implements MetadataRpcService {
28  
29      private static final long serialVersionUID = 1L;
30  
31      private MetadataServiceImpl serviceImpl;
32      
33      @Override
34      public Metadata getMetadata(String objectKey, String type, String state) {
35          return serviceImpl.getMetadata(objectKey, type, state);
36      }
37  
38      public List<Metadata> getMetadataList(String objectKey, List<String> types, String state) {
39        try
40        {
41          List<Metadata> metadataList = new ArrayList<Metadata>();
42          for (String type : types) {
43              metadataList.add(serviceImpl.getMetadata(objectKey, type, state));
44          }
45          return metadataList;
46        }
47        catch(Exception ex){
48            // Log exception 
49            ex.printStackTrace();
50            throw new RuntimeException(ex);
51        }
52      }
53  
54      public Metadata getMetadataList(String objectKey, String state) {
55          try
56          {
57              return serviceImpl.getMetadata(objectKey, state);
58          } catch (Exception ex) {
59              // Log exception 
60              ex.printStackTrace();
61              throw new RuntimeException(ex);
62          }
63      }
64      
65      public void setServiceImpl(MetadataServiceImpl serviceImpl) {
66          this.serviceImpl = serviceImpl;
67      }
68  }