Example usage for org.apache.commons.lang Validate notNull

List of usage examples for org.apache.commons.lang Validate notNull

Introduction

In this page you can find the example usage for org.apache.commons.lang Validate notNull.

Prototype

public static void notNull(Object object, String message) 

Source Link

Document

Validate an argument, throwing IllegalArgumentException if the argument is null.

 Validate.notNull(myObject, "The object must not be null"); 

Usage

From source file:com.opengamma.analytics.financial.model.option.pricing.fourier.MeanCorrection.java

public MeanCorrection(CharacteristicExponent base) {
    Validate.notNull(base, "null base ce");
    _base = base;
}

From source file:fr.ribesg.bukkit.api.chat.Click.java

/**
 * Builds a new Click of type {@link Type#OPEN_URL}.
 *
 * @param url an URL matching {@link #HTTP_REGEX}
 *
 * @return a new Click of type OPEN_URL//from   w w  w .  j  a v  a2  s  . c o  m
 */
public static Click ofOpenUrl(final String url) {
    Validate.notNull(url, "Url cannot be null!");
    Validate.isTrue(HTTP_REGEX.matcher(url).matches(), "Provided url is invalid: " + url);
    return forType(Type.OPEN_URL, url);
}

From source file:com.opengamma.analytics.financial.simpleinstruments.derivative.SimpleFuture.java

public SimpleFuture(final double expiry, final double settlement, final double referencePrice,
        final double unitAmount, final Currency currency) {
    Validate.notNull(currency, "currency");
    Validate.isTrue(expiry >= 0, "time to expiry must be positive");
    Validate.isTrue(settlement >= 0, "time to settlement must be positive");
    _expiry = expiry;//ww w  .  j  a  v  a2 s .c om
    _settlement = settlement;
    _referencePrice = referencePrice;
    _unitAmount = unitAmount;
    _currency = currency;
}

From source file:com.opengamma.analytics.financial.var.parametric.DeltaCovarianceMatrixStandardDeviationCalculator.java

public DeltaCovarianceMatrixStandardDeviationCalculator(final MatrixAlgebra algebra) {
    Validate.notNull(algebra, "algebra");
    _algebra = algebra;
}

From source file:com.opengamma.analytics.math.surface.NodalSurfaceAdditiveShiftFunction.java

/**
 * {@inheritDoc}//  www .ja va  2 s  . c  o m
 */
@Override
public NodalDoublesSurface evaluate(final NodalDoublesSurface surface, final double shift) {
    Validate.notNull(surface, "surface");
    return evaluate(surface, shift, "PARALLEL_SHIFT_" + surface.getName());
}

From source file:com.opengamma.financial.convention.AUConventions.java

