@Override protected void doPostDbLoading(SubEquipment subEquipment){
  Equipment parent=equipmentCache.get(subEquipment.getParentId());
  Long processId=parent.getProcessId();
  if (processId == null) {
    throw new NullPointerException(String.format("Equipment %s (%d) has no associated Process id - this should never happen!",parent.getName(),parent.getId()));
  }
  Long aliveTagId=subEquipment.getAliveTagId();
  if (aliveTagId != null) {
    ControlTag aliveTagCopy=controlCache.getCopy(aliveTagId);
    if (aliveTagCopy != null) {
      setSubEquipmentId((ControlTagCacheObject)aliveTagCopy,subEquipment.getId(),processId);
    }
 else {
      throw new ConfigurationException(ConfigurationException.INVALID_PARAMETER_VALUE,String.format("No Alive tag (#%d) found for Sub-Equipment %s (#%d).",aliveTagId,subEquipment.getName(),subEquipment.getId()));
    }
  }
  Long commFaultTagId=subEquipment.getCommFaultTagId();
  if (commFaultTagId != null) {
    ControlTag commFaultTagCopy=controlCache.getCopy(commFaultTagId);
    if (commFaultTagCopy != null) {
      setSubEquipmentId((ControlTagCacheObject)commFaultTagCopy,subEquipment.getId(),processId);
    }
 else {
      throw new ConfigurationException(ConfigurationException.INVALID_PARAMETER_VALUE,String.format("No CommFault tag (%s) found for sub-equipment #%d (%s).",commFaultTagId,subEquipment.getId(),subEquipment.getName()));
    }
  }
 else {
    throw new ConfigurationException(ConfigurationException.INVALID_PARAMETER_VALUE,String.format("No CommFault tag for Sub-Equipment %s (#%d) defined.",subEquipment.getName(),subEquipment.getId()));
  }
  Long statusTagId=subEquipment.getStateTagId();
  if (statusTagId != null) {
    ControlTag statusTagCopy=controlCache.getCopy(statusTagId);
    if (statusTagCopy != null) {
      setSubEquipmentId((ControlTagCacheObject)statusTagCopy,subEquipment.getId(),processId);
    }
 else {
      throw new ConfigurationException(ConfigurationException.INVALID_PARAMETER_VALUE,String.format("No Status tag (%s) found for Sub-Equipment %s (#%d).",statusTagId,subEquipment.getName(),subEquipment.getId()));
    }
  }
 else {
    throw new ConfigurationException(ConfigurationException.INVALID_PARAMETER_VALUE,String.format("No Status tag for Sub-Equipment %s (#%d) defined.",subEquipment.getName(),subEquipment.getId()));
  }
}

@ Override protected void doPostDbLoading ( SubEquipment subEquipment ) { Equipment parent = equipmentCache . get ( subEquipment . getParentId ( ) ) ; Long processId = parent . getProcessId ( ) ; if ( processId == null ) { throw new NullPointerException ( String . format ( "Equipment %s (%d) has no associated Process id - this should never happen!" , parent . getName ( ) , parent . getId ( ) ) ) ; } Long aliveTagId = subEquipment . getAliveTagId ( ) ; if ( aliveTagId != null ) { ControlTag aliveTagCopy = controlCache . getCopy ( aliveTagId ) ; if ( aliveTagCopy != null ) { setSubEquipmentId ( ( ControlTagCacheObject ) aliveTagCopy , subEquipment . getId ( ) , processId ) ; } else { throw new ConfigurationException ( ConfigurationException . INVALID_PARAMETER_VALUE , String . format ( "No Alive tag (#%d) found for Sub-Equipment %s (#%d)." , aliveTagId , subEquipment . getName ( ) , subEquipment . getId ( ) ) ) ; } } Long commFaultTagId = subEquipment . getCommFaultTagId ( ) ; if ( commFaultTagId != null ) { ControlTag commFaultTagCopy = controlCache . getCopy ( commFaultTagId ) ; if ( commFaultTagCopy != null ) { setSubEquipmentId ( ( ControlTagCacheObject ) commFaultTagCopy , subEquipment . getId ( ) , processId ) ; } else { throw new ConfigurationException ( ConfigurationException . INVALID_PARAMETER_VALUE , String . format ( "No CommFault tag (%s) found for sub-equipment #%d (%s)." , commFaultTagId , subEquipment . getId ( ) , subEquipment . getName ( ) ) ) ; } } else { throw new ConfigurationException ( ConfigurationException . INVALID_PARAMETER_VALUE , String . format ( "No CommFault tag for Sub-Equipment %s (#%d) defined." , subEquipment . getName ( ) , subEquipment . getId ( ) ) ) ; } Long statusTagId = subEquipment . getStateTagId ( ) ; if ( statusTagId != null ) { ControlTag statusTagCopy = controlCache . getCopy ( statusTagId ) ; if ( statusTagCopy != null ) { setSubEquipmentId ( ( ControlTagCacheObject ) statusTagCopy , subEquipment . getId ( ) , processId ) ; } else { throw new ConfigurationException ( ConfigurationException . INVALID_PARAMETER_VALUE , String . format ( "No Status tag (%s) found for Sub-Equipment %s (#%d)." , statusTagId , subEquipment . getName ( ) , subEquipment . getId ( ) ) ) ; } } else { throw new ConfigurationException ( ConfigurationException . INVALID_PARAMETER_VALUE , String . format ( "No Status tag for Sub-Equipment %s (#%d) defined." , subEquipment . getName ( ) , subEquipment . getId ( ) ) ) ; } }
ensures that the alive - , status - and commfault tags have appropriately the sub - equipment id set .
