コード例 #1
0
 /**
  * Deletes the given ITD, either now or later.
  *
  * @param metadataId the ITD's metadata ID
  * @param itdFilename the ITD's filename
  * @param reason the reason for deletion; ignored if now is <code>false</code>
  * @param now whether to delete the ITD immediately; <code>false</code> schedules it for later
  *     deletion; this is preferable when it's possible that the ITD might need to be re-created in
  *     the meantime (e.g. because some ancestor metadata has changed to that effect), otherwise
  *     there will be spurious console messages about the ITD being deleted and created
  */
 private void deleteItd(
     final String metadataId, final String itdFilename, final String reason, final boolean now) {
   if (now) {
     fileManager.delete(itdFilename, reason);
   } else {
     fileManager.createOrUpdateTextFileIfRequired(itdFilename, "", false);
   }
   itdDiscoveryService.removeItdTypeDetails(metadataId);
   // TODO do we need to notify downstream dependencies that this ITD has gone away?
 }
コード例 #2
0
  /**
   * Deletes the given {@link JavaType} for the given reason
   *
   * @param javaType the type to be deleted (required)
   * @param reason the reason for deletion (can be blank)
   */
  private void deleteJavaType(final JavaType javaType, final String reason) {
    final PhysicalTypeMetadata governorPhysicalTypeMetadata = getPhysicalTypeMetadata(javaType);
    if (governorPhysicalTypeMetadata != null) {
      final String filePath = governorPhysicalTypeMetadata.getPhysicalLocationCanonicalPath();
      if (fileManager.exists(filePath)) {
        fileManager.delete(filePath, reason);
        shell.flash(
            Level.FINE,
            "Deleted " + javaType.getFullyQualifiedTypeName(),
            DbreDatabaseListenerImpl.class.getName());
      }

      shell.flash(Level.FINE, "", DbreDatabaseListenerImpl.class.getName());
    }
  }