Package org.company.recordshop.domain

Examples of org.company.recordshop.domain.Relation


  /**
   * {@inheritDoc}
   */
  public RelationDto readRelationAsRelationDto(Long id) {
    Relation result = customerServiceModelDomainService.readRelation(id);
    return (result == null) ? null : relationDtoTranslator.toDto(result);
  }
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public void updateRelation(RelationDto object) {
    Relation domainObject = customerServiceModelDomainService
        .readRelation(object.getId());
    relationDtoTranslator.fromDto(object, domainObject);
    customerServiceModelDomainService.updateRelation(domainObject);
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void deleteRelation(RelationDto object) {
    Assert.notNull(object, "argument [object] may not be null");
    Relation existing = customerServiceModelDomainService
        .readRelation(object.getId());
    customerServiceModelDomainService.deleteRelation(existing);
  }
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);
    Relation target = new Relation(source.getName()

    );
    return fromDto(source, target, translated);

  }
View Full Code Here

      } else {

        /* An existing object to be updated */
        if (target.getFromRelationsFrom(element.getId()) == null) {
          // Element is not in target yet, read it from the store and add to target
          Relation original = relationDao.retrieve(element.getId());
          Relation updated = relationDtoTranslator.fromDto(element,
              original, translated);
          target.addToRelationsFrom(updated);
        } else {
          // Element is in target already, use this object. No need to add to the collection
          relationDtoTranslator.fromDto(element, target
              .getFromRelationsFrom(element.getId()), translated);
        }
      }
    }

    /*
     * Synchronize RelationsTo association.
     */
    Set<Relation> relationsToToBeRemoved = new HashSet<Relation>();
    /* Avoid changing the collection underneath an active iterator. */
    for (Relation element : target.getRelationsTo()) {
      if (source.getFromRelationsTo(element.getId()) == null) {
        relationsToToBeRemoved.add(element);
      }
    }
    /* Objects to be removed */
    for (Relation element : relationsToToBeRemoved) {
      target.removeFromRelationsTo(element);
    }
    for (RelationDto element : source.getRelationsTo()) {
      if (element.getId() == null) {
        /* A new object to be added */
        target.addToRelationsTo(relationDtoTranslator.fromDto(element,
            translated));
      } else {

        /* An existing object to be updated */
        if (target.getFromRelationsTo(element.getId()) == null) {
          // Element is not in target yet, read it from the store and add to target
          Relation original = relationDao.retrieve(element.getId());
          Relation updated = relationDtoTranslator.fromDto(element,
              original, translated);
          target.addToRelationsTo(updated);
        } else {
          // Element is in target already, use this object. No need to add to the collection
          relationDtoTranslator.fromDto(element, target
View Full Code Here

      } else {

        /* An existing object to be updated */
        if (target.getFromRelationsFrom(element.getId()) == null) {
          // Element is not in target yet, read it from the store and add to target
          Relation original = relationDao.retrieve(element.getId());
          Relation updated = relationDtoTranslator.fromDto(element,
              original, translated);
          target.addToRelationsFrom(updated);
        } else {
          // Element is in target already, use this object. No need to add to the collection
          relationDtoTranslator.fromDto(element, target
              .getFromRelationsFrom(element.getId()), translated);
        }
      }
    }

    /*
     * Synchronize RelationsTo association.
     */
    Set<Relation> relationsToToBeRemoved = new HashSet<Relation>();
    /* Avoid changing the collection underneath an active iterator. */
    for (Relation element : target.getRelationsTo()) {
      if (source.getFromRelationsTo(element.getId()) == null) {
        relationsToToBeRemoved.add(element);
      }
    }
    /* Objects to be removed */
    for (Relation element : relationsToToBeRemoved) {
      target.removeFromRelationsTo(element);
    }
    for (RelationDto element : source.getRelationsTo()) {
      if (element.getId() == null) {
        /* A new object to be added */
        target.addToRelationsTo(relationDtoTranslator.fromDto(element,
            translated));
      } else {

        /* An existing object to be updated */
        if (target.getFromRelationsTo(element.getId()) == null) {
          // Element is not in target yet, read it from the store and add to target
          Relation original = relationDao.retrieve(element.getId());
          Relation updated = relationDtoTranslator.fromDto(element,
              original, translated);
          target.addToRelationsTo(updated);
        } else {
          // Element is in target already, use this object. No need to add to the collection
          relationDtoTranslator.fromDto(element, target
View Full Code Here

TOP

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

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.