Check service group parent type

This commit is contained in:
crschnick 2024-07-01 15:10:07 +00:00
parent 0329ee614c
commit 30d28b7a19
2 changed files with 18 additions and 3 deletions

View file

@ -1,5 +1,6 @@
package io.xpipe.ext.base.service;
import io.xpipe.app.util.Validators;
import io.xpipe.core.store.NetworkTunnelStore;
import com.fasterxml.jackson.annotation.JsonTypeName;
@ -14,4 +15,12 @@ import lombok.extern.jackson.Jacksonized;
@SuperBuilder
@Jacksonized
@JsonTypeName("customServiceGroup")
public class CustomServiceGroupStore extends AbstractServiceGroupStore<NetworkTunnelStore> {}
public class CustomServiceGroupStore extends AbstractServiceGroupStore<NetworkTunnelStore> {
@Override
public void checkComplete() throws Throwable {
super.checkComplete();
Validators.isType(getParent(), NetworkTunnelStore.class);
}
}

View file

@ -1,12 +1,12 @@
package io.xpipe.ext.base.service;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.xpipe.app.storage.DataStoreEntry;
import io.xpipe.app.storage.DataStoreEntryRef;
import io.xpipe.app.util.FixedHierarchyStore;
import io.xpipe.app.util.Validators;
import io.xpipe.core.store.DataStore;
import io.xpipe.core.store.FixedChildStore;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.experimental.FieldDefaults;
@ -23,6 +23,12 @@ import java.util.List;
public class FixedServiceGroupStore extends AbstractServiceGroupStore<FixedServiceCreatorStore>
implements DataStore, FixedHierarchyStore {
@Override
public void checkComplete() throws Throwable {
super.checkComplete();
Validators.isType(getParent(),FixedServiceCreatorStore.class);
}
@Override
@SuppressWarnings("unchecked")
public List<? extends DataStoreEntryRef<? extends FixedChildStore>> listChildren(DataStoreEntry self)