public static synchronized void addFixedIncomeInstrumentConventions(
        final InMemoryConventionBundleMaster conventionMaster) {
    Validate.notNull(conventionMaster, "convention master");
    final BusinessDayConvention modified = BusinessDayConventionFactory.INSTANCE
            .getBusinessDayConvention("Modified Following");
    final BusinessDayConvention following = BusinessDayConventionFactory.INSTANCE
            .getBusinessDayConvention("Following");
    final DayCount act365 = DayCountFactory.INSTANCE.getDayCount("Actual/365");
    final Frequency semiAnnual = SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.SEMI_ANNUAL_NAME);
    final Frequency quarterly = SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.QUARTERLY_NAME);
    final Frequency annual = SimpleFrequencyFactory.INSTANCE.getFrequency(Frequency.ANNUAL_NAME);

    //TODO holiday associated with AUD swaps is Sydney
    final ExternalId au = ExternalSchemes.financialRegionId("AU");

    final Integer overnightPublicationLag = 0;

    final ConventionBundleMasterUtils utils = new ConventionBundleMasterUtils(conventionMaster);
    // IR FUTURES
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("AUD_IR_FUTURE")), "AUD_IR_FUTURE",
            act365, modified, Period.ofMonths(3), 0, true, au);

    utils.addConventionBundle(//from w w  w.jav a  2  s.  co m
            ExternalIdBundle.of(bloombergTickerSecurityId("AU00O/N Index"),
                    simpleNameSecurityId("AUD LIBOR O/N")),
            "AUD LIBOR O/N", act365, following, Period.ofDays(1), 0, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU00S/N Index"),
                    simpleNameSecurityId("AUD LIBOR S/N")),
            "AUD LIBOR S/N", act365, following, Period.ofDays(1), 0, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU00T/N Index"),
                    simpleNameSecurityId("AUD LIBOR T/N")),
            "AUD LIBOR T/N", act365, following, Period.ofDays(1), 0, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0001W Index"),
                    simpleNameSecurityId("AUD LIBOR 1w")),
            "AUD LIBOR 1w", act365, following, Period.ofDays(1), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0002W Index"),
                    simpleNameSecurityId("AUD LIBOR 2w")),
            "AUD LIBOR 2w", act365, following, Period.ofDays(1), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0001M Index"),
                    simpleNameSecurityId("AUD LIBOR 1m")),
            "AUD LIBOR 1m", act365, following, Period.ofMonths(1), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0002M Index"),
                    simpleNameSecurityId("AUD LIBOR 2m")),
            "AUD LIBOR 2m", act365, following, Period.ofMonths(2), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0003M Index"),
                    simpleNameSecurityId("AUD LIBOR 3m")),
            "AUD LIBOR 3m", act365, following, Period.ofMonths(3), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0004M Index"),
                    simpleNameSecurityId("AUD LIBOR 4m")),
            "AUD LIBOR 4m", act365, following, Period.ofMonths(4), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0005M Index"),
                    simpleNameSecurityId("AUD LIBOR 5m")),
            "AUD LIBOR 5m", act365, following, Period.ofMonths(5), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0006M Index"),
                    simpleNameSecurityId("AUD LIBOR 6m")),
            "AUD LIBOR 6m", act365, following, Period.ofMonths(6), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0007M Index"),
                    simpleNameSecurityId("AUD LIBOR 7m")),
            "AUD LIBOR 7m", act365, following, Period.ofMonths(7), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0008M Index"),
                    simpleNameSecurityId("AUD LIBOR 8m")),
            "AUD LIBOR 8m", act365, following, Period.ofMonths(8), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0009M Index"),
                    simpleNameSecurityId("AUD LIBOR 9m")),
            "AUD LIBOR 9m", act365, following, Period.ofMonths(9), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0010M Index"),
                    simpleNameSecurityId("AUD LIBOR 10m")),
            "AUD LIBOR 10m", act365, following, Period.ofMonths(10), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0011M Index"),
                    simpleNameSecurityId("AUD LIBOR 11m")),
            "AUD LIBOR 11m", act365, following, Period.ofMonths(11), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("AU0012M Index"),
                    simpleNameSecurityId("AUD LIBOR 12m")),
            "AUD LIBOR 12m", act365, following, Period.ofMonths(12), 2, false, au);

    //TODO need to check that these are right for deposit rates
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR1T Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 1d")),
            "AUD DEPOSIT 1d", act365, following, Period.ofDays(1), 0, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR2T Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 2d")),
            "AUD DEPOSIT 2d", act365, following, Period.ofDays(1), 0, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR3T Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 3d")),
            "AUD DEPOSIT 3d", act365, following, Period.ofDays(1), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR1Z Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 1w"), tullettPrebonSecurityId("ASDEPAUDSPT01W")),
            "AUD DEPOSIT 1w", act365, following, Period.ofDays(7), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR2Z Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 2w"), tullettPrebonSecurityId("ASDEPAUDSPT02W")),
            "AUD DEPOSIT 2w", act365, following, Period.ofDays(14), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR3Z Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 3w"), tullettPrebonSecurityId("ASDEPAUDSPT03W")),
            "AUD DEPOSIT 3w", act365, following, Period.ofDays(21), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRA Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 1m"), tullettPrebonSecurityId("ASDEPAUDSPT01M")),
            "AUD DEPOSIT 1m", act365, following, Period.ofMonths(1), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRB Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 2m"), tullettPrebonSecurityId("ASDEPAUDSPT02M")),
            "AUD DEPOSIT 2m", act365, following, Period.ofMonths(2), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRC Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 3m"), tullettPrebonSecurityId("ASDEPAUDSPT03M")),
            "AUD DEPOSIT 3m", act365, following, Period.ofMonths(3), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRD Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 4m"), tullettPrebonSecurityId("ASDEPAUDSPT04M")),
            "AUD DEPOSIT 4m", act365, following, Period.ofMonths(4), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRE Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 5m"), tullettPrebonSecurityId("ASDEPAUDSPT05M")),
            "AUD DEPOSIT 5m", act365, following, Period.ofMonths(5), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRF Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 6m"), tullettPrebonSecurityId("ASDEPAUDSPT06M")),
            "AUD DEPOSIT 6m", act365, following, Period.ofMonths(6), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRG Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 7m"), tullettPrebonSecurityId("ASDEPAUDSPT07M")),
            "AUD DEPOSIT 7m", act365, following, Period.ofMonths(7), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRH Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 8m"), tullettPrebonSecurityId("ASDEPAUDSPT08M")),
            "AUD DEPOSIT 8m", act365, following, Period.ofMonths(8), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRI Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 9m"), tullettPrebonSecurityId("ASDEPAUDSPT09M")),
            "AUD DEPOSIT 9m", act365, following, Period.ofMonths(9), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRJ Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 10m"), tullettPrebonSecurityId("ASDEPAUDSPT10M")),
            "AUD DEPOSIT 10m", act365, following, Period.ofMonths(10), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDRK Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 11m"), tullettPrebonSecurityId("ASDEPAUDSPT11M")),
            "AUD DEPOSIT 11m", act365, following, Period.ofMonths(11), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR1 Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 1y"), tullettPrebonSecurityId("ASDEPAUDSPT12M")),
            "AUD DEPOSIT 1y", act365, following, Period.ofYears(1), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR2 Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 2y")),
            "AUD DEPOSIT 2y", act365, following, Period.ofYears(2), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR3 Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 3y")),
            "AUD DEPOSIT 3y", act365, following, Period.ofYears(3), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR4 Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 4y")),
            "AUD DEPOSIT 4y", act365, following, Period.ofYears(4), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADDR5 Curncy"),
                    simpleNameSecurityId("AUD DEPOSIT 5y")),
            "AUD DEPOSIT 5y", act365, following, Period.ofYears(5), 2, false, au);

    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADBB1M Curncy"),
                    simpleNameSecurityId("AUD BILL 1m")),
            "AUD BILL 1m", act365, following, Period.ofMonths(1), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADBB2M Curncy"),
                    simpleNameSecurityId("AUD BILL 2m")),
            "AUD BILL 2m", act365, following, Period.ofMonths(2), 2, false, au);
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("ADBB3M Curncy"),
                    simpleNameSecurityId("AUD BILL 3m")),
            "AUD BILL 3m", act365, following, Period.ofMonths(3), 2, false, au);

    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("RBACOR Index"),
                    simpleNameSecurityId("RBA OVERNIGHT CASH RATE")),
            "RBA OVERNIGHT CASH RATE", act365, following, Period.ofDays(1), 0, false, au,
            overnightPublicationLag);

    final DayCount swapFixedDayCount = act365;
    final BusinessDayConvention swapFixedBusinessDay = modified;

    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("AUD_SWAP")), "AUD_SWAP", act365,
            modified, semiAnnual, 0, au, act365, modified, semiAnnual, 0,
            simpleNameSecurityId(IndexType.BBSW + "_AUD_P6M"), au, true);

    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("AUD_3M_SWAP")), "AUD_3M_SWAP",
            swapFixedDayCount, swapFixedBusinessDay, quarterly, 0, au, act365, modified, quarterly, 0,
            simpleNameSecurityId(IndexType.BBSW + "_AUD_P3M"), au, true);
    // simpleNameSecurityId("AUD Bank Bill 3m")
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("AUD_6M_SWAP")), "AUD_6M_SWAP",
            swapFixedDayCount, swapFixedBusinessDay, semiAnnual, 0, au, act365, modified, semiAnnual, 0,
            simpleNameSecurityId(IndexType.BBSW + "_AUD_P6M"), au, true);
    // simpleNameSecurityId("AUD Bank Bill 6m")

    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("AUD_3M_FRA")), "AUD_3M_FRA", act365,
            modified, quarterly, 0, au, act365, modified, quarterly, 0,
            simpleNameSecurityId(IndexType.BBSW + "_AUD_P3M"), au, true);
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("AUD_6M_FRA")), "AUD_6M_FRA", act365,
            modified, semiAnnual, 0, au, act365, modified, semiAnnual, 0,
            simpleNameSecurityId(IndexType.BBSW + "_AUD_P6M"), au, true);
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("AUD_OIS_SWAP")), "AUD_OIS_SWAP", act365,
            modified, annual, 0, au, act365, modified, annual, 0,
            simpleNameSecurityId("RBA OVERNIGHT CASH RATE"), au, true, overnightPublicationLag);

    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("BBSW3M Index"), ricSecurityId("AUBABSL3M=AFMA"),
                    simpleNameSecurityId(IndexType.BBSW + "_AUD_P3M")),
            "AUD Bank Bill 3m", act365, modified, Period.ofMonths(3), 0, true, au); // "AUD Bank Bill 3m"
    utils.addConventionBundle(
            ExternalIdBundle.of(bloombergTickerSecurityId("BBSW6M Index"), ricSecurityId("AUBABSL6M=AFMA"),
                    simpleNameSecurityId(IndexType.BBSW + "_AUD_P6M")),
            "AUD Bank Bill 6m", act365, modified, Period.ofMonths(6), 0, true, au); // "AUD Bank Bill 6m"
    utils.addConventionBundle(ExternalIdBundle.of(simpleNameSecurityId("AUD_SWAPTION")), "AUD_SWAPTION", false);
}

