Class GrouperLoaderJexlScriptFullSync

java.lang.Object
edu.internet2.middleware.grouper.app.loader.OtherJobBase
edu.internet2.middleware.grouper.abac.GrouperLoaderJexlScriptFullSync
All Implemented Interfaces:
org.quartz.Job

@DisallowConcurrentExecution public class GrouperLoaderJexlScriptFullSync extends OtherJobBase
  • Constructor Details

    • GrouperLoaderJexlScriptFullSync

      public GrouperLoaderJexlScriptFullSync()
  • Method Details

    • main

      public static void main(String[] args)
    • analyzeJexlScriptHtml

      public static GrouperJexlScriptAnalysis analyzeJexlScriptHtml(GrouperDataEngine grouperDataEngine, String jexlScript, Subject subject, Subject loggedInSubject, boolean readOnly)
      Parameters:
      grouperDataEngine -
      jexlScript -
      subject -
      loggedInSubject -
      readOnly - - true if only analyzing; false if about to save the script
      Returns:
    • analyzeJexlScriptHtml

      public static GrouperJexlScriptAnalysis analyzeJexlScriptHtml(GrouperDataEngine grouperDataEngine, String jexlScript, Subject subject, Subject loggedInSubject, boolean readOnly, Set<String> effectiveSourceIds, boolean buildVisualization)
      analyze a jexl script and return the analysis with counts and subject checks
      Parameters:
      grouperDataEngine -
      jexlScript -
      subject -
      loggedInSubject -
      readOnly - - true if only analyzing; false if about to save the script
      effectiveSourceIds - - the effective subject source IDs to use for the count query, or null for global defaults
      buildVisualization - - true if this is being called to build visualization
      Returns:
    • analyzeJexlScript

      public static GrouperJexlScriptAnalysis analyzeJexlScript(GrouperDataEngine grouperDataEngine, String jexlStript)
      Parameters:
      jexlStript -
      arguments - first one is type (e.g. group), second is list (e.g. members), third is name (e.g. test:testGroup). Used for bind variables
      Returns:
      the sql
    • analyzeJexlScriptToSqlHelper

      public static void analyzeJexlScriptToSqlHelper(GrouperJexlScriptAnalysis grouperJexlScriptAnalysis, GrouperJexlScriptPart theGrouperJexlScriptPart, org.apache.commons.jexl3.parser.JexlNode jexlNode, boolean clonePart)
    • isGlobalAttributeValueNode

      public static boolean isGlobalAttributeValueNode(org.apache.commons.jexl3.parser.JexlNode jexlNode)
      Whether this AST node is a globalAttributeValue('alias') function call. This is a value-producing expression that can appear anywhere a literal value is expected as a function argument (e.g. the value argument of hasAttribute). It resolves to the value of a data field assigned to the abacGlobal group, so scripts can use global variables, e.g. hasAttribute('term', globalAttributeValue('termCurrent')).
      Parameters:
      jexlNode - the argument node
      Returns:
      true if it is a globalAttributeValue(...) call
    • resolveGlobalAttributeValueNode

      public static Object resolveGlobalAttributeValueNode(GrouperJexlScriptAnalysis grouperJexlScriptAnalysis, org.apache.commons.jexl3.parser.JexlNode jexlNode)
      Resolve a globalAttributeValue('alias') function call to the scalar value of the data field assigned to the abacGlobal group. The value is read once (cached, single query) from the abacGlobal member and returned as a literal (String for string fields, Long otherwise) so the caller can bind it as a normal SQL bind variable.
      Parameters:
      grouperJexlScriptAnalysis - the analysis (provides the data engine to resolve the alias)
      jexlNode - the globalAttributeValue(...) function node
      Returns:
      the resolved value
    • isGlobalAttributeValuesNode

      public static boolean isGlobalAttributeValuesNode(org.apache.commons.jexl3.parser.JexlNode jexlNode)
      True if this AST node is a globalAttributeValues('alias') (plural) function call — the multi-valued companion to globalAttributeValue. Resolves to the full list of values assigned to a multi-valued data field on the abacGlobal group. Only meaningful inside list-taking operators (hasAttributeAny, row-inner =~ / !~) where it expands to individual bind vars in a SQL "in (?, ?, ...)" clause.
      Parameters:
      jexlNode - the argument node
      Returns:
      true if it is a globalAttributeValues(...) call
    • resolveGlobalAttributeValuesNode

      public static List<Object> resolveGlobalAttributeValuesNode(GrouperJexlScriptAnalysis grouperJexlScriptAnalysis, org.apache.commons.jexl3.parser.JexlNode jexlNode)
      Resolve a globalAttributeValues('alias') function call to the full list of values assigned to the named data field on the abacGlobal group. Order matches insertion order in the map (which reflects DB row order). List is guaranteed non-empty — a missing / unassigned global throws instead.
      Parameters:
      jexlNode - the globalAttributeValues(...) function node
      Returns:
      non-empty list of resolved values (String for string fields, Long otherwise)
    • isStringLiteralOrGlobal

      public static boolean isStringLiteralOrGlobal(org.apache.commons.jexl3.parser.JexlNode jexlNode)
      Whether this AST node is acceptable where a string literal value is expected (hasAttributeLike / hasAttributeRegex): a string literal or a globalAttributeValue('alias') reference.
      Parameters:
      jexlNode - the argument node
      Returns:
      true if it can be resolved by stringLiteralOrGlobal(edu.internet2.middleware.grouper.abac.GrouperJexlScriptAnalysis, org.apache.commons.jexl3.parser.JexlNode)
    • stringLiteralOrGlobal

      public static String stringLiteralOrGlobal(GrouperJexlScriptAnalysis grouperJexlScriptAnalysis, org.apache.commons.jexl3.parser.JexlNode jexlNode)
      Resolve a value argument node that is expected to be a string (a like / regex pattern), supporting a string literal or a globalAttributeValue('alias') reference (rendered to its string form).
      Parameters:
      grouperJexlScriptAnalysis - the analysis (provides the data engine to resolve globals)
      jexlNode - the value argument node
      Returns:
      the resolved string value
    • isTimeFromNowNode

      public static boolean isTimeFromNowNode(org.apache.commons.jexl3.parser.JexlNode jexlNode)
      True if this AST node is a timeFromNow('...') function call. This is a value-producing helper that resolves at analysis time to a millisecond epoch value — current time offset by the amount named in the string argument. Acceptable anywhere a numeric / timestamp literal is expected as a comparison value (hasAttribute value, hasAttributeLessThan / GreaterThan / Between bounds, row inner-predicate column comparisons). Argument syntax mirrors the recentMemberOf time-period style: a single string like '30 days' or '-5 minutes' (leading minus for past). The string 'now' is an alias for zero offset. Units accepted (singular or plural, case-insensitive): minutes, hours, days, weeks, months, years.
      Parameters:
      jexlNode - argument node
      Returns:
      true if this is a timeFromNow(...) call
    • describeTimeFromNowNode

      public static String describeTimeFromNowNode(org.apache.commons.jexl3.parser.JexlNode jexlNode)
      Renders a timeFromNow('...') call in natural English for analysis-screen row descriptions and visualization box labels. Examples: timeFromNow('now') → "now" timeFromNow('1 day') → "in 1 day" timeFromNow('30 days') → "in 30 days" timeFromNow('-30 days') → "30 days ago" timeFromNow('-1 year') → "1 year ago" timeFromNow('-5 minutes') → "5 minutes ago" Singular is used when |N| == 1 regardless of what the script wrote ('day' vs 'days'). The bind value in the SQL is still the resolved Long from resolveTimeFromNowNode(org.apache.commons.jexl3.parser.JexlNode); only the display uses this form.
      Parameters:
      jexlNode - the timeFromNow(...) function node
      Returns:
      a natural-language phrase describing the offset from now
    • resolveTimeFromNowNode

      public static Long resolveTimeFromNowNode(org.apache.commons.jexl3.parser.JexlNode jexlNode)
      Resolve a timeFromNow('...') function call to a Long millisecond epoch value = current time offset by the amount named in the string argument. Accepted forms: 'now' (zero offset), or a signed integer followed by a unit like '30 days' or '-5 minutes'. Units (singular or plural, case-insensitive): minutes, hours, days, weeks, months, years. Uses Calendar for month / year arithmetic so leap years and variable-length months don't drift; other units use plain millisecond math. Resolved once at analysis time and bound as a normal SQL bind variable rather than joined in.
      Parameters:
      jexlNode - the timeFromNow(...) function node
      Returns:
      millis since epoch
    • analyzeJexlReferenceTwoChildrenToSqlHelper

      public static void analyzeJexlReferenceTwoChildrenToSqlHelper(GrouperJexlScriptAnalysis grouperJexlScriptAnalysis, GrouperJexlScriptPart grouperJexlScriptPart, org.apache.commons.jexl3.parser.ASTReference astReference, boolean clonePart)
      has two children
      Parameters:
      result -
      astReference -
    • analyzeJexlRowToSqlHelper

      public static void analyzeJexlRowToSqlHelper(GrouperJexlScriptAnalysis grouperJexlScriptAnalysis, GrouperJexlScriptPart grouperJexlScriptPart, GrouperJexlScriptPart rowJexlScriptPart, String jexlStript, boolean clonePart)
      Parameters:
      jexlStript -
      arguments - first one is type (e.g. group), second is list (e.g. members), third is name (e.g. test:testGroup)
    • analyzeJexlRowToSqlHelper

      public static void analyzeJexlRowToSqlHelper(GrouperJexlScriptAnalysis grouperJexlScriptAnalysis, GrouperJexlScriptPart grouperJexlScriptPart, GrouperJexlScriptPart rowJexlScriptPart, String jexlStript, boolean clonePart, GrouperJexlScriptPart innerAstBridgeTarget)
      Overload that lets the caller specify which part should own the inner-AST registrations (so per-attribute parent walks resolve correctly even when called from an accumulator pass where grouperJexlScriptPart is not the hasRow leaf).
    • analyzeJexlRowToSqlHelper

      public static void analyzeJexlRowToSqlHelper(GrouperJexlScriptAnalysis grouperJexlScriptAnalysis, GrouperJexlScriptPart grouperJexlScriptPart, GrouperJexlScriptPart rowJexlScriptPart, org.apache.commons.jexl3.parser.JexlNode jexlNode, boolean clonePart)
    • run

      Description copied from class: OtherJobBase
      implement this method for the logic of the OtherJob
      Specified by:
      run in class OtherJobBase
      Returns:
      the output
    • syncFullGroup

      public static void syncFullGroup(Map<String,Object> debugMap, Hib3GrouperLoaderLog hib3GrouperLoaderLog, GrouperDataEngine grouperDataEngine, AttributeAssign attributeAssign, Group group, Map<MultiKey,SqlCacheDependency> allMshipHistoryAbacSqlCacheDependenciesMap, Set<Long> sqlCacheGroupInternalIdsStillNeedingMshipHistory, boolean readOnly)
    • generateJexlSql

      public static GrouperJexlScriptSql generateJexlSql(GrouperDataEngine grouperDataEngine, GcDbAccess gcDbAccess, GrouperJexlScriptAnalysis analyzeJexlScript)
    • runDaemonStandalone

      public static void runDaemonStandalone()
      run standalone