javax.xml.datatype.DatatypeConfigurationException Java Examples

The following examples show how to use javax.xml.datatype.DatatypeConfigurationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BirtDuration.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Object getValue( Object[] args ) throws BirtException
{
	Duration duration;
	int factor;
	try
	{
		duration = DatatypeFactory.newInstance( )
				.newDuration( args[0].toString( ) );

		factor = DataTypeUtil.toInteger( args[1] ).intValue( );
	}
	catch ( DatatypeConfigurationException e )
	{
		throw new IllegalArgumentException( Messages.getFormattedString( "error.BirtDuration.literal.invalidArgument",
				args ) );
	}
	return duration.multiply( factor ).toString( );
}
 
Example #2
Source File: DatatypeConverterImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static DatatypeFactory getDatatypeFactory() {
    ClassLoader tccl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
        public ClassLoader run() {
            return Thread.currentThread().getContextClassLoader();
        }
    });
    DatatypeFactory df = DF_CACHE.get(tccl);
    if (df == null) {
        synchronized (DatatypeConverterImpl.class) {
            df = DF_CACHE.get(tccl);
            if (df == null) { // to prevent multiple initialization
                try {
                    df = DatatypeFactory.newInstance();
                } catch (DatatypeConfigurationException e) {
                    throw new Error(Messages.FAILED_TO_INITIALE_DATATYPE_FACTORY.format(),e);
                }
                DF_CACHE.put(tccl, df);
            }
        }
    }
    return df;
}
 
Example #3
Source File: TModelInstanceDetailsComparatorTest.java    From juddi with Apache License 2.0 6 votes vote down vote up
@Test
public void testCompareToDurationEQ() throws DatatypeConfigurationException {
    System.out.println("TModelInstanceDetailsComparator.compare testCompareToDurationEQ");
    TModelInstanceDetails lhs = new TModelInstanceDetails();
    lhs.getTModelInstanceInfo().add(new TModelInstanceInfo());
    lhs.getTModelInstanceInfo().get(0).setTModelKey("hi");
    lhs.getTModelInstanceInfo().get(0).setInstanceDetails(new InstanceDetails());
    lhs.getTModelInstanceInfo().get(0).getInstanceDetails().setInstanceParms("P5Y");
    TModelInstanceDetails rhs = new TModelInstanceDetails();

    rhs.getTModelInstanceInfo().add(new TModelInstanceInfo());
    rhs.getTModelInstanceInfo().get(0).setTModelKey("hi");
    rhs.getTModelInstanceInfo().get(0).setInstanceDetails(new InstanceDetails());
    rhs.getTModelInstanceInfo().get(0).getInstanceDetails().setInstanceParms("P5Y");
    TModelInstanceDetailsComparator instance = new TModelInstanceDetailsComparator("hi", false, false, true);
    int result = instance.compare(lhs, rhs);
    Assert.assertTrue("result " + lhs.getTModelInstanceInfo().get(0).getInstanceDetails().getInstanceParms() + " compare to " +
            lhs.getTModelInstanceInfo().get(0).getInstanceDetails().getInstanceParms() + " " +
            result, result == 0);
}
 
Example #4
Source File: DateTimeWithinPeriodTest.java    From rya with Apache License 2.0 6 votes vote down vote up
@Test
public void testSeconds() throws DatatypeConfigurationException, ValueExprEvaluationException {
    DatatypeFactory dtf = DatatypeFactory.newInstance();

    ZonedDateTime zTime = testThisTimeDate;
    String time = zTime.format(DateTimeFormatter.ISO_INSTANT);

    ZonedDateTime zTime1 = zTime.minusSeconds(1);
    String time1 = zTime1.format(DateTimeFormatter.ISO_INSTANT);

    Literal now = VF.createLiteral(dtf.newXMLGregorianCalendar(time));
    Literal nowMinusOne = VF.createLiteral(dtf.newXMLGregorianCalendar(time1));

    DateTimeWithinPeriod func = new DateTimeWithinPeriod();

    assertEquals(TRUE, func.evaluate(VF, now, now, VF.createLiteral(1), OWLTime.SECONDS_URI));
    assertEquals(FALSE, func.evaluate(VF, now, nowMinusOne,VF.createLiteral(1), OWLTime.SECONDS_URI));
    assertEquals(TRUE, func.evaluate(VF, now, nowMinusOne,VF.createLiteral(2), OWLTime.SECONDS_URI));
}
 
