示例#1
0
 public virtual System.String getConstraintMessage(EvaluationContext ec, FormInstance instance, System.String textForm)
 {
     if (xPathConstraintMsg == null)
     {
         //If the request is for getting a constraint message in a specific format (like audio) from
         //itext, and there's no xpath, we couldn't possibly fulfill it
         return(textForm == null?constraintMsg:null);
     }
     else
     {
         if (textForm != null)
         {
             ec.OutputTextForm = textForm;
         }
         try
         {
             System.Object value_Renamed = xPathConstraintMsg.eval(instance, ec);
             if (value_Renamed != (System.Object) "")
             {
                 return((System.String)value_Renamed);
             }
             return(null);
         }
         catch (System.Exception e)
         {
             Logger.exception("Error evaluating a valid-looking constraint xpath ", e);
             return(constraintMsg);
         }
     }
 }
示例#2
0
 /// <summary> Attempts to set the storage factory for the current environment and fails and dies if there
 /// is already a storage factory set if specified. Should be used by actual applications who need to use
 /// a specific storage factory and shouldn't tolerate being pre-empted.
 ///
 /// </summary>
 /// <param name="fact">An available storage factory.
 /// </param>
 /// <param name="mustWork">true if it is intolerable for another storage factory to have been set. False otherwise
 /// </param>
 public static void  setStorageFactory(IStorageFactory fact, bool mustWork)
 {
     if (storageFactory == null)
     {
         storageFactory = fact;
     }
     else
     {
         if (mustWork)
         {
             Logger.die("A Storage Factory had already been set when storage factory " + fact.GetType().FullName + " attempted to become the only storage factory", new System.SystemException("Duplicate Storage Factory set"));
         }
         else
         {
             //Not an issue
         }
     }
 }
示例#3
0
 private void  InitBlock()
 {
     try
     {
         List <Object> pivots = new List <Object>();
         this.pivot(model, evalContext, pivots, evalContext.getContextRef());
         return(pivots);
     }
     catch (UnpivotableExpressionException uee)
     {
         //Rethrow unpivotable (expected)
         throw uee;
     }
     catch (System.Exception e)
     {
         //Pivots aren't critical, if there was a problem getting one, log the exception
         //so we can fix it, and then just report that.
         Logger.exception(e);
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         throw new UnpivotableExpressionException(e.Message);
     }
     return(eval(model, evalContext));
 }