Package com.pnfsoftware.jeb.core
Class RuntimeProjectUtil
java.lang.Object
com.pnfsoftware.jeb.core.RuntimeProjectUtil
A collection of utility methods to navigate and act on JEB projects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
destroyLiveArtifact
(ILiveArtifact liveArtifact) Destroy a live Artifact and all its children.filterUnits
(IRuntimeProject prj, IUnitFilter filter) Find the units in the project that pass a test provided by the user-defined filter object.static <T extends IUnit>
TfindFirstUnitByType
(IRuntimeProject prj, Class<T> c, boolean strict) Find a units of a project that are of the specified type.static IRuntimeProject
findProject
(IUnitCreator object) Retrieve a JEB project object given any unit or artifact belonging to the project.static IUnit
findUnitByUid
(IRuntimeProject prj, long uid) static List<IUnitContribution>
findUnitContributions
(IRuntimeProject prj, IUnit target) Retrieve a list of contributions (defined within a given project) for a target unit.findUnits
(IRuntimeProject prj, Class<T> c) Find all units of a project that are of the specified type.findUnitsByType
(IRuntimeProject prj, Class<T> c, boolean strict) Find all units of a project that are of the specified type.Retrieve a list of all units in the provided project.static boolean
Determine if a project has at least one unit with at least one notification.static boolean
hasNotification
(IRuntimeProject prj, int minLevel) Determine if a project has at least one unit with at least one notification whose level is greater than or equal than the requested one.
-
Constructor Details
-
RuntimeProjectUtil
public RuntimeProjectUtil()
-
-
Method Details
-
findProject
Retrieve a JEB project object given any unit or artifact belonging to the project.- Parameters:
object
- a unit or an artifact- Returns:
- null on error
-
getAllUnits
Retrieve a list of all units in the provided project.- Parameters:
prj
-- Returns:
-
findFirstUnitByType
public static <T extends IUnit> T findFirstUnitByType(IRuntimeProject prj, Class<T> c, boolean strict) Find a units of a project that are of the specified type.- Parameters:
prj
- a projectc
- a type of unit, or null to indicate all unitsstrict
- if true, only units of class `c` will be returned; else, units of type `c` or any type derived from `c` will be returned- Returns:
- a unit or null
-
findUnits
Find all units of a project that are of the specified type.Same as
findUnitsByType(prj, c, false)
.- Parameters:
prj
- JEB projectc
-unit
type- Returns:
- the list of units
-
findUnitsByType
public static <T extends IUnit> List<T> findUnitsByType(IRuntimeProject prj, Class<T> c, boolean strict) Find all units of a project that are of the specified type.- Parameters:
prj
- a projectc
- a type of unit, or null to indicate all unitsstrict
- if true, only units of class `c` will be returned; else, units of type `c` or any type derived from `c` will be returned- Returns:
- the list of units
-
findUnitByUid
-
filterUnits
Find the units in the project that pass a test provided by the user-defined filter object.- Parameters:
prj
- a projectfilter
- a filter, null means no filter (ie, all units will be returned)- Returns:
- the list of units
-
findUnitContributions
Retrieve a list of contributions (defined within a given project) for a target unit.- Parameters:
prj
- a projecttarget
- the target unit- Returns:
- a list of contributions, potentially empty
-
destroyLiveArtifact
Destroy a live Artifact and all its children.- Returns:
- false in case of error: the live artifact may be in an invalid state after
destruction fails (some
IUnit
children may have been deleted)
-
hasNotification
Determine if a project has at least one unit with at least one notification.- Parameters:
prj
-- Returns:
-
hasNotification
Determine if a project has at least one unit with at least one notification whose level is greater than or equal than the requested one.- Parameters:
prj
-minLevel
-- Returns:
-