List of usage examples for java.lang Exception getStackTrace
public StackTraceElement[] getStackTrace()
From source file:au.org.theark.study.model.dao.StudyDao.java
/** * If a consent is not in a state where it can be deleted then remove it. It can be in a different status before it can be removed. * //from w w w. j a v a 2 s .c o m * @param consent * @throws ArkSystemException */ public void delete(Consent consent) throws ArkSystemException, EntityNotFoundException { try { Session session = getSession(); consent = (Consent) session.get(Consent.class, consent.getId()); if (consent != null) { getSession().delete(consent); } else { throw new EntityNotFoundException( "The Consent record you tried to remove does not exist in the Ark System"); } } catch (HibernateException someHibernateException) { log.error("An Exception occured while trying to delete this consent " + someHibernateException.getStackTrace()); } catch (Exception e) { log.error("An Exception occured while trying to delete this consent " + e.getStackTrace()); throw new ArkSystemException( "A System Error has occured. We wil have someone contact you regarding this issue"); } }
From source file:au.org.theark.study.model.dao.StudyDao.java
/** * If a consentFile is not in a state where it can be deleted then remove it. It can be in a different status before it can be removed. * /* w w w .ja v a 2 s. c om*/ * @param consentFile * @throws ArkSystemException */ public void delete(ConsentFile consentFile) throws ArkSystemException, EntityNotFoundException { try { Session session = getSession(); consentFile = (ConsentFile) session.get(ConsentFile.class, consentFile.getId()); if (consentFile != null) { getSession().delete(consentFile); } else { throw new EntityNotFoundException( "The Consent file record you tried to remove does not exist in the Ark System"); } } catch (HibernateException someHibernateException) { log.error("An Exception occured while trying to delete this consent file " + someHibernateException.getStackTrace()); } catch (Exception e) { log.error("An Exception occured while trying to delete this consent file " + e.getStackTrace()); throw new ArkSystemException( "A System Error has occured. We wil have someone contact you regarding this issue"); } }
From source file:au.org.theark.study.model.dao.StudyDao.java
/** * If a subjectFile is not in a state where it can be deleted then remove it. It can be in a different status before it can be removed. * /*from ww w . ja va2s . c o m*/ * @param subjectFile * @throws ArkSystemException */ public void delete(SubjectFile subjectFile) throws ArkSystemException, EntityNotFoundException { try { Session session = getSession(); subjectFile = (SubjectFile) session.get(SubjectFile.class, subjectFile.getId()); if (subjectFile != null) { getSession().delete(subjectFile); } else { throw new EntityNotFoundException( "The Consent file record you tried to remove does not exist in the Ark System"); } } catch (HibernateException someHibernateException) { log.error("An Exception occured while trying to delete this consent file " + someHibernateException.getStackTrace()); } catch (Exception e) { log.error("An Exception occured while trying to delete this consent file " + e.getStackTrace()); throw new ArkSystemException( "A System Error has occured. We wil have someone contact you regarding this issue"); } }
From source file:com.quinsoft.zeidon.dbhandler.AbstractSqlHandler.java
/** * Write a row with a specific key to the genkey table. A successful write means we * have locked the table for this commit. * * @return/* w w w . j a v a 2 s. c om*/ */ protected void writeGenkeyLockRow(View kzgkhwob, List<? extends View> viewList) { for (int tries = 0; tries < 5; tries++) { try { executeSql("INSERT INTO ZEIDONGENKEYTABLE (TABLENAME, CURRENTGENKEY ) " + "VALUES ('..ENQ KZHGENKY', 999)"); return; } catch (Exception e) { // For good or ill we'll assume that this exception is caused by the lock // being held. We'll pause a brief time and try again. getTask().log().warn("Exception attempting to lock GENKEY table: %s\n %s", e.getMessage(), StringUtils.join(e.getStackTrace(), "\n ")); } try { Thread.sleep(tries * tries * 100); } catch (InterruptedException e2) { throw ZeidonException.wrapException(e2); } getTask().log().warn("Attempting to acquire GenKey lock again #%d.", tries); } // If we get here then we didn't acquire the lock. throw new GenkeyLockException("Unable to acquire GENKEY lock. See logs for possible explanation."); }
From source file:it.geosolutions.geoserver.rest.GeoServerRESTPublisher.java
/** * Create a new ImageMosaic with the provided configuration provided as a zip file. * /*from w ww . j ava 2s. c o m*/ * <p> * With the options configure we can decide whether or not to configure or not the coverages contained in the ImageMosaic. * * @param workspace the GeoServer workspace * @param coverageStore the GeoServer coverageStore * @param the absolute path to the file to upload * @param configureOpt tells GeoServer whether to configure all coverages in this mosaic (ALL) or none of them (NONE). * * @return <code>true</code> if the call succeeds or <code>false</code> otherwise. * @since geoserver-2.4.0, geoserver-mng-1.6.0 */ public boolean createImageMosaic(String workspace, String coverageStore, String path, ConfigureCoveragesOption configureOpt) { // checks checkString(workspace); checkString(coverageStore); checkString(path); final File zipFile = new File(path); if (!zipFile.exists() || !zipFile.isFile() || !zipFile.canRead()) { throw new IllegalArgumentException( "The provided pathname does not point to a valide zip file: " + path); } // is it a zip? ZipFile zip = null; try { zip = new ZipFile(zipFile); zip.getName(); } catch (Exception e) { LOGGER.trace(e.getLocalizedMessage(), e.getStackTrace()); throw new IllegalArgumentException( "The provided pathname does not point to a valide zip file: " + path); } finally { if (zip != null) { try { zip.close(); } catch (IOException e) { // swallow LOGGER.trace(e.getLocalizedMessage(), e.getStackTrace()); } } } // create URL StringBuilder ss = HTTPUtils.append(restURL, "/rest/workspaces/", workspace, "/coveragestores/", coverageStore, "/", UploadMethod.EXTERNAL.toString(), ".imagemosaic"); switch (configureOpt) { case ALL: break; case NONE: ss.append("?configure=none"); break; default: throw new IllegalArgumentException("Unrecognized COnfigureOption: " + configureOpt); } String sUrl = ss.toString(); // POST request String result = HTTPUtils.put(sUrl, zipFile, "application/zip", gsuser, gspass); return result != null; }
From source file:com.quinsoft.zeidon.dbhandler.AbstractSqlHandler.java
protected void deleteGenkeyLockRow() { for (int tries = 0; tries < 5; tries++) { try {/*w w w. j a v a 2 s .com*/ executeSql("DELETE FROM ZEIDONGENKEYTABLE WHERE TABLENAME = '..ENQ KZHGENKY'"); return; } catch (Exception e) { // Danger danger Will Robinson! We couldn't delete the lock, which will // prevent anybody else from creating new entities. Log a warning and try again. getTask().log().warn("Exception attempting to delete GENKEY lock entry: %s\n %s", e.getMessage(), StringUtils.join(e.getStackTrace(), "\n ")); } try { Thread.sleep(tries * tries * 100); } catch (InterruptedException e2) { // Ignore this error. If we somehow get a crazy error here we still want // to try and unlock the tables. } getTask().log().warn("Attempting to delete Genkey lock again #%d.", tries); } // If we get here then we didn't acquire the lock. throw new GenkeyLockException("Unable to delete GENKEY lock. See logs for possible explanation."); }
From source file:base.BasePlayer.AminoTable.java
void drawScreen(Graphics g) { if (!isEnabled()) { return;/*w ww . j ava2s .c om*/ } buf.setColor(Color.black); buf.fillRect(0, 0, VariantHandler.tableScroll.getViewport().getWidth(), tablescroll.getViewport().getHeight()); if (VariantHandler.writetofile.isSelected()) { buf.setColor(Color.white); if (FileRead.output != null && Main.drawCanvas.loading && Draw.variantcalculator) { buf.drawString("Writing results to " + FileRead.outputName, 10, 20); } else { buf.drawString("Press annotate to write results straight to file", 10, 20); } g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null); return; } //Header Draw genemutcount = 0; hoverVar = null; hoverSample = -1; headerHover = -1; geneHeaderHover = -1; if (!mouseDrag) { resizeColumn = -1; } firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - samplecount - listAdd - aminoarray.size(); if (firstrow < 0) { firstrow = 0; } for (int i = 0; i < genearray.size(); i++) { dot = false; if ((i + 1 + samplecount + aminoarray.size() + listAdd) * rowHeight < tablescroll.getVerticalScrollBar() .getValue()) { continue; } if (i * rowHeight > tablescroll.getVerticalScrollBar().getValue() + tablescroll.getViewport().getHeight()) { break; } if (mouseY >= (rowHeight * (i + genemutcount + 1)) && mouseY < (rowHeight * (i + genemutcount + 2))) { hoverNode = genearray.get(i); } try { buf.setColor(Color.darkGray); buf.drawLine(4, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } textWidth = (int) fm.getStringBounds("" + (i + 1) + ". " + genearray.get(i).getName(), buf) .getWidth(); if (genearray.get(i).intergenic) { if (genearray.get(i).varnodes.get(0).getTranscripts() == null) { buf.drawString((i + 1) + ". " + genearray.get(i).getName(), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) { buf.drawString( (i + 1) + ". " + genearray.get(i).getName() + " ... " + genearray.get(i).varnodes.get(0).getTranscripts().get(1).getGenename(), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getPosition() < genearray.get(i).getStart()) { buf.drawString((i + 1) + ". " + " ... " + genearray.get(i).getName(), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString((i + 1) + ". " + genearray.get(i).getName() + " ... ", 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else { buf.drawString((i + 1) + ". " + genearray.get(i).getName(), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) (headerlengths[1][0] + 1), (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) (headerlengths[1][1]), rowHeight - 1); if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } mutcountbuffer = new StringBuffer("" + genearray.get(i).mutations + " ("); buf.drawString(mutcountbuffer.toString(), (int) (headerlengths[1][0] + 5), (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (genearray.get(i).nonsense > 0) { buf.setColor(Color.red); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString("" + genearray.get(i).nonsense, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).nonsense); dot = true; } if (genearray.get(i).missense > 0) { if (dot) { buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(", "); } textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.setColor(Color.yellow); buf.drawString("" + genearray.get(i).missense, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).missense); dot = true; } if (genearray.get(i).synonymous > 0) { if (dot) { buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(", "); } textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.setColor(Color.green); buf.drawString("" + genearray.get(i).synonymous, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).synonymous); dot = true; } if (genearray.get(i).utr > 0) { if (dot) { buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(", "); } buf.setColor(Color.lightGray); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString("" + genearray.get(i).utr, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).utr); dot = true; } if (genearray.get(i).intronic > 0) { if (dot) { buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(", "); } buf.setColor(Color.gray); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString("" + genearray.get(i).intronic, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append(genearray.get(i).intronic); dot = true; } if (genearray.get(i).intergenic) { buf.setColor(Color.gray); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString("" + genearray.get(i).mutations, (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); mutcountbuffer.append("" + genearray.get(i).mutations); } buf.setColor(Color.white); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); buf.drawString(") ", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.gray); textWidth = (int) fm.getStringBounds(mutcountbuffer.toString() + ") ", buf).getWidth(); if (genearray.get(i).samples.size() == 1) { buf.drawString(" 1 sample", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString(" " + genearray.get(i).samples.size() + " samples", (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) (headerlengths[2][0]) + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } if (genearray.get(i).intergenic) { if (genearray.get(i).varnodes.get(0).getTranscripts() == null) { buf.drawString(genearray.get(i).getChrom(), (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) { buf.drawString( genearray.get(i).getChrom() + ":" + MethodLibrary.formatNumber(genearray.get(i).getEnd()) + "-" + MethodLibrary.formatNumber(genearray.get(i).varnodes.get(0) .getTranscripts().get(1).getStart()), (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getPosition() < genearray.get(i).getStart()) { buf.drawString( genearray.get(i).getChrom() + ":1-" + MethodLibrary.formatNumber(genearray.get(i).varnodes.get(0) .getTranscripts().get(1).getStart()), (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString( genearray.get(i).getChrom() + ":" + MethodLibrary.formatNumber(genearray.get(i).getEnd()) + "-end", (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else { buf.drawString( genearray.get(i).getChrom() + ":" + MethodLibrary.formatNumber(genearray.get(i).getStart()) + "-" + MethodLibrary.formatNumber(genearray.get(i).getEnd()), (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) (headerlengths[3][0]) + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } if (genearray.get(i).intergenic) { if (genearray.get(i).varnodes.get(0).getTranscripts() == null) { buf.drawString("-", (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) { buf.drawString( genearray.get(i).getDescription() + ";" + genearray.get(i).varnodes.get(0).getTranscripts().get(1).getGene() .getDescription(), (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else { buf.drawString(genearray.get(i).getDescription(), (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.darkGray); buf.drawLine(3, rowHeight + 3, 3, (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); for (int r = 0; r < headerlengths.length; r++) { buf.drawLine((int) (headerlengths[r][0]), (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) (headerlengths[r][0]), (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); } if (selectedNode != null && selectedNode.equals(genearray.get(i))) { hoverSample = -1; genemutcount = aminoarray.size() + 1; listAdd = 1; // buf.drawLine(10, (rowHeight*(i+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+3, this.getWidth(), (rowHeight*(i+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+3); drawGeneheader( (rowHeight * (i + listAdd + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); for (int s = 0; s < aminoarray.size(); s++) { buf.setColor(Color.darkGray); buf.drawLine(21, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("nonsense")) { textcolor = Color.red; } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("missense")) { textcolor = Color.yellow; } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("synonymous")) { textcolor = Color.green; } else if (aminoarray.get(s).getRow()[3].contains("UTR")) { textcolor = Color.lightGray; } else { textcolor = Color.gray; } buf.setColor(textcolor); if (mouseY >= (rowHeight * (i + s + listAdd + 2)) && mouseY < (rowHeight * (i + s + listAdd + 3))) { hoverNode = null; hoverVar = aminoarray.get(s).getNode(); hoverString = aminoarray.get(s).getRow(); buf.setColor(Color.white); hoverSample = -1; if (aminoarray.get(s).getRow()[1].equals("1")) { for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getSample().getIndex(); hoverSampleNode = aminoarray.get(s).getNode().vars.get(v).getValue().get(0); hoverBase = aminoarray.get(s).getRow()[5]; break; } } } // hoverSample = -1; } if (!aminoarray.get(s).getRow()[1].equals("1")) { buf.drawString("Multiple", 24, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { buf.drawString( aminoarray.get(s).getNode().vars.get(v).getValue().get(0).getSample() .getName(), 24, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); break; } } } if (hoverVar != null && hoverString.equals(aminoarray.get(s).getRow())) { //TODO textcolor = Color.white; } for (int h = 1; h < 4; h++) { buf.setColor(Color.black); buf.fillRect((int) geneheader.get(h)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(h)[2], rowHeight - 1); buf.setColor(textcolor); if (h == 3) { if (aminoarray.get(s).getRow()[5].length() == 1) { buf.drawString( Main.getBase.get(aminoarray.get(s).getNode().getRefBase()) + ">" + aminoarray.get(s).getRow()[5], (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString(aminoarray.get(s).getRow()[5], (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(4)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(4)[2], rowHeight - 1); buf.setColor(textcolor); buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(4)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } if (aminoarray.get(s).getRow()[1].equals("1")) { buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(5)[2], rowHeight - 1); buf.setColor(textcolor); for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0).isHomozygous()) { buf.drawString( "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getCoverage() + ")", (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 2; casefreq = 2 / (double) (Main.varsamples * 2 - 2); } } else { buf.drawString( "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getCoverage() + ")", (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 1; casefreq = 1 / (double) (Main.varsamples * 2 - 1); } } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(6)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .getQuality(), (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } else { //TODO piirra mustat boksit buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (Control.controlData.controlsOn) { cases = 0; for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { for (int j = 0; j < aminoarray.get(s).getNode().vars.get(v).getValue() .size(); j++) { if (aminoarray.get(s).getNode().vars.get(v).getValue() .get(j).alleles != null) { continue; } if (aminoarray.get(s).getNode().vars.get(v).getValue().get(j) .isHomozygous()) { cases += 2; } else { cases += 1; } } } } casefreq = cases / (double) (Main.varsamples * 2 - cases); } } buf.setColor(textcolor); buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(7)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); // buf.setColor(Color.black); if (Control.controlData.controlsOn) { buf.setColor(textcolor); for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey() .equals(aminoarray.get(s).getRow()[5])) { vararray = aminoarray.get(s).getNode().vars.get(v).getValue(); controlarray = new SampleNode[Control.controlData.fileArray.size()]; if (vararray.get(vararray.size() - 1).alleles != null) { for (int e = vararray.size() - 1; e > 0; e--) { if (vararray.get(e).alleles == null) { break; } controlarray[vararray.get(e).getControlSample().getIndex()] = vararray .get(e); } } for (int e = 0; e < controlarray.length; e++) { if (Control.controlData.fileArray.get(e).controlOn) { if (controlarray[e] == null) { buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString("0", (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString("-", (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + MethodLibrary.round(controlarray[e].alleles / (double) controlarray[e].allelenumber, 5), (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + MethodLibrary.round(casefreq / (controlarray[e].alleles / (double) (controlarray[e].allelenumber - controlarray[e].alleles)), 2) + " (p=" + MethodLibrary.round( fe.getRightTailedP(cases, Main.varsamples * 2 - cases, controlarray[e].alleles, controlarray[e].allelenumber - controlarray[e].alleles), 2) + ")", (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else { buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(Color.darkGray); buf.drawString("Apply controls", (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(Color.darkGray); buf.drawString("-", (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } } } else { buf.setColor(Color.darkGray); for (int e = geneheaderlength; e < geneheader.size(); e++) { if (geneheader.get(e)[0] instanceof ControlFile) { buf.drawString("Apply controls", (int) geneheader.get(e)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } buf.setColor(Color.lightGray); } vararray = null; //if(Main.bedCanvas.bedOn) { for (int a = 0; a < aminoarray.size(); a++) { bedarray = MethodLibrary.makeTrackArray(aminoarray.get(a).getNode(), aminoarray.get(a).getRow()[5]); if (bedarray != null) { for (int b = 0; b < bedarray.length; b++) { buf.setColor(Color.black); if (b == bedarray.length - 1) { buf.fillRect( (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[1] + 12, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth() - (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[1], rowHeight - 1); } else { buf.fillRect( (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[1] + 12, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[2], rowHeight - 1); } buf.setColor(Color.white); if (bedarray[b] != null) { buf.drawString(bedarray[b].toString(), (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + b)[1] + 14, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } } /*if(c < header.size()-1-Main.bedCanvas.bedTrack.size()) { buf.setColor(Color.black); buf.fillRect((int)header.get(c+1)[1]+1, (rowHeight*(i+genemutcount+1))-tablescroll.getVerticalScrollBar().getValue()+4, (int)header.get(c)[2], rowHeight-1); }*/ // } buf.setColor(Color.darkGray); for (int j = 0; j < geneheader.size(); j++) { buf.drawLine((int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); } if (selectedVar != null && selectedString.equals(aminoarray.get(s).getRow()) && Integer.parseInt(selectedString[1]) > 1) { pointer = 0; //TODO for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) { if (aminoarray.get(s).getNode().vars.get(v).getKey().equals(selectedString[5])) { for (int l = 0; l < aminoarray.get(s).getNode().vars.get(v).getValue() .size(); l++) { if (aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).alleles != null) { break; } if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .getSample().annotation) { continue; } if (mouseY > (rowHeight * (i + s + pointer + 4)) && mouseY < (rowHeight * (i + s + pointer + 5))) { textcolor = Color.white; hoverVar = aminoarray.get(s).getNode(); hoverString = aminoarray.get(s).getRow(); hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .getSample().getIndex(); hoverSampleNode = aminoarray.get(s).getNode().vars.get(v).getValue() .get(l); hoverBase = aminoarray.get(s).getRow()[5]; } else { textcolor = Color.lightGray; } // if(aminoarray.get(s).getNode().getSamples().get(l).getVariation().equals(selectedString[5])) { buf.setColor(textcolor); buf.drawString( aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .getSample().getName(), 30, (rowHeight * (i + s + pointer + 4)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); pointer++; // } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 10, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l) .isHomozygous()) { buf.drawString( "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getCoverage() + ")", (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString( "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getCalls() + "/" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getCoverage() + ")", (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(6)[1] + 10, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); buf.setColor(textcolor); buf.drawString( "" + aminoarray.get(s).getNode().vars .get(v).getValue().get(l).getQuality(), (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.darkGray); for (int j = 5; j < 7; j++) { buf.drawLine((int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue(), (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight + 2); } } } } listAdd = Integer.parseInt(selectedString[1]) + 1; genemutcount = aminoarray.size() + listAdd; buf.setColor(Color.darkGray); buf.drawLine(21, (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue() + 3); } } } } catch (Exception e) { ErrorLog.addError(e.getStackTrace()); e.printStackTrace(); } } buf.setColor(Color.darkGray); buf.drawLine(4, (rowHeight * (genearray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (genearray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3); drawHeader(); if (headerHover == -1 && geneHeaderHover == -1) { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (resizeColumn == -1) { setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } else { setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); } } g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null); }
From source file:axiom.framework.core.Application.java
/** * Log an exception's message and stack trace */// w ww. j a va2 s .c o m public void logEvent(Exception ex) { StringBuffer msg = new StringBuffer(); msg.append(ex.getLocalizedMessage()); msg.append("\n"); StackTraceElement[] trace = ex.getStackTrace(); int len = trace.length; for (int i = 0; i < len; i++) { msg.append("\tat " + trace[i].toString()); msg.append("\n"); } getEventLog().info(msg); }
From source file:com.esri.geoevent.solutions.adapter.cot.CoTAdapterInbound.java
private MapGeometry createGeometry(Node node) throws Exception { try {/*from ww w. j av a 2 s .c om*/ if (node.getNodeName().equals("point")) { try { String lat = getAttribute(node, "lat"); String lon = getAttribute(node, "lon"); String hae = getAttribute(node, "hae"); com.esri.core.geometry.Point pt = new com.esri.core.geometry.Point(); SpatialReference srOut = SpatialReference.create(4326); if (!lat.isEmpty() && !lon.isEmpty()) { if (hae.isEmpty()) pt.setXY(Double.valueOf(lon), Double.valueOf(lat)); //return spatial.createPoint(Double.valueOf(lon), //Double.valueOf(lat), GCS_WGS_1984); else { pt.setXY(Double.valueOf(lon), Double.valueOf(lat)); pt.setZ(Double.valueOf(hae)); } return new MapGeometry(pt, srOut); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } if (node.getNodeName().equals("shape")) { try { List<Node> polylines = findChildNodes(node, "polyline"); for (Node polyline : polylines) { startNewPolygon(); List<Node> vertices = findChildNodes(polyline, "vertex"); for (Node vertex : vertices) { double lat = 0; double lon = 0; double hae = 0; String s = null; s = getAttribute(vertex, "lat"); if (s != null) lat = Double.parseDouble(s); s = getAttribute(vertex, "lon"); if (s != null) lon = Double.parseDouble(s); s = getAttribute(vertex, "hae"); if (s != null) hae = Double.parseDouble(s); addVertexToPolygon(lat, lon, hae); } String geometryString = closePolygon(); String jsonString = geometryString.substring(0, geometryString.length() - 1) + ",\"spatialReference\":{\"wkid\":" + GCS_WGS_1984 + "}}"; // System.out.println("json string = \""+jsonString+"\""); JsonFactory jf = new JsonFactory(); JsonParser jp = jf.createJsonParser(jsonString); MapGeometry geometry = GeometryEngine.jsonToGeometry(jp); return geometry; } } catch (Exception ex) { generator = null; return null; } } return null; } catch (Exception e) { log.error(e); log.error(e.getStackTrace()); throw (e); } }
From source file:com.MainFiles.Functions.java
public void printScreenMessage(HashMap<String, String> FieldsMap) { try {/* w ww . j a v a 2 s . c o m*/ String strlines = "\n=============================="; String strResponseDescription = ""; String responseDescription = ""; String TransactionType = ""; String CorrelationID = ""; String Field48 = ""; if (FieldsMap.containsKey("3")) { TransactionType = getTransactionType(FieldsMap.get("3").toString()); } if (FieldsMap.containsKey("39")) { if (FieldsMap.containsKey("37")) { CorrelationID = FieldsMap.get("37").toString(); } if (FieldsMap.containsKey("48")) { Field48 = FieldsMap.get("48").toString(); } responseDescription = strlines + strlines; responseDescription += "\n" + TransactionType + " Response at " + (new SimpleDateFormat("MMMM dd,yyyy hh:mm:ss.SSS a zzzz")).format(new java.util.Date()); responseDescription += "\nLogFromESB:CorrelationID: " + CorrelationID; responseDescription += "\nLogFromESB:StatusCode: " + FieldsMap.get("39").toString(); responseDescription += "\nLogFromESB:StatusType: RESPONSE"; responseDescription += "\nLogFromESB:StatusDescription: " + Field48; } System.out.println(responseDescription); } catch (Exception ex) { this.log("Exception", ex.getMessage() + " " + ex.getStackTrace()); } }