Example #5
Source File: DateTimeTtlValueConverter.java    From rya with Apache License 2.0 6 votes vote down vote up
@Override
public void convert(String ttl, String startTime) {
    try {
        long start_l, stop_l;
        long ttl_l = Long.parseLong(ttl);
        stop_l = System.currentTimeMillis();
        if (startTime != null)
            stop_l = Long.parseLong(startTime);
        start_l = stop_l - ttl_l;

        GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();
        cal.setTimeZone(getTimeZone());
        cal.setTimeInMillis(start_l);
        DatatypeFactory factory = DatatypeFactory.newInstance();
        start = VF.createLiteral(factory.newXMLGregorianCalendar(cal));

        cal.setTimeInMillis(stop_l);
        stop = VF.createLiteral(factory.newXMLGregorianCalendar(cal));
    } catch (DatatypeConfigurationException e) {
        throw new RuntimeException("Exception occurred creating DataTypeFactory", e);
    }
}
 
Example #6
Source File: SupplierShareResultAssembler.java    From development with Apache License 2.0 6 votes vote down vote up
private void addService(Marketplace marketplace, long subscriptionKey)
        throws DatatypeConfigurationException {

    Set<Long> priceModelKeys = xmlSearch.findPriceModelKeys();
    for (Iterator<Long> iterator = priceModelKeys.iterator(); iterator
            .hasNext();) {
        pmKey = iterator.next();
        ProductHistory prd = billingRetrievalService.loadProductOfVendor(
                subscriptionKey, pmKey, periodEndTime);
        Service service = marketplace.getServiceByKey(prd.getObjKey());
        if (service == null) {
            service = buildService(marketplace, prd);
            marketplace.addService(service);
        }
        addSubscription(service, subscriptionKey);
        addServiceCustomerRevenue(service, subscriptionKey);
    }
}
 
Example #7
Source File: BirtDurationTest.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
@Test
   public void testSecond() throws DatatypeConfigurationException
{
	String script1 = "BirtDuration.second( \"P1Y2M1D\" )";
	String script2 = "BirtDuration.second( \"P2M2DT4S\" )";
	
	assertEquals( (cx.evaluateString( scope,
			script1,
			"inline",
			1,
			null )) ,Integer.valueOf( 0 ) );
	assertEquals( (cx.evaluateString( scope,
			script2,
			"inline",
			1,
			null )) ,Integer.valueOf( 4 ) );
}
 
Example #8
Source File: BirtDurationTest.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
@Test
   public void testIsLongerThan() throws DatatypeConfigurationException
{
	String script1 = "BirtDuration.isLongerThan( \"P1Y2M3D\", \"P1Y2M2D\" )";
	String script2 = "BirtDuration.isLongerThan( \"P1Y2M2DT2S\", \"P1Y2M2DT3S\" )";
	
	assertEquals( cx.evaluateString( scope,
			script1,
			"inline",
			1,
			null ) ,Boolean.valueOf( true ) );
	assertEquals( cx.evaluateString( scope,
			script2,
			"inline",
			1,
			null ) ,Boolean.valueOf( false ) );
}
 
Example #9
Source File: ResellerShareResultAssembler.java    From development with Apache License 2.0 6 votes vote down vote up
private Subscription buildSubscription(long subscriptionKey)
        throws DatatypeConfigurationException {
    SubscriptionHistory subscriptionHistory = sharesRetrievalService
            .loadSubscriptionHistoryWithinPeriod(subscriptionKey,
                    periodEndTime);

    Subscription subscription = new Subscription();
    subscription.setKey(BigInteger.valueOf(subscriptionKey));
    subscription.setId(subscriptionHistory.getDataContainer()
            .getSubscriptionId());
    subscription.setBillingKey(BigInteger.valueOf(currentBillingResult
            .getKey()));
    subscription.setRevenue(currentBillingResult.getNetAmount());
    Period period = preparePeriod(
            this.currentBillingResult.getPeriodStartTime(),
            this.currentBillingResult.getPeriodEndTime());
    subscription.setPeriod(period);
    return subscription;
}
 
