/** * Creates a lightweight, serializable model object from a logical model * * @param m * @param domainId * @return */ public Model createThinModel( LogicalModel m, String domainId ) { // create the model object Model model = new Model(); model.setName( m.getName( getLocale() ) ); model.setId( m.getId() ); model.setDomainId( domainId ); model.setDescription( m.getDescription( getLocale() ) ); // add the categories to the model List<Category> categories = new ArrayList<Category>(); for ( org.pentaho.metadata.model.Category cat : m.getCategories() ) { categories.add( createCategory( m, cat ) ); } model.setCategories( categories.toArray( new Category[ categories.size() ] ) ); return model; }
/** * Returns a list of ModelInfo objects for the specified domain. These objects are small and this list is intended to * allow a client to provide a list of models to a user so the user can pick which one they want to work with. * * @param domain * @param models */ private void getModelInfos( final String domain, List<ModelInfo> models ) { IMetadataDomainRepository repo = getMetadataRepository(); Domain domainObject = repo.getDomain( domain ); // find the best locale String locale = LocaleHelper.getClosestLocale( LocaleHelper.getLocale().toString(), domainObject.getLocaleCodes() ); // iterate over all of the models in this domain for ( LogicalModel model : domainObject.getLogicalModels() ) { // create a new ModelInfo object and give it the envelope information about the model ModelInfo modelInfo = new ModelInfo(); modelInfo.setDomainId( domain ); modelInfo.setModelId( model.getId() ); modelInfo.setModelName( model.getName( locale ) ); if ( model.getDescription() != null ) { String modelDescription = model.getDescription( locale ); modelInfo.setModelDescription( modelDescription ); } models.add( modelInfo ); } return; }
if ( model.getDescription() != null ) { String modelDescription = model.getDescription( locale ); if ( modelDescription != null ) { modelNode.addElement( "model_description" ).setText( modelDescription ); //$NON-NLS-1$
modelNode.addElement( "model_name" ).setText( model.getName( locale ) ); //$NON-NLS-1$ if ( model.getDescription( locale ) != null ) { modelNode.addElement( "model_description" ).setText( model.getDescription( locale ) ); //$NON-NLS-1$