public Element generateXml() { Element element = null; if (this.portableType.equals(PortableType.IMPORTABLE)) { element = new Element(XMLElements.IMPORTABLE.toString()); element.setAttribute(XMLElements.FILTERS.toString(), McUtils.listToStr(this.filterList, ",")); } else { element = new Element(XMLElements.EXPORTABLE.toString()); element.setAttribute( XMLElements.ATTRIBUTES.toString(), McUtils.listToStr(this.attributeList, ",")); element.setAttribute( XMLElements.DEFAULT.toString(), this.getPropertyValue(XMLElements.DEFAULT)); } element.setAttribute(XMLElements.NAME.toString(), this.getPropertyValue(XMLElements.NAME)); element.setAttribute(XMLElements.INTERNALNAME.toString(), this.getInternalName()); element.setAttribute(XMLElements.DISPLAYNAME.toString(), this.getDisplayName()); element.setAttribute(XMLElements.DESCRIPTION.toString(), this.getDescription()); element.setAttribute( XMLElements.VERSION.toString(), this.getPropertyValue(XMLElements.VERSION)); element.setAttribute( XMLElements.ORDERBY.toString(), this.getPropertyValue(XMLElements.ORDERBY)); element.setAttribute( XMLElements.LINKVERSION.toString(), this.getPropertyValue(XMLElements.LINKVERSION)); element.setAttribute(XMLElements.TYPE.toString(), this.getPropertyValue(XMLElements.TYPE)); element.setAttribute(XMLElements.LINKVERSIONS.toString(), this.MapToStr(this.linkVersionMap)); return element; }
public Map<String, List<String>> getMartTablesInfo(JdbcLinkObject conObj, String dsName) throws MartBuilderException { Map<String, List<String>> tblColMap = new TreeMap<String, List<String>>(McUtils.BETTER_STRING_COMPARATOR); // see DCCTEST-491 List<String> colList = new ArrayList<String>(); StringBuffer sb = new StringBuffer( "select table_name,column_name,column_key " + "from information_schema.columns where table_schema='" + conObj.getDatabaseName() + "' and " + "table_name like '" + dsName + "%' order by " + "table_name, ordinal_position"); String lastTableName = ""; List<Map<String, String>> resultSet = ConnectionPool.Instance.query(conObj, sb.toString()); for (Map<String, String> mapItem : resultSet) { String tableName = (String) mapItem.get("table_name"); if (!(tableName.endsWith("__main") || tableName.endsWith("__dm"))) { continue; } // finish all columns in one table and move to the next, if previous table doesn't have a PK, // create using keyguessing if (!lastTableName.equals(tableName)) { if (!lastTableName.equals("")) { tblColMap.put(lastTableName, colList); colList = new ArrayList<String>(); } // move to next table // clean flags lastTableName = tableName; } colList.add((String) mapItem.get("column_name")); } // sort column list Collections.sort(colList, McUtils.BETTER_STRING_COMPARATOR); // see DCCTEST-491 if (!McUtils.isStringEmpty(lastTableName)) tblColMap.put(lastTableName, colList); return tblColMap; }
@Override public Object getTransferData(DataFlavor e) throws UnsupportedFlavorException, IOException { if (e == DataFlavor.stringFlavor) { Container container = SwingUtilities.getAncestorOfClass( org.biomart.configurator.view.idwViews.McViewSourceGroup.class, this); if (container != null) { McViewSourceGroup sgview = (McViewSourceGroup) container; List<Mart> martList = sgview.getSelectedMarts(); List<String> marts = new ArrayList<String>(); for (Mart mart : martList) { marts.add(mart.getName()); } if (!marts.isEmpty()) { return McUtils.StrListToStr(marts, ","); } } return null; } else return null; }
public void refreshIcon() { String iconPath = "images/source.gif"; this.iconLabel.setIcon(McUtils.createImageIcon(iconPath)); this.revalidate(); }
public void initSourceSchema(List<SourceSchema> sourceSchemas) throws MartBuilderException { if (McUtils.isCollectionEmpty(sourceSchemas)) this.initSourceSchemaFromDB(); else this.initSourceSchemaFromXML(sourceSchemas); }
public void addAttribute(Attribute attribute) { this.attributeList.add(attribute); this.setProperty(XMLElements.ATTRIBUTES, McUtils.listToStr(this.attributeList, ",")); }
public void addFilter(Filter filter) { this.filterList.add(filter); this.setProperty(XMLElements.FILTERS, McUtils.listToStr(this.filterList, ",")); }