public PivotExcelExporter(PivotTable pivotTable) { entityMetaClass = pivotTable.getDataProvider() instanceof HasMetaClass ? ((HasMetaClass) pivotTable.getDataProvider()).getMetaClass() : null; initNotifications(pivotTable); }
protected void loadProperties(PivotTable pivot, Element element) { Element propertiesElement = element.element("properties"); if (propertiesElement != null) { for (Object item : propertiesElement.elements("property")) { Element propertyElement = (Element) item; String name = propertyElement.attributeValue("name"); if (StringUtils.isNotEmpty(name)) { MetaClass metaClass = pivot.getDataProvider() instanceof HasMetaClass ? ((HasMetaClass) pivot.getDataProvider()).getMetaClass() : null; checkValidProperty(metaClass, name); String localizedName = propertyElement.attributeValue("localizedName"); if (StringUtils.isNotEmpty(localizedName)) { localizedName = loadResourceString(localizedName); } else if (metaClass != null) { localizedName = getMessageTools().getPropertyCaption(metaClass, name); } else { localizedName = name; } pivot.addProperty(name, localizedName); } } } }
protected void detectDateBasedCategoryAxis() { MetaClass metaClass = getDataProvider() instanceof HasMetaClass ? ((HasMetaClass) getDataProvider()).getMetaClass() : null; if (metaClass != null && StringUtils.isNotEmpty(getCategoryField()) && getCategoryAxis() != null && getCategoryAxis().getParseDates() == null) { MetaProperty property = metaClass.getProperty(getCategoryField()); if (property == null) { throw new DevelopmentException( String.format("Unable to find metaproperty '%s' for class '%s'", getCategoryField(), metaClass)); } if (Date.class.isAssignableFrom(property.getJavaType())) { getCategoryAxis().setParseDates(true); } } }