mirror of
https://github.com/google/nomulus.git
synced 2025-05-01 12:37:52 +02:00
We're going to need to switch away from Guava's Functions and Predicates for everything and replace them with the java.util versions. Unfortunately there does not appear to be an automated tool to do this all at once. Refaster got close but doesn't seem to care about these particular types of mismatch (I suspect we're using a different version of the JDK than the outside world; ours is OK with Guava classes). This also bumps up Guava to 0.23, which is needed for some new functionality used in combination with Java 8 features. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=170531539
52 lines
2.2 KiB
Java
52 lines
2.2 KiB
Java
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package google.registry.export;
|
|
|
|
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
|
|
import static google.registry.model.EntityClasses.CLASS_TO_KIND_FUNCTION;
|
|
import static google.registry.util.TypeUtils.hasAnnotation;
|
|
|
|
import com.google.common.collect.ImmutableSet;
|
|
import com.google.common.collect.Ordering;
|
|
import google.registry.model.EntityClasses;
|
|
import google.registry.model.annotations.NotBackedUp;
|
|
import google.registry.model.annotations.ReportedOn;
|
|
import google.registry.model.annotations.VirtualEntity;
|
|
|
|
/** Constants related to export code. */
|
|
public final class ExportConstants {
|
|
|
|
/** Returns the names of kinds to include in Datastore backups. */
|
|
public static ImmutableSet<String> getBackupKinds() {
|
|
// Back up all entity classes that aren't annotated with @VirtualEntity (never even persisted
|
|
// to Datastore, so they can't be backed up) or @NotBackedUp (intentionally omitted).
|
|
return EntityClasses.ALL_CLASSES
|
|
.stream()
|
|
.filter(hasAnnotation(VirtualEntity.class).negate())
|
|
.filter(hasAnnotation(NotBackedUp.class).negate())
|
|
.map(CLASS_TO_KIND_FUNCTION)
|
|
.collect(toImmutableSortedSet(Ordering.natural()));
|
|
}
|
|
|
|
/** Returns the names of kinds to import into reporting tools (e.g. BigQuery). */
|
|
public static ImmutableSet<String> getReportingKinds() {
|
|
return EntityClasses.ALL_CLASSES
|
|
.stream()
|
|
.filter(hasAnnotation(ReportedOn.class))
|
|
.filter(hasAnnotation(VirtualEntity.class).negate())
|
|
.map(CLASS_TO_KIND_FUNCTION)
|
|
.collect(toImmutableSortedSet(Ordering.natural()));
|
|
}
|
|
}
|