本文整理汇总了Java中com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor.setMainReport方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceDescriptor.setMainReport方法的具体用法?Java ResourceDescriptor.setMainReport怎么用?Java ResourceDescriptor.setMainReport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor
的用法示例。
在下文中一共展示了ResourceDescriptor.setMainReport方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setChild
import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; //导入方法依赖的package包/类
public static void setChild(ResourceDescriptor rd, ResourceDescriptor child) {
List<ResourceDescriptor> children = rd.getChildren();
for (int i = 0; i < children.size(); i++) {
ResourceDescriptor r = children.get(i);
if (r.isMainReport() && child.isMainReport()) {
child.setName(r.getName());
child.setLabel(r.getLabel());
child.setDescription(r.getDescription());
child.setUriString(r.getUriString());
children.set(i, child);
return;
}
if ((child.getUriString() == null && r.getUriString() == null && child.getWsType().equals(r.getWsType())) || (r.getUriString() != null && r.getUriString().equals(child.getUriString()))) {
if (r.isMainReport())
child.setMainReport(true);
children.set(i, child);
return;
}
}
children.add(child);
}
示例2: setRemoteResource
import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; //导入方法依赖的package包/类
private void setRemoteResource(MResource res, ResourceDescriptor rd, ANode parent) {
ResourceDescriptor runit = res.getValue();
try {
rd = WSClientHelper.getResource(new NullProgressMonitor(), parent, rd);
rd.setIsReference(true);
rd.setMainReport(true);
rd.setReferenceUri(rd.getUriString());
rd.setParentFolder(runit.getParentFolder() + "/" + runit.getName() + "_files");
rd.setWsType(ResourceDescriptor.TYPE_JRXML);
rd.setUriString(rd.getParentFolder() + "/" + rd.getName());
replaceMainReport(res, rd);
rd.setDirty(false);
fireSelectionChanged();
jsRefDS.setText(rd.getUriString());
} catch (Exception e1) {
UIUtils.showError(e1);
}
}
示例3: doPasteIntoReportUnit
import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; //导入方法依赖的package包/类
protected ResourceDescriptor doPasteIntoReportUnit(ResourceDescriptor prd, ResourceDescriptor origin) {
String ruuri = prd.getUriString();
origin.setParentFolder(ruuri + "_files"); //$NON-NLS-1$
origin.setUriString(ruuri + "_files/" + origin.getName()); //$NON-NLS-1$
origin.setIsNew(true);
origin.setName(getRName(origin.getName(), prd.getChildren()));
origin.setLabel(origin.getLabel());
origin.setMainReport(false);
return origin;
}
示例4: getReportUnit
import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; //导入方法依赖的package包/类
private static void getReportUnit(ARestV2Connection rc, AbstractClientReportUnit<?> cr, ResourceDescriptor rd) throws ParseException {
rd.setResourceProperty(ResourceDescriptor.PROP_RU_ALWAYS_PROPMT_CONTROLS, cr.isAlwaysPromptControls());
rd.setResourceProperty(ResourceDescriptor.PROP_RU_INPUTCONTROL_RENDERING_VIEW, cr.getInputControlRenderingView());
rd.setResourceProperty(ResourceDescriptor.PROP_RU_REPORT_RENDERING_VIEW, cr.getReportRenderingView());
if (cr.getControlsLayout() == ControlsLayoutType.popupScreen)
rd.setResourceProperty(ResourceDescriptor.PROP_RU_CONTROLS_LAYOUT, ResourceDescriptor.RU_CONTROLS_LAYOUT_POPUP_SCREEN);
if (cr.getControlsLayout() == ControlsLayoutType.separatePage)
rd.setResourceProperty(ResourceDescriptor.PROP_RU_CONTROLS_LAYOUT, ResourceDescriptor.RU_CONTROLS_LAYOUT_SEPARATE_PAGE);
if (cr.getControlsLayout() == ControlsLayoutType.topOfPage)
rd.setResourceProperty(ResourceDescriptor.PROP_RU_CONTROLS_LAYOUT, ResourceDescriptor.RU_CONTROLS_LAYOUT_TOP_OF_PAGE);
if (cr.getControlsLayout() == ControlsLayoutType.inPage)
rd.setResourceProperty(ResourceDescriptor.PROP_RU_CONTROLS_LAYOUT, 4);
rd.getChildren().clear();
if (cr.getDataSource() != null)
rd.getChildren().add(getDataSource(rc, cr.getDataSource()));
if (cr.getQuery() != null)
rd.getChildren().add(getRDContainer(rc, (ClientQuery) cr.getQuery()));
if (cr.getJrxml() != null) {
ResourceDescriptor mjrxml = getRDContainer(rc, (ClientResource<?>) cr.getJrxml());
mjrxml.setMainReport(true);
rd.getChildren().add(mjrxml);
}
if (cr.getInputControls() != null)
for (ClientReferenceableInputControl cric : cr.getInputControls())
rd.getChildren().add(getRDContainer(rc, (ClientResource<?>) cric));
if (cr.getFiles() != null)
for (String key : cr.getFiles().keySet()) {
ClientReferenceableFile crf = cr.getFiles().get(key);
ResourceDescriptor r = getRDContainer(rc, (ClientResource<?>) crf);
r.setName(key);
rd.getChildren().add(r);
}
Collections.sort(rd.getChildren(), new Comparator<ResourceDescriptor>() {
@Override
public int compare(ResourceDescriptor arg0, ResourceDescriptor arg1) {
if (arg0.getLabel() == arg1.getLabel())
return 0;
if (arg0.getLabel() == null)
return -1;
if (arg1.getLabel() == null)
return 1;
String wsType0 = arg0.getWsType();
String wsType1 = arg1.getWsType();
if (wsType0.equals(wsType1)) {
if (wsType0.equals(ResourceDescriptor.TYPE_JRXML)) {
if (arg0.isMainReport())
return -1;
if (arg1.isMainReport())
return 1;
return arg0.getLabel().compareTo(arg1.getLabel());
} else if (wsType0.equals(ResourceDescriptor.TYPE_INPUT_CONTROL))
// ignore input controls
return 0;
return arg0.getLabel().compareTo(arg1.getLabel());
}
if (DatasourcesAllFilter.getTypes().contains(wsType0))
return -1;
if (DatasourcesAllFilter.getTypes().contains(wsType1))
return 1;
if (wsType0.equals(ResourceDescriptor.TYPE_JRXML))
return -1;
if (wsType1.equals(ResourceDescriptor.TYPE_JRXML))
return 1;
if (wsType0.equals(ResourceDescriptor.TYPE_QUERY))
return -1;
if (wsType1.equals(ResourceDescriptor.TYPE_QUERY))
return 1;
if (wsType0.equals(ResourceDescriptor.TYPE_INPUT_CONTROL))
return -1;
if (wsType1.equals(ResourceDescriptor.TYPE_INPUT_CONTROL))
return 1;
return wsType0.compareTo(wsType1);
}
});
}
示例5: getMainReport
import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; //导入方法依赖的package包/类
public static ResourceDescriptor getMainReport(IProgressMonitor monitor, MReportUnit mrunit, JasperDesign jd) {
String jrxmln = jd.getProperty(AExporter.PROP_REPORTRESOURCE);
String unit = mrunit.getValue().getUriString();
if (jrxmln != null) {
if (unit != null && jrxmln.startsWith(unit) && jrxmln.length() > unit.length() && jrxmln.substring((unit + WSClientHelper._FILES).length()).indexOf('/') < 0) {
MServerProfile sp = (MServerProfile) mrunit.getRoot();
if (sp != null) {
ResourceDescriptor rd = new ResourceDescriptor();
rd.setName(jrxmln.substring((unit + WSClientHelper._FILES).length()));
rd.setLabel(IDStringValidator.safeChar(rd.getName()));
rd.setUriString(jrxmln);
rd.setParentFolder(unit + "_files");
rd.setUriString(rd.getParentFolder() + "/" + rd.getName());
rd.setIsNew(true);
rd.setWsType(ResourceDescriptor.TYPE_JRXML);
rd.setIsReference(false);
rd.setHasData(true);
try {
rd = sp.getWsClient(monitor).get(monitor, rd, null);
rd.setHasData(true);
if (rd != null)
return rd;
} catch (Exception e) {
rd.setMainReport(true);
return rd;
}
}
}
}
ResourceDescriptor mainr = new ResourceDescriptor();
mainr.setName(Messages.JrxmlPublishAction_defaultresourcename);
mainr.setLabel(Messages.JrxmlPublishAction_defaultresourcelabel);
mainr.setWsType(ResourceDescriptor.TYPE_JRXML);
mainr.setIsNew(true);
mainr.setMainReport(true);
mainr.setIsReference(false);
mainr.setHasData(true);
mainr.setParentFolder(unit + "_files");
mainr.setUriString(mainr.getParentFolder() + "/" + mainr.getName());
return mainr;
}
示例6: setupResource
import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; //导入方法依赖的package包/类
@Override
protected void setupResource(ResourceDescriptor rd) {
rd.setMainReport(true);
rd.setName("main_jrxml");
rd.setLabel("Main Jrxml");
}
示例7: saveResource
import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; //导入方法依赖的package包/类
public static ResourceDescriptor saveResource(MResource res, IProgressMonitor monitor, boolean refresh) throws Exception {
INode n = res.getRoot();
ResourceDescriptor rd = null;
if (n != null && n instanceof MServerProfile) {
MServerProfile sp = (MServerProfile) n;
rd = res.getValue();
if (rd.getIsNew()) {
rd.setUriString(getParentFolder(rd) + rd.getName());
}
File file = null;
if (res instanceof AFileResource) {
file = ((AFileResource) res).getFile();
if (file != null) {
rd.setData(Base64.encodeBase64(FileUtils.getBytes(file)));
rd.setHasData(true);
} else
rd.setHasData(false);
} else
rd.setHasData(false);
MReportUnit mru = res.getReportUnit();
IConnection cli = sp.getWsClient(monitor);
if (cli == null)
cli = connect(sp, monitor);
System.out.println("saving: " + rd.getUriString() + " parent:" + rd.getParentFolder());
if (mru != null && res != mru) {
String wsType = rd.getWsType();
if (wsType.equals(ResourceDescriptor.TYPE_INPUT_CONTROL) && !rd.getIsNew())
rd = cli.addOrModifyResource(monitor, rd, file);
else if (res instanceof MRDataAdapterFile || res instanceof MRDataAdapter)
rd = cli.addOrModifyResource(monitor, rd, file);
else {
if (wsType.equals(ResourceDescriptor.TYPE_JRXML) && !rd.getIsNew() && rd.getName().equals("main_jrxml"))
rd.setMainReport(true);
// String turi = rd.getUriString();
ResourceDescriptor trd = cli.modifyReportUnitResource(monitor, mru.getValue(), rd, file);
// if (!trd.getUriString().equals(turi))
// rd = getResource(cli, rd, null);
rd = trd;
}
} else
rd = cli.addOrModifyResource(monitor, rd, file);
if (refresh && res.getParent() instanceof MResource) {
// standard resource creation inside an existing MResource
refreshContainer((MResource) res.getParent(), monitor);
} else if (res.getParent() instanceof MServerProfile) {
// resource created inside the root folder
connectGetData((MServerProfile) res.getParent(), monitor);
fireResourceChanged(res);
}
}
return rd;
}
示例8: createReportUnit
import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor; //导入方法依赖的package包/类
private static void createReportUnit(WSClient client, String folder, String name, String label, String jrxmlFile) throws Exception {
String reportUnitUri = folder + "/" + name;
ResourceDescriptor rd = new ResourceDescriptor();
rd.setName(name);
rd.setLabel(label);
rd.setWsType(ResourceDescriptor.TYPE_REPORTUNIT);
rd.setUriString(folder + "/" + name);
rd.setParentFolder(folder);
// If you want delete the report in case it already exists, just uncomment this code
//try {
// client.delete(rd);
//} catch (Exception ex) { }
rd.setIsNew(true);
rd.setResourceProperty(ResourceDescriptor.PROP_RU_ALWAYS_PROPMT_CONTROLS, true);
ResourceDescriptor datasource = new ResourceDescriptor();
datasource.setIsNew(true);
datasource.setWsType(ResourceDescriptor.TYPE_DATASOURCE);
datasource.setIsReference(true);
datasource.setReferenceUri("/datasources/JServerJdbcDS");
rd.getChildren().add(datasource);
ResourceDescriptor jrxmlDescriptor = new ResourceDescriptor();
jrxmlDescriptor.setName("main_jrxml");
jrxmlDescriptor.setLabel("Main Jrxml");
jrxmlDescriptor.setWsType( ResourceDescriptor.TYPE_JRXML );
jrxmlDescriptor.setIsNew(true);
jrxmlDescriptor.setMainReport(true);
jrxmlDescriptor.setIsReference(false);
jrxmlDescriptor.setHasData(true);
rd.getChildren().add( jrxmlDescriptor );
client.addOrModifyResource( rd, new File(jrxmlFile));
System.out.println(" Created report " + label);
System.out.flush();
}