コード例 #1
0
  public static ims.core.configuration.domain.objects.DrawingGraphicGroup
      extractDrawingGraphicGroup(
          ims.domain.ILightweightDomainFactory domainFactory,
          ims.core.vo.GraphicGroupVo valueObject,
          HashMap domMap) {
    if (null == valueObject) {
      return null;
    }
    Integer id = valueObject.getID_DrawingGraphicGroup();
    ims.core.configuration.domain.objects.DrawingGraphicGroup domainObject = null;
    if (null == id) {
      if (domMap.get(valueObject) != null) {
        return (ims.core.configuration.domain.objects.DrawingGraphicGroup) domMap.get(valueObject);
      }
      // ims.core.vo.GraphicGroupVo ID_DrawingGraphicGroup field is unknown
      domainObject = new ims.core.configuration.domain.objects.DrawingGraphicGroup();
      domMap.put(valueObject, domainObject);
    } else {
      String key =
          (valueObject.getClass().getName() + "__" + valueObject.getID_DrawingGraphicGroup());
      if (domMap.get(key) != null) {
        return (ims.core.configuration.domain.objects.DrawingGraphicGroup) domMap.get(key);
      }
      domainObject =
          (ims.core.configuration.domain.objects.DrawingGraphicGroup)
              domainFactory.getDomainObject(
                  ims.core.configuration.domain.objects.DrawingGraphicGroup.class, id);

      // TODO: Not sure how this should be handled. Effectively it must be a staleobject exception,
      // but maybe should be handled as that further up.
      if (domainObject == null) return null;

      domMap.put(key, domainObject);
    }
    domainObject.setVersion(valueObject.getVersion_DrawingGraphicGroup());

    domainObject.setGroupID(valueObject.getGroupID());
    // This is to overcome a bug in both Sybase and Oracle which prevents them from storing an empty
    // string correctly
    // Sybase stores it as a single space, Oracle stores it as NULL. This fix will make them
    // consistent at least.
    if (valueObject.getGroupName() != null && valueObject.getGroupName().equals("")) {
      valueObject.setGroupName(null);
    }
    domainObject.setGroupName(valueObject.getGroupName());
    domainObject.setAreaCollection(
        ims.core.vo.domain.GraphicAreaVoAssembler.extractDrawingGraphicAreaSet(
            domainFactory,
            valueObject.getAreaCollection(),
            domainObject.getAreaCollection(),
            domMap));
    domainObject.setChildGroups(
        ims.core.vo.domain.GraphicGroupVoAssembler.extractDrawingGraphicGroupSet(
            domainFactory, valueObject.getChildGroups(), domainObject.getChildGroups(), domMap));

    return domainObject;
  }
コード例 #2
0
 /**
  * Copy one ValueObject to another
  *
  * @param valueObjectDest to be updated
  * @param valueObjectSrc to copy values from
  */
 public static ims.core.vo.GraphicGroupVo copy(
     ims.core.vo.GraphicGroupVo valueObjectDest, ims.core.vo.GraphicGroupVo valueObjectSrc) {
   if (null == valueObjectSrc) {
     return valueObjectSrc;
   }
   valueObjectDest.setID_DrawingGraphicGroup(valueObjectSrc.getID_DrawingGraphicGroup());
   valueObjectDest.setIsRIE(valueObjectSrc.getIsRIE());
   // groupID
   valueObjectDest.setGroupID(valueObjectSrc.getGroupID());
   // groupName
   valueObjectDest.setGroupName(valueObjectSrc.getGroupName());
   // areaCollection
   valueObjectDest.setAreaCollection(valueObjectSrc.getAreaCollection());
   // childGroups
   valueObjectDest.setChildGroups(valueObjectSrc.getChildGroups());
   return valueObjectDest;
 }
コード例 #3
0
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.core.configuration.domain.objects.DrawingGraphicGroup
   */
  public static ims.core.vo.GraphicGroupVo insert(
      DomainObjectMap map,
      ims.core.vo.GraphicGroupVo valueObject,
      ims.core.configuration.domain.objects.DrawingGraphicGroup domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_DrawingGraphicGroup(domainObject.getId());
    valueObject.setIsRIE(domainObject.getIsRIE());

    // If this is a recordedInError record, and the domainObject
    // value isIncludeRecord has not been set, then we return null and
    // not the value object
    if (valueObject.getIsRIE() != null
        && valueObject.getIsRIE().booleanValue() == true
        && !domainObject.isIncludeRecord()) return null;

    // If this is not a recordedInError record, and the domainObject
    // value isIncludeRecord has been set, then we return null and
    // not the value object
    if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false)
        && domainObject.isIncludeRecord()) return null;

    // groupID
    valueObject.setGroupID(domainObject.getGroupID());
    // groupName
    valueObject.setGroupName(domainObject.getGroupName());
    // areaCollection
    valueObject.setAreaCollection(
        ims.core.vo.domain.GraphicAreaVoAssembler
            .createGraphicAreaVoCollectionFromDrawingGraphicArea(
                map, domainObject.getAreaCollection()));
    // childGroups
    valueObject.setChildGroups(
        ims.core.vo.domain.GraphicGroupVoAssembler
            .createGraphicGroupVoCollectionFromDrawingGraphicGroup(
                map, domainObject.getChildGroups()));
    return valueObject;
  }