Package es.udc.tfg.journals.model.journal

Examples of es.udc.tfg.journals.model.journal.Journal


  }

  @Test
  public void testEditJournal() throws DuplicateInstanceException,
      InstanceNotFoundException {
    Journal journal = new Journal("experimental research", "exp res",
        "http://www.blackwellpublishing.com/journal.asp?ref=0145-6008",
        0, 0);
    Journal journal1 = journalService.createJournal(journal);

    Journal newJournal = new Journal("experimental", "exp",
        "http://www.blackwellpublishing.com/", 0, 0);
    journalService.editJournal(journal1.getJournalId(), newJournal);

    Journal journal2 = journalService.findJournal(journal1.getJournalId());

    assertEquals(newJournal.getName(), journal2.getName());
    assertEquals(newJournal.getAcronym(), journal2.getAcronym());
    assertEquals(newJournal.getUrl(), journal2.getUrl());
  }
View Full Code Here


  }

  @Test(expected = DuplicateInstanceException.class)
  public void testEditExistingJournal() throws DuplicateInstanceException,
      InstanceNotFoundException {
    journalService.createJournal(new Journal("experimental research",
        "exp res",
        "http://www.blackwellpublishing.com/journal.asp?ref=0145-6008",
        0, 0));

    Journal journal2 = journalService.createJournal(new Journal(
        "experimental research 2", "exp res",
        "http://www.blackwellpublishing.com/journal.asp?ref=0145-6008",
        0, 0));

    journalService
        .editJournal(
            journal2.getJournalId(),
            new Journal(
                "experimental research",
                "exp res *2",
                "http://www.blackwellpublishing.com/journal.asp?ref=0145-6008___2",
                0, 0));
  }
View Full Code Here

  }

  @Test
  public void testFindJournalsByName() throws DuplicateInstanceException,
      InstanceNotFoundException {
    Journal j1 = journalService.createJournal(new Journal(
        "experimental research", "exp res abc",
        "http://www.blackwellpublishing.com/journal.asp?ref=0145-6008",
        0, 0));
    journalService.createJournal(new Journal("arid zone research", null,
        "http://www.ceps.com.tw/ec/ecjnlintro.aspx?jnliid=1968", 0, 0));
    journalService.createJournal(new Journal(
        "critical reviews in food science and nutrition abc",
        "crit rev food sci nutr", null, 0, 0));

    List<JournalRatingDto> journals = journalService
        .findJournalsByNameOrAcronym("experimenTAL", "", "", 0, 10);
    assertEquals(1, journals.size());
    assertEquals(j1.getJournalId(), journals.get(0).getJournalId());
    assertEquals(null, journals.get(0).getRating());

    journals = journalService.findJournalsByNameOrAcronym(null, "", "", 0,
        10);
    assertEquals(3, journals.size());

    journals = journalService.findJournalsByNameOrAcronym("reSEarch", "",
        "", 0, 10);
    assertEquals(2, journals.size());

    journals = journalService.findJournalsByNameOrAcronym("aBc", "", "", 0,
        10);
    assertEquals(2, journals.size());

    journals = journalService.findJournalsByNameOrAcronym("e", "", "", 0,
        10);
    assertEquals(3, journals.size());

    journals = journalService
        .findJournalsByNameOrAcronym("", "", "", 0, 10);
    assertEquals(3, journals.size());
    long count = journalService.countFoundJournalsByNameOrAcronym("");
    assertEquals(3, count);
    count = journalService.countFoundJournalsByNameOrAcronym(null);
    assertEquals(3, count);

    Journal j2 = journalService.findJournalByName("experimentAL REsearch");
    assertEquals(j1, j2);

  }
View Full Code Here

        "name3", "lastName", "user3@udc.es", "user3"));
    userService.registerUser("userPassword", new UserDetails("name4",
        "lastName", "user4@udc.es", "user4"));

    // Query
    journal1 = journalService.createJournal(new Journal(
        "siam journal on applied mathematics", "j1", "", 0, 0));

    keywordService.createListOfKeywords(
        new String[] { "mathematical model", "computer science",
            "integral equation" }, user1.getUserId(),
        journal1.getJournalId(), 1);

    // Journal 2 (without keywords)
    journal2 = journalService.createJournal(new Journal(
        "european journal of information systems", "j2", "", 0, 0));

    // Journal 3 (without commun keywords)
    journal3 = journalService
        .createJournal(new Journal(
            "international journal of information quality", "j3",
            "", 0, 0));
    keywordService.createListOfKeywords(new String[] { "case study",
        "numerical solution" }, user1.getUserId(),
        journal3.getJournalId(), 1);

    // Journal 4
    journal4 = journalService.createJournal(new Journal(
        "computer music journal", "j4", "", 0, 0));
    keywordService.createListOfKeywords(new String[] { "computer science",
        "mathematical model", "numerical solution",
        "machine learning & pattern recognition" }, user3.getUserId(),
        journal4.getJournalId(), 1);
    keywordService.createListOfKeywords(new String[] { "computer science",
        "mathematical model", "system development",
        "distributed system" }, user2.getUserId(),
        journal4.getJournalId(), 1);

    // ****************** Reviews ******************

    reviewService.createReviewType("global");
    List<ReviewRatingDto> rrDtos = new ArrayList<ReviewRatingDto>();
    rrDtos.add(new ReviewRatingDto("global", 5));

    // User 1
    reviewService.createReview("", user1.getUserId(),
        journal1.getJournalId(), rrDtos);
    reviewService.createReview("", user1.getUserId(),
        journal3.getJournalId(), rrDtos);

    // User 2
    reviewService.createReview("", user2.getUserId(),
        journal1.getJournalId(), rrDtos);
    reviewService.createReview("", user2.getUserId(),
        journal3.getJournalId(), rrDtos);
    reviewService.createReview("", user2.getUserId(),
        journal4.getJournalId(), rrDtos);

    // User 3
    // TODO: User3 da 2 punto a la revista 1, que tiene 5 puntos de User1,
    // pero obtienen similitud 1 igual ¿?¿
    rrDtos.clear();
    rrDtos.add(new ReviewRatingDto("global", 2));
    reviewService.createReview("", user3.getUserId(),
        journal1.getJournalId(), rrDtos);
    reviewService.createReview("", user3.getUserId(),
        journal3.getJournalId(), rrDtos);

    // Revista null
    Journal jnull = new Journal("", null, null, null, null);
    journalService.createJournal(jnull);
    keywordService.createKeywordWeightJournal(new KeywordWeightJournal(
        new KeywordWeight(1, user1, new Keyword("aditional keyword")),
        jnull));
  }
