Checks whether processing is allowed.

@param prefix  variable prefix
@param context {@link TemplateReplacementContext}
@return {@code boolean} flag
325974
private boolean processingAllowed(final String prefix, final String variable, final TemplateReplacementContext context) {
		return (PREFIX.equals(prefix) && !StringUtils.isEmpty(variable) && context instanceof MailTemplateReplacementContext);
	}
775806
public boolean acceptTemplate(String tpl)
	{

		if (isInWhiteList(tpl) && !isInBlackList(tpl)) {
			if (containsAllowedPrefix(tpl) && !containsRestrictedPrefix(tpl)) {
				return true;
			}
			else {
				return false;
			}
		}
		else {
			return false;
		}

	}
534697
protected boolean isWritable(WriterInterceptorContext context) {
        return context.getEntity() != null
                && !Boolean.FALSE.equals(requestProvider.get().getProperty(MessageHelper.STREAMING_RANGE_ENABLED))
                && context.getHeaders().containsKey(HttpHeaders.CONTENT_LENGTH)
                && !(context.getEntity() instanceof MediaStreaming);
    }
860138
async def update_template_context(self, context: dict) -> None:
        
        processors = self.template_context_processors[None]
        if has_request_context():
            blueprint = _request_ctx_stack.top.request.blueprint
            if blueprint is not None and blueprint in self.template_context_processors:
                processors = chain(processors, self.template_context_processors[blueprint])  # type: ignore # noqa
        extra_context: dict = {}
        for processor in processors:
            extra_context.update(await processor())
        original = context.copy()
        context.update(extra_context)
        context.update(original)
713587
public void addRule(final RuleBuildContext context) {
        final RuleImpl rule = context.getRule();
        final RuleDescr ruleDescr = context.getRuleDescr();

        RuleClassBuilder classBuilder = context.getDialect().getRuleClassBuilder();

        String ruleClass = classBuilder.buildRule(context);
        // return if there is no ruleclass name;
        if (ruleClass == null) {
            return;
        }

        // The compilation result is for the entire rule, so difficult to associate with any descr
        addClassCompileTask(this.pkg.getName() + "." + ruleDescr.getClassName(),
                            ruleDescr,
                            ruleClass,
                            this.src,
                            new RuleErrorHandler(ruleDescr,
                                                 rule,
                                                 "Rule Compilation error"));

        JavaDialectRuntimeData data = (JavaDialectRuntimeData) this.pkg.getDialectRuntimeRegistry().getDialectData(ID);

        for (Map.Entry<String, String> invokers : context.getInvokers().entrySet()) {
            final String className = invokers.getKey();

            // Check if an invoker - returnvalue, predicate, eval or consequence has been associated
            // If so we add it to the PackageCompilationData as it will get wired up on compilation
            final Object invoker = context.getInvokerLookup(className);
            if (invoker instanceof Wireable) {
                data.putInvoker(className, (Wireable)invoker);
            }
            final String text = invokers.getValue();

            final BaseDescr descr = context.getDescrLookup(className);
            addClassCompileTask(className,
                                descr,
                                text,
                                this.src,
                                new RuleInvokerErrorHandler(descr,
                                                            rule,
                                                            "Unable to generate rule invoker."));
        }

        // setup the line mappins for this rule
        final String name = this.pkg.getName() + "." + StringUtils.ucFirst(ruleDescr.getClassName());
        final LineMappings mapping = new LineMappings(name);
        mapping.setStartLine(ruleDescr.getConsequenceLine());
        mapping.setOffset(ruleDescr.getConsequenceOffset());

        this.pkg.getDialectRuntimeRegistry().getLineMappings().put(name,
                                                                   mapping);
    }
685302
public static void checkUnWritabilityAndNotify(ChannelHandlerContext context,
                                                   BackPressureHandler backpressureHandler) {
        if (backpressureHandler != null) {
            Channel channel = context.channel();
            if (!channel.isWritable() && channel.isActive()) {
                backpressureHandler.getBackPressureObservable().notifyUnWritable();
            }
        }
    }
1201891
public <T extends ViewHandler<R>> T processing(boolean flag) {
        lock.lock();
        try {
            setProcessing(flag);
            return (T)this;
        }
        finally {
            lock.unlock();
        }
    }
