Пример #1
0
  /**
   * Returns a <tt>PartyType</tt> for the supplied party and contact.
   *
   * @param party the party
   * @param location the location contact. May be <tt>null</tt>
   * @return the corresponding <tt>PartyType</tt>
   */
  private PartyType getParty(Party party, Contact location) {
    PartyType result = new PartyType();

    PartyNameType partyName = new PartyNameType();
    partyName.setName(UBLHelper.createName(party.getName()));
    result.getPartyName().add(partyName);
    if (location != null) {
      result.setPostalAddress(getAddress(location));
    }
    return result;
  }
Пример #2
0
 /**
  * Invoked when an appointment is selected.
  *
  * <p>If the appointment can be viewed at the current practice location, the appointment workspace
  * will be switched to.
  *
  * @param appointment the appointment
  * @param layoutContext the layout context
  */
 private void onAppointmentSelected(Act appointment, LayoutContext layoutContext) {
   AppointmentRules rules = ServiceHelper.getBean(AppointmentRules.class);
   Context context = layoutContext.getContext();
   ContextSwitchListener listener = layoutContext.getContextSwitchListener();
   ActBean bean = new ActBean(appointment);
   Entity schedule = bean.getNodeParticipant("schedule");
   Party location = context.getLocation();
   if (schedule != null && location != null) {
     Entity view = rules.getScheduleView(location, schedule);
     if (view != null) {
       listener.switchTo(appointment);
     } else {
       Party newLocation = rules.getLocation(schedule);
       String name = (newLocation != null) ? newLocation.getName() : Messages.get("imobject.none");
       InformationDialog.show(Messages.format("customer.info.appointment.wrongLocation", name));
     }
   }
 }
Пример #3
0
 /**
  * Returns the name of the party associated with a contact, if any.
  *
  * @param contact the contact
  * @return the party name. May be {@code null}
  */
 private String getPartyName(Contact contact) {
   Party party = contact.getParty();
   return (party != null) ? party.getName() : null;
 }