Permalink
Browse files

Added Faces#isSystemTest() and Faces#isProduction()

  • Loading branch information...
BalusC committed Dec 20, 2016
1 parent 89971c0 commit c267b1c064b55a1614e82a2126efdc57794013d1
Showing with 43 additions and 1 deletion.
  1. +26 −0 src/main/java/org/omnifaces/util/Faces.java
  2. +17 −1 src/main/java/org/omnifaces/util/FacesLocal.java
@@ -318,6 +318,32 @@ public static boolean isDevelopment() {
return FacesLocal.isDevelopment(getContext());
}
/**
* Returns whether we're in system test stage. This will be the case when the <code>javax.faces.PROJECT_STAGE</code>
* context parameter in <code>web.xml</code> is set to <code>SystemTest</code>.
* <p>
* This is also available in EL as <code>#{faces.systemTest}</code>.
* @return <code>true</code> if we're in system test stage, otherwise <code>false</code>.
* @see Application#getProjectStage()
* @since 2.6
*/
public static boolean isSystemTest() {
return FacesLocal.isSystemTest(getContext());
}
/**
* Returns whether we're in production stage. This will be the case when the <code>javax.faces.PROJECT_STAGE</code>
* context parameter in <code>web.xml</code> is set to <code>Production</code>.
* <p>
* This is also available in EL as <code>#{faces.production}</code>.
* @return <code>true</code> if we're in production stage, otherwise <code>false</code>.
* @see Application#getProjectStage()
* @since 2.6
*/
public static boolean isProduction() {
return FacesLocal.isProduction(getContext());
}
/**
* Determines and returns the faces servlet mapping used in the current request. If JSF is prefix mapped (e.g.
* <code>/faces/*</code>), then this returns the whole path, with a leading slash (e.g. <code>/faces</code>). If JSF
@@ -166,7 +166,23 @@ public static ProjectStage getProjectStage(FacesContext context) {
* @see Faces#isDevelopment()
*/
public static boolean isDevelopment(FacesContext context) {
return context.getApplication().getProjectStage() == ProjectStage.Development;
return getProjectStage(context) == ProjectStage.Development;
}
/**
* {@inheritDoc}
* @see Faces#isSystemTest()
*/
public static boolean isSystemTest(FacesContext context) {
return getProjectStage(context) == ProjectStage.SystemTest;
}
/**
* {@inheritDoc}
* @see Faces#isProduction()
*/
public static boolean isProduction(FacesContext context) {
return getProjectStage(context) == ProjectStage.Production;
}
/**

0 comments on commit c267b1c

Please sign in to comment.