From source file:com.opengamma.analytics.math.surface.NodalSurfaceMultiplicativeShiftFunction.java

/**
 * {@inheritDoc}/*w  w w  .  ja  va 2  s . c  om*/
 */
@Override
public NodalDoublesSurface evaluate(final NodalDoublesSurface surface, final double percentage) {
    Validate.notNull(surface, "surface");
    return evaluate(surface, percentage, "CONSTANT_MULTIPLIER_" + surface.getName());
}

From source file:com.opengamma.analytics.financial.schedule.FirstOfMonthScheduleCalculator.java

public LocalDate[] getSchedule(final LocalDate startDate, final LocalDate endDate) {
    Validate.notNull(startDate, "start date");
    Validate.notNull(endDate, "end date");
    Validate.isTrue(startDate.isBefore(endDate) || startDate.equals(endDate));
    if (startDate.equals(endDate)) {
        if (startDate.getDayOfMonth() == 1) {
            return new LocalDate[] { startDate };
        }// www . j a  va 2  s  . c o m
        throw new IllegalArgumentException(
                "Start date and end date were the same but neither was the first day of the month");
    }
    final List<LocalDate> dates = new ArrayList<LocalDate>();
    LocalDate date = startDate.with(DateAdjusters.firstDayOfMonth());
    if (date.isBefore(startDate)) {
        date = date.plusMonths(1);
    }
    while (!date.isAfter(endDate)) {
        dates.add(date);
        date = date.plusMonths(1);
    }
    return dates.toArray(EMPTY_LOCAL_DATE_ARRAY);
}

