@Override public void deleteProfile(String versionId, String profileId, boolean force) { profileService.deleteProfile(fabricService, versionId, profileId, force); }
private static void maybeDeleteProfile(FabricService fabricService, String versionId, String targetId, boolean force) { ProfileService profileService = fabricService.adapt(ProfileService.class); if (force && profileService.hasProfile(versionId, targetId)) { profileService.deleteProfile(fabricService, versionId, targetId, force); } }
private static void maybeDeleteProfile(FabricService fabricService, String versionId, String targetId, boolean force) { ProfileService profileService = fabricService.adapt(ProfileService.class); if (force && profileService.hasProfile(versionId, targetId)) { profileService.deleteProfile(fabricService, versionId, targetId, force); } }
@DELETE public void deleteProfile() { FabricService fabricService = getFabricService(); Objects.notNull(fabricService, "fabricService"); ProfileService profileService = getProfileService(); Objects.notNull(profileService, "profileService"); profileService.deleteProfile(fabricService, profile.getVersion(), profile.getId(), true); }
@Override public void deleteProfile(String versionId, String profileId, boolean force) { Permit<ProfileService> permit = permitManager.get().aquirePermit(ProfileService.PERMIT, false); try { ProfileService service = permit.getInstance(); service.deleteProfile(versionId, profileId, force); } finally { permit.release(); } }
@DELETE public void deleteProfile() { FabricService fabricService = getFabricService(); Objects.notNull(fabricService, "fabricService"); ProfileService profileService = getProfileService(); Objects.notNull(profileService, "profileService"); profileService.deleteProfile(fabricService, profile.getVersion(), profile.getId(), true); }
@Override protected Object doExecute() throws Exception { // do not validate the name in case a profile was created somehow with invalid name ProfileService profileService = fabricService.adapt(ProfileService.class); Version version = versionId != null ? profileService.getRequiredVersion(versionId) : fabricService.getRequiredDefaultVersion(); boolean deleted = false; for (Profile profile : version.getProfiles()) { String versionId = profile.getVersion(); String profileId = profile.getId(); if (name.equals(profileId)) { profileService.deleteProfile(fabricService, versionId, profileId, force); deleted = true; } } if (!deleted) { System.out.println("Profile " + name + " not found."); } return null; }