Example #10
Source File: MpOwnerShareResultAssembler.java    From development with Apache License 2.0 6 votes vote down vote up
void setPeriod(long periodStartTime, long periodEndTime)
        throws DatatypeConfigurationException {

    this.periodStartTime = periodStartTime;
    this.periodEndTime = periodEndTime;

    Period period = new Period();

    DatatypeFactory df = DatatypeFactory.newInstance();
    GregorianCalendar gc = new GregorianCalendar();

    // start date
    period.setStartDate(BigInteger.valueOf(periodStartTime));
    gc.setTimeInMillis(periodStartTime);
    period.setStartDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    // end date
    period.setEndDate(BigInteger.valueOf(periodEndTime));
    gc.setTimeInMillis(periodEndTime);
    period.setEndDateIsoFormat(df.newXMLGregorianCalendar(gc).normalize());

    result.setPeriod(period);
}
 
Example #11
Source File: BirtDurationTest.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
@Test
   public void testCompare() throws DatatypeConfigurationException
{
	String script1 = "BirtDuration.compare( \"P1Y2M1D\", \"P1Y2M2D\" )";
	String script2 = "BirtDuration.compare( \"P1Y2M2DT3S\", \"P1Y2M2DT3S\" )";
	
	assertEquals( cx.evaluateString( scope,
			script1,
			"inline",
			1,
			null ) ,Integer.valueOf( -1 ) );
	assertEquals( cx.evaluateString( scope,
			script2,
			"inline",
			1,
			null ) ,Integer.valueOf( 0 ) );
}
 
Example #12
Source File: LiteralsTest.java    From ldp4j with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreationFromXMLGregorianCalendar$customDefaults() throws DatatypeConfigurationException {
	XMLGregorianCalendar xgc = xmlGregorianCalendar();

	XMLGregorianCalendar nxgc =
		DatatypeFactory.
			newInstance().
				newXMLGregorianCalendar(
					new GregorianCalendar(anotherTimeZone(this.dateTime.get())));
	DateTimeLiteral dateTimeLiteral=
		Literals.
			of(xgc).
				withDefaults(nxgc).
					dateTime();

	assertThat(this.dateTime,equalTo(dateTimeLiteral));
}
 
Example #13
Source File: TModelInstanceDetailsComparatorTest.java    From juddi with Apache License 2.0 6 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testCompareToDate() throws DatatypeConfigurationException {
    System.out.println("TModelInstanceDetailsComparator.compare testCompareToDate");
    TModelInstanceDetails lhs = new TModelInstanceDetails();
    lhs.getTModelInstanceInfo().add(new TModelInstanceInfo());
    lhs.getTModelInstanceInfo().get(0).setTModelKey("hi");
    lhs.getTModelInstanceInfo().get(0).setInstanceDetails(new InstanceDetails());
    lhs.getTModelInstanceInfo().get(0).getInstanceDetails().setInstanceParms("asdasd");
    TModelInstanceDetails rhs = new TModelInstanceDetails();

    rhs.getTModelInstanceInfo().add(new TModelInstanceInfo());
    rhs.getTModelInstanceInfo().get(0).setTModelKey("hi");
    rhs.getTModelInstanceInfo().get(0).setInstanceDetails(new InstanceDetails());
    rhs.getTModelInstanceInfo().get(0).getInstanceDetails().setInstanceParms("asdasdasd");
    TModelInstanceDetailsComparator instance = new TModelInstanceDetailsComparator("hi", false, true, false);

    int result = instance.compare(lhs, rhs);
    //Assert.assertTrue("result " + result,result < 0);

}
 
Example #14
Source File: BirtDuration.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Object getValue( Object[] args ) throws BirtException
{
	Duration duration1, duration2;
	try
	{
		duration1 = DatatypeFactory.newInstance( )
				.newDuration( args[0].toString( ) );
		duration2 = DatatypeFactory.newInstance( )
				.newDuration( args[1].toString( ) );
	}
	catch ( DatatypeConfigurationException e )
	{
		throw new IllegalArgumentException( Messages.getFormattedString( "error.BirtDuration.literal.invalidArgument",
				args ) );
	}
	return duration1.add( duration2 ).toString( );
}
 
Example #15
Source File: DateTimeWithinPeriodTest.java    From rya with Apache License 2.0 6 votes vote down vote up
@Test
public void testHours() throws DatatypeConfigurationException, ValueExprEvaluationException {
    DatatypeFactory dtf = DatatypeFactory.newInstance();

    ZonedDateTime zTime = testThisTimeDate;
    String time = zTime.format(DateTimeFormatter.ISO_INSTANT);

    ZonedDateTime zTime1 = zTime.minusHours(1);
    String time1 = zTime1.format(DateTimeFormatter.ISO_INSTANT);

    Literal now = VF.createLiteral(dtf.newXMLGregorianCalendar(time));
    Literal nowMinusOne = VF.createLiteral(dtf.newXMLGregorianCalendar(time1));

    DateTimeWithinPeriod func = new DateTimeWithinPeriod();

    assertEquals(TRUE, func.evaluate(VF, now, now,VF.createLiteral(1),OWLTime.HOURS_URI));
    assertEquals(FALSE, func.evaluate(VF, now, nowMinusOne,VF.createLiteral(1),OWLTime.HOURS_URI));
    assertEquals(TRUE, func.evaluate(VF, now, nowMinusOne,VF.createLiteral(2),OWLTime.HOURS_URI));
}
 
Example #16
Source File: Bug6925410Test.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void test() throws DatatypeConfigurationException {
    try {
        int times = 100;
        long start = System.currentTimeMillis();
        for (int i = 0; i < times; i++) {
            XMLReaderFactory.createXMLReader();
        }
        long end = System.currentTimeMillis();
        double speed = ((end - start));
        System.out.println(speed + "ms");
    } catch (Throwable e) {
        e.printStackTrace();
        Assert.fail(e.toString());
    }

}
 
Example #17
Source File: DurationConverter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public DurationConverter() {
    this(new Object() {
        DatatypeFactory getFactory() {
            try {
                return DatatypeFactory.newInstance();
            } catch (final DatatypeConfigurationException e) {
                return null;
            }
        }
    }.getFactory());
}
 
Example #18
Source File: DurationType.java    From cxf with Apache License 2.0 5 votes vote down vote up
public DurationType() {
    try {
        dtFactory = DatatypeFactory.newInstance();
    } catch (DatatypeConfigurationException e) {
        throw new DatabindingException("Couldn't load DatatypeFactory.", e);
    }

    setTypeClass(Duration.class);
}
 
Example #19
Source File: ISO8601.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parse string date in format "YYYY-MM-DDThh:mm:ss.SSSTZD"
 */
public static Calendar parseExtended(String value) {
	if (value == null) {
		return null;
	} else {
		try {
			DatatypeFactory dtf = DatatypeFactory.newInstance();
			XMLGregorianCalendar xml = dtf.newXMLGregorianCalendar(value);
			return xml.toGregorianCalendar();
		} catch (DatatypeConfigurationException e) {
			throw new IllegalArgumentException(value);
		}
	}
}
 
Example #20
Source File: DtoFactoryAbstract.java    From estatio with Apache License 2.0 5 votes vote down vote up
/**
 * For convenience of subclasses.
 */
protected static XMLGregorianCalendar asXMLGregorianCalendar(final LocalDate date) {
    if (date == null) {
        return null;
    }
    try {
        return DatatypeFactory
                .newInstance().newXMLGregorianCalendar(date.getYear(),date.getMonthOfYear(), date.getDayOfMonth(), 0,0,0,0,0);
    } catch (DatatypeConfigurationException e) {
        e.printStackTrace();

    }
    return null;
    //return JodaLocalDateXMLGregorianCalendarAdapter.print(date);
}
 
