List of usage examples for javax.xml.datatype DatatypeConfigurationException printStackTrace
public void printStackTrace()
From source file:com.retroduction.carma.eventlisteners.ReportEventListener.java
public void notifyEvent(IEvent event) { if (event instanceof ProcessingClassUnderTest) { this.classProcessingStart = System.currentTimeMillis(); ProcessingClassUnderTest eventObj = (ProcessingClassUnderTest) event; ClassUnderTest clazz = new ClassUnderTest(); clazz.setClassName(eventObj.getClassUnderTest().getClassName()); clazz.setPackageName(eventObj.getClassUnderTest().getPackageName()); clazz.setBaseClassFile(eventObj.getClassUnderTest().getClassFile()); this.currentClassUnderTestSubReport = clazz; return;/*from w w w .j ava 2 s . com*/ } if (event instanceof ProcessingClassUnderTestFinished) { try { if (this.writeTimingInfo) { ProcessingInfo info = this.createTimingInformation(this.classProcessingStart, System.currentTimeMillis()); this.currentClassUnderTestSubReport.setProcessingInfo(info); } } catch (DatatypeConfigurationException e) { e.printStackTrace(); } this.run.getClassUnderTest().add(this.currentClassUnderTestSubReport); return; } if (event instanceof ProcessingMutant) { com.retroduction.carma.core.api.testrunners.om.Mutant mutant = ((ProcessingMutant) event).getMutant(); Mutant mutantInfo = new Mutant(); mutantInfo.setName(mutant.getName()); mutantInfo.setBaseSourceLineStart(mutant.getSourceMapping().getLineStart()); mutantInfo.setBaseSourceLineEnd(mutant.getSourceMapping().getLineEnd()); mutantInfo.setBaseSourceColumnStart(mutant.getSourceMapping().getColumnStart()); mutantInfo.setBaseSourceColumnEnd(mutant.getSourceMapping().getColumnEnd()); if (mutant.getTransitionGroup() != null) { mutantInfo.setTransitionGroup(mutant.getTransitionGroup().getName()); } if (mutant.getTransition() != null) { mutantInfo.setTransition(mutant.getTransition().getName()); } this.currentMutantReport = mutantInfo; this.currentClassUnderTestSubReport.getMutant().add(this.currentMutantReport); this.currentClassUnderTestSubReport .setBaseSourceFile(((ProcessingMutant) event).getMutant().getSourceMapping().getSourceFile()); return; } if (event instanceof TestsExecuted) { TestsExecuted eventObj = (TestsExecuted) event; this.currentMutantReport.setSurvived(eventObj.getMutant().isSurvived()); this.currentMutantReport.getKillerTests().addAll(eventObj.getMutant().getKillerTestNames()); // TODO not very beautiful here - is executed for each // mutant for // relevant for whole class this.currentClassUnderTestSubReport.getExecutedTests().clear(); this.currentClassUnderTestSubReport.getExecutedTests() .addAll(eventObj.getMutant().getExecutedTestsNames()); return; } if (event instanceof TestSetNotSane) { TestSetNotSane eventObj = (TestSetNotSane) event; this.run.getBrokenTests().addAll(eventObj.getTestCaseName()); return; } }
From source file:it.cnr.icar.eric.server.persistence.rdb.AuditableEventDAO.java
/** * Creates an unitialized binding object for the type supported by this DAO. *///from ww w .jav a2 s . c om Object createObject() throws JAXBException { AuditableEventType ebAuditableEventType = null; try { ebAuditableEventType = bu.rimFac.createAuditableEventType(); XMLGregorianCalendar timeNow = DatatypeFactory.newInstance() .newXMLGregorianCalendar(new GregorianCalendar()); ebAuditableEventType.setTimestamp(timeNow); } catch (DatatypeConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ebAuditableEventType; }
From source file:it.cnr.icar.eric.server.persistence.rdb.AuditableEventDAO.java
/** * Returns the SQL fragment string needed by insert or update statements * within insert or update method of sub-classes. This is done to avoid code * duplication.//from w w w . j av a 2s. c o m */ protected String getSQLStatementFragment(Object ro) throws RegistryException { AuditableEventType auditableEvent = (AuditableEventType) ro; String stmtFragment = null; try { String requestId = auditableEvent.getRequestId(); String eventType = auditableEvent.getEventType(); if (auditableEvent.getTimestamp() == null) { XMLGregorianCalendar timeNow; timeNow = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); auditableEvent.setTimestamp(timeNow); } Timestamp timestamp = new Timestamp( auditableEvent.getTimestamp().toGregorianCalendar().getTimeInMillis()); // ??The timestamp is being truncated to work around a bug in // PostgreSQL 7.2.2 JDBC driver String timestampStr = timestamp.toString().substring(0, 19); String aeUser = auditableEvent.getUser(); if (aeUser == null) { UserType user = context.getUser(); if (user != null) { aeUser = user.getId(); } } if (action == DAO_ACTION_INSERT) { stmtFragment = "INSERT INTO AuditableEvent " + super.getSQLStatementFragment(ro) + ", '" + requestId + "', '" + eventType + "', '" + timestampStr + "', '" + aeUser + "' ) "; } else if (action == DAO_ACTION_UPDATE) { stmtFragment = "UPDATE AuditableEvent SET " + super.getSQLStatementFragment(ro) + ", requestId='" + requestId + "', eventType='" + eventType + "', timestamp_='" + timestampStr + "', user_='" + aeUser + "' WHERE id = '" + ((RegistryObjectType) ro).getId() + "' "; } else if (action == DAO_ACTION_DELETE) { stmtFragment = super.getSQLStatementFragment(ro); } } catch (DatatypeConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } return stmtFragment; }
From source file:org.enotron.EnergySimulatorEndpoint.java
public EnergySimulatorEndpoint() { try {//w ww. j a va 2s . co m factory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { _logger.warning("Exception on XML DataFactory Creation: " + e.getMessage()); e.printStackTrace(); } }
From source file:eu.openminted.registry.service.generate.WorkflowOutputMetadataGenerate.java
protected VersionInfo generateVersionInfo() { VersionInfo versionInfo = new VersionInfo(); versionInfo.setVersion("0.0.1"); // Set creation date and last date updated XMLGregorianCalendar calendar = null; try {/*from w w w. j av a2 s . c om*/ calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregory); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); String str = format.format(calendar.toGregorianCalendar().getTime()); versionInfo.setVersionDate(str); return versionInfo; }
From source file:eu.openminted.registry.service.generate.WorkflowOutputMetadataGenerate.java
protected MetadataHeaderInfo generateMetadataHeaderInfo(String userId) throws IOException { MetadataHeaderInfo metadataHeaderInfo = new MetadataHeaderInfo(); // Set metadata record identifier MetadataIdentifier identifier = new MetadataIdentifier(); identifier.setValue(UUID.randomUUID().toString()); identifier.setMetadataIdentifierSchemeName(MetadataIdentifierSchemeNameEnum.OMTD); metadataHeaderInfo.setMetadataRecordIdentifier(identifier); // Set creation date and last date updated XMLGregorianCalendar calendar = null; try {/*ww w . j ava 2 s. c om*/ calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregory); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } metadataHeaderInfo.setMetadataCreationDate(calendar); metadataHeaderInfo.setMetadataLastDateUpdated(calendar); // Set metadata creator metadataHeaderInfo.setMetadataCreators(new ArrayList<PersonInfo>()); PersonInfo personInfo = generatePersonInfo(userId, true); metadataHeaderInfo.getMetadataCreators().add(personInfo); logger.debug("MetadataHeaderInfo:\n" + mapper.writeValueAsString(metadataHeaderInfo) + "\n"); return metadataHeaderInfo; }
From source file:eu.openminted.registry.service.generate.WorkflowOutputMetadataGenerate.java
protected ResourceCreationInfo generateResourceCreationInfo(String userId) throws JsonParseException, JsonMappingException, IOException { ResourceCreationInfo resourceCreationInfo = new ResourceCreationInfo(); // resourceCreators.resourceCreator.relatedPerson List<ActorInfo> resourceCreators = new ArrayList<>(); ActorInfo actorInfo = new ActorInfo(); actorInfo.setActorType(ActorTypeEnum.PERSON); actorInfo.setRelatedPerson(generatePersonInfo(userId, false)); resourceCreators.add(actorInfo);// w w w . j a v a 2 s.co m resourceCreationInfo.setResourceCreators(resourceCreators); // resourceCreationDate DateCombination creationDate = new DateCombination(); XMLGregorianCalendar calendar = null; try { calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gregory); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } Date date = new Date(); date.setYear(calendar.getYear()); date.setMonth(calendar.getMonth()); date.setDay(calendar.getDay()); creationDate.setDate(date); resourceCreationInfo.setCreationDate(creationDate); return resourceCreationInfo; }
From source file:io.getlime.security.powerauth.soap.spring.client.PowerAuthServiceClient.java
/** * Convert date to XMLGregorianCalendar/*from w w w. java2s.c om*/ * @param date Date to be converted. * @return A new instance of {@link XMLGregorianCalendar}. * @throws DatatypeConfigurationException */ private XMLGregorianCalendar calendarWithDate(Date date) { try { GregorianCalendar c = new GregorianCalendar(); c.setTime(date); return DatatypeFactory.newInstance().newXMLGregorianCalendar(c); } catch (DatatypeConfigurationException e) { // Unless there is a terrible configuration error, this should not happen e.printStackTrace(); } return null; }
From source file:org.openmrs.module.dhisconnector.api.impl.DHISConnectorServiceImpl.java
private AdxDataValueSet convertDHISDataValueSetToAdxDataValueSet(DHISDataValueSet valueSet) { AdxDataValueSet adx = null;/* ww w. j a v a 2 s. com*/ if (valueSet != null) { try { String dataSet = getCodeFromClazz(DHISDataSet.class, DATASETS_PATH + valueSet.getDataSet() + JSON_POST_FIX); String orgUnit = getCodeFromClazz(DHISOrganisationUnit.class, ORGUNITS_PATH + valueSet.getOrgUnit() + JSON_POST_FIX); String period = valueSet.getPeriod(); AdxDataValueGroup group = new AdxDataValueGroup(); XMLGregorianCalendar exported = DatatypeFactory.newInstance() .newXMLGregorianCalendar(new GregorianCalendar()); AdxDataValueGroupPeriod adxPeriod = new AdxDataValueGroupPeriod(period); adx = new AdxDataValueSet(); adx.setExported(exported); group.setOrgUnit(orgUnit); group.setDataSet(dataSet); group.setPeriod(adxPeriod); group.setCompleteDate(adxPeriod.getdHISAdxEndDate()); for (DHISDataValue dv : valueSet.getDataValues()) { AdxDataValue adxDv = new AdxDataValue(); String dataElement = getCodeFromClazz(DHISDataElement.class, DATA_ELEMETS_PATH + dv.getDataElement() + JSON_POST_FIX); if (StringUtils.isNotBlank(dataElement)) { adxDv.setDataElement(dataElement); adxDv.setValue(new BigDecimal(Integer.parseInt(dv.getValue()))); if (StringUtils.isNotBlank(dv.getCategoryOptionCombo())) { DHISCategoryCombo c = getCategoryComboFromOption(dv.getCategoryOptionCombo()); DHISCategoryOptionCombo oc = getCategoryOptionCombo(dv.getCategoryOptionCombo()); if (c != null && oc != null) adxDv.getOtherAttributes().put( new QName(StringUtils.isNotBlank(c.getCode()) ? c.getCode() : c.getId()), StringUtils.isNotBlank(oc.getCode()) ? oc.getCode() : oc.getId()); } group.getDataValues().add(adxDv); } } adx.getGroups().add(group); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } } return adx; }
From source file:it.cnr.icar.eric.server.common.ServerRequestContext.java
private void saveAuditableEvents() throws RegistryException { UserType user = getUser();/*from www . j a v a 2 s .c om*/ if (user != null) { auditableEvents.clear(); XMLGregorianCalendar timeNow; try { timeNow = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()); //create events during relocate event should be ignored if (eventOccured(getRelocateEvent())) { getRelocateEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getRelocateEvent()); auditableEvents.add(getRelocateEvent()); } else if (eventOccured(getCreateEvent())) { getCreateEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getCreateEvent()); auditableEvents.add(getCreateEvent()); } //Delete during update should be ignored as they are an impl artifact if (eventOccured(getUpdateEvent())) { getUpdateEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getUpdateEvent()); auditableEvents.add(getUpdateEvent()); } else if (eventOccured(getDeleteEvent())) { getDeleteEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getDeleteEvent()); auditableEvents.add(getDeleteEvent()); } if (eventOccured(getSetStatusEvent())) { getSetStatusEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getSetStatusEvent()); auditableEvents.add(getSetStatusEvent()); } if (eventOccured(getApproveEvent())) { getApproveEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getApproveEvent()); auditableEvents.add(getApproveEvent()); } if (eventOccured(getDeprecateEvent())) { getDeprecateEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getDeprecateEvent()); auditableEvents.add(getDeprecateEvent()); } if (eventOccured(getUnDeprecateEvent())) { getUnDeprecateEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getUnDeprecateEvent()); auditableEvents.add(getUnDeprecateEvent()); } if (eventOccured(getVersionEvent())) { getVersionEvent().setTimestamp(timeNow); removeDuplicateAffectedObjects(getVersionEvent()); auditableEvents.add(getVersionEvent()); } if (auditableEvents.size() > 0) { getCreateEvent().setTimestamp(timeNow); pm.insert(this, auditableEvents); } } catch (DatatypeConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }