Package com.casamind.adware.server.domain

Examples of com.casamind.adware.server.domain.Publisher


        log.info("Created new slot for company:" + company.getLastname());
        log.info(entity.toString());
      } else {
        log.warning("Did not find a company with attendee: " + attendee);
        log.info("Trying to a find a publisher with attendee: " + attendee);
        Publisher publisher = DatastoreProxy.getPublisherByLogin(attendee);
        if (publisher != null) {
          log.info("Found publisher with attendee: " + publisher.getFirstname() + " " + publisher.getLastname());
          Slot slot = new Slot();
          slot.setOwnerId(publisher.getId());
          log.info("DTSTART :" + startDate);
          Date parsedStartDate = icalFormatter.parse(startDate);
          log.info("Parsed start date :" + logFormatter.format(parsedStartDate));
          log.info("DTEND :" + endDate);
          Date parsedEndDate = icalFormatter.parse(endDate);
          log.info("Parsed end date :" + logFormatter.format(parsedEndDate));
          slot.setStartDate(parsedStartDate);
          slot.setEndDate(parsedEndDate);
          slot.setStatus(SlotStatus.Ordered);
          long slotInterval = parsedEndDate.getTime() - parsedStartDate.getTime();
          log.info("Interval in miliseconds: " + slotInterval);
          long slotDurationInMilisecondes = (long) duration * 60 * 1000;
          log.info("Default slot duration in miliseconds: " + slotDurationInMilisecondes);
          long nbSlots = slotInterval / slotDurationInMilisecondes;
          log.info("Number of slots (Long): " + nbSlots);
          slot.setNbSlots((int) nbSlots);
          slot.setPrice(price);
          Slot entity = DatastoreProxy.createSlot(slot);
          log.info("Created new slot for publisher:" + publisher.getFirstname() + " " + publisher.getLastname());
          log.info(entity.toString());
        } else {
          log.warning("Could not find publisher: " + attendee);
        }
        response.getWriter().println(logFormatter.format(new Date()) + " : Finshed! See the server logs for debug.");
View Full Code Here


        log.info("Adding ACL.\n\tuser: " + login + ".\n\trole: " + role);
        proxy.addAclRole(entry, email, role);
        log.info("Rol added successfully!");
      }
      try {
        Publisher publisher = (Publisher) owner;
        log.info("Owner is a publisher. Adding company ACL entries...");
        Company company = DatastoreProxy.getCompanyById(publisher.getCompanyId());
        String cLogin = company.getLogin();
        if (cLogin != null && !"".equals(cLogin)) {
          log.info("Adding ACL.\n\tuser: " + cLogin + ".\n\trole: " + role);
          proxy.addAclRole(entry, cLogin, role);
          log.info("Rol added successfully!");
View Full Code Here

    return Publisher.toDTO((DatastoreProxy.updatePublisher(dto)));
  }

  @Override
  public PublisherDTO createPublisher(PublisherDTO dto) {
    Publisher entity = Publisher.toEntity(null, dto);
    entity.setGdataLogin(gdataWebLogin);
    entity.setGdataPassword(gdataWebPassword);
    PublisherDTO returnedDTO = Publisher.toDTO((DatastoreProxy.createPublisher(entity)));
    QueueFactory.getQueue("gdata").add(TaskOptions.Builder.withUrl("/tasks/gdata/reports").param("task", GoogleDocumentsTaskTypes.CREATE).param("title", returnedDTO.getUUID()).param("folder", ReportTypes.PUBLISHER));
    return returnedDTO;
  }
View Full Code Here

  public List<EntitySummary> getEntitySummaries(UserAccountDTO user) {
    List<EntitySummary> list = new ArrayList<EntitySummary>();
    int accessLevel = user.getAccessLevel();
    String login = user.getLogin();
    if (accessLevel == AccessLevels.Publisher) {
      Publisher publisher = DatastoreProxy.getPublisherByLogin(login);
      if (publisher != null) {
        for (Product entity : DatastoreProxy.getProductsByPublisherId(publisher.getId())) {
          list.add(Product.toSummaryDTO(entity));
        }
      }
    } else if (accessLevel == AccessLevels.Company) {
      Company company = DatastoreProxy.getCompanyByLogin(login);
View Full Code Here

    return Company.toSummaryDTO(DatastoreProxy.getCompanyByLogin(login));
  }

  @Override
  public CompanySummaryDTO getCompanySummaryByPublisherId(Long id) {
    Publisher publisher = DatastoreProxy.getPublisherById(id);
    return publisher != null ? Company.toSummaryDTO(DatastoreProxy.getCompanyById(publisher.getCompanyId())) : null;
  }
View Full Code Here

  }

  @Override
  public List<ProductSummaryDTO> getProductSummariesBySlotOwnerId(Long id) {
    List<ProductSummaryDTO> list = new ArrayList<ProductSummaryDTO>();
    Publisher publisher = DatastoreProxy.getPublisherById(id);
    if (publisher != null) {
      // get products by publisher
      for (Product entity : DatastoreProxy.getProductsByPublisherId(id)) {
        list.add(Product.toSummaryDTO(entity));
      }
View Full Code Here

      company.setReceiveNewsLetter(false);
      company.setReceiveNotifications(false);
      company.setLastLoginOn(calendar.getTime());
      companyDAO.put(company);
      for (int j = 0; j < 2; j++) {
        Publisher publisher = new Publisher();
        publisher.setAccessLevel(AccessLevels.Publisher);
        publisher.setLogin("publisher" + j + "@company" + i + ".com");
        publisher.setService(AuthTypes.GOOGLE);
        publisher.setUniqueId(publisher.getLogin() + "-" + publisher.getService());
        publisher.setFirstname("Publisher");
        publisher.setLastname(j + "-" + i);
        publisher.setPhone("+212522" + (100000 + rand.nextInt(999999)));
        publisher.setEmail("publisher" + j + "@company" + i + ".com");
        ArrayList<Long> products = new ArrayList<Long>();
        ArrayList<Long> slots = new ArrayList<Long>();
        publisherDAO.put(publisher);
        publisher.setCompanyId(company.getId());
        for (int k = 0; k < 5; k++) {
          Product product = new Product();
          product.setName("Product" + k + "-" + j + "-" + i);
          product.setSlogan("Slogan");
          product.setText("Text");
          product.setLink("Link");
          productDAO.put(product);
          product.setPublisherId(publisher.getId());
          products.add(product.getId());
          for (int n = 0; n < 10; n++) {
            Resource resource = new Resource();
            resource.setFilename("resource" + n + ".jpeg");
            resource.setImageURL("https://lh3.googleusercontent.com/-hQtlZHxpmA0/SMv3w4UUqcI/AAAAAAAACAQ/nPEx0-f9L6Y/s912/DSC02207.JPG");
            resource.setUUID((UUID.randomUUID().toString()));
            resource.setProductId(product.getId());
            resourceDAO.put(resource);
          }
          productDAO.put(product);
        }
        for (int n = 0; n < 5; n++) {
          start = calendar.getTime();
          calendar.add(Calendar.HOUR, 12);
          end = calendar.getTime();
          Slot slot = new Slot(1, 10, start, end, publisher.getId());
          for (int p = 0; p < slot.getNbSlots(); p++) {
            slot.getProductIds().add(products.get(rand.nextInt(products.size())));
          }
          slot.setStatus(rand.nextInt(1));
          slotDAO.put(slot);
          slot.setOwnerId(publisher.getId());
          slots.add(slot.getId());
        }
        publisherDAO.put(publisher);
      }
      companyDAO.put(company);
View Full Code Here

      String email = owner.getEmail();
      if (Strings.isValidEmailAddress(email) && !email.equals(login)) {
        cc.put(email, name);
      }
      try {
        Publisher publisher = (Publisher) owner;
        log.info("Owner is a publisher. Adding company to CC recipients...");
        Company company = DatastoreProxy.getCompanyById(publisher.getCompanyId());
        String companyName = company.getDisplayName();
        String companyLogin = company.getLogin();
        if (Strings.isValidEmailAddress(companyLogin)) {
          cc.put(companyLogin, companyName);
          String companyEmail = company.getEmail();
View Full Code Here

    String billingAddress = "";
    try {
      Company company = (Company) owner;
      billingAddress = company.getBillingAddress();
    } catch (ClassCastException e) {
      Publisher publisher = (Publisher) owner;
      Company company = DatastoreProxy.getCompanyById(publisher.getCompanyId());
      if (company != null) {
        billingAddress = company.getBillingAddress();
      } else {
        log.warning("Could not find company with id: " + publisher.getCompanyId() + "\nBilling address is void.");
      }
    }
    return billingAddress;
  }
View Full Code Here

  public static Ad getAdById(Long id) {
    return new ObjectifyGenericDAO<Ad>(Ad.class).getByProperty("id", id);
  }

  public static Publisher updatePublisher(PublisherDTO dto) {
    Publisher entity = Publisher.toEntity(getPublisherById(dto.getId()), dto);
    if (entity != null)
      new ObjectifyGenericDAO<Publisher>(Publisher.class).put(entity);
    return entity;
  }
View Full Code Here

TOP

Related Classes of com.casamind.adware.server.domain.Publisher

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.