@Override public String getRoleAliases( String roleName ) throws ModelerException { String aliasKey = GeoContext.GEO_PREFIX + roleName + GeoContext.ALIAS_SUFFIX; String aliases = props.getProperty( aliasKey ); if ( aliases == null || aliases.trim().length() == 0 ) { throw new ModelerException( "Error while building GeoContext from properties: No Aliases found for role " + roleName + ". Make sure there is a " + aliasKey + " property defined" ); } return aliases; }
private Element getCalculatedMeasureNode( final String cubeName, final String measureName ) throws ModelerException { try { XPathFactory xPathFactory = XPathFactory.newInstance(); XPath xPath = xPathFactory.newXPath(); String inlineWithHierarchy = String.format( "Schema/Cube[@name=\"%s\"]/CalculatedMember[@name=\"%s\" and @dimension=\"Measures\"]", cubeName, measureName ); return (Element) xPath.compile( inlineWithHierarchy ).evaluate( this.schema, XPathConstants.NODE ); } catch ( Exception e ) { throw new ModelerException( e ); } }
private Element getCalculatedMeasureElement( String cubeName, String measureName ) throws ModelerException { measureName = getMeasureName( measureName ); try { String xPathExpr = String.format( "/Schema/Cube[@name=\"%s\"]/CalculatedMember[@name=\"%s\"]", cubeName, measureName ); XPathFactory xPathFactory = XPathFactory.newInstance(); XPath xPath = xPathFactory.newXPath(); XPathExpression xPathExpression = xPath.compile( xPathExpr ); return (Element) xPathExpression.evaluate( this.schema, XPathConstants.NODE ); } catch ( Exception e ) { throw new ModelerException( e ); } }
@Override public void validate() throws ModelerException { if ( StringUtils.isBlank( measure ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.UpdateMeasure.validation.MEASURE_NAME_REQUIRED" ) ); } }
@Override public String getRoleAliases( String roleName ) throws ModelerException { String aliasKey = "geo/" + roleName + "/aliases"; String aliases = PentahoSystem.getSystemSetting( settingsFile, aliasKey, null ); if ( aliases == null || aliases.trim().length() == 0 ) { throw new ModelerException( "Error while building GeoContext: No Aliases found for role " + roleName + ". Make sure there is a " + aliasKey + " element defined" ); } return aliases; }
@Override public void validate() throws ModelerException { if ( StringUtils.isBlank( getName() ) ) { // not ui facing, shouldn't happen throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.CreateAttribute.validation.ATTRIBUTE_NAME_REQUIRED" ) ); } if ( StringUtils.isBlank( getDimension() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.CreateAttribute.validation.PARENT_PROVIDED_MISSING_DIMENSION" ) ); } }
@Override public void validate() throws ModelerException { if ( StringUtils.isBlank( getLevel() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.RemoveAttribute.validation.FIELD_NAME_REQUIRED" ) ); } }
@Override public void validate() throws ModelerException { if ( isBlank( getCube() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.ShowHide.validation.CUBE_NAME_REQUIRED" ) ); } if ( isBlank( getName() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.ShowHide.validation.MEASURE_NAME_REQUIRED" ) ); } }
@Override public void validate() throws ModelerException { if ( StringUtils.isBlank( getName() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "Modeler.LinkDimension.validation.DIMENSION_NAME_REQUIRED" ) ); } if ( StringUtils.isBlank( getSharedDimension() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "Modeler.LinkDimension.validation.SHARED_DIMENSION_REQUIRED" ) ); } }
@Override public Domain generateDomain( boolean dualModelingMode ) throws ModelerException { try { BusinessData bd = datasourceImpl.generateLogicalModel( datasourceName, connectionName, dbType, query, "10" ); Domain domain = bd.getDomain(); return domain; } catch ( DatasourceServiceException dce ) { throw new ModelerException( dce ); } }
public static void saveWorkspace( ModelerWorkspace aModel, String fileName ) throws ModelerException { try { String xmi = getMetadataXML( aModel ); // write the XMI to a tmp file // models was created earlier. try { save( xmi, fileName ); } catch ( IOException e ) { logger.info( BaseMessages.getString( ModelerWorkspace.class, "ModelerWorkspaceUtil.Populate.BadGenerateMetadata" ), e ); //$NON-NLS-1$ throw new ModelerException( BaseMessages.getString( ModelerWorkspace.class, "ModelerWorkspaceUtil.Populate.BadGenerateMetadata" ), e ); //$NON-NLS-1$ } } catch ( Exception e ) { logger.error( "error", e ); throw new ModelerException( e ); } }
@Override public void validate() throws ModelerException { if ( isBlank( getCube() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.ShowHide.validation.CUBE_NAME_REQUIRED" ) ); } if ( isBlank( getDimension() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.ShowHide.validation.DIMENSION_NAME_REQUIRED" ) ); } if ( isBlank( getHierarchy() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.ShowHide.validation.HIERARCHY_NAME_REQUIRED" ) ); } if ( isBlank( getName() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.ShowHide.validation.LEVEL_NAME_REQUIRED" ) ); } }
@Override public void validate() throws ModelerException { if ( StringUtils.isBlank( getCube() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.UpdateAttribute.validation.CUBE_NAME_REQUIRED" ) ); } if ( StringUtils.isBlank( getDimension() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.UpdateAttribute.validation.DIMENSION_NAME_REQUIRED" ) ); } if ( StringUtils.isBlank( getHierarchy() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.UpdateAttribute.validation.HIERARCHY_NAME_REQUIRED" ) ); } if ( StringUtils.isBlank( getLevel() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.UpdateAttribute.validation.LEVEL_NAME_REQUIRED" ) ); } if ( StringUtils.isBlank( getName() ) ) { throw new ModelerException( BaseMessages.getString( MSG_CLASS, "ModelAnnotation.UpdateAttribute.validation.NAME_REQUIRED" ) ); } }
@Override public void validate() throws ModelerException { if ( StringUtils.isBlank( getField() ) && ( StringUtils.isBlank( getLevel() ) || StringUtils.isBlank( getCube() ) ) && ( StringUtils.isBlank( getMeasure() ) || StringUtils.isBlank( getCube() ) ) ) { throw new ModelerException( BaseMessages .getString( MSG_CLASS, "ModelAnnotation.CreateMeasure.validation.FIELD_OR_LEVEL_NOT_PROVIDED" ) ); } if ( StringUtils.isBlank( getName() ) ) { throw new ModelerException( BaseMessages .getString( MSG_CLASS, "ModelAnnotation.CreateMeasure.validation.MEASURE_NAME_REQUIRED" ) ); } } }
public static void saveWorkspaceAsMondrianSchema( ModelerWorkspace aModel, String fileName, String locale ) throws ModelerException { try { String xml = getMondrianSchemaXml( aModel, locale ); if ( xml == null ) { return; } // write the XMI to a tmp file // models was created earlier. try { save( xml, fileName ); } catch ( IOException e ) { logger.info( BaseMessages.getString( ModelerWorkspace.class, "ModelerWorkspaceUtil.Populate.BadGenerateMetadata" ), e ); //$NON-NLS-1$ throw new ModelerException( BaseMessages.getString( ModelerWorkspace.class, "ModelerWorkspaceUtil.Populate.BadGenerateMetadata" ), e ); //$NON-NLS-1$ } } catch ( Exception e ) { logger.error( "error", e ); throw new ModelerException( e ); } }
public void addField( Object[] selectedFields ) throws ModelerException { try { IDropTarget dropNode = (IDropTarget) getSelectedTreeItem(); for ( Object selectedField : selectedFields ) { AbstractModelNode newNode = (AbstractModelNode) dropNode.onDrop( selectedField ); ( (AbstractModelNode) dropNode ).add( newNode ); } } catch ( IllegalStateException e ) { throw new ModelerException( e ); } }
protected void fireBindings() throws ModelerException { try { modelerModeBinding.fireSourceChanged(); fieldListBinding.fireSourceChanged(); selectedFieldsBinding.fireSourceChanged(); modelTreeBinding.fireSourceChanged(); relModelTreeBinding.fireSourceChanged(); } catch ( Exception e ) { e.printStackTrace(); throw new ModelerException( e ); } }
@Override public Object onDrop( Object data ) throws ModelerException { try { if ( data instanceof AvailableField ) { AvailableField field = (AvailableField) data; return getWorkspace().createFieldForParentWithNode( this, field ); } else if ( data instanceof FieldMetaData ) { ( (FieldMetaData) data ).setParent( this ); return data; } else { return null; } } catch ( Exception e ) { throw new ModelerException( e ); } } }
private String resolveField( final ModelerWorkspace workspace ) throws ModelerException { String field = getField(); if ( StringUtils.isBlank( field ) ) { if ( !StringUtils.isBlank( getLevel() ) && !StringUtils.isBlank( getCube() ) ) { field = resolveFieldFromLevel( workspace, getLevel(), getCube() ); setField( field ); } else { throw new ModelerException( BaseMessages.getString( "ModelAnnotation.resolveField.UNABLE_TO_FIND_FIELD" ) ); } } return field; }
public static void verifyTableExistsAndMayBeQuoted( DatabaseMeta databaseMeta, String schemaName, String tableName ) throws ModelerException { Database database = new Database( databaseMeta ); String quotedSchema = schemaName; if ( !StringUtils.isBlank( quotedSchema ) ) { quotedSchema = databaseMeta.getStartQuote() + quotedSchema + databaseMeta.getEndQuote(); } String quotedTable = tableName; if ( !StringUtils.isBlank( quotedTable ) ) { quotedTable = databaseMeta.getStartQuote() + quotedTable + databaseMeta.getEndQuote(); } String schemaTableCombination = databaseMeta.getQuotedSchemaTableCombination( quotedSchema, quotedTable ); try { database.connect(); database.getTableFields( schemaTableCombination ); } catch ( KettleDatabaseException e ) { throw new ModelerException( BaseMessages.getString( ModelerWorkspace.class, "ModelerSourceUtil.FAILED_TO_GET_TABLE_FIELDS", schemaTableCombination ), e ); //$NON-NLS-1$ } finally { database.disconnect(); } }