145c95e6447c646a41559da8d8f9c783c33a83c4.svn-base 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <%@ page contentType="text/xml; charset=UTF-8" language="java"%>
  2. <%@ page
  3. import ="com.sysmodel.datamodel.xmlmodel.ModelFactory,
  4. com.sysmodel.datamodel.xmlmodel.able.SysModel,
  5. com.sysmodel.datamodel.xmlmodel.impl.MdpAttributeImpl,
  6. com.sysmodel.datamodel.xmlmodel.able.MdpClass,
  7. java.util.*"
  8. %>
  9. <%
  10. SysModel sysmodel = ModelFactory.getSysmodel();
  11. String classid = request.getParameter("classid") == null ? "0" : request.getParameter("classid");
  12. String gettype = request.getParameter("gettype") == null ? "all" : request.getParameter("gettype");
  13. MdpClass MdpClass = sysmodel.getMdpClassByClassID(Integer.parseInt(classid));
  14. ArrayList Attributes = (ArrayList)MdpClass.getAllMdpAttributes();
  15. StringBuffer sb = new StringBuffer();
  16. sb.append("<root>");
  17. for (int i = 0; i < Attributes.size(); i++) {
  18. MdpAttributeImpl MdpAttributeImpl = (MdpAttributeImpl) Attributes.get(i);
  19. if(gettype.equals("all")){
  20. sb.append("<name>"+MdpAttributeImpl.getName()+"</name>");
  21. sb.append("<description>"+MdpAttributeImpl.getDescription()+"</description>");
  22. } else if (gettype.equals("constant") && MdpAttributeImpl.getReferenceType() != 0){
  23. sb.append("<name>"+MdpAttributeImpl.getName()+"</name>");
  24. sb.append("<description>"+MdpAttributeImpl.getDescription()+"</description>");
  25. } else if (gettype.equals("date") && MdpAttributeImpl.getDataType().equals("date")){
  26. sb.append("<name>"+MdpAttributeImpl.getName()+"</name>");
  27. sb.append("<description>"+MdpAttributeImpl.getDescription()+"</description>");
  28. } else if (gettype.equals("text")
  29. && MdpAttributeImpl.getReferenceType() == 0
  30. && !MdpAttributeImpl.getDataType().equals("date")){
  31. sb.append("<name>"+MdpAttributeImpl.getName()+"</name>");
  32. sb.append("<description>"+MdpAttributeImpl.getDescription()+"</description>");
  33. }
  34. }
  35. sb.append("</root>");
  36. out.print(sb.toString());
  37. %>