Example #21
Source File: XmlCalendar2Date.java    From SDA with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static XMLGregorianCalendar toXmlGregorianCalendar(String str){

		try {
			return DatatypeFactory.newInstance().newXMLGregorianCalendar(str);
		} catch (DatatypeConfigurationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
		
	}
 
Example #22
Source File: NotificationFactoryTest.java    From amazon-pay-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 * Test Order Reference Notification
 */
@Test
public void testOrderReferenceIPN() throws IOException, DatatypeConfigurationException {
    final String notificationPayload = loadTestFile("OrderReferenceNotification.json");
    final Notification notification = NotificationFactory.parseNotification(ipnHeader, notificationPayload);
    testIPNValues(notification, notificationPayload);
}
 
Example #23
Source File: NotificationFactoryTest.java    From amazon-pay-sdk-java with Apache License 2.0 5 votes vote down vote up
/**
 * Test Chargeback Notification for Generic Service reason
 */
@Test
public void testChargebackServiceIPN() throws IOException, DatatypeConfigurationException {
    final String notificationPayload = loadTestFile("ChargebackNotification_Service.json");
    final Notification notification = NotificationFactory.parseNotification(ipnHeader, notificationPayload);
    final NotificationType type = notification.getNotificationType();
    Assert.assertEquals(type, NotificationType.ChargebackNotification);

    final NotificationMetaData nm = notification.getNotificationMetadata();
    Assert.assertEquals(nm.getType(), "Notification");
    Assert.assertEquals(nm.getMessageId(), "83d848c9-7376-56f8-b5a7-1ae9be88a82a");
    Assert.assertEquals(nm.getTopicArn(), "arn:aws:sns:us-east-1:598607868003:A35A4JO734ER04A08593053M41F7TQ7YR7W");
    Assert.assertEquals(nm.getTimeStamp(), "2017-08-30T14:29:18.908Z");
    Assert.assertEquals(nm.getSignatureVersion(), "1");
    Assert.assertEquals(nm.getSignature(), "XOYWtZKrjKXws8V2Ulx4GMUoMa3e10dok4cHlz6vs/BwFiQkC6KqhP0KIaOzIMu3V1WK7+0Kp7wC6F5MuxnumdcDIFFrL/hCLHHeDRWKzogcTCXjstNjoA0tWqsN0OHmIiP0VWTtXYswRL2+FFMd5q2JBkmlAONv/cbOcsWR++2Aa6K2Nf2VWxjW3iykJmnmruAtGctM68xjBv2Q6F3uBaHLKgsD02er+sU5rUWXYSr0qzHMx5AK+lrHuTbvZ7scHGWWGRufAmmq94D8wXXiWlL3h8TK5Abes5upfJiAaG6NikppD+wzBQ0NhDczJhmodCh+aVIcA8NAol/hOclX9A==");
    Assert.assertEquals(nm.getSigningCertUrl(), "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-433026a4050d206028891664da859041.pem");
    Assert.assertEquals(nm.getUnsubscribeUrl(), "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:598607868003:A35A4JO734ER04A08593053M41F7TQ7YR7W:413d945a-6cc4-4c6f-a45a-c5c0918b03b9");

    final IPNMessageMetaData mm = notification.getMessageMetadata();
    Assert.assertEquals(mm.getReleaseEnvironment(), "Live");
    Assert.assertEquals(mm.getMarketplaceId(), "165570");
    Assert.assertEquals(mm.getVersion(), "2013-01-01");
    Assert.assertEquals(mm.getNotificationReferenceId(), "9bc8ec61-da88-4b63-b201-dc7afeaae764");
    Assert.assertEquals(mm.getSellerId(), "A08593053M41F7TQ7YR7W");
    Assert.assertEquals(mm.getTimeStamp(), "2017-08-30T14:29:18.833Z");

    final ChargebackNotification cn = (ChargebackNotification)notification;
    final ChargebackDetails cd = cn.getChargebackDetails();
    Assert.assertEquals(cd.getAmazonChargebackId(), "C9KORZRXQ655G");
    Assert.assertEquals(cd.getAmazonOrderReferenceId(), "P01-7128087-7259534");
    Assert.assertEquals(cd.getAmazonCaptureReferenceId(), "CaptureReference6282176");
    final XMLGregorianCalendar xgc = DatatypeFactory.newInstance().newXMLGregorianCalendar("2017-08-23T12:20:56.061Z");
    Assert.assertEquals(cd.getCreationTimestamp(), xgc);
    Assert.assertEquals(cd.getChargebackAmount().getAmount(), "100.0");
    Assert.assertEquals(cd.getChargebackAmount().getCurrencyCode(), "USD");
    Assert.assertEquals(cd.getChargebackState(), "RECEIVED");
    Assert.assertEquals(cd.getChargebackReason(), "Generic Service Chargeback");
}
 
Example #24
Source File: NsesssMapper.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
DatatypeFactory getXmlTypes() {
    try {
        if (xmlTypes == null) {
            xmlTypes = DatatypeFactory.newInstance();
        }
        return xmlTypes;
    } catch (DatatypeConfigurationException ex) {
        throw new IllegalStateException(ex);
    }
}
 
Example #25
Source File: DateTimeConverter.java    From atdl4j with MIT License 5 votes vote down vote up
protected static DatatypeFactory getJavaxDatatypeFactory()
{
	// -- Lazy init --
	if ( javaxDatatypeFactory == null )
	{
		try {
			javaxDatatypeFactory = DatatypeFactory.newInstance();
		} catch (DatatypeConfigurationException e) {
		    	// swallow, likely generate NPE   
		}
	}
	
	return javaxDatatypeFactory;
}
 
Example #26
Source File: XmlCalendar2Date.java    From SDA with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static XMLGregorianCalendar toXMLGregorianCalendar(Date date) {
		GregorianCalendar gCalendar = new GregorianCalendar();
		gCalendar.setTime(date);
		XMLGregorianCalendar xmlCalendar = null;
		try {
			xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar);
		} catch (DatatypeConfigurationException ex) {
//			Logger.getLogger(StringReplace.class.getName()).log(Level.SEVERE, null, ex);
		}
		return xmlCalendar;
	}
 
