Package org.company.recordshop.domain

Examples of org.company.recordshop.domain.Record


    Assert.notNull(source, "argument [source] may not be null");
    Assert.isNull(source.getId(),
        "Can not translate a dto with existing id to a new domain object. Dto: "
            + source);
    Record target = new Record(source.getAsin(), source.getPrice(),
        typeTranslator.fromDto(source.getType())

    );
    return fromDto(source, target, translated);
View Full Code Here


    Assert.notNull(source, "argument [source] may not be null");
    Assert.isNull(source.getId(),
        "Can not translate a dto with existing id to a new domain object. Dto: "
            + source);
    Record target = new Record(source.getAsin(), source.getPrice(),
        typeTranslator.fromDto(source.getType())

    );
    return fromDto(source, target, translated);
View Full Code Here

    return new DateTime(2008, 11, 6, 0, 0, 0, 0);
  }

  @Before
  public void setUp() throws Exception {
    record1 = new Record("1234", 24.95F, RecordTypeEnum.BLUERAY);
    record2 = new Record("1234", 24.95F, RecordTypeEnum.BLUERAY);
    record3 = new Record("1234", 24.95F, RecordTypeEnum.BLUERAY);
    recordDao.add(record1);
    recordDao.add(record2);
    recordDao.add(record3);

    artist1 = new Artist("A1", "L1", date(), "A1");
View Full Code Here

    return new DateTime(2008, 11, 6, 0, 0, 0, 0);
  }

  @Test
  public void testRetrieve() {
    Record record = new Record("Abbey Road", 25.50F, RecordTypeEnum.BLUERAY);
    recordDao.add(record);
    flush();
    clear();

    Record saved = recordDao.retrieve(record.getId());
    assertEquals("Abbey Road", saved.getAsin());
  }
View Full Code Here

  @Test
  public void testAddContributors() {
    assertEquals(0, countRowsInTable("Record_TABLE"));
    assertEquals(0, countRowsInTable("Artist_TABLE"));
    assertEquals(0, countRowsInTable("records_contributors"));
    Record record = new Record("Abbey Road", 25.50F, RecordTypeEnum.BLUERAY);
    Artist john = new Artist("John", "Lennon", date(),
        "singer/guitarist/songwriter");
    Artist paul = new Artist("Paul", "McCartney", date(), "singer/bass/songwriter");
    artistDao.add(john);
    artistDao.add(paul);

    record.addToContributors(john);
    record.addToContributors(paul);
    recordDao.add(record);
    flush();
    clear();
    assertEquals(1, countRowsInTable("Record_TABLE"));
    assertEquals(2, countRowsInTable("Artist_TABLE"));
    assertEquals(2, countRowsInTable("records_contributors"));

    Record saved = recordDao.retrieve(record.getId());
    assertEquals("Abbey Road", saved.getAsin());
    assertEquals(2, countRowsInTable("records_contributors"));
    assertEquals(2, saved.getContributors().size());
    for (Artist artist : saved.getContributors()) {
      if ("John".equals(artist.getFirstName())) {
        john = artist;
      } else if ("Paul".equals(artist.getFirstName())) {
        paul = artist;
      }
    }
    saved.removeFromContributors(john);
    flush();
    clear();

    saved = recordDao.retrieve(record.getId());
    assertEquals("Abbey Road", saved.getAsin());
    assertEquals(1, saved.getContributors().size());
    assertEquals(1, countRowsInTable("records_contributors"));
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public FullRecordDto readRecordAsFullRecordDto(Long id) {
    Record result = recordsDomainService.readRecord(id);
    return (result == null) ? null : fullRecordDtoTranslator.toDto(result);
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void updateRecord(FullRecordDto object) {
    Record domainObject = recordsDomainService.readRecord(object.getId());
    fullRecordDtoTranslator.fromDto(object, domainObject);
    recordsDomainService.updateRecord(domainObject);
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void deleteRecord(FullRecordDto object) {
    Assert.notNull(object, "argument [object] may not be null");
    Record existing = recordsDomainService.readRecord(object.getId());
    recordsDomainService.deleteRecord(existing);
  }
View Full Code Here

TOP

Related Classes of org.company.recordshop.domain.Record

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.