From source file:com.opengamma.analytics.financial.model.interestrate.HullWhiteTwoFactorInterestRateModel.java

@Override
public Function1D<HullWhiteTwoFactorDataBundle, Double> getDiscountBondFunction(final ZonedDateTime time,
        final ZonedDateTime maturity) {
    Validate.notNull(time, "time");
    Validate.notNull(maturity, "maturity");
    return new Function1D<HullWhiteTwoFactorDataBundle, Double>() {

        @Override//from w w  w . j  av a2 s. com
        public Double evaluate(final HullWhiteTwoFactorDataBundle data) {
            Validate.notNull(data, "data");
            final double t1 = 0;
            final double t2 = DateUtils.getDifferenceInYears(data.getDate(), time);
            final double t3 = DateUtils.getDifferenceInYears(data.getDate(), maturity);
            final double r2 = data.getShortRate(t2);
            final double r3 = data.getShortRate(t3);
            final double p2 = Math.exp(-r2 * t2);
            final double p3 = Math.exp(-r3 * t3);
            final double alpha = data.getFirstSpeed();
            final double beta = data.getSecondSpeed();
            final double sigma1 = data.getShortRateVolatility(t1);
            final double sigma2 = data.getSecondVolatility(t1);
            final double rho = data.getCorrelation();
            final double eta = getEta(t1, t2, t3, alpha, beta, sigma1, sigma2, rho);
            final double b = getB(t3 - t2, alpha);
            final double c = getC(t3 - t2, alpha, beta);
            final double u = data.getMeanReversionLevel();
            final double f = data.getForwardRate(t1);
            final double lnA = Math.log(p3 / p2) + b * f - eta;
            return Math.exp(lnA - r2 * b - u * c);
        }

    };
}

