List of usage examples for java.util GregorianCalendar setTime
public final void setTime(Date date)
Date
. From source file:eu.europa.ec.markt.dss.signature.xades.XAdESProfileC.java
private void incorporateCRLRefs(CompleteRevocationRefsType completeRevocationRefs, ValidationContext ctx) { if (!ctx.getNeededCRL().isEmpty()) { CRLRefsType crlRefs = xadesObjectFactory.createCRLRefsType(); completeRevocationRefs.setCRLRefs(crlRefs); List<CRLRefType> crlRefList = crlRefs.getCRLRef(); for (X509CRL crl : ctx.getNeededCRL()) { try { CRLRefType crlRef = xadesObjectFactory.createCRLRefType(); CRLIdentifierType crlIdentifier = xadesObjectFactory.createCRLIdentifierType(); crlRef.setCRLIdentifier(crlIdentifier); String issuerName = crl.getIssuerX500Principal().getName(); crlIdentifier.setIssuer(issuerName); GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); cal.setTime(crl.getThisUpdate()); crlIdentifier.setIssueTime(this.datatypeFactory.newXMLGregorianCalendar(cal)); // crlIdentifier.setNumber(getCrlNumber(encodedCrl)); DigestAlgAndValueType digestAlgAndValue = getDigestAlgAndValue(crl.getEncoded(), DigestAlgorithm.SHA1); crlRef.setDigestAlgAndValue(digestAlgAndValue); crlRefList.add(crlRef);/*from ww w . j av a 2 s . c om*/ } catch (CRLException ex) { throw new RuntimeException(ex); } } } }
From source file:edu.umm.radonc.ca_dash.model.ActivityFacade.java
public TreeMap<Date, SynchronizedDescriptiveStatistics> getWeeklyTrailingSummaryStats(Date start, Date end, Long hospitalser, boolean imrtOnly, boolean includeWeekends) { TreeMap<Date, SynchronizedDescriptiveStatistics> retval = new TreeMap(); GregorianCalendar gc = new GregorianCalendar(); gc.setTime(end); Date d;/*from w ww. ja va2 s . co m*/ SynchronizedDescriptiveStatistics stats; while (gc.getTime().compareTo(start) > 0) { d = gc.getTime(); gc.add(Calendar.DATE, -7); if (hospitalser <= 0) { stats = getDailyStats(gc.getTime(), d, imrtOnly, includeWeekends); } else { stats = getDailyStats(gc.getTime(), d, hospitalser, imrtOnly, includeWeekends); } retval.put(gc.getTime(), stats); } return retval; }
From source file:org.jahia.utils.maven.plugin.contentgenerator.ContentGeneratorService.java
/** * Format a date for inclusion in JCR XML file If date is null, current date * is used Format used: http://www.day.com/specs/jcr/1.0/6.2.5.1_Date.html * // w w w .j a v a 2 s. c o m * @param date * @return formated date */ public String getDateForJcrImport(Date date) { GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance(); if (date != null) { gc.setTime(date); } StringBuffer sbNewDate = new StringBuffer(); // 2011-04-01T17:39:59.265+02:00 sbNewDate.append(gc.get(Calendar.YEAR)); sbNewDate.append("-"); sbNewDate.append(gc.get(Calendar.MONTH)); sbNewDate.append("-"); sbNewDate.append(gc.get(Calendar.DAY_OF_MONTH)); sbNewDate.append("T"); sbNewDate.append(gc.get(Calendar.HOUR_OF_DAY)); sbNewDate.append(":"); sbNewDate.append(gc.get(Calendar.MINUTE)); sbNewDate.append(":"); sbNewDate.append(gc.get(Calendar.SECOND)); sbNewDate.append("."); sbNewDate.append(gc.get(Calendar.MILLISECOND)); sbNewDate.append(gc.get(Calendar.ZONE_OFFSET)); return sbNewDate.toString(); }
From source file:eu.europa.ec.markt.dss.signature.xades.XAdESProfileC.java
private void incorporateOCSPRefs(CompleteRevocationRefsType completeRevocationRefs, ValidationContext ctx) { if (!ctx.getNeededOCSPResp().isEmpty()) { OCSPRefsType ocspRefs = this.xadesObjectFactory.createOCSPRefsType(); completeRevocationRefs.setOCSPRefs(ocspRefs); List<OCSPRefType> ocspRefList = ocspRefs.getOCSPRef(); for (BasicOCSPResp basicOcspResp : ctx.getNeededOCSPResp()) { try { OCSPRefType ocspRef = this.xadesObjectFactory.createOCSPRefType(); DigestAlgAndValueType digestAlgAndValue = getDigestAlgAndValue( OCSPUtils.fromBasicToResp(basicOcspResp).getEncoded(), DigestAlgorithm.SHA1); LOG.info("Add a reference for OCSP produced at " + basicOcspResp.getProducedAt() + " digest " + Hex.encodeHexString(digestAlgAndValue.getDigestValue())); ocspRef.setDigestAlgAndValue(digestAlgAndValue); OCSPIdentifierType ocspIdentifier = xadesObjectFactory.createOCSPIdentifierType(); ocspRef.setOCSPIdentifier(ocspIdentifier); Date producedAt = basicOcspResp.getProducedAt(); GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); cal.setTime(producedAt); ocspIdentifier.setProducedAt(this.datatypeFactory.newXMLGregorianCalendar(cal)); ResponderIDType responderId = this.xadesObjectFactory.createResponderIDType(); ocspIdentifier.setResponderID(responderId); RespID respId = basicOcspResp.getResponderId(); ResponderID ocspResponderId = respId.toASN1Object(); DERTaggedObject derTaggedObject = (DERTaggedObject) ocspResponderId.toASN1Object(); if (2 == derTaggedObject.getTagNo()) { ASN1OctetString keyHashOctetString = (ASN1OctetString) derTaggedObject.getObject(); responderId.setByKey(keyHashOctetString.getOctets()); } else { X509Name name = X509Name.getInstance(derTaggedObject.getObject()); responderId.setByName(name.toString()); }/* w w w . j ava 2 s . co m*/ ocspRefList.add(ocspRef); } catch (IOException ex) { throw new RuntimeException(ex); } } } }
From source file:org.kuali.kra.external.award.impl.AccountCreationClientBase.java
/** * This method sets the necessary values in the AccountParametersDTO object to be sent * across to the financial service.//from w w w . j a va2 s. c o m * @param award * @throws DatatypeConfigurationException */ protected AccountParametersDTO getAccountParameters(Award award) throws DatatypeConfigurationException { AccountParametersDTO accountParameters = new AccountParametersDTO(); setName(award, accountParameters); //Account number accountParameters.setAccountNumber(award.getAccountNumber()); setDefaultAddress(award, accountParameters); setAdminAddress(award, accountParameters); //cfdaNumber String cfdaNumber = award.getCfdaNumber(); if (cfdaNumber != null) { accountParameters.setCfdaNumber(cfdaNumber); } //effective date Date effectiveDate = award.getAwardEffectiveDate(); GregorianCalendar dateEffective = new GregorianCalendar(); dateEffective.setTime(effectiveDate); XMLGregorianCalendar gregorianDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateEffective); accountParameters.setEffectiveDate(gregorianDate); //expiration date Date expirationDate = award.getProjectEndDate(); GregorianCalendar dateExpiration = new GregorianCalendar(); dateExpiration.setTime(expirationDate); gregorianDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateExpiration); accountParameters.setExpirationDate(gregorianDate); // expense guideline text String expenseGuidelineText = award.getAwardNumber(); accountParameters.setExpenseGuidelineText(expenseGuidelineText); setIncomeGuidelineText(award, accountParameters); //account purpose text accountParameters.setPurposeText(award.getTitle()); // unit number accountParameters.setUnit(award.getUnitNumber()); //Principal id accountParameters.setPrincipalId(GlobalVariables.getUserSession().getPrincipalId()); AwardFandaRate currentFandaRate = award.getCurrentFandaRate(); String rateClassCode = currentFandaRate.getFandaRateType().getRateClassCode(); String rateTypeCode = currentFandaRate.getFandaRateType().getRateTypeCode(); String icrTypeCode = getIndirectCostTypeCode(rateClassCode, rateTypeCode); accountParameters.setOffCampusIndicator(!currentFandaRate.getOnOffCampusFlag()); String icrRateCode = award.getIcrRateCode(); if (Award.ICR_RATE_CODE_NONE.equals(icrRateCode)) { accountParameters.setIndirectCostRate(""); } else { accountParameters.setIndirectCostRate(icrRateCode); } accountParameters.setIndirectCostTypeCode(icrTypeCode + ""); accountParameters.setHigherEdFunctionCode(award.getActivityType().getHigherEducationFunctionCode()); return accountParameters; }
From source file:org.overlord.dtgov.ui.server.services.WorkflowQueryService.java
@Override public String save(WorkflowQueryBean workflowQuery) throws DtgovUiException { List<ValidationError> errors = _queryValidator.validate(workflowQuery, PAGE_SIZE); if (errors.size() == 0) { String uuid = ""; //$NON-NLS-1$ ExtendedArtifactType toSave = new ExtendedArtifactType(); toSave.setArtifactType(BaseArtifactEnum.EXTENDED_ARTIFACT_TYPE); toSave.setExtendedType("DtgovWorkflowQuery"); //$NON-NLS-1$ toSave.setName(workflowQuery.getName()); toSave.setDescription(workflowQuery.getDescription()); SrampModelUtils.setCustomProperty(toSave, "query", workflowQuery.getQuery()); //$NON-NLS-1$ SrampModelUtils.setCustomProperty(toSave, "workflow", workflowQuery.getWorkflow()); //$NON-NLS-1$ GregorianCalendar gcal = new GregorianCalendar(); gcal.setTime(new Date()); try {// w w w. ja v a 2s. c o m XMLGregorianCalendar xmlCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal); toSave.setCreatedTimestamp(xmlCal); } catch (DatatypeConfigurationException ee) { throw new RuntimeException(ee); } for (WorkflowQueryProperty property : workflowQuery.getProperties()) { SrampModelUtils.setCustomProperty(toSave, "prop." + property.getKey(), property.getValue()); //$NON-NLS-1$ } SrampAtomApiClient client = _srampClientAccessor.getClient(); if (StringUtils.isBlank(workflowQuery.getUuid())) { try { BaseArtifactType art = client.createArtifact(toSave); uuid = art.getUuid(); } catch (Exception exc) { throw new DtgovUiException( Messages.i18n.format("WorkflowQueryService.ArtifactCreateFailed", exc)); //$NON-NLS-1$ } } else { uuid = workflowQuery.getUuid(); toSave.setUuid(workflowQuery.getUuid()); try { client.updateArtifactMetaData(toSave); } catch (SrampClientException e) { throw new DtgovUiException(e.getMessage()); } catch (SrampAtomException e) { throw new DtgovUiException(e.getMessage()); } } return uuid; } else { throw new DtgovFormValidationException(errors); } }
From source file:test.unit.be.e_contract.dssp.client.DigitalSignatureServiceTestPort.java
@Override public ResponseBaseType verify(VerifyRequest verifyRequest) { ResponseBaseType response = this.objectFactory.createResponseBaseType(); response.setProfile(DigitalSignatureServiceConstants.PROFILE); Result result = this.objectFactory.createResult(); response.setResult(result);//from ww w. j av a 2 s. com result.setResultMajor(DigitalSignatureServiceConstants.SUCCESS_RESULT_MAJOR); AnyType optionalOutputs = this.objectFactory.createAnyType(); response.setOptionalOutputs(optionalOutputs); VerificationReportType verificationReport = this.vrObjectFactory.createVerificationReportType(); optionalOutputs.getAny().add(this.vrObjectFactory.createVerificationReport(verificationReport)); DeadlineType timeStampRenewalDeadline = this.dsspObjectFactory.createDeadlineType(); GregorianCalendar beforeGregorianCalendar = new GregorianCalendar(); beforeGregorianCalendar.setTime(new Date()); beforeGregorianCalendar.setTimeZone(TimeZone.getTimeZone("UTC")); XMLGregorianCalendar beforeXMLGregorianCalendar = this.datatypeFactory .newXMLGregorianCalendar(beforeGregorianCalendar); timeStampRenewalDeadline.setBefore(beforeXMLGregorianCalendar); optionalOutputs.getAny().add(this.dsspObjectFactory.createTimeStampRenewal(timeStampRenewalDeadline)); IndividualReportType individualReport = this.vrObjectFactory.createIndividualReportType(); verificationReport.getIndividualReport().add(individualReport); individualReport.setResult(result); SignedObjectIdentifierType signedObjectIdentifier = this.vrObjectFactory.createSignedObjectIdentifierType(); individualReport.setSignedObjectIdentifier(signedObjectIdentifier); SignedPropertiesType signedProperties = this.vrObjectFactory.createSignedPropertiesType(); signedObjectIdentifier.setSignedProperties(signedProperties); SignedSignaturePropertiesType signedSignatureProperties = this.vrObjectFactory .createSignedSignaturePropertiesType(); signedProperties.setSignedSignatureProperties(signedSignatureProperties); GregorianCalendar signingTimeGregorianCalendar = new GregorianCalendar(); signingTimeGregorianCalendar.setTime(new Date()); signingTimeGregorianCalendar.setTimeZone(TimeZone.getTimeZone("UTC")); XMLGregorianCalendar signingTimeXMLGregorianCalendar = this.datatypeFactory .newXMLGregorianCalendar(signingTimeGregorianCalendar); signedSignatureProperties.setSigningTime(signingTimeXMLGregorianCalendar); AnyType details = this.objectFactory.createAnyType(); individualReport.setDetails(details); DetailedSignatureReportType detailedSignatureReport = this.vrObjectFactory .createDetailedSignatureReportType(); details.getAny().add(this.vrObjectFactory.createDetailedSignatureReport(detailedSignatureReport)); VerificationResultType formatOKVerificationResult = this.vrObjectFactory.createVerificationResultType(); formatOKVerificationResult.setResultMajor(DigitalSignatureServiceConstants.VR_RESULT_MAJOR_VALID); detailedSignatureReport.setFormatOK(formatOKVerificationResult); SignatureValidityType signatureOkSignatureValidity = this.vrObjectFactory.createSignatureValidityType(); detailedSignatureReport.setSignatureOK(signatureOkSignatureValidity); VerificationResultType sigMathOkVerificationResult = this.vrObjectFactory.createVerificationResultType(); signatureOkSignatureValidity.setSigMathOK(sigMathOkVerificationResult); sigMathOkVerificationResult.setResultMajor(DigitalSignatureServiceConstants.VR_RESULT_MAJOR_VALID); CertificatePathValidityType certificatePathValidity = this.vrObjectFactory .createCertificatePathValidityType(); detailedSignatureReport.setCertificatePathValidity(certificatePathValidity); VerificationResultType certPathVerificationResult = this.vrObjectFactory.createVerificationResultType(); certPathVerificationResult.setResultMajor(DigitalSignatureServiceConstants.VR_RESULT_MAJOR_VALID); certificatePathValidity.setPathValiditySummary(certPathVerificationResult); X509IssuerSerialType certificateIdentifier = this.xmldsigObjectFactory.createX509IssuerSerialType(); certificatePathValidity.setCertificateIdentifier(certificateIdentifier); certificateIdentifier.setX509IssuerName("CN=Issuer"); certificateIdentifier.setX509SerialNumber(BigInteger.ONE); CertificatePathValidityVerificationDetailType certificatePathValidityVerificationDetail = this.vrObjectFactory .createCertificatePathValidityVerificationDetailType(); certificatePathValidity.setPathValidityDetail(certificatePathValidityVerificationDetail); CertificateValidityType certificateValidity = this.vrObjectFactory.createCertificateValidityType(); certificatePathValidityVerificationDetail.getCertificateValidity().add(certificateValidity); certificateValidity.setCertificateIdentifier(certificateIdentifier); certificateValidity.setSubject("CN=Subject"); VerificationResultType chainingOkVerificationResult = this.vrObjectFactory.createVerificationResultType(); certificateValidity.setChainingOK(chainingOkVerificationResult); chainingOkVerificationResult.setResultMajor(DigitalSignatureServiceConstants.VR_RESULT_MAJOR_VALID); VerificationResultType validityPeriodOkVerificationResult = this.vrObjectFactory .createVerificationResultType(); certificateValidity.setValidityPeriodOK(validityPeriodOkVerificationResult); validityPeriodOkVerificationResult.setResultMajor(DigitalSignatureServiceConstants.VR_RESULT_MAJOR_VALID); VerificationResultType extensionsOkVerificationResult = this.vrObjectFactory.createVerificationResultType(); certificateValidity.setExtensionsOK(extensionsOkVerificationResult); extensionsOkVerificationResult.setResultMajor(DigitalSignatureServiceConstants.VR_RESULT_MAJOR_VALID); byte[] encodedCertificate; try { encodedCertificate = IOUtils .toByteArray(DigitalSignatureServiceTestPort.class.getResource("/fcorneli.der")); } catch (IOException e) { throw new RuntimeException(e); } certificateValidity.setCertificateValue(encodedCertificate); certificateValidity.setSignatureOK(signatureOkSignatureValidity); CertificateStatusType certificateStatus = this.vrObjectFactory.createCertificateStatusType(); certificateValidity.setCertificateStatus(certificateStatus); VerificationResultType certStatusOkVerificationResult = this.vrObjectFactory.createVerificationResultType(); certificateStatus.setCertStatusOK(certStatusOkVerificationResult); certStatusOkVerificationResult.setResultMajor(DigitalSignatureServiceConstants.VR_RESULT_MAJOR_VALID); return response; }
From source file:org.jasig.schedassist.messaging.ObjectMarshallingTest.java
/** * Marshal a {@link VisibleScheduleRequest} to a byte array stream, unmarshal the {@link VisibleScheduleRequest} * back out from the byte array stream, assert it comes back intact. * //from w w w.j a v a2s.c o m * @throws Exception */ @Test public void testVisibleScheduleRequest() throws Exception { VisibleScheduleRequest request = new VisibleScheduleRequest(); request.setOwnerId(127L); GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(new Date()); request.setVisitorNetid("visitornetid"); ByteArrayOutputStream output = new ByteArrayOutputStream(); context.createMarshaller().marshal(request, output); context.createMarshaller().marshal(request, System.out); System.out.println(); VisibleScheduleRequest result = (VisibleScheduleRequest) context.createUnmarshaller() .unmarshal(new ByteArrayInputStream(output.toByteArray())); Assert.assertNotNull(result); Assert.assertEquals(127L, result.getOwnerId()); Assert.assertEquals("visitornetid", result.getVisitorNetid()); }
From source file:org.kuali.kra.award.external.award.impl.AccountCreationClientBase.java
/** * This method sets the necessary values in the AccountParametersDTO object to be sent * across to the financial service.//from w w w . j a v a 2s. c o m * @param award * @throws DatatypeConfigurationException */ protected AccountParametersDTO getAccountParameters(Award award) throws DatatypeConfigurationException { AccountParametersDTO accountParameters = new AccountParametersDTO(); setName(award, accountParameters); //Account number accountParameters.setAccountNumber(award.getAccountNumber()); setDefaultAddress(award, accountParameters); setAdminAddress(award, accountParameters); //cfdaNumber String cfdaNumber = award.getCfdaNumber(); if (cfdaNumber != null) { accountParameters.setCfdaNumber(cfdaNumber); } //effective date Date effectiveDate = award.getAwardEffectiveDate(); GregorianCalendar dateEffective = new GregorianCalendar(); dateEffective.setTime(effectiveDate); XMLGregorianCalendar gregorianDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateEffective); accountParameters.setEffectiveDate(gregorianDate); //expiration date Date expirationDate = award.getProjectEndDate(); GregorianCalendar dateExpiration = new GregorianCalendar(); dateExpiration.setTime(expirationDate); gregorianDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateExpiration); accountParameters.setExpirationDate(gregorianDate); // expense guideline text String expenseGuidelineText = award.getAwardNumber(); accountParameters.setExpenseGuidelineText(expenseGuidelineText); setIncomeGuidelineText(award, accountParameters); //account purpose text accountParameters.setPurposeText(award.getTitle()); // unit number accountParameters.setUnit(award.getUnitNumber()); //Principal id accountParameters.setPrincipalId(GlobalVariables.getUserSession().getPrincipalId()); // get the current FandaRate AwardFandaRate currentFandaRate = award.getCurrentFandaRate(); String rateClassCode = currentFandaRate.getFandaRateType().getRateClassCode(); String rateTypeCode = currentFandaRate.getFandaRateType().getRateTypeCode(); String icrTypeCode = getIndirectCostTypeCode(rateClassCode, rateTypeCode); //campus on/off indicator accountParameters.setOffCampusIndicator(!currentFandaRate.getOnOffCampusFlag()); //indirect cost rate String icrRateCode = award.getIcrRateCode(); if (Award.ICR_RATE_CODE_NONE.equals(icrRateCode)) { accountParameters.setIndirectCostRate(""); } else { accountParameters.setIndirectCostRate(icrRateCode); } // indirect cost type code accountParameters.setIndirectCostTypeCode(icrTypeCode + ""); //higher education function code accountParameters.setHigherEdFunctionCode(award.getActivityType().getHigherEducationFunctionCode()); return accountParameters; }
From source file:test.integ.be.e_contract.mycarenet.genins.GenericInsurabilityClientTest.java
@Test public void testInvoke() throws Exception { EHealthSTSClient client = new EHealthSTSClient("https://wwwacc.ehealth.fgov.be/sts_1_1/SecureTokenService"); Security.addProvider(new BeIDProvider()); KeyStore keyStore = KeyStore.getInstance("BeID"); keyStore.load(null);//from w ww. j a v a2 s.c o m PrivateKey authnPrivateKey = (PrivateKey) keyStore.getKey("Authentication", null); X509Certificate authnCertificate = (X509Certificate) keyStore.getCertificate("Authentication"); KeyStore eHealthKeyStore = KeyStore.getInstance("PKCS12"); FileInputStream fileInputStream = new FileInputStream(this.config.getEHealthPKCS12Path()); eHealthKeyStore.load(fileInputStream, this.config.getEHealthPKCS12Password().toCharArray()); Enumeration<String> aliasesEnum = eHealthKeyStore.aliases(); String alias = aliasesEnum.nextElement(); X509Certificate eHealthCertificate = (X509Certificate) eHealthKeyStore.getCertificate(alias); PrivateKey eHealthPrivateKey = (PrivateKey) eHealthKeyStore.getKey(alias, this.config.getEHealthPKCS12Password().toCharArray()); List<Attribute> attributes = new LinkedList<Attribute>(); attributes.add(new Attribute("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:person:ssin")); attributes.add(new Attribute("urn:be:fgov:identification-namespace", "urn:be:fgov:person:ssin")); List<AttributeDesignator> attributeDesignators = new LinkedList<AttributeDesignator>(); attributeDesignators.add(new AttributeDesignator("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:person:ssin")); attributeDesignators .add(new AttributeDesignator("urn:be:fgov:identification-namespace", "urn:be:fgov:person:ssin")); attributeDesignators.add(new AttributeDesignator("urn:be:fgov:certified-namespace:ehealth", "urn:be:fgov:person:ssin:ehealth:1.0:doctor:nihii11")); attributeDesignators.add(new AttributeDesignator("urn:be:fgov:certified-namespace:ehealth", "urn:be:fgov:person:ssin:doctor:boolean")); Element assertion = client.requestAssertion(authnCertificate, authnPrivateKey, eHealthCertificate, eHealthPrivateKey, attributes, attributeDesignators); assertNotNull(assertion); String assertionString = client.toString(assertion); // String location = // "https://services-int.ehealth.fgov.be/GenericInsurability/v1"; String location = "https://services-acpt.ehealth.fgov.be/GenericInsurability/v1"; GenericInsurabilityClient genInsClient = new GenericInsurabilityClient(location); genInsClient.setCredentials(eHealthPrivateKey, assertionString); ObjectFactory objectFactory = new ObjectFactory(); GetInsurabilityAsXmlOrFlatRequestType body = objectFactory.createGetInsurabilityAsXmlOrFlatRequestType(); be.e_contract.mycarenet.genins.jaxb.core.ObjectFactory coreObjectFactory = new be.e_contract.mycarenet.genins.jaxb.core.ObjectFactory(); CommonInputType commonInput = coreObjectFactory.createCommonInputType(); body.setCommonInput(commonInput); RequestType request = coreObjectFactory.createRequestType(); request.setIsTest(true); commonInput.setRequest(request); OriginType origin = coreObjectFactory.createOriginType(); commonInput.setOrigin(origin); PackageType packageObject = coreObjectFactory.createPackageType(); origin.setPackage(packageObject); LicenseType license = coreObjectFactory.createLicenseType(); packageObject.setLicense(license); PackageLicenseKey packageLicenseKey = this.config.getPackageLicenseKey(); license.setUsername(packageLicenseKey.getUsername()); license.setPassword(packageLicenseKey.getPassword()); Element namespaceElement = assertion.getOwnerDocument().createElement("ns"); namespaceElement.setAttributeNS(Constants.NamespaceSpecNS, "xmlns:saml", "urn:oasis:names:tc:SAML:1.0:assertion"); Node nihiiNode = XPathAPI.selectSingleNode(assertion, "saml:AttributeStatement/saml:Attribute[@AttributeName='urn:be:fgov:person:ssin:ehealth:1.0:doctor:nihii11']/saml:AttributeValue/text()", namespaceElement); String myNihii = nihiiNode.getTextContent(); LOG.debug("NIHII: " + myNihii); Node ssinNode = XPathAPI.selectSingleNode(assertion, "saml:AttributeStatement/saml:Attribute[@AttributeName='urn:be:fgov:person:ssin']/saml:AttributeValue/text()", namespaceElement); String mySsin = ssinNode.getTextContent(); CareProviderType careProvider = coreObjectFactory.createCareProviderType(); origin.setCareProvider(careProvider); NihiiType nihii = coreObjectFactory.createNihiiType(); careProvider.setNihii(nihii); nihii.setQuality("doctor"); ValueRefString nihiiValue = coreObjectFactory.createValueRefString(); nihii.setValue(nihiiValue); nihiiValue.setValue(myNihii); IdType physicalPerson = coreObjectFactory.createIdType(); careProvider.setPhysicalPerson(physicalPerson); ValueRefString ssinValue = coreObjectFactory.createValueRefString(); physicalPerson.setSsin(ssinValue); ssinValue.setValue(mySsin); commonInput.setInputReference("PRIG1234567890"); RecordCommonInputType recordCommonInput = coreObjectFactory.createRecordCommonInputType(); body.setRecordCommonInput(recordCommonInput); recordCommonInput.setInputReference(new BigDecimal("1234567890123")); SingleInsurabilityRequestType singleInsurabilityRequest = coreObjectFactory .createSingleInsurabilityRequestType(); body.setRequest(singleInsurabilityRequest); CareReceiverIdType careReceiverId = coreObjectFactory.createCareReceiverIdType(); singleInsurabilityRequest.setCareReceiverId(careReceiverId); careReceiverId.setInss(mySsin); InsurabilityRequestDetailType insurabilityRequestDetail = coreObjectFactory .createInsurabilityRequestDetailType(); singleInsurabilityRequest.setInsurabilityRequestDetail(insurabilityRequestDetail); InsurabilityRequestTypeType insurabilityRequestType = InsurabilityRequestTypeType.INFORMATION; insurabilityRequestDetail.setInsurabilityRequestType(insurabilityRequestType); PeriodType period = coreObjectFactory.createPeriodType(); insurabilityRequestDetail.setPeriod(period); DatatypeFactory datatypeFactory = DatatypeFactory.newInstance(); GregorianCalendar periodStartCal = new GregorianCalendar(); DateTime periodStartDateTime = new DateTime(); periodStartCal.setTime(periodStartDateTime.toDate()); XMLGregorianCalendar periodStart = datatypeFactory.newXMLGregorianCalendar(periodStartCal); period.setPeriodStart(periodStart); DateTime periodEndDateTime = periodStartDateTime; GregorianCalendar periodEndCal = new GregorianCalendar(); periodEndCal.setTime(periodEndDateTime.toDate()); XMLGregorianCalendar periodEnd = datatypeFactory.newXMLGregorianCalendar(periodEndCal); period.setPeriodEnd(periodEnd); insurabilityRequestDetail.setInsurabilityContactType(InsurabilityContactTypeType.HOSPITALIZED_FOR_DAY); genInsClient.getInsurability(body); }