12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <%@ page contentType="text/xml; charset=UTF-8" language="java"%>
- <%@ page
- import ="com.sysmodel.datamodel.xmlmodel.ModelFactory,
- com.sysmodel.datamodel.xmlmodel.able.SysModel,
- com.sysmodel.datamodel.xmlmodel.impl.MdpAttributeImpl,
- com.sysmodel.datamodel.xmlmodel.able.MdpClass,
- com.sysmodel.datamodel.xmlmodel.able.MdpAttribute,
- java.util.*"
- %>
- <%
- SysModel sysmodel = ModelFactory.getSysmodel();
- String classid = request.getParameter("classid") == null ? "0" : request.getParameter("classid");
- String name = request.getParameter("name") == null ? "" : request.getParameter("name");
- String gettype = request.getParameter("gettype") == null ? "all" : request.getParameter("gettype");
- MdpClass MdpClass = sysmodel.getMdpClassByClassID(Integer.parseInt(classid));
- ArrayList Attributes = (ArrayList)MdpClass.getAllMdpAttributes();
- out.print("<root>");
- if(name.equals("")){
- for (int i = 0; i < Attributes.size(); i++) {
- MdpAttributeImpl MdpAttributeImpl = (MdpAttributeImpl) Attributes.get(i);
-
- if(gettype.equals("all")){
-
- out.print("<name>"+MdpAttributeImpl.getName()+"</name>");
- out.print("<description>"+MdpAttributeImpl.getDescription()+"</description>");
-
- } else if (gettype.equals("constant") && MdpAttributeImpl.getReferenceType() != 0){
-
- out.print("<name>"+MdpAttributeImpl.getName()+"</name>");
- out.print("<description>"+MdpAttributeImpl.getDescription()+"</description>");
-
- } else if (gettype.equals("date") && MdpAttributeImpl.getDataType().equals("date")){
-
- out.print("<name>"+MdpAttributeImpl.getName()+"</name>");
- out.print("<description>"+MdpAttributeImpl.getDescription()+"</description>");
-
- } else if (gettype.equals("text")
- && MdpAttributeImpl.getReferenceType() == 0
- && !MdpAttributeImpl.getDataType().equals("date")){
-
- out.print("<name>"+MdpAttributeImpl.getName()+"</name>");
- out.print("<description>"+MdpAttributeImpl.getDescription()+"</description>");
-
- }
- }
- } else {
- MdpAttribute MdpAttribute = MdpClass.getMdpAttributeByName(name);
- if(MdpAttribute.getReferenceType() == 1 && MdpAttribute.getReference().getReferenceTable() != null){
- MdpClass mdpClass = sysmodel.getMdpClassByClassID(Integer.parseInt(MdpAttribute.getReference().getReferenceTable()));
- List attributes = mdpClass.getAllMdpAttributes();
- for (int i = 0; i < attributes.size(); i++) {
- MdpAttributeImpl MdpAttributeImpl = (MdpAttributeImpl) attributes.get(i);
- out.print("<name>"+MdpAttributeImpl.getName()+"</name>");
- out.print("<description>"+MdpAttributeImpl.getDescription()+"</description>");
- }
- }
-
- }
- out.print("</root>");
- %>
|