1 package edu.sampleu.krms.impl;
2
3 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
4 import org.kuali.rice.core.api.uif.DataType;
5 import org.kuali.rice.core.api.uif.RemotableAbstractWidget;
6 import org.kuali.rice.core.api.uif.RemotableAttributeError;
7 import org.kuali.rice.core.api.uif.RemotableAttributeField;
8 import org.kuali.rice.core.api.uif.RemotableAttributeLookupSettings;
9 import org.kuali.rice.core.api.uif.RemotableQuickFinder;
10 import org.kuali.rice.core.api.uif.RemotableTextInput;
11 import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
12 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
13 import org.kuali.rice.krms.framework.type.AgendaTypeService;
14 import org.kuali.rice.shareddata.impl.campus.CampusBo;
15
16 import javax.jws.WebParam;
17 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
18 import java.util.ArrayList;
19 import java.util.Collections;
20 import java.util.List;
21 import java.util.Map;
22
23
24
25
26 public class CampusAgendaTypeService implements AgendaTypeService {
27
28 @Override
29 public List<RemotableAttributeField> getAttributeFields(@WebParam(name = "krmsTypeId") String krmsTypeId) throws RiceIllegalArgumentException {
30
31 List<RemotableAttributeField> remoteFields = new ArrayList<RemotableAttributeField>();
32
33 String campusBoClassName = CampusBo.class.getName();
34
35 String baseLookupUrl = KRADServiceLocatorWeb.getRiceApplicationConfigurationMediationService()
36 .getBaseLookupUrl(campusBoClassName);
37
38 RemotableQuickFinder.Builder quickFinderBuilder =
39 RemotableQuickFinder.Builder.create(baseLookupUrl, campusBoClassName);
40
41 quickFinderBuilder.setFieldConversions(Collections.singletonMap("code","Campus"));
42
43 RemotableTextInput.Builder controlBuilder = RemotableTextInput.Builder.create();
44 controlBuilder.setSize(30);
45 controlBuilder = RemotableTextInput.Builder.create();
46 controlBuilder.setSize(Integer.valueOf(40));
47
48 RemotableAttributeLookupSettings.Builder lookupSettingsBuilder = RemotableAttributeLookupSettings.Builder.create();
49 lookupSettingsBuilder.setCaseSensitive(Boolean.TRUE);
50 lookupSettingsBuilder.setInCriteria(true);
51 lookupSettingsBuilder.setInResults(true);
52 lookupSettingsBuilder.setRanged(false);
53
54 RemotableAttributeField.Builder builder = RemotableAttributeField.Builder.create("Campus");
55 builder.setAttributeLookupSettings(lookupSettingsBuilder);
56 builder.setRequired(true);
57 builder.setDataType(DataType.STRING);
58 builder.setControl(controlBuilder);
59 builder.setLongLabel("Campus");
60 builder.setShortLabel("Campus");
61 builder.setMinLength(Integer.valueOf(1));
62 builder.setMaxLength(Integer.valueOf(40));
63 builder.setWidgets(Collections.<RemotableAbstractWidget.Builder>singletonList(quickFinderBuilder));
64
65 remoteFields.add(builder.build());
66
67 return remoteFields;
68 }
69
70 @Override
71 public List<RemotableAttributeError> validateAttributes(@WebParam(name = "krmsTypeId") String krmsTypeId,
72 @WebParam(name = "attributes") @XmlJavaTypeAdapter(
73 value = MapStringStringAdapter.class) Map<String, String> attributes) throws RiceIllegalArgumentException {
74
75 return Collections.emptyList();
76 }
77
78 @Override
79 public List<RemotableAttributeError> validateAttributesAgainstExisting(
80 @WebParam(name = "krmsTypeId") String krmsTypeId, @WebParam(name = "newAttributes") @XmlJavaTypeAdapter(
81 value = MapStringStringAdapter.class) Map<String, String> newAttributes,
82 @WebParam(name = "oldAttributes") @XmlJavaTypeAdapter(
83 value = MapStringStringAdapter.class) Map<String, String> oldAttributes) throws RiceIllegalArgumentException {
84
85 return Collections.emptyList();
86 }
87 }