use of com.dexels.navajo.document.types.Binary in project navajo by Dexels.
the class KMLMap method getKmlData.
/**
* TODO: Make thread safe
* @return
*/
public Binary getKmlData() {
try {
if (!isPointFile()) {
File kmz = createKmlFile(inMessage);
myKmzData = new Binary(kmz, false);
kmz.delete();
FormatDescription fd = new FormatDescription();
fd.addFileExtension("kmz");
fd.addMimeType("application/vnd.google-earth.kmz");
myKmzData.setMimeType("application/vnd.google-earth.kmz");
myKmzData.setFormatDescriptor(fd);
return myKmzData;
} else {
File kml = createPointKmlFile(inMessage, messagePath);
myKmzData = new Binary(kml, false);
kml.delete();
FormatDescription fd = new FormatDescription();
fd.addFileExtension("kml");
fd.addMimeType("application/vnd.google-earth.kml");
myKmzData.setMimeType("application/vnd.google-earth.kml");
myKmzData.setFormatDescriptor(fd);
return myKmzData;
}
} catch (XMLParseException e) {
logger.error("Error: ", e);
} catch (IOException e) {
logger.error("Error: ", e);
}
return null;
}
use of com.dexels.navajo.document.types.Binary in project navajo by Dexels.
the class BirtUtils method createEmptyReport.
public Binary createEmptyReport(Navajo n, Binary template) throws IOException {
InputStream templateStream = null;
if (template == null) {
templateStream = getClass().getResourceAsStream("blank.rptdesign");
} else {
templateStream = template.getDataAsStream();
}
File reportFile = File.createTempFile("temp", ".rptdesign");
createEmptyReport(n, reportFile, templateStream);
Binary result = new Binary(reportFile, false);
Files.delete(reportFile.toPath());
return result;
}
use of com.dexels.navajo.document.types.Binary in project navajo by Dexels.
the class BirtUtils method main.
public static void main(String[] args) throws Exception {
System.out.println("***IS IT A BIRT?***");
// Change the path to the file to match your filesystem
FileInputStream fis = new java.io.FileInputStream("C:/Users/Robin/Documents/Test.xml");
Navajo navajo = NavajoFactory.getInstance().createNavajo(fis);
Binary template = null;
BirtUtils report = new BirtUtils();
Binary result = report.createEmptyReport(navajo, template);
BinaryOpener bo = BinaryOpenerFactory.getInstance();
bo.open(result);
}
use of com.dexels.navajo.document.types.Binary in project navajo by Dexels.
the class BIRTXmlMap method processReport.
private Binary processReport(File fixedFile, Navajo n) throws IOException {
Property outputFormatProperty = n.getProperty("/__ReportDefinition/OutputFormat");
if (outputFormatProperty != null) {
outputFormat = outputFormatProperty.getValue();
}
if (outputFormat == null || "".equals(outputFormat)) {
outputFormat = DEFAULT_OUTPUT_FORMAT;
}
Binary result;
StringBuilder urlBuffer = new StringBuilder();
urlBuffer.append(getViewerUrl());
urlBuffer.append("/run?__report=" + fixedFile.getName());
for (Iterator<String> iter = parameters.keySet().iterator(); iter.hasNext(); ) {
String element = iter.next();
String value = (String) parameters.get(element);
urlBuffer.append("&" + element + "=" + value);
}
urlBuffer.append("&__format=" + outputFormat);
logger.debug("Result = {}", urlBuffer);
URL u = new URL(urlBuffer.toString());
InputStream is = u.openStream();
result = new Binary(is);
return result;
}
use of com.dexels.navajo.document.types.Binary in project navajo by Dexels.
the class ElasticSearchAdapter method setPropertyValue.
private void setPropertyValue(ObjectNode an, Property property, ObjectMapper objectMapper) {
if (Property.DATE_PROPERTY.equals(property.getType())) {
Date d = (Date) property.getTypedValue();
an.put(property.getName(), df.format(d));
} else if (Property.INTEGER_PROPERTY.equals(property.getType())) {
Integer d = (Integer) property.getTypedValue();
an.put(property.getName(), d);
} else if (Property.BOOLEAN_PROPERTY.equals(property.getType())) {
Boolean d = (Boolean) property.getTypedValue();
an.put(property.getName(), d);
} else if (Property.BINARY_PROPERTY.equals(property.getType())) {
Binary b = (Binary) property.getTypedValue();
an.put(property.getName(), b.getData());
} else {
an.put(property.getName(), property.getValue());
}
}
Aggregations