/** * Gets the dimension with the specified name within this cube. * * @param dimensionName name of the dimension to find * @return dimension within the cube if found, otherwise <code>null</code> */ public DimensionHandle getDimension(String dimensionName) { if (StringUtil.isBlank(dimensionName)) return null; if (!getElement().canDynamicExtends()) { Dimension dimension = module.findDimension(dimensionName); if (dimension == null) return null; if (dimension.isContentOf(getElement())) return (DimensionHandle) dimension.getHandle(module); else { // check the client to find the children of the cube List<BackRef> clients = dimension.getClientList(); if (clients != null) { for (BackRef ref : clients) { DesignElement client = ref.getElement(); if (client.isContentOf(getElement())) return (DimensionHandle) client.getHandle(module); } } } } else if (getElement().getDynamicExtendsElement(getModule()) != null) { Cube cube = (Cube) getElement(); DesignElement element = cube.findLocalElement( dimensionName, MetaDataDictionary.getInstance().getElement(ReportDesignConstants.DIMENSION_ELEMENT)); return (DimensionHandle) (element == null ? null : element.getHandle(module)); } return null; }
/** * Gets the measure with the specified name within this cube. * * @param measureName name of the measure to find * @return measure within the cube if found, otherwise <code>null</code> */ public MeasureHandle getMeasure(String measureName) { if (StringUtil.isBlank(measureName)) return null; if (!getElement().canDynamicExtends()) { DesignElement measure = module.findOLAPElement(measureName); if (measure instanceof Measure && measure.isContentOf(getElement())) return (MeasureHandle) measure.getHandle(module); } else if (getElement().getDynamicExtendsElement(getModule()) != null) { Cube cube = (Cube) getElement(); DesignElement element = cube.findLocalElement( measureName, MetaDataDictionary.getInstance().getElement(ReportDesignConstants.MEASURE_ELEMENT)); return (MeasureHandle) (element == null ? null : element.getHandle(module)); } return null; }
protected void resetMetadata() { MetaDataDictionary.reset(); MetaDataDictionary.initialize(); }