From source file:com.indoqa.daisy.adapter.pr.PublisherRequestDocumentBuilder.java

public static PublisherRequestDocument createPublisherRequestDocument(final DaisyDocumentProxy proxy,
        final PRDocumentConfiguration config) {
    final String id = proxy.getDocId();
    final String branchId = proxy.getBranchId();
    final String languageId = proxy.getLanguageId();

    PublisherRequestDocument prDoc = PublisherRequestDocument.Factory.newInstance();

    Validate.notNull(id, "You have to pass the document id.");
    Validate.notNull(branchId, "You have to pass the branch id.");
    Validate.notNull(languageId, "You have to pass a language id.");

    PublisherRequest pr = prDoc.addNewPublisherRequest();
    if (config.useLast) {
        pr.setVersionMode("last");
    }//from   w  w w.  jav  a 2  s.c om

    if (!config.isNavigationDocument) {
        org.outerx.daisy.x10Publisher.DocumentDocument.Document doc = pr.addNewDocument();
        doc.setId(id);
        doc.setBranch(branchId);
        doc.setLanguage(languageId);
        if (config.useLast) {
            doc.setVersion("last");
        }

        PreparedDocuments preparedDocuments = doc.addNewPreparedDocuments();
        preparedDocuments.setApplyDocumentTypeStyling(true);

        if (config.annotatingNavDocId != null) {
            VariantKeyType navDoc = preparedDocuments.addNewNavigationDocument();
            navDoc.setId(config.annotatingNavDocId);
            navDoc.setBranch(config.annotatingNavDocBranchId);
            navDoc.setLanguage(config.annotatingNavDocLanguageId);
        }

    } else {
        NavigationTree navTree = pr.addNewNavigationTree();
        VariantKeyType navDoc = navTree.addNewNavigationDocument();
        navDoc.setId(id);
        navDoc.setBranch(branchId);
        navDoc.setLanguage(languageId);
        navTree.setContextualized(false);
    }
    return prDoc;
}