Example #27
Source File: GregorianCalendarTester.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void test_toDate() throws DatatypeConfigurationException {
    GregorianCalendar calendarActual = new GregorianCalendar(2018, 6, 28);
    DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
    XMLGregorianCalendar expectedXMLGregorianCalendar = datatypeFactory
        .newXMLGregorianCalendar(calendarActual);
    expectedXMLGregorianCalendar.toGregorianCalendar().getTime();
    assertEquals(calendarActual.getTime(), 
        expectedXMLGregorianCalendar.toGregorianCalendar().getTime() );
}
 
Example #28
Source File: BatchBankPaymentServiceImpl.java    From axelor-open-suite with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@Transactional(rollbackOn = {Exception.class})
public BankOrder createBankOrderFromPaymentScheduleLines(Batch batch)
    throws AxelorException, JAXBException, IOException, DatatypeConfigurationException {

  List<PaymentScheduleLine> paymentScheduleLineList;
  int offset = 0;

  while (!(paymentScheduleLineList = fetchPaymentScheduleLineDoneList(batch, offset)).isEmpty()) {
    createBankOrders(batch, paymentScheduleLineList);
    offset += paymentScheduleLineList.size();
    JPA.clear();
    batch = batchRepo.find(batch.getId());
  }

  List<BankOrder> bankOrderList;

  while ((bankOrderList = fetchLimitedBankOrderList(batch)).size() > 1) {
    bankOrderMergeService.mergeBankOrders(bankOrderList);
    JPA.clear();
    batch = batchRepo.find(batch.getId());
  }

  if (bankOrderList.isEmpty()) {
    throw new AxelorException(
        batch,
        TraceBackRepository.CATEGORY_INCONSISTENCY,
        I18n.get(IExceptionMessage.BANK_ORDER_MERGE_NO_BANK_ORDERS));
  }

  BankOrder bankOrder = bankOrderRepo.find(bankOrderList.iterator().next().getId());
  batch.setBankOrder(bankOrder);

  return bankOrder;
}
 
Example #29
Source File: RedirectSamlURLBuilderTest.java    From development with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws DatatypeConfigurationException {
    authnRequest = new AuthnRequestGenerator("Issuer Name", Boolean.TRUE)
            .generateAuthnRequest();
    redirectSamlURLBuilder = spy(new RedirectSamlURLBuilder<AuthnRequestType>());
    logger = mock(Log4jLogger.class);
}
 
Example #30
Source File: ResellerShareResultAssembler.java    From development with Apache License 2.0 5 votes vote down vote up
private void addSupplier(Currency currency)
        throws DatatypeConfigurationException {
    long subscriptionKey = currentBillingResult.getSubscriptionKey()
            .longValue();
    long supplierKey = billingRetrievalService
            .loadSupplierKeyForSubscription(subscriptionKey);
    Supplier supplier = currency.getSupplierByKey(supplierKey);
    if (supplier == null) {
        supplier = buildSupplier(supplierKey);
        currency.addSupplier(supplier);
    }

    addService(supplier, subscriptionKey);
}