blob: 64305875639d7498634f783ddf06cef3384de9c2 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*/
package org.eclipse.osbp.xtext.reportdsl.common.item;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.eclipse.birt.report.model.api.DataItemHandle;
import org.eclipse.birt.report.model.api.ReportItemHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.osbp.xtext.reportdsl.DatamartTableAttribute;
import org.eclipse.osbp.xtext.reportdsl.jvmmodel.ReportGeneratorWorkSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DataItem implements BaseItem {
private static final Logger LOGGER = LoggerFactory.getLogger(DataItem.class);
private final DataItemHandle fItem;
public DataItem(ReportGeneratorWorkSet workset, DatamartTableAttribute tableAttribute) {
fItem = workset.newDataItem("");
try {
fItem.setResultSetColumn(DataUtils.getAttributeName(tableAttribute));
} catch (SemanticException e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
String exceptionDetails = sw.toString();
LOGGER.error("{}", exceptionDetails);
}
}
@Override
public ReportItemHandle getHandle() {
return fItem;
}
}