use of org.vcell.util.document.PublicationInfo in project vcell by virtualcell.
the class MathModelDbTreePanel method treeSelection.
/**
* Comment
*/
protected void treeSelection() {
TreePath treePath = getJTree1().getSelectionPath();
if (treePath == null) {
setSelectedVersionInfo(null);
return;
}
BioModelNode bioModelNode = (BioModelNode) treePath.getLastPathComponent();
Object object = bioModelNode.getUserObject();
if (object instanceof PublicationInfo) {
// TODO: is this line needed?
setSelectedVersionInfo(null);
setSelectedPublicationInfo(bioModelNode);
} else if (object instanceof VersionInfo) {
setSelectedVersionInfo((VersionInfo) object);
} else if (object instanceof VCDocumentInfoNode && bioModelNode.getChildCount() > 0 && ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject() instanceof MathModelInfo) {
MathModelInfo mathModelInfo = (MathModelInfo) ((BioModelNode) bioModelNode.getChildAt(0)).getUserObject();
setSelectedVersionInfo(mathModelInfo);
} else {
setSelectedVersionInfo(null);
}
}
use of org.vcell.util.document.PublicationInfo in project vcell by virtualcell.
the class DbDriver method getVCInfoContainer.
/**
* Insert the method's description here.
* Creation date: (9/24/2003 12:54:32 PM)
* @return cbit.vcell.modeldb.VCInfoContainer
*/
public static VCInfoContainer getVCInfoContainer(User user, Connection con, DatabaseSyntax dbSyntax, int whichExtraInfo) throws SQLException, DataAccessException {
VCInfoContainer results = null;
//
VCImageInfo[] vcImageInfos = null;
GeometryInfo[] geometryInfos = null;
MathModelInfo[] mathModelInfos = null;
BioModelInfo[] bioModelInfos = null;
PublicationInfo[] publicationInfos = null;
//
StringBuffer sql = null;
String special = null;
ResultSet rset = null;
boolean enableSpecial = true;
boolean enableDistinct = true;
Statement stmt = con.createStatement();
stmt.setFetchSize(500);
try {
String aliasSimName = "aliasSimName";
String aliasSimID = "aliasSimID";
String aliasSCName = "aliasSCName";
String aliasSVName = "aliasSVName";
//
// BioModelInfos
//
{
double beginTime = System.currentTimeMillis();
special = " ORDER BY " + BioModelTable.table.name.getQualifiedColName() + "," + BioModelTable.table.versionBranchID.getQualifiedColName() + "," + BioModelTable.table.versionDate.getQualifiedColName();
sql = new StringBuffer(BioModelTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), dbSyntax));
sql.insert(7, Table.SQL_GLOBAL_HINT);
rset = stmt.executeQuery(sql.toString());
TreeMap<BigDecimal, BioModelInfo> mapBmToBioModelInfo = new TreeMap<BigDecimal, BioModelInfo>();
while (rset.next()) {
BigDecimal bmID = rset.getBigDecimal(VersionTable.id_ColumnName);
if (!mapBmToBioModelInfo.containsKey(bmID)) {
BioModelInfo versionInfo = (BioModelInfo) BioModelTable.table.getInfo(rset, con, dbSyntax);
mapBmToBioModelInfo.put(bmID, versionInfo);
}
}
rset.close();
if (whichExtraInfo != 0) {
// Add mapping simName->SimID
try {
// String aliasUserKey = "aliasUserKey";
sql = new StringBuffer("SELECT " + SimContextTable.table.id.getQualifiedColName() + "," + SimContextTable.table.name.getQualifiedColName() + " " + aliasSCName + "," + BioModelSimContextLinkTable.table.bioModelRef.getQualifiedColName() + "," + SimulationTable.table.name.getQualifiedColName() + " " + aliasSimName + "," + SimulationTable.table.id.getQualifiedColName() + " " + aliasSimID + (whichExtraInfo == 0xFF ? "," + ApplicationMathTable.table.outputFuncLarge.getQualifiedColName() + "," + ApplicationMathTable.table.outputFuncSmall.getQualifiedColName() + "," + SimulationTable.table.mathOverridesSmall + "," + SimulationTable.table.mathOverridesLarge + "," + SubVolumeTable.table.handle.getQualifiedColName() + "," + SubVolumeTable.table.name.getQualifiedColName() + " " + aliasSVName : // SubVolumeTable.table.ordinal.getQualifiedColName()+
"") + " FROM " + SimContextTable.table.getTableName() + "," + BioModelSimContextLinkTable.table.getTableName() + "," + BioModelSimulationLinkTable.table.getTableName() + "," + SimulationTable.table.getTableName() + (whichExtraInfo == 0xFF ? "," + ApplicationMathTable.table.getTableName() + "," + // GeometricRegionTable.table.getTableName()+","+
SubVolumeTable.table.getTableName() : "") + " WHERE " + BioModelSimContextLinkTable.table.simContextRef.getQualifiedColName() + " = " + SimContextTable.table.id.getQualifiedColName() + " AND " + SimulationTable.table.id.getQualifiedColName() + " = " + BioModelSimulationLinkTable.table.simRef.getQualifiedColName() + " AND " + BioModelSimulationLinkTable.table.bioModelRef.getQualifiedColName() + " = " + BioModelSimContextLinkTable.table.bioModelRef.getQualifiedColName() + " AND " + SimContextTable.table.mathRef.getQualifiedColName() + " = " + SimulationTable.table.mathRef.getQualifiedColName() + (whichExtraInfo == 0xFF ? " AND " + SimContextTable.table.id.getQualifiedColName() + " = " + ApplicationMathTable.table.simContextRef.getQualifiedColName() + " (+)" + // " AND "+SubVolumeTable.table.geometryRef.getQualifiedColName()+" = "+GeometricRegionTable.table.geometryRef.getQualifiedColName()
" AND " + SimContextTable.table.geometryRef.getQualifiedColName() + " = " + SubVolumeTable.table.geometryRef.getQualifiedColName() + " (+)" : ""));
final BigDecimal[] array = mapBmToBioModelInfo.keySet().toArray(new BigDecimal[0]);
final int MAX_LIST = 500;
for (int i = 0; i < array.length; i += MAX_LIST) {
StringBuffer bmListStr = new StringBuffer();
for (int j = 0; (i + j) < array.length && j < MAX_LIST; j++) {
bmListStr.append((j != 0 ? "," : "") + array[i + j].toString());
}
final String sql2 = sql.toString() + " AND " + BioModelSimulationLinkTable.table.bioModelRef.getQualifiedColName() + " IN (" + bmListStr.toString() + ")" + " ORDER BY " + BioModelSimulationLinkTable.table.bioModelRef.getQualifiedColName() + "," + SimContextTable.table.id.getQualifiedColName() + "," + SimulationTable.table.id.getQualifiedColName();
rset = stmt.executeQuery(sql2);
BioModelInfo bmInfo = null;
while (rset.next()) {
final BigDecimal bmID = rset.getBigDecimal(BioModelSimContextLinkTable.table.bioModelRef.toString());
bmInfo = mapBmToBioModelInfo.get(bmID);
if (bmInfo != null) {
final BigDecimal scID = rset.getBigDecimal(SimContextTable.table.id.toString());
final String scName = rset.getString(aliasSCName);
bmInfo.addSCID(scName, scID);
if ((whichExtraInfo & EXTRAINFO_ANNOTFUNC) != 0) {
if (!bmInfo.hasSCIDForAnnotFunc(scID)) {
String outputFunctionsXML = DbDriver.varchar2_CLOB_get(rset, ApplicationMathTable.table.outputFuncSmall, ApplicationMathTable.table.outputFuncLarge, dbSyntax);
if (outputFunctionsXML != null) {
bmInfo.addAnnotatedFunctionsStr(scName, scID, outputFunctionsXML);
}
}
}
final String simName = rset.getString(aliasSimName);
if (bmInfo.getSimID(simName) == null) {
final BigDecimal simID = rset.getBigDecimal(aliasSimID);
bmInfo.addSimID(simName, simID);
if ((whichExtraInfo & EXTRAINFO_MATHOVERRIDES) != 0) {
CommentStringTokenizer mathOverridesTokenizer = SimulationTable.getMathOverridesTokenizer(rset, dbSyntax);
List<Element> mathOverrideElements = MathOverrides.parseOverrideElementsFromVCML(mathOverridesTokenizer);
// int scanCount=1;
// for(Element ele:mathOverrideElements) {
// if(ele.getSpec() != null) {
// scanCount*=ele.getSpec().getNumValues();
// // if(scanCount==0) {
// // scanCount=ele.getSpec().getNumValues();
// // }else {
// // scanCount*=ele.getSpec().getNumValues();
// // }
// }
// }
// // if(scanCount > 1) {
// // System.out.println("bmid="+bmID+" simid="+simID+" scans="+scanCount+" "+simName);
// // }
bmInfo.addMathOverrides(simName, mathOverrideElements);
}
}
if ((whichExtraInfo & EXTRAINFO_SUBVOLUMES) != 0) {
final int subVolumeID = rset.getInt(SubVolumeTable.table.handle.toString());
if (bmInfo.getSubVolumeName(subVolumeID) == null) {
bmInfo.addSubVolume(subVolumeID, rset.getString(aliasSVName));
}
}
}
}
rset.close();
}
} catch (Exception e) {
e.printStackTrace();
// ignore
}
}
if (mapBmToBioModelInfo.size() > 0) {
bioModelInfos = new BioModelInfo[mapBmToBioModelInfo.size()];
mapBmToBioModelInfo.values().toArray(bioModelInfos);
}
// }
if (lg.isInfoEnabled()) {
lg.info("BioModelInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
}
}
//
// MathModelInfos
//
{
double beginTime = System.currentTimeMillis();
special = " ORDER BY " + MathModelTable.table.name.getQualifiedColName() + "," + MathModelTable.table.versionBranchID.getQualifiedColName() + "," + MathModelTable.table.versionDate.getQualifiedColName();
sql = new StringBuffer(MathModelTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), dbSyntax));
sql.insert(7, Table.SQL_GLOBAL_HINT);
TreeMap<BigDecimal, MathModelInfo> mapMmToMathModelInfo = new TreeMap<BigDecimal, MathModelInfo>();
rset = stmt.executeQuery(sql.toString());
ArrayList<MathModelInfo> tempInfos = new ArrayList<MathModelInfo>();
Set<String> distinctV = new HashSet<String>();
while (rset.next()) {
MathModelInfo versionInfo = (MathModelInfo) MathModelTable.table.getInfo(rset, con, dbSyntax);
if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
tempInfos.add(versionInfo);
distinctV.add(versionInfo.getVersion().getVersionKey().toString());
mapMmToMathModelInfo.put(BigDecimal.valueOf(Long.parseLong(versionInfo.getVersion().getVersionKey().toString())), versionInfo);
}
}
rset.close();
if (whichExtraInfo != 0) {
// Add mapping simName->SimID
try {
// String aliasUserKey = "aliasUserKey";
sql = new StringBuffer("SELECT " + MathModelSimulationLinkTable.table.mathModelRef.getQualifiedColName() + "," + ApplicationMathTable.table.outputFuncLarge.getQualifiedColName() + "," + ApplicationMathTable.table.outputFuncSmall.getQualifiedColName() + "," + SimulationTable.table.name.getQualifiedColName() + " " + aliasSimName + "," + SimulationTable.table.id.getQualifiedColName() + " " + aliasSimID + "," + SimulationTable.table.mathOverridesSmall + "," + SimulationTable.table.mathOverridesLarge + "," + SubVolumeTable.table.handle.getQualifiedColName() + "," + SubVolumeTable.table.name.getQualifiedColName() + " " + aliasSVName + " FROM " + MathModelTable.table.getTableName() + "," + MathDescTable.table.getTableName() + "," + MathModelSimulationLinkTable.table.getTableName() + "," + ApplicationMathTable.table.getTableName() + "," + SimulationTable.table.getTableName() + "," + SubVolumeTable.table.getTableName() + " WHERE " + MathModelSimulationLinkTable.table.mathModelRef.getQualifiedColName() + " = " + ApplicationMathTable.table.mathModelRef.getQualifiedColName() + " (+)" + " AND " + MathModelTable.table.id.getQualifiedColName() + " = " + MathModelSimulationLinkTable.table.mathModelRef.getQualifiedColName() + " AND " + SimulationTable.table.id.getQualifiedColName() + " = " + MathModelSimulationLinkTable.table.simRef.getQualifiedColName() + " AND " + MathDescTable.table.id.getQualifiedColName() + " = " + MathModelTable.table.mathRef.getQualifiedColName() + " AND " + MathDescTable.table.geometryRef.getQualifiedColName() + " = " + SubVolumeTable.table.geometryRef.getQualifiedColName() + " (+)");
final BigDecimal[] array = mapMmToMathModelInfo.keySet().toArray(new BigDecimal[0]);
final int MAX_LIST = 500;
for (int i = 0; i < array.length; i += MAX_LIST) {
StringBuffer mmListStr = new StringBuffer();
for (int j = 0; (i + j) < array.length && j < MAX_LIST; j++) {
mmListStr.append((j != 0 ? "," : "") + array[i + j].toString());
}
final String sql2 = sql.toString() + " AND " + MathModelSimulationLinkTable.table.mathModelRef.getQualifiedColName() + " IN (" + mmListStr.toString() + ")" + " ORDER BY " + MathModelSimulationLinkTable.table.mathModelRef.getQualifiedColName() + "," + SimulationTable.table.id.getQualifiedColName();
rset = stmt.executeQuery(sql2);
MathModelInfo mmInfo = null;
while (rset.next()) {
final BigDecimal mmID = rset.getBigDecimal(MathModelSimulationLinkTable.table.mathModelRef.toString());
mmInfo = mapMmToMathModelInfo.get(mmID);
if (mmInfo != null) {
if (mmInfo.getAnnotatedFunctionsStr() == null) {
String outputFunctionsXML = DbDriver.varchar2_CLOB_get(rset, ApplicationMathTable.table.outputFuncSmall, ApplicationMathTable.table.outputFuncLarge, dbSyntax);
if (outputFunctionsXML != null) {
mmInfo.setAnnotatedFunctionsStr(outputFunctionsXML);
}
}
final String simName = rset.getString(aliasSimName);
if (mmInfo.getSimID(simName) == null) {
final BigDecimal simID = rset.getBigDecimal(aliasSimID);
CommentStringTokenizer mathOverridesTokenizer = SimulationTable.getMathOverridesTokenizer(rset, dbSyntax);
List<Element> mathOverrideElements = MathOverrides.parseOverrideElementsFromVCML(mathOverridesTokenizer);
// int scanCount=1;
// for(Element ele:mathOverrideElements) {
// if(ele.getSpec() != null) {
// scanCount*=ele.getSpec().getNumValues();
// }
// }
mmInfo.addSimID(simName, simID, mathOverrideElements);
}
final int subVolumeID = rset.getInt(SubVolumeTable.table.handle.toString());
if (mmInfo.getSubVolumeName(subVolumeID) == null) {
mmInfo.addSubVolume(subVolumeID, rset.getString(aliasSVName));
}
}
}
rset.close();
}
} catch (Exception e) {
e.printStackTrace();
// ignore
}
}
if (tempInfos.size() > 0) {
mathModelInfos = new MathModelInfo[tempInfos.size()];
tempInfos.toArray(mathModelInfos);
}
if (lg.isInfoEnabled()) {
lg.info("MathModelInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
}
}
//
// VCImageInfos
//
{
double beginTime = System.currentTimeMillis();
special = " ORDER BY " + ImageTable.table.name.getQualifiedColName() + "," + ImageTable.table.versionBranchID.getQualifiedColName() + "," + ImageTable.table.versionDate.getQualifiedColName();
sql = new StringBuffer(ImageTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), true, dbSyntax));
sql.insert(7, Table.SQL_GLOBAL_HINT);
rset = stmt.executeQuery(sql.toString());
ArrayList<VCImageInfo> tempInfos = new ArrayList<VCImageInfo>();
Set<String> distinctV = new HashSet<String>();
while (rset.next()) {
VCImageInfo versionInfo = (VCImageInfo) ImageTable.table.getInfo(rset, con, dbSyntax);
if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
tempInfos.add(versionInfo);
distinctV.add(versionInfo.getVersion().getVersionKey().toString());
}
}
rset.close();
if (tempInfos.size() > 0) {
vcImageInfos = new VCImageInfo[tempInfos.size()];
tempInfos.toArray(vcImageInfos);
}
if (lg.isInfoEnabled()) {
lg.info("ImageInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
}
}
//
// GeometeryInfos
//
{
double beginTime = System.currentTimeMillis();
special = " ORDER BY " + GeometryTable.table.name.getQualifiedColName() + "," + GeometryTable.table.versionBranchID.getQualifiedColName() + "," + GeometryTable.table.versionDate.getQualifiedColName();
sql = new StringBuffer(GeometryTable.table.getInfoSQL(user, null, (enableSpecial ? special : null), true, dbSyntax));
sql.insert(7, Table.SQL_GLOBAL_HINT + (enableDistinct ? "DISTINCT " : ""));
rset = stmt.executeQuery(sql.toString());
ArrayList<GeometryInfo> tempInfos = new ArrayList<GeometryInfo>();
Set<String> distinctV = new HashSet<String>();
while (rset.next()) {
GeometryInfo versionInfo = (GeometryInfo) GeometryTable.table.getInfo(rset, con);
if (!distinctV.contains(versionInfo.getVersion().getVersionKey().toString())) {
tempInfos.add(versionInfo);
distinctV.add(versionInfo.getVersion().getVersionKey().toString());
}
}
rset.close();
if (tempInfos.size() > 0) {
geometryInfos = new GeometryInfo[tempInfos.size()];
tempInfos.toArray(geometryInfos);
}
if (lg.isInfoEnabled()) {
lg.info("GeometryInfo Time=" + (((double) System.currentTimeMillis() - beginTime) / (double) 1000));
}
}
try {
Vector<VersionInfo> bm_mm_VCDocumentInfos = new Vector<>();
bm_mm_VCDocumentInfos.addAll(Arrays.asList((bioModelInfos != null ? bioModelInfos : new BioModelInfo[0])));
bm_mm_VCDocumentInfos.addAll(Arrays.asList((mathModelInfos != null ? mathModelInfos : new MathModelInfo[0])));
DbDriver.addPublicationInfos(con, stmt, bm_mm_VCDocumentInfos);
} catch (Exception e) {
e.printStackTrace();
// Don't fail if something goes wrong with setting publication info
}
} finally {
if (stmt != null) {
stmt.close();
}
}
results = new VCInfoContainer(user, vcImageInfos, geometryInfos, mathModelInfos, bioModelInfos);
return results;
}
use of org.vcell.util.document.PublicationInfo in project vcell by virtualcell.
the class MathModelMetaDataPanel method getJTree1.
private JTree getJTree1() {
if (tree == null) {
try {
tree = new JTree();
tree.setName("JTree1");
tree.setEnabled(true);
tree.setRootVisible(false);
tree.setRequestFocusEnabled(false);
tree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 1) {
DefaultMutableTreeNode value = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (value instanceof BioModelNode) {
BioModelNode node = (BioModelNode) value;
try {
if (node.getUserObject() instanceof PublicationInfo && "PublicationInfoDoi".equals(node.getRenderHint("type"))) {
PublicationInfo info = (PublicationInfo) node.getUserObject();
Desktop.getDesktop().browse(new URI(BeanUtils.getDynamicClientProperties().getProperty(PropertyLoader.DOI_URL) + info.getDoi()));
} else if (node.getUserObject() instanceof PublicationInfo && "PublicationInfoUrl".equals(node.getRenderHint("type"))) {
PublicationInfo info = (PublicationInfo) node.getUserObject();
Desktop.getDesktop().browse(new URI(info.getUrl()));
}
} catch (URISyntaxException | IOException ex) {
handleException(ex);
}
}
}
}
});
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return tree;
}
use of org.vcell.util.document.PublicationInfo in project vcell by virtualcell.
the class PublicationInfoNodeCellRenderer method getTreeCellRendererComponent.
public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
JLabel component = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
//
if (!leaf && expanded) {
setIcon(fieldFolderOpenIcon);
} else if (!leaf && !expanded) {
setIcon(fieldFolderClosedIcon);
}
try {
if (value instanceof BioModelNode) {
BioModelNode node = (BioModelNode) value;
if (node.getUserObject() instanceof String && "PublicationsInfo".equals(node.getRenderHint("type"))) {
String label = (String) node.getUserObject();
component.setToolTipText("Publications Info");
component.setText("<html><b>" + label + "</b></html>");
setIcon(fieldTextIcon);
} else if (node.getUserObject() instanceof String && "ModelsList".equals(node.getRenderHint("type"))) {
String label = (String) node.getUserObject();
component.setToolTipText("Model(s) mentioned in this Publication");
component.setText("<html><b>" + label + "</b></html>");
setIcon(fieldTextIcon);
} else if (node.getUserObject() instanceof PublicationInfo && "PublicationInfoTitle".equals(node.getRenderHint("type"))) {
PublicationInfo info = (PublicationInfo) node.getUserObject();
component.setToolTipText("Title");
String text = "<b>" + info.getTitle() + "</b>";
component.setText("<html>" + text + "</html>");
setIcon(fieldTextIcon);
} else if (node.getUserObject() instanceof PublicationInfo && "PublicationInfoAuthors".equals(node.getRenderHint("type"))) {
PublicationInfo info = (PublicationInfo) node.getUserObject();
component.setToolTipText("Authors");
String text = "";
int count = 0;
for (String author : info.getAuthors()) {
if (count > 0) {
text += "; ";
}
text += author;
count++;
}
component.setText("<html>" + text + "</html>");
setIcon(null);
} else if (node.getUserObject() instanceof PublicationInfo && "PublicationInfoCitation".equals(node.getRenderHint("type"))) {
PublicationInfo info = (PublicationInfo) node.getUserObject();
component.setToolTipText("Citation");
String text = "";
text += info.getCitation();
component.setText("<html>" + text + "</html>");
setIcon(null);
} else if (node.getUserObject() instanceof PublicationInfo && "PublicationInfoDoi".equals(node.getRenderHint("type"))) {
PublicationInfo info = (PublicationInfo) node.getUserObject();
component.setToolTipText("DOI");
String text = "<a href=\"" + BeanUtils.getDynamicClientProperties().getProperty(PropertyLoader.DOI_URL) + info.getDoi() + "\">" + "DOI: " + info.getDoi() + "</a>";
component.setText("<html>" + text + "</html>");
setIcon(null);
} else if (node.getUserObject() instanceof PublicationInfo && "PublicationInfoUrl".equals(node.getRenderHint("type"))) {
PublicationInfo info = (PublicationInfo) node.getUserObject();
component.setToolTipText("PMID");
// we know from the tree model that this is not null or empty
String pmid = info.getUrl();
if (pmid.contains("list_uids=")) {
// ex: http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&dopt=Citation&list_uids=12644446
pmid = pmid.substring(pmid.lastIndexOf("list_uids=") + "list_uids=".length());
} else if (pmid.contains("pubmed/")) {
// ex: http://www.ncbi.nlm.nih.gov/pubmed/23093806
pmid = pmid.substring(pmid.lastIndexOf("/") + 1);
} else if (pmid.contains("pubmed.ncbi")) {
// ex: https://pubmed.ncbi.nlm.nih.gov/34360784/
if (pmid.endsWith("/")) {
pmid = pmid.substring(0, pmid.length() - 1);
}
pmid = pmid.substring(pmid.lastIndexOf("/") + 1);
} else {
// something that we don't know how to parse
pmid = "?";
}
String text = "<a href=\"" + info.getUrl() + "\">" + "PubMed PMID: " + pmid + "</a>";
component.setText("<html>" + text + "</html>");
setIcon(null);
} else if (node.getUserObject() instanceof String && "ModelName".equals(node.getRenderHint("type"))) {
String label = (String) node.getUserObject();
component.setToolTipText("Model Name");
component.setText("<html><b>" + label + "</b></html>");
if ("BioModel".equals(node.getRenderHint("category"))) {
component.setToolTipText("BioModel Name");
setIcon(fieldBioModelIcon);
} else if ("MathModel".equals(node.getRenderHint("category"))) {
component.setToolTipText("MathModel Name");
setIcon(fieldMathModelIcon);
} else if ("Geometry".equals(node.getRenderHint("category"))) {
component.setToolTipText("Geometry Name");
setIcon(fieldGeometryIcon);
} else {
component.setToolTipText("Document Name");
setIcon(fieldTextIcon);
}
} else if (node.getUserObject() instanceof User && "ModelOwner".equals(node.getRenderHint("type"))) {
String label = ((User) node.getUserObject()).getName();
component.setToolTipText("Model Owner");
component.setText("<html>" + label + "</html>");
setIcon(fieldUsersIcon);
} else if (node.getUserObject() instanceof Date && "ModelDate".equals(node.getRenderHint("type"))) {
Date date = (Date) node.getUserObject();
component.setToolTipText("Model Creation Date");
component.setText("<html>" + date + "</html>");
setIcon(fieldCalendarIcon);
} else {
setComponentProperties(component, node.getUserObject());
}
if (selectedFont == null && component.getFont() != null) {
selectedFont = component.getFont().deriveFont(Font.BOLD);
}
if (unselectedFont == null && component.getFont() != null) {
unselectedFont = component.getFont().deriveFont(Font.PLAIN);
}
component.setFont(unselectedFont);
}
} catch (Throwable e) {
e.printStackTrace(System.out);
}
//
return component;
}
use of org.vcell.util.document.PublicationInfo in project vcell by virtualcell.
the class DbDriver method addPublicationInfos.
public static void addPublicationInfos(Connection con, Statement stmt, Vector<VersionInfo> mm_and_bm_VersionInfos) throws SQLException, DataAccessException {
TreeMap<Long, VersionInfo> mapModelIdToVersionInfo = new TreeMap<>(new Comparator<Long>() {
@Override
public int compare(Long o1, Long o2) {
return o1.compareTo(o2);
}
});
for (int i = 0; i < mm_and_bm_VersionInfos.size(); i++) {
mapModelIdToVersionInfo.put(Long.parseLong(mm_and_bm_VersionInfos.get(i).getVersion().getVersionKey().toString()), mm_and_bm_VersionInfos.get(i));
}
//
// PublicationInfos
//
final String DOCTYPE_COL = "doctype";
final String DOCID_COL = "docid";
String sql = new String("select vc_publication.*,'bm' " + DOCTYPE_COL + ",vc_biomodel.id " + DOCID_COL + ",vc_biomodel.ownerref,vc_userinfo.userid" + " from vc_publication,vc_publicationmodellink,vc_biomodel,vc_userinfo" + " where" + " vc_biomodel.id=vc_publicationmodellink.biomodelref and vc_userinfo.id=vc_biomodel.ownerref" + " and vc_publication.id=vc_publicationmodellink.pubref and vc_publicationmodellink.pubref is not null" + " and vc_publicationmodellink.biomodelref is not null" + " UNION ALL" + " select vc_publication.*,'mm' " + DOCTYPE_COL + ",vc_mathmodel.id " + DOCID_COL + ",vc_mathmodel.ownerref,vc_userinfo.userid" + " from vc_publication,vc_publicationmodellink,vc_mathmodel,vc_userinfo" + " where" + " vc_mathmodel.id=vc_publicationmodellink.mathmodelref and vc_userinfo.id=vc_mathmodel.ownerref" + " and vc_publication.id=vc_publicationmodellink.pubref and vc_publicationmodellink.pubref is not null" + " and vc_publicationmodellink.mathmodelref is not null");
System.out.println(sql);
ResultSet rset = null;
try {
rset = stmt.executeQuery(sql);
while (rset.next()) {
Publication publication = PublicationTable.table.getInfo(rset, con);
String docType = rset.getString(DOCTYPE_COL);
BigDecimal modelVersionID = rset.getBigDecimal(DOCID_COL);
KeyValue versionKey = new KeyValue(modelVersionID);
Timestamp timestamp = rset.getTimestamp("pubdate");
PublicationInfo publicationInfo = new PublicationInfo(publication.key, versionKey, publication.title, publication.authors, publication.citation, publication.pubmedid, publication.doi, publication.url, (docType.equals("bm") ? VCDocumentType.BIOMODEL_DOC : VCDocumentType.MATHMODEL_DOC), new User(rset.getString(UserTable.table.userid.getUnqualifiedColName()), new KeyValue(rset.getBigDecimal("ownerref").toString())), timestamp);
if (mapModelIdToVersionInfo.containsKey(modelVersionID.longValue()) && mapModelIdToVersionInfo.get(modelVersionID.longValue()) instanceof VCDocumentInfo) {
((VCDocumentInfo) mapModelIdToVersionInfo.get(modelVersionID.longValue())).addPublicationInfo(publicationInfo);
}
// publicationInfoArr.add(publicationInfo);
}
} catch (Exception e) {
e.printStackTrace();
throw new DataAccessException(DbDriver.class.getName() + ".getPublicationInfo(...) Error -" + e.getMessage(), e);
} finally {
if (rset != null) {
rset.close();
}
}
// return publicationInfoArr.toArray(new PublicationInfo[0]);
}
Aggregations