khsam2001 Posted January 9, 2009 Share Posted January 9, 2009 hi allthrere are one to help me to transform this xml soap to a java code :<resourceDescriptor name="QR" wsType="query" uriString="/ReportingSystem/MyReports/JX_files" isNew="true"> <label>QRlabel</label> <resourceProperty name="PROP_QUERY"> <value>select * from users</value> </resourceProperty> <resourceProperty name="PROP_QUERY_LANGUAGE"> <value>sql</value> </resourceProperty> <resourceProperty name="PROP_PARENT_FOLDER"> <value>/ReportingSystem/MyReports/JX_files</value> </resourceProperty> <resourceDescriptor name="" wsType="datasource" uriString="" isNew="false"> <label>null</label> <resourceProperty name="PROP_REFERENCE_URI"> <value>/ReportingSystem/MyReports/JX_files</value> </resourceProperty> <resourceProperty name="PROP_IS_REFERENCE"> <value>false</value> </resourceProperty> </resourceDescriptor> </resourceDescriptor>i try to do it but i stop at this one where i want to delegate resourceDescriptor to an other resourceDescriptorthere are no methode to do it !!!!!!!!!!!!!!!!!!!!!my code java is :public ResourceDescriptor put ()throws Exception { ResourceDescriptor rd = new ResourceDescriptor(); rd.setWsType(ResourceDescriptor.TYPE_QUERY); rd.setResourceType(ResourceDescriptor.TYPE_QUERY); rd.setName("QR"); rd.setLabel("QRlabel"); rd.setResourceProperty(new ResourceProperty(ResourceDescriptor.PROP_QUERY,"select * from users")); rd.setResourceProperty(new ResourceProperty(ResourceDescriptor.PROP_QUERY_LANGUAGE,"sql")); rd.setParentFolder("/ReportingSystem/MyReports/JX_files"); rd.setUriString(rd.getParentFolder() + "/" + rd.getName()); rd.setIsNew(true); /* then we declare a new resourceDescriptor() for datasource who exist in JasperServer and reference it to query ResourceDescriptor datasource = new ResourceDescriptor(); datasource.setDataSourceType(ResourceDescriptor.TYPE_DATASOURCE); datasource.setIsNew(false); datasource.setResourceProperty(new ResourceProperty(ResourceDescriptor.PROP_REFERENCE_URI,"/ReportingSystem/MyReports/JX_files")); the pb is here --> how to set this datasource ResourceDescriptor to rd ResourceDescriptor */ ResourceDescriptor result = server.getWSClient().addOrModifyResource(rd, null); return result; } please help me !!!!!!! Link to comment Share on other sites More sharing options...
khsam2001 Posted January 12, 2009 Author Share Posted January 12, 2009 hi after searchi find that in ResourceDescriptor (RD) class there are a field: "List children" with getters & setters, if you have a parrent ResourceDescriptor like :<resourceDescriptor name="MyReportUnit" wsType="reportUnit" uriString="/reports/Jrxml/MyReportUnit" isNew="true">in java :ResourceDescriptor rdReportUnit = new ResourceDescriptor(); rdReportUnit.setWsType(ResourceDescriptor.TYPE_REPORTUNIT); rdReportUnit.setUriString("/reports/Jrxml/MyReportUnit"); rdReportUnit.setName("MyReportUnit"); rdReportUnit.setLabel("MyReportUnit_teste"); rdReportUnit.setDescription("MyReportUnit for test"); rdReportUnit.setResourceProperty(new ResourceProperty(ResourceDescriptor.PROP_PARENT_FOLDER,"/reports/Jrxml")); rdReportUnit.setIsNew(true);and this RD have children like jrxml or query or datasource, you must create an other ResourceDescriptor :<resourceDescriptor name="JX" wsType="jrxml" uriString="/ReportingSystem/MyReports/JX_files" isNew="true">in java :ResourceDescriptor rdJrxml = new ResourceDescriptor(); rdJrxml.setWsType(ResourceDescriptor.TYPE_JRXML); rdJrxml.setIsNew(false); rdJrxml.setIsReference(true); rdJrxml.setResourceProperty(new ResourceProperty(ResourceDescriptor.PROP_FILERESOURCE_REFERENCE_URI,"/ContentFiles/jrxml/rapport_exemple")); rdJrxml.setResourceProperty(new ResourceProperty(ResourceDescriptor.PROP_RU_IS_MAIN_REPORT,"true")); after set this RD children to RD parrent like List children = new ArrayList ();children.add(rdJrxml);rdReportUnit.setChildren(children);server.getWSClient().addOrModifyResource(rdReportUnit, null);thanks !!!!!!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now