Package org.projectforge.address

Examples of org.projectforge.address.AddressDO


      sval = parameters.get(PARAMETER_ADDRESS_CAMPAIGN_ID);
      final Integer addressCampaignId = sval.isEmpty() || "null".equals(sval.toString()) ? null : sval.toInteger();
      if (addressId == null || addressCampaignId == null) {
        throw new UserException("plugins.marketing.addressCampaignValue.error.addressOrCampaignNotGiven");
      }
      final AddressDO address = addressDao.getById(addressId);
      final AddressCampaignDO addressCampaign = addressCampaignDao.getById(addressCampaignId);
      if (address == null || addressCampaign == null) {
        throw new UserException("plugins.marketing.addressCampaignValue.error.addressOrCampaignNotGiven");
      }
      AddressCampaignValueDO data = addressCampaignValueDao.get(addressId, addressCampaignId);
View Full Code Here


      final AddressCampaignValueListPage listPage = (AddressCampaignValueListPage) this.returnToPage;
      final Iterator<AddressDO> it = listPage.getList().iterator();
      while (it.hasNext() == true) {
        if (it.next().getId().equals(getHighlightedRowId()) == true && it.hasNext() == true) {
          // Found current entry and next entry available.
          final AddressDO address = it.next();
          final PageParameters parameters = new PageParameters();
          parameters.add(AddressCampaignValueEditPage.PARAMETER_ADDRESS_ID, String.valueOf(address.getId()));
          parameters.add(AddressCampaignValueEditPage.PARAMETER_ADDRESS_CAMPAIGN_ID, String.valueOf(getData().getAddressCampaignId()));
          final AddressCampaignValueEditPage editPage = new AddressCampaignValueEditPage(parameters);
          editPage.setReturnToPage(this.returnToPage);
          setResponsePage(editPage);
          return;
View Full Code Here

    final List<IColumn<AddressDO, String>> columns = new ArrayList<IColumn<AddressDO, String>>();
    final CellItemListener<AddressDO> cellItemListener = new CellItemListener<AddressDO>() {
      @Override
      public void populateItem(final Item<ICellPopulator<AddressDO>> item, final String componentId, final IModel<AddressDO> rowModel)
      {
        final AddressDO address = rowModel.getObject();
        final PersonalAddressDO personalAddress = personalAddressMap.get(address.getId());
        appendCssClasses(item, address.getId(), address.isDeleted());
        if (address.isDeleted() == true) {
          // Do nothing further
        } else if (personalAddress != null && personalAddress.isFavoriteCard() == true) {
          appendCssClasses(item, RowCssClass.FAVORITE_ENTRY);
        }
      }
    };
    columns.add(new CellItemListenerPropertyColumn<AddressDO>(new Model<String>(getString("modified")),
        getSortable("lastUpdate", sortable), "lastUpdate", cellItemListener) {
      /**
       * @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item,
       *      java.lang.String, org.apache.wicket.model.IModel)
       */
      @Override
      public void populateItem(final Item<ICellPopulator<AddressDO>> item, final String componentId, final IModel<AddressDO> rowModel)
      {
        final AddressDO address = rowModel.getObject();
        final RepeatingView view = new RepeatingView(componentId);
        item.add(view);
        view.add(new ListSelectActionPanel(view.newChildId(), rowModel, AddressEditPage.class, address.getId(), returnToPage,
            DateTimeFormatter.instance().getFormattedDate(address.getLastUpdate())));
        view.add(new IconLinkPanel(view.newChildId(), IconType.PRINT, new ResourceModel("printView"), new Link<Void>(IconLinkPanel.LINK_ID) {

          @Override
          public void onClick()
          {
            final PageParameters params = new PageParameters();
            params.add(AbstractEditPage.PARAMETER_KEY_ID, address.getId());
            final AddressViewPage addressViewPage = new AddressViewPage(params);
            setResponsePage(addressViewPage);
          }
        }));
        addRowClick(item);
        cellItemListener.populateItem(item, componentId, rowModel);
      }
    });
    columns.add(new CellItemListenerPropertyColumn<AddressDO>(new Model<String>(getString("name")), getSortable("name", sortable), "name",
        cellItemListener));
    columns.add(new CellItemListenerPropertyColumn<AddressDO>(new Model<String>(getString("firstName")),
        getSortable("firstName", sortable), "firstName", cellItemListener));
    columns.add(new CellItemListenerPropertyColumn<AddressDO>(new Model<String>(getString("organization")), getSortable("organization",
        sortable), "organization", cellItemListener));
    columns.add(new CellItemListenerPropertyColumn<AddressDO>(new Model<String>(getString("email")), null, "email", cellItemListener) {
      /**
       * @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item,
       *      java.lang.String, org.apache.wicket.model.IModel)
       */
      @Override
      public void populateItem(final Item<ICellPopulator<AddressDO>> item, final String componentId, final IModel<AddressDO> rowModel)
      {
        final AddressDO address = rowModel.getObject();
        final RepeatingView view = new RepeatingView(componentId);
        item.add(view);
        boolean first = true;
        if (StringUtils.isNotBlank(address.getEmail()) == true) {
          final ExternalLinkPanel mailToLinkPanel = new ExternalLinkPanel(view.newChildId(), "mailto:" + address.getEmail(), address
              .getEmail());
          mailToLinkPanel.getLink().add(AttributeModifier.replace("onclick", "javascript:suppressNextRowClick();"));
          view.add(mailToLinkPanel);
          first = false;
        }
        if (StringUtils.isNotBlank(address.getPrivateEmail()) == true) {
          if (first == true) {
            first = false;
          } else {
            view.add(new Label(view.newChildId(), "<br/>").setEscapeModelStrings(false));
          }
          view.add(new ExternalLinkPanel(view.newChildId(), "mailto:" + address.getPrivateEmail(), address.getPrivateEmail()));
        }
        cellItemListener.populateItem(item, componentId, rowModel);
      }
    });
    columns.add(new CellItemListenerPropertyColumn<AddressDO>(new Model<String>(getString("address.phoneNumbers")), null, null,
        cellItemListener) {
      /**
       * @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item,
       *      java.lang.String, org.apache.wicket.model.IModel)
       */
      @Override
      public void populateItem(final Item<ICellPopulator<AddressDO>> item, final String componentId, final IModel<AddressDO> rowModel)
      {
        final AddressDO address = rowModel.getObject();
        final PersonalAddressDO personalAddress = personalAddressMap.get(address.getId());
        final RepeatingView view = new RepeatingView(componentId);
        item.add(view);
        final Integer id = address.getId();
        boolean first = addPhoneNumber(view, id, PhoneType.BUSINESS, address.getBusinessPhone(),
            (personalAddress != null && personalAddress.isFavoriteBusinessPhone() == true), false, IconType.BUILDING, true);
        first = addPhoneNumber(view, id, PhoneType.MOBILE, address.getMobilePhone(),
            (personalAddress != null && personalAddress.isFavoriteMobilePhone() == true), true, IconType.TABLET, first);
        first = addPhoneNumber(view, id, PhoneType.PRIVATE, address.getPrivatePhone(),
            (personalAddress != null && personalAddress.isFavoritePrivatePhone() == true), false, IconType.HOME, first);
        first = addPhoneNumber(view, id, PhoneType.PRIVATE_MOBILE, address.getPrivateMobilePhone(),
            (personalAddress != null && personalAddress.isFavoritePrivateMobilePhone() == true), true, IconType.TABLET,
            first);
        cellItemListener.populateItem(item, componentId, rowModel);
        item.add(AttributeModifier.append("style", new Model<String>("white-space: nowrap;")));
      }
View Full Code Here

          final List<AddressDO> newAddresses = new ArrayList<AddressDO>();

          final FileInputStream fis = new FileInputStream(file);
          final VCardBuilder builder = new VCardBuilder(fis);

          AddressDO newAddress = null;
          for (final VCard card : builder.buildAll()) {
            newAddress = new AddressDO();

            // //// SET BASE DATA
            if (card.getProperty(net.fortuna.ical4j.vcard.Property.Id.N) != null) {
              setName(card.getProperty(net.fortuna.ical4j.vcard.Property.Id.N), newAddress);
            }
            if (card.getProperty(net.fortuna.ical4j.vcard.Property.Id.ORG) != null) {
              setOrganization(card.getProperty(net.fortuna.ical4j.vcard.Property.Id.ORG), newAddress);
            }
            if (card.getProperty(net.fortuna.ical4j.vcard.Property.Id.BDAY) != null) {
              setBirth(card.getProperty(net.fortuna.ical4j.vcard.Property.Id.BDAY), newAddress);
            }
            if (card.getProperty(net.fortuna.ical4j.vcard.Property.Id.NOTE) != null) {
              setNote(card.getProperty(net.fortuna.ical4j.vcard.Property.Id.NOTE), newAddress);
            }

            // //// SET ADDITIONAL DATA
            final List<Property> li = card.getProperties();
            setProperties(li, newAddress);

            // handle item entries
            final VCardItemElementHandler ih = new VCardItemElementHandler(new FileInputStream(file));
            if (!ih.getItemList().isEmpty())
              setProperties(ih.getItemList(), newAddress);

            newAddress.setAddressStatus(AddressStatus.UPTODATE);
            newAddress.setDeleted(false);
            newAddress.setLastUpdate(DateTime.now().toDate());
            newAddress.setCreated(DateTime.now().toDate());
            newAddress.setContactStatus(ContactStatus.ACTIVE);
            newAddress.setForm(FormOfAddress.UNKNOWN);

            // //// CHECK IF THERE IS SOMETHING MORE TO ADD
            if (newAddress.getAddressText() == null || newAddress.getAddressText() == "") {
              setOtherPropertiesToWork(li, newAddress);
              if (!ih.getItemList().isEmpty() && newAddress.getAddressText() == null || newAddress.getAddressText() == "") {
                setOtherPropertiesToWork(ih.getItemList(), newAddress);
              }
            } else if (newAddress.getPrivateAddressText() == null || newAddress.getPrivateAddressText() == "") {
              setOtherPropertiesToPrivate(li, newAddress);
              if (!ih.getItemList().isEmpty() && newAddress.getPostalAddressText() == null || newAddress.getPostalAddressText() == "")
                setOtherPropertiesToPrivate(ih.getItemList(), newAddress);
            } else {
              setPostalProperties(li, newAddress);
              if (!ih.getItemList().isEmpty() && newAddress.getPostalAddressText() == null || newAddress.getPostalAddressText() == "")
                setPostalProperties(ih.getItemList(), newAddress);
            }
            newAddresses.add(newAddress);
          }
View Full Code Here

    final StringBuffer buf = new StringBuffer();
    // Use internal get list method for avoiding access checking (no user is logged-in):
    final List<AddressDO> list = addressDao.internalGetList(queryFilter);
    if (list != null && list.size() >= 1) {
      AddressDO result = list.get(0);
      if (list.size() > 1) {
        // More than one result, therefore find the newest one:
        buf.append("+"); // Mark that more than one entry does exist.
        for (final AddressDO matchingUser : list) {
          if (matchingUser.getLastUpdate().after(result.getLastUpdate()) == true) {
            result = matchingUser;
          }
        }
      }
      resp.setContentType("text/plain");
      final String fullname = result.getFullName();
      final String organization = result.getOrganization();
      StringHelper.listToString(buf, "; ", fullname, organization);
      resp.getOutputStream().print(buf.toString());
    } else {
      /* mit Thomas abgesprochen. */
      resp.getOutputStream().print(0);
View Full Code Here

    if (start.getMonthOfYear() == Calendar.MARCH && start.getDayOfMonth() == 1) {
      from = start.minusDays(1);
    }
    final Set<BirthdayAddress> set = addressDao.getBirthdays(from.toDate(), end.toDate(), 1000, true);
    for (final BirthdayAddress birthdayAddress : set) {
      final AddressDO address = birthdayAddress.getAddress();
      final int month = birthdayAddress.getMonth() + 1;
      final int dayOfMonth = birthdayAddress.getDayOfMonth();
      DateTime date = getDate(from, end, month, dayOfMonth);
      // February, 29th fix:
      if (date == null && month == Calendar.FEBRUARY + 1 && dayOfMonth == 29) {
        date = getDate(from, end, month + 1, 1);
      }
      if (date == null && WebConfiguration.isDevelopmentMode() == true) {
        log.info("Date "
            + birthdayAddress.getDayOfMonth()
            + "/"
            + (birthdayAddress.getMonth() + 1)
            + " not found between "
            + from
            + " and "
            + end);
        continue;
      } else {
        if (dataProtection == false && date != null) {
          birthdayAddress.setAge(date.toDate());
        }
      }
      final Event event = new Event().setAllDay(true);
      event.setClassName(EVENT_CLASS_NAME);
      final String id = "" + address.getId();
      event.setId(id);
      event.setStart(date);
      final StringBuffer buf = new StringBuffer();
      if (dataProtection == false) {
        // Birthday is not visible for all users (age == 0).
        buf.append(
            DateTimeFormatter.instance().getFormattedDate(address.getBirthday(), DateFormats.getFormatString(DateFormatType.DATE_SHORT)))
            .append(" ");
      }
      buf.append(address.getFirstName()).append(" ").append(address.getName());
      if (dataProtection == false && birthdayAddress.getAge() > 0) {
        // Birthday is not visible for all users (age == 0).
        buf.append(" (").append(birthdayAddress.getAge()).append(" ").append(PFUserContext.getLocalizedString("address.age.short")).append(")");
      }
      event.setTitle(buf.toString());
View Full Code Here

      final ContentMenuEntryPanel singleIcalExport = new ContentMenuEntryPanel(getNewContentMenuChildId(), new Link<Void>(ContentMenuEntryPanel.LINK_ID) {
        @Override
        public void onClick()
        {
          final AddressDO address = form.getData();
          final String filename = "ProjectForge-" + address.getFullName() + "_" + DateHelper.getDateAsFilenameSuffix(new Date()) + ".vcf";
          final StringWriter writer = new StringWriter();
          addressDao.exportVCard(new PrintWriter(writer), address);
          DownloadUtils.setUTF8CharacterEncoding(getResponse());
          DownloadUtils.setDownloadTarget(writer.toString().getBytes(), filename);
        };
View Full Code Here

  }

  @Override
  public AbstractSecuredBasePage afterSaveOrUpdate()
  {
    final AddressDO address = addressDao.getOrLoad(getData().getId());
    final PersonalAddressDO personalAddress = form.addressEditSupport.personalAddress;
    personalAddress.setAddress(address);
    personalAddressDao.setOwner(personalAddress, getUserId()); // Set current logged in user as owner.
    personalAddressDao.saveOrUpdate(personalAddress);
    return null;
View Full Code Here

    final PFAutoCompleteTextField<AddressDO> searchField = new PFAutoCompleteTextField<AddressDO>(InputPanel.WICKET_ID, new Model() {
      @Override
      public Serializable getObject()
      {
        // Pseudo object for storing search string (title field is used for this foreign purpose).
        return new AddressDO().setComment(searchFilter.getSearchString());
      }

      @Override
      public void setObject(final Serializable object)
      {
View Full Code Here

public class AddressDOConverter
{
  public static final String UID_PREFIX = "pf-address-";

  public static AddressDO convert(final LdapPerson person) {
    final AddressDO address = new AddressDO();
    address.setName(person.getSurname());
    address.setFirstName(person.getGivenName());
    final String uid = person.getUid();
    if (uid != null && uid.startsWith(UID_PREFIX) == true && uid.length() > UID_PREFIX.length()) {
      final String id = uid.substring(UID_PREFIX.length());
      address.setId(NumberHelper.parseInteger(id));
    }
    address.setOrganization(person.getOrganization());
    address.setComment(person.getDescription());
    //person.getMail();
    address.setBusinessPhone( person.getTelephoneNumber());
    address.setPrivatePhone( person.getHomePhoneNumber());
    //person.getMobilePhoneNumber();
    return address;
  }
View Full Code Here

TOP

Related Classes of org.projectforge.address.AddressDO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.