View Full Code Here

  public void createListOfKeywords(String[] keys, long userId,
      long journalId, int weight) throws InstanceNotFoundException,
      DuplicateInstanceException {
    User user = userDao.find(userId);
    Journal journal = journalDao.find(journalId);
    createListOfKeywords(keys, user, journal, weight);
  }
View Full Code Here

    try {
      this.startIndex = Integer.parseInt(startIndex);
    } catch (NumberFormatException e) {
      this.startIndex = 0;
    }
    Journal journal = null;
    try {
      journal = journalService.findJournal(journalId);
    } catch (InstanceNotFoundException e) {
      notFound.setInstanceId(journalId.toString());
      return notFound;
    }
    this.journalId = journalId;
    this.name = WordUtils.capitalize(journal.getName());
    this.acronym = journal.getAcronym();
    this.url = journal.getUrl();
    this.publications = journal.getPublications() == null ? "" : journal
        .getPublications().toString();
    this.citations = journal.getCitations() == null ? "" : journal
        .getCitations().toString();

    this.keywords = keywordService.findKeywordsByJournal(journalId);
    keywordsCreated = false;
View Full Code Here

    }
  }

  public void editJournal(Long journalId, Journal editedJournal)
      throws DuplicateInstanceException, InstanceNotFoundException {
    Journal aux = null;
    try {
      aux = journalDao.findByName(editedJournal.getName());
    } catch (InstanceNotFoundException e) {
    }
    if (aux != null && journalId != aux.getJournalId()) {
      throw new DuplicateInstanceException(editedJournal.getName(),
          Journal.class.getName());
    }

    Journal journal = journalDao.find(journalId);
    journal.setName(editedJournal.getName());
    journal.setAcronym(editedJournal.getAcronym());
    journal.setUrl(editedJournal.getUrl());
    journal.setCitations(editedJournal.getCitations());
    journal.setPublications(editedJournal.getPublications());
  }
View Full Code Here

      // TODO: Mejorar encoding (&#39; &#47;)
      String line = StringEscapeUtils.unescapeHtml(br.readLine());

      while (line != null && !line.equals("")) {
        // Journal
        Journal j = createJournalByString(line);
        if (j == null) {
          line = br.readLine();
          continue;
        }
        createKeywordsByString(line, j, userId);
View Full Code Here

    int indexUrl = line.indexOf("URL=") + "URL=".length();
    int indexUrlEnd = line.indexOf(", keywords=");
    String url = line.substring(indexUrl, indexUrlEnd);
    url = url.equals("null") ? null : url;

    Journal j = new Journal(name, acronym, url, publications, citations);
    try {
      createJournal(j);
    } catch (DuplicateInstanceException e) {
      j = findJournalByName(j.getName());
    }
    return j;
  }
View Full Code Here

      return null;
    }

    if (journal == null) {
      try {
        Journal j = journalService.createJournal(new Journal(name,
            acronym, url, publications, citations));
        // Domains
        String[] keys;
        if (domains != null && domains != "") {
          keys = domains.split(",");
          keywordService.createListOfKeywords(keys,
              userSession.getUserId(), j.getJournalId(),
              Constants.DOMAIN_WEIGHT);
        }
        // Subdomains
        if (subdomains != null && subdomains != "") {
          keys = subdomains.split(",");
          keywordService.createListOfKeywords(keys,
              userSession.getUserId(), j.getJournalId(),
              Constants.SUBDOMAIN_WEIGHT);
        }
      } catch (DuplicateInstanceException e) {
        createJournalForm.recordError(nameField,
            messages.get("error-nameAlreadyExists"));
      } catch (InstanceNotFoundException e) {
        notFound.setInstanceId("");
        return notFound;
      }

    } else {
      Journal editedJournal = new Journal(name, acronym, url,
          publications, citations);
      try {
        journalService.editJournal(journal.getJournalId(),
            editedJournal);
      } catch (InstanceNotFoundException e) {
View Full Code Here

TOP

Related Classes of es.udc.tfg.journals.model.journal.Journal

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.