Example usage for org.apache.commons.jxpath Pointer getValue

List of usage examples for org.apache.commons.jxpath Pointer getValue

Introduction

In this page you can find the example usage for org.apache.commons.jxpath Pointer getValue.

Prototype

Object getValue();

Source Link

Document

Returns the value of the object, property or collection element this pointer represents.

Usage

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns a formatted billing address for a party.
 *
 * @param context the expression context. Expected to reference a party or act
 * @return a formatted billing address, or {@code null}
 *///  w  ww  .  j  a  v  a2  s  .  co  m
public String getCorrespondenceAddress(ExpressionContext context) {
    Pointer pointer = context.getContextNodePointer();
    Object value = pointer.getValue();
    if (value instanceof Party) {
        return getCorrespondenceAddress((Party) value);
    } else if (value instanceof Act) {
        return getCorrespondenceAddress((Act) value);
    }
    return null;
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns a formatted fax number for a party.
 *
 * @param context the expression context. Expected to reference a party
 * @return a formatted fax number. party. May be empty if there is no corresponding <em>contact.phoneNumber</em>
 *         contact with a FAX purpose/*from  w  w  w. j  a  va 2  s  .  c o m*/
 */
public String getFaxNumber(ExpressionContext context) {
    Pointer pointer = context.getContextNodePointer();
    Object value = pointer.getValue();
    if (value instanceof Party) {
        return getFaxNumber((Party) value);
    } else if (value instanceof Act) {
        return getFaxNumber((Act) value);
    }
    return "";
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns a formatted email address for a party.
 *
 * @param context the expression context. Expected to reference a party
 * @return a formatted email address. party. May be empty if
 *         there is no corresponding <em>contact.email</em> contact
 *//*  w w w. ja  va  2 s .  c o m*/
public String getEmailAddress(ExpressionContext context) {
    Pointer pointer = context.getContextNodePointer();
    Object value = pointer.getValue();
    if (value instanceof Party) {
        return getEmailAddress((Party) value);
    } else if (value instanceof Act) {
        return getEmailAddress((Act) value);
    }
    return "";
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns a formatted contact purpose string for the Contact.
 *
 * @param context the expression context. Expected to reference a contact.
 * @return a formatted string with the contacts contact purposes,
 *         or {@code null}//  w ww .j  av a 2  s  .co m
 */
public String getContactPurposes(ExpressionContext context) {
    Pointer pointer = context.getContextNodePointer();
    if (pointer == null || !(pointer.getValue() instanceof Contact)) {
        return "";
    }
    Contact contact = (Contact) pointer.getValue();
    return partyRules.getContactPurposes(contact);
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns a stringified form of a party's identities.
 *
 * @param context the expression context. Expected to reference a party.
 * @return the stringified form of the party's identities
 *///  www . j  a va 2  s  .  co m
public String identities(ExpressionContext context) {
    Pointer pointer = context.getContextNodePointer();
    if (pointer == null || !(pointer.getValue() instanceof Party)) {
        return "";
    }
    Party party = (Party) pointer.getValue();
    return identities(party);
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns the current account Balance for a party or act.
 *
 * @param context the expression context. Expected to reference a party or act
 * @return the account balance/*from w w w . j ava 2 s.  co  m*/
 */
public BigDecimal getAccountBalance(ExpressionContext context) {
    BigDecimal result = BigDecimal.ZERO;
    Pointer pointer = context.getContextNodePointer();
    Object value = pointer.getValue();
    if (value instanceof Party) {
        result = getAccountBalance((Party) value);

    } else if (value instanceof Act) {
        result = getAccountBalance((Act) value);
    }
    return result;
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns the referral vet for a patient.
 * <p/>/*from  w  w  w .j a v  a 2 s.c  o  m*/
 * This is the patient's associated party from the first matching <em>entityRelationship.referredFrom</em> or
 * <em>entityrRelationship.referredTo</em> that matches the:
 * <ul>
 * <li>act's start time, if the context refers to an act; or</li>
 * <li>the current time, if it refers to a patient</li>
 * </ul>
 *
 * @param context the expression context. Expected to reference an act or patient.
 * @return the referral vet, or {@code null} if there is no patient associated with the act, the act has no start
 *         time, or the patient isn't being referred
 */
public Party getPatientReferralVet(ExpressionContext context) {
    Pointer pointer = context.getContextNodePointer();
    Object value = pointer.getValue();
    if (value instanceof Act) {
        return getPatientReferralVet((Act) value);
    } else if (value instanceof Party) {
        return getPatientReferralVet((Party) value);
    }
    return null;
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns the referral vet practice for a vet.
 *
 * @param context the expression context. Expected to reference an patient, or an act containing a patient
 * @return the practice the vet is associated with or {@code null} if the vet is not associated with any practice
 *///from   ww  w .ja  v a2 s.co m
public Party getPatientReferralVetPractice(ExpressionContext context) {
    Party result = null;
    Pointer pointer = context.getContextNodePointer();
    Object value = pointer.getValue();
    if (value instanceof Act) {
        result = getPatientReferralVetPractice((Act) value);
    } else if (value instanceof Party) {
        result = getPatientReferralVetPractice((Party) value);
    }
    return result;
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns the age of the patient./*from w  w w . j a  v a  2  s.  c  om*/
 * <p/>
 * If the patient is deceased, the age of the patient when they died will be returned
 *
 * @param context the expression context. Expected to reference a party.
 * @return the stringified form of the patient's age
 */
public String getPatientAge(ExpressionContext context) {
    Pointer pointer = context.getContextNodePointer();
    if (pointer == null || !(pointer.getValue() instanceof Party)) {
        return null;
    }
    return getPatientAge((Party) pointer.getValue());
}

From source file:org.openvpms.archetype.function.party.PartyFunctions.java

/**
 * Returns the most recent active microchip identity for a patient.
 *
 * @param context the expression context
 * @return the active microchip object, or {@code null} if none is found
 *//*from www  .  j a v  a  2s .  c  o m*/
public Object getMicrochip(ExpressionContext context) {
    Object result = null;
    Pointer pointer = context.getContextNodePointer();
    Object value = pointer.getValue();
    if (value instanceof Act) {
        result = getMicrochip((Act) value);
    } else if (value instanceof Party) {
        result = getMicrochip((Party) value);
    }
    return result;
}