-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MID-8842 ninja, moved upgrade validator to schema module, since it co…
…uld be used in different places as well (e.g. tasks or gui)
- Loading branch information
Showing
18 changed files
with
212 additions
and
176 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...a/schema/src/main/java/com/evolveum/midpoint/schema/validator/ObjectUpgradeValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.evolveum.midpoint.schema.validator; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.evolveum.midpoint.prism.PrismContext; | ||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
|
||
public class ObjectUpgradeValidator { | ||
|
||
private final ObjectValidator validator; | ||
|
||
public ObjectUpgradeValidator(@NotNull PrismContext prismContext) { | ||
|
||
this.validator = new ObjectValidator(prismContext); | ||
} | ||
|
||
public void setWarnDeprecated(boolean value) { | ||
this.validator.setWarnDeprecated(value); | ||
} | ||
|
||
public void setWarnPlannedRemoval(boolean value) { | ||
this.validator.setWarnPlannedRemoval(value); | ||
} | ||
|
||
public void setWarnPlannedRemovalVersion(String value) { | ||
this.validator.setWarnPlannedRemovalVersion(value); | ||
} | ||
|
||
public void setWarnIncorrectOids(boolean value) { | ||
this.validator.setWarnIncorrectOids(value); | ||
} | ||
|
||
public void showAllWarnings() { | ||
this.validator.setAllWarnings(); | ||
} | ||
|
||
public <O extends ObjectType> UpgradeValidationResult validate(PrismObject<O> object) { | ||
ValidationResult result = validator.validate(object); | ||
|
||
UpgradeObjectsHandler handler = new UpgradeObjectsHandler(); | ||
return handler.verify(object, result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
infra/schema/src/main/java/com/evolveum/midpoint/schema/validator/UpgradePhase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.evolveum.midpoint.schema.validator; | ||
|
||
public enum UpgradePhase { | ||
|
||
BEFORE, AFTER | ||
} |
2 changes: 1 addition & 1 deletion
2
...ninja/action/upgrade/UpgradePriority.java → ...int/schema/validator/UpgradePriority.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...int/ninja/action/upgrade/UpgradeType.java → ...idpoint/schema/validator/UpgradeType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
infra/schema/src/main/java/com/evolveum/midpoint/schema/validator/UpgradeValidationItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.evolveum.midpoint.schema.validator; | ||
|
||
import com.evolveum.midpoint.prism.delta.ObjectDelta; | ||
|
||
public class UpgradeValidationItem { | ||
|
||
private final ValidationItem item; | ||
|
||
private boolean changed; | ||
|
||
private String identifier; | ||
|
||
private UpgradePhase phase; | ||
|
||
private UpgradePriority priority; | ||
|
||
private UpgradeType type; | ||
|
||
private ObjectDelta<?> delta; | ||
|
||
public UpgradeValidationItem(ValidationItem item) { | ||
this.item = item; | ||
} | ||
|
||
public boolean isChanged() { | ||
return changed; | ||
} | ||
|
||
public void setChanged(boolean changed) { | ||
this.changed = changed; | ||
} | ||
|
||
public String getIdentifier() { | ||
return identifier; | ||
} | ||
|
||
public void setIdentifier(String identifier) { | ||
this.identifier = identifier; | ||
} | ||
|
||
public UpgradePhase getPhase() { | ||
return phase; | ||
} | ||
|
||
public void setPhase(UpgradePhase phase) { | ||
this.phase = phase; | ||
} | ||
|
||
public UpgradePriority getPriority() { | ||
return priority; | ||
} | ||
|
||
public void setPriority(UpgradePriority priority) { | ||
this.priority = priority; | ||
} | ||
|
||
public UpgradeType getType() { | ||
return type; | ||
} | ||
|
||
public void setType(UpgradeType type) { | ||
this.type = type; | ||
} | ||
|
||
public ObjectDelta<?> getDelta() { | ||
return delta; | ||
} | ||
|
||
public void setDelta(ObjectDelta<?> delta) { | ||
this.delta = delta; | ||
} | ||
|
||
public ValidationItem getItem() { | ||
return item; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../schema/src/main/java/com/evolveum/midpoint/schema/validator/UpgradeValidationResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.evolveum.midpoint.schema.validator; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class UpgradeValidationResult { | ||
|
||
private ValidationResult result; | ||
|
||
private final List<UpgradeValidationItem> items = new ArrayList<>(); | ||
|
||
public UpgradeValidationResult(@NotNull ValidationResult result) { | ||
this.result = result; | ||
} | ||
|
||
public @NotNull ValidationResult getResult() { | ||
return result; | ||
} | ||
|
||
public @NotNull List<UpgradeValidationItem> getItems() { | ||
return items; | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
...de/processor/RemovedElementProcessor.java → ...or/processor/RemovedElementProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...ade/processor/UserDashboardProcessor.java → ...tor/processor/UserDashboardProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...s/ninja/src/main/java/com/evolveum/midpoint/ninja/action/upgrade/UpgradeObjectResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
tools/ninja/src/main/java/com/evolveum/midpoint/ninja/action/upgrade/UpgradePhase.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
tools/ninja/src/main/java/com/evolveum/midpoint/ninja/action/upgrade/VerificationResult.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.