496462
public static boolean isEditRestricted(@NotNull ComponentContext wcmComponentContext) {
    Page page = wcmComponentContext.getPage();
    if (page == null) {
      return false;
    }
    ResourceResolver resourceResolver = wcmComponentContext.getResource().getResourceResolver();
    Template template = page.getTemplate();

    if (template == null || isPageInTemplateDefinition(page) || !isEditableTemplate(template)) {
      return false;
    }

    // check if the current resource path already points to a structure path in the editable template
    String resourcePath = wcmComponentContext.getResource().getPath();
    String templateStructurePath = template.getPath() + "/" + NN_EDITABLE_TEMPLATE_STRUCTURE + "/" + JCR_CONTENT;
    String resourcePathInStructure = null;
    if (StringUtils.startsWith(resourcePath, templateStructurePath + "/")) {
      resourcePathInStructure = resourcePath;
    }
    else {
      // resource path points to the current page, build structure path from path in page
      String relativePathInPage = StringUtils.substringAfter(resourcePath, page.getContentResource().getPath());
      if (StringUtils.isNotEmpty(relativePathInPage)) {
        resourcePathInStructure = templateStructurePath + relativePathInPage;
      }
    }
    if (resourcePathInStructure == null) {
      return false;
    }

    Resource resourceInStructure = resourceResolver.getResource(resourcePathInStructure);
    if (resourceInStructure == null) {
      return false;
    }
    return !resourceInStructure.getValueMap().get(PN_EDITABLE, false);
  }
733510
private final CompiledST loadTemplateResource(String prefix, String unqualifiedFileName) {
        //if (resourceRoot == null) return null;
        //return loadTemplate(resourceRoot, prefix, unqualifiedFileName);
        if (resourceRoots.isEmpty()) return null;
        CompiledST template = null;
        for (URL resourceRoot : resourceRoots) {
            if ((template = loadTemplate(resourceRoot, prefix, unqualifiedFileName)) != null)
                return template;
        }
        return null;
    }
1135778
protected boolean addWork(final ForkJoinContext<?> context) {
	requireNotStopped(this);

	final boolean result = workQueue.addWaitingWork(context);
	if (result) {
	    addWorkerIfNeeded();
	}

	return result;
    }
1305586
public void setPrefix(String prefix) {
		this.prefix = prefix;
		if (this.prefix != null && this.prefix.isEmpty())
			this.prefix = null;
	}
71040
boolean isAlreadyProcessed(
            final CtClass ctClass,
            final ClassProcessor processor) {
        final ClassFile classFile = ctClass.getClassFile();
        AnnotationsAttribute annotationAttribute = null;
        for (final Object attributeObject : classFile.getAttributes()) {
            if (attributeObject instanceof AnnotationsAttribute) {
                annotationAttribute = (AnnotationsAttribute) attributeObject;
                final Annotation annotation = annotationAttribute.getAnnotation(PROCESSED_ANNOTATION_CLASS);
                if (annotation != null) {
                    final MemberValue value = annotation.getMemberValue("value");
                    _log.debug("Existing processed annotation on: " + ctClass.getName() + " = " + value);
                    final ArrayMemberValue valueArray = (ArrayMemberValue) value;
                    for (final MemberValue processorValue : valueArray.getValue()) {
                        final StringMemberValue processorValueString = (StringMemberValue) processorValue;
                        if (processor.getClass().getName().equals(processorValueString.getValue())) {
                            return true;
                        }
                    }
                }
            }
        }
        _log.debug("No annotation attribute or processed annotation found on: " + ctClass.getName());
        return false;
    }
30505
@Deprecated
    public void setPrefix(String prefix) {
        if (prefix == null) {
            throw new IllegalArgumentException(
                    "Prefix cannot be null for a replication rule");
        }
        if (filter != null) {
            throw new IllegalArgumentException(
                    "You cannot use both prefix and filter at the same time in a replication rule");
        }
        this.prefix = prefix;
    }
270750
public boolean allowAdd(@NotNull Resource contextResource, @NotNull String configName) {
    return serviceResolver.resolveAll(ConfigurationEditorFilter.class, contextResource).getServices()
        .filter(filter -> !filter.allowAdd(configName))
        .count() == 0;
  }
358275
@Modified
    protected void modified(ComponentContext context) throws Exception {

        processProperties(context.getProperties());
        deregisterJavaMailMBean();
        registerJavaMailMBean();
    }
1015749
public final void configureAccess(final Template template, final ApplicationContext context) {
        final Configuration configuration = template.getConfiguration();

        AndAccessAssertion accessAssertion = context.getBean(AndAccessAssertion.class);
        accessAssertion.setPredicates(configuration.getAccessAssertion(), template.getAccessAssertion());
        this.access = accessAssertion;
    }
147226
void declarePrefix (String prefix, String uri)
    {
                                // Lazy processing...
        if (!tablesDirty) {
            copyTables();
        }
        if (declarations == null) {
            declarations = new Vector();
        }
            
        prefix = prefix.intern();
        uri = uri.intern();
        if ("".equals(prefix)) {
            if ("".equals(uri)) {
                defaultNS = null;
            } else {
                defaultNS = uri;
            }
        } else {
            prefixTable.put(prefix, uri);
            uriTable.put(uri, prefix); // may wipe out another prefix
        }
        declarations.addElement(prefix);
    }