/* --- Methods ---
485241
public String scan() {
        logger.info("Starting analysis - component scan has started");
        String directory = config.getProperty(Constants.DIRECTORY);
        String[] directories = directory.split(Constants.COMMA);
        List<String> scannerBaseDirs = new ArrayList<>(Arrays.asList(directories));
        if (!scannerBaseDirs.isEmpty()) {
            logger.info("Getting properties");
            // configure properties
            FSAConfiguration fsaConfiguration = new FSAConfiguration(config);
            // set default values in case of missing parameters
            ResolverConfiguration resolverConfiguration = fsaConfiguration.getResolver();
            String[] includes = config.getProperty(ConfigPropertyKeys.INCLUDES_PATTERN_PROPERTY_KEY) != null ?
                    config.getProperty(ConfigPropertyKeys.INCLUDES_PATTERN_PROPERTY_KEY).split(FSAConfiguration.INCLUDES_EXCLUDES_SEPARATOR_REGEX) : ExtensionUtils.INCLUDES;
            String[] excludes = config.getProperty(ConfigPropertyKeys.EXCLUDES_PATTERN_PROPERTY_KEY) != null ?
                    config.getProperty(ConfigPropertyKeys.EXCLUDES_PATTERN_PROPERTY_KEY).split(FSAConfiguration.INCLUDES_EXCLUDES_SEPARATOR_REGEX) : ExtensionUtils.EXCLUDES;
            String[] acceptExtensionsList = (String[]) config.get(ConfigPropertyKeys.ACCEPT_EXTENSIONS_LIST);
            boolean globCaseSensitive = config.getProperty(ConfigPropertyKeys.CASE_SENSITIVE_GLOB_PROPERTY_KEY) != null ?
                    Boolean.valueOf(config.getProperty(ConfigPropertyKeys.CASE_SENSITIVE_GLOB_PROPERTY_KEY)) : false;
            boolean followSymlinks = config.getProperty(ConfigPropertyKeys.CASE_SENSITIVE_GLOB_PROPERTY_KEY) != null ?
                    Boolean.valueOf(config.getProperty(ConfigPropertyKeys.CASE_SENSITIVE_GLOB_PROPERTY_KEY)) : false;
            Collection<String> excludedCopyrights = fsaConfiguration.getAgent().getExcludedCopyrights();
            excludedCopyrights.remove(Constants.EMPTY_STRING);
            //todo hasScmConnectors[0] in future - no need for cx
            // Resolving dependencies
            logger.info("Resolving dependencies");
            // via should not run for componentScan
            Set<String> setDirs = new HashSet<>();
            setDirs.addAll(scannerBaseDirs);
            Map<String, Set<String>> appPathsToDependencyDirs = new HashMap<>();
            appPathsToDependencyDirs.put(FSAConfiguration.DEFAULT_KEY, setDirs);
            Collection<AgentProjectInfo> projects;
            // scan packageManager||Docker||Regular Scan
            if (Boolean.valueOf(config.getProperty(ConfigPropertyKeys.SCAN_PACKAGE_MANAGER))) {
                projects = new PackageManagerExtractor().createProjects();
            } else if (Boolean.valueOf(config.getProperty(ConfigPropertyKeys.SCAN_DOCKER_IMAGES))) {
                projects = new DockerResolver(fsaConfiguration).resolveDockerImages();
            } else {
                ProjectConfiguration projectConfiguration = new ProjectConfiguration(fsaConfiguration.getAgent(), scannerBaseDirs, appPathsToDependencyDirs, false);
                projects = new FileSystemScanner(resolverConfiguration, fsaConfiguration.getAgent(), false).createProjects(projectConfiguration).keySet();
            }

            logger.info("Finished dependency resolution");
            for (AgentProjectInfo project : projects) {
                project.setProjectToken(Constants.WHITESPACE);
                if (acceptExtensionsList != null && acceptExtensionsList.length > 0) {
                    project.setDependencies(getDependenciesFromExtensionsListOnly(project.getDependencies(), acceptExtensionsList));
                }
            }
            //             Return dependencies
            String jsonString = new ConfigurationSerializer().getAsString(projects, true);
            return jsonString;
        } else {
            return Constants.EMPTY_STRING;// new ConfigurationSerializer<>().getAsString(new Collection<AgentProjectInfo>);
        }
    }
522591
private void encodeThis() throws IOException {
        if (id == null) {
            this.extensionValue = null;
            return;
        }
        DerOutputStream os = new DerOutputStream();
        id.encode(os);
        this.extensionValue = os.toByteArray();
    }
644865
private static void generateModifierForContentProvider(Elements elementUtils, Builder builder,
			final SQLiteModelMethod method, ModifyType updateResultType) {
		final SQLiteDaoDefinition daoDefinition = method.getParent();
		final SQLiteEntity entity = method.getEntity();

		final Set<String> columns = new LinkedHashSet<>();

		JQLChecker jqlChecker = JQLChecker.getInstance();

		// parameters extracted from query
		final One<String> whereStatement = new One<>();

		if (method.jql.isWhereConditions()) {
			// parameters extracted from query

			final One<Boolean> alreadyFoundWhereStatement = new One<>(false);

			// put in whereStatement value of where statement.
			jqlChecker.replaceVariableStatements(method, method.jql.value,
					new JQLReplaceVariableStatementListenerImpl() {

						@Override
						public String onWhere(String statement) {
							if (alreadyFoundWhereStatement.value0 == false) {
								whereStatement.value0 = statement;
								alreadyFoundWhereStatement.value0 = true;
								return "";
							} else {
								// DO NOTHING
								return null;
							}
						}

					});
		}

		List<JQLPlaceHolder> placeHolders = jqlChecker.extractFromVariableStatement(method, whereStatement.value0);
		// remove placeholder for dynamic where, we are not interested here
		placeHolders = SqlBuilderHelper.removeDynamicPlaceHolder(placeHolders);
		checkContentProviderVarsAndArguments(method, placeHolders);

		// detect column used for content value
		jqlChecker.replace(method, method.jql, new JQLReplacerListenerImpl(method) {

			@Override
			public String onColumnNameToUpdate(String columnName) {
				SQLProperty tempProperty = entity.get(columnName);
				AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName);

				columns.add(tempProperty.columnName);
				return null;
			}

		});

		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(method.contentProviderMethodName);
		if (!method.getParent().hasSamePackageOfSchema()) {
			methodBuilder.addModifiers(Modifier.PUBLIC);
		}

		// params
		methodBuilder.addParameter(ParameterSpec.builder(Uri.class, "uri").build());

		if (updateResultType == ModifyType.UPDATE_BEAN || updateResultType == ModifyType.UPDATE_RAW) {
			methodBuilder.addParameter(ParameterSpec.builder(ContentValues.class, "contentValues").build());
		}

		methodBuilder.addParameter(ParameterSpec.builder(String.class, "selection").build());
		methodBuilder.addParameter(ParameterSpec.builder(ArrayTypeName.of(String.class), "selectionArgs").build());
		methodBuilder.returns(Integer.TYPE);

		// retrieve content values
		if (updateResultType == ModifyType.UPDATE_BEAN || updateResultType == ModifyType.UPDATE_RAW) {
			methodBuilder.addStatement("$T _contentValues=contentValuesForContentProvider(contentValues)",
					KriptonContentValues.class);
		} else {
			methodBuilder.addStatement("$T _contentValues=contentValues()", KriptonContentValues.class);
		}

		SqlBuilderHelper.generateLogForContentProviderBeginning(method, methodBuilder);

		// query builder
		methodBuilder.addStatement("$T _sqlBuilder=sqlBuilder()", StringBuilder.class);
		generateInitForDynamicWhereVariables(method, methodBuilder, "selection", "selectionArgs");

		SqlBuilderHelper.generateWhereCondition(methodBuilder, method, false);

		int i = 0;
		// extract pathVariables
		// every controls was done in constructor of SQLiteModelMethod
		for (ContentUriPlaceHolder variable : method.contentProviderUriVariables) {
			AssertKripton.assertTrue(SqlBuilderHelper.validate(variable.value, placeHolders, i),
					"In '%s.%s' content provider URI path variables and variables in where conditions are different. If SQL uses parameters, they must be defined in URI path.",
					daoDefinition.getName(), method.getName());

			JQLParameterName paramName = JQLParameterName.parse(variable.value);
			SQLProperty entityProperty = entity.get(paramName.getValue());

			if (entityProperty != null) {
				methodBuilder.addCode("// Add parameter $L at path segment $L\n", variable.value,
						variable.pathSegmentIndex);
				// methodBuilder.addStatement("_sqlWhereParams.add(uri.getPathSegments().get($L))",
				// variable.pathSegmentIndex);
				methodBuilder.addStatement("_contentValues.addWhereArgs(uri.getPathSegments().get($L))",
						variable.pathSegmentIndex);
				AssertKripton.assertTrue(
						TypeUtility.isTypeIncludedIn(entityProperty.getPropertyType().getTypeName(), String.class,
								Long.class, Long.TYPE),
						"In '%s.%s' content provider URI path variables %s must be String of Long type",
						daoDefinition.getName(), method.getName(), entityProperty.getName());
			}

			i++;
		}

		if (method.hasDynamicWhereConditions() && method.hasDynamicWhereArgs()) {
			// ASSERT: only with dynamic where conditions
			methodBuilder.beginControlFlow("if ($T.hasText(_sqlDynamicWhere) && _sqlDynamicWhereArgs!=null)",
					StringUtils.class);

			if (method.hasDynamicWhereConditions()) {
				methodBuilder.beginControlFlow("for (String _arg: _sqlDynamicWhereArgs)");
				// methodBuilder.addStatement("_sqlWhereParams.add(_arg)");
				methodBuilder.addStatement("_contentValues.addWhereArgs(_arg)");
				methodBuilder.endControlFlow();
			}

			methodBuilder.endControlFlow();
		}

		// column checj
		switch (updateResultType) {
		case UPDATE_BEAN:
		case UPDATE_RAW:
			SqlBuilderHelper.generateColumnCheckSet(builder, method, columns);
			SqlBuilderHelper.forEachColumnInContentValue(methodBuilder, method, "_contentValues.values().keySet()",
					true, null);
			break;
		default:
			break;
		}

		// generate log section - BEGIN
		methodBuilder.addComment("log section BEGIN");
		methodBuilder.beginControlFlow("if (_context.isLogEnabled())");

		generateLogForModifiers(method, methodBuilder);

		if (method.jql.operationType == JQLType.UPDATE) {
			// generate log for content values
			SqlBuilderHelper.generateLogForContentValues(method, methodBuilder);
		}

		// log for where parames
		SqlBuilderHelper.generateLogForWhereParameters(method, methodBuilder);

		// generate log section - END
		methodBuilder.endControlFlow();
		methodBuilder.addComment("log section END");

		methodBuilder.addCode("\n// execute SQL\n");
		switch (updateResultType) {
		case DELETE_BEAN:
		case DELETE_RAW:
			methodBuilder.addStatement(
					"int result = database().delete($S, _sqlWhereStatement, _contentValues.whereArgsAsArray())",
					entity.getTableName());

			if (method.getParent().getParent().generateRx) {
				GenericSQLHelper.generateSubjectNext(entity, methodBuilder, SubjectType.DELETE, "result");
			}
			break;
		case UPDATE_BEAN:
		case UPDATE_RAW:
			if (method.jql.conflictAlgorithmType == ConflictAlgorithmType.NONE) {
				methodBuilder.addStatement(
						"int result = database().update($S, _contentValues.values(), _sqlWhereStatement, _contentValues.whereArgsAsArray())",
						entity.getTableName());
			} else {
				methodBuilder.addCode("// conflict algorithm $L\n", method.jql.conflictAlgorithmType);
				methodBuilder.addStatement(
						"int result = database().updateWithOnConflict($S, _contentValues.values(), _sqlWhereStatement, _contentValues.whereArgsAsArray()), $L)",
						entity.getTableName(),
						method.jql.conflictAlgorithmType.getConflictAlgorithm());
			}

			if (method.getParent().getParent().generateRx) {
				GenericSQLHelper.generateSubjectNext(entity, methodBuilder, SubjectType.UPDATE, "result");
			}

			break;
		}

		// support for livedata
		if (daoDefinition.hasLiveData()) {
			methodBuilder.addComment("support for livedata");
			methodBuilder.addStatement(BindDaoBuilder.METHOD_NAME_REGISTRY_EVENT + "(result)");
		}

		methodBuilder.addStatement("return result");

		// we add at last javadoc, because need info is built at last.
		SqlBuilderHelper.generateJavaDocForContentProvider(method, methodBuilder);

		methodBuilder.addJavadoc("@param uri $S\n", method.contentProviderUriTemplate.replace("*", "[*]"));
		switch (updateResultType) {
		case UPDATE_BEAN:
		case UPDATE_RAW:
			methodBuilder.addJavadoc("@param contentValues content values\n");
			break;
		default:
			break;
		}
		methodBuilder.addJavadoc("@param selection dynamic part of <code>where</code> statement $L\n",
				method.hasDynamicWhereConditions() ? "" : "<b>NOT USED</b>");
		methodBuilder.addJavadoc("@param selectionArgs arguments of dynamic part of <code>where</code> statement $L\n",
				method.hasDynamicWhereConditions() ? "" : "<b>NOT USED</b>");

		methodBuilder.addJavadoc("@return number of effected rows\n");

		builder.addMethod(methodBuilder.build());
	}
717238
@PostConstruct
	public void init() {
		findBeans();
		SAXBuilder builder = new SAXBuilder();
		Document doc = null;
		try {
			doc = builder.build(getSchema().getInputStream());
			SchemaParserImpl schemaParser = new SchemaParserImpl();
			schemaParser.parse(doc);
			ParserSource parserSource = new InputStreamParserSource(getProcesses());
			
			ProcessTextProvider textProvider = new ProcessTextProvider(parserSource,schemaParser,this);
			ParsePackage parsePackage = new ParsePackage();
			parsePackage.parse(textProvider);
		} catch (Exception e) {
			throw new WorkflowException(e);
		}
		HashIdLogger.log(this,"postconstruct");
	}
827244
@Override
	protected StringBuffer doPostProcessBundle(BundleProcessingStatus status, StringBuffer bundleData)
			throws IOException {

		if (jsEngine == null) {
			initialize(status.getJawrConfig());
		}

		StopWatch stopWatch = new StopWatch();
		stopWatch.start("Processing Autoprefixer on '" + status.getLastPathAdded() + "'");

		String cssSource = bundleData.toString();
		String res = null;
		try {
			res = (String) jsEngine.invokeFunction("process", cssSource, options);

		} catch (NoSuchMethodException | ScriptException e) {
			throw new BundlingProcessException(e);
		}

		stopWatch.stop();
		if (PERF_LOGGER.isDebugEnabled()) {
			PERF_LOGGER.debug(stopWatch.shortSummary());
		}
		return new StringBuffer(res);
	}
485647
private void _ws() throws
      IOException
  {
    builder.type = Type.S;
    // no need to preserve exact whitespace
    // but append an S char to keep the token
    // contract of always having a value
    builder.append(' ');
    reader.forward(NOT_WHITESPACE);

    if (debug)
    {
      int nxt = reader.peek();
      checkArgument(WHITESPACE.matches((char) reader.curChar));
      if (nxt > -1)
      {
        checkArgument(NOT_WHITESPACE.matches((char) nxt));
      }
    }
  }
1159772
@Override
  public void process(Node externs, Node root) {
    checkState(compiler.getLifeCycleStage().isNormalized());
    if (!allowRemovalOfExternProperties) {
      referencedPropertyNames.addAll(compiler.getExternProperties());
    }
    traverseAndRemoveUnusedReferences(root);
    // This pass may remove definitions of getter or setter properties.
    GatherGettersAndSetterProperties.update(compiler, externs, root);
  }
1272451
@Override
  public PostingsFormat postingsFormat() {
    initDelegate();
    if (delegate.postingsFormat() instanceof PerFieldPostingsFormat) {
      Codec defaultCodec = Codec.getDefault();
      PostingsFormat defaultPostingsFormat = defaultCodec.postingsFormat();
      if (defaultPostingsFormat instanceof PerFieldPostingsFormat) {
        defaultPostingsFormat = ((PerFieldPostingsFormat) defaultPostingsFormat)
            .getPostingsFormatForField(null);
        if ((defaultPostingsFormat == null)
            || (defaultPostingsFormat instanceof PerFieldPostingsFormat)) {
          // fallback option
          return new MtasCodecPostingsFormat(
              PostingsFormat.forName("Lucene70"));
        } else {
          return new MtasCodecPostingsFormat(defaultPostingsFormat);
        }
      } else {
        return new MtasCodecPostingsFormat(defaultPostingsFormat);
      }
    } else {
      return new MtasCodecPostingsFormat(delegate.postingsFormat());
    }
  }
576269
@Override
    public void merge(JMSDestinationDefinition annotation, Class<?> instanceClass, Member member) throws InjectionException {

        if (member != null) {
            // JMSDestinationDefinition is a class-level annotation only.
            throw new IllegalArgumentException(member.toString());
        }

        name = mergeAnnotationValue(name, isXmlNameSet, annotation.name(), JMSDestinationProperties.NAME.getAnnotationKey(), "");
        interfaceName = mergeAnnotationValue(interfaceName, isXmlInterfaceNameSet, annotation.interfaceName(), JMSDestinationProperties.INTERFACE_NAME.getAnnotationKey(), "");
        className = mergeAnnotationValue(className, isXmlclassNameSet, annotation.className(), JMSDestinationProperties.CLASS_NAME.getAnnotationKey(), "");
        description = mergeAnnotationValue(description, isXmlDescriptionSet, annotation.description(), JMSDestinationProperties.DESCRIPTION.getAnnotationKey(), "");
        destinationName = mergeAnnotationValue(destinationName, isXmlDestinationNameSet, annotation.destinationName(),
                                               JMSDestinationProperties.DESTINATION_NAME.getAnnotationKey(), "");
        resourceAdapter = mergeAnnotationValue(resourceAdapter, isXmlResourceAdapterSet, annotation.resourceAdapter(),
                                               JMSDestinationProperties.RESOURCE_ADAPTER.getAnnotationKey(), "");
        properties = mergeAnnotationProperties(properties, xmlProperties, annotation.properties());

    }
613785
function Mapping() {
    this.generatedLine = 0;
    this.generatedColumn = 0;
    this.source = null;
    this.originalLine = null;
    this.originalColumn = null;
    this.name = null;
  }
667896
private void initJavaFXTaglets() {
        addStandardTaglet(new PropertyGetterTaglet());
        addStandardTaglet(new PropertySetterTaglet());
        addStandardTaglet(new SimpleTaglet("propertyDescription",
                message.getText("doclet.PropertyDescription"),
                SimpleTaglet.FIELD + SimpleTaglet.METHOD));
        addStandardTaglet(new SimpleTaglet("defaultValue", message.getText("doclet.DefaultValue"),
            SimpleTaglet.FIELD + SimpleTaglet.METHOD));
        addStandardTaglet(new SimpleTaglet("treatAsPrivate", null,
                SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE));
    }
990151
static void extractString(Elements elementUtils, Element item, Class<? extends Annotation> annotationClass, AnnotationAttributeType attribute, OnAttributeFoundListener listener) {
		extractAttributeValue(elementUtils, item, annotationClass.getCanonicalName(), attribute, listener);
	}
267660
@Override
    public void visit(PrimitiveParameter primitiveParameter) {
        PrimitiveParameter copy = new PrimitiveParameter(primitiveParameter.getId(), this.uniqueId != null ? this.uniqueId : primitiveParameter.getUniqueId());
        copy.setCreateDate(this.createDate != null ? this.createDate : primitiveParameter.getCreateDate());
        copy.setUpdateDate(this.updateDate != null ? this.updateDate : primitiveParameter.getUpdateDate());
        copy.setDeleteDate(this.deleteDate != null ? this.deleteDate : primitiveParameter.getDeleteDate());
        copy.setDownloadDate(this.downloadDate != null ? this.downloadDate : primitiveParameter.getDownloadDate());
        copy.setInterval(primitiveParameter.getInterval());
        copy.setSourceSystem(this.sourceSystem != null ? this.sourceSystem : primitiveParameter.getSourceSystem());
        if (this.references != null) {
            for (String refName : this.references.keySet()) {
                copy.setReferences(refName, this.references.get(refName));
            }
        } else {
            for (String refName : primitiveParameter.getReferenceNames()) {
                copy.setReferences(refName, primitiveParameter.getReferences(refName));
            }
        }
        if (this.properties != null) {
            for (String propName : this.properties.keySet()) {
                copy.setProperty(propName, this.properties.get(propName));
            }
        } else {
            for (String propName : primitiveParameter.getPropertyNames()) {
                copy.setProperty(propName, primitiveParameter.getProperty(propName));
            }
        }
        copy.setValue(primitiveParameter.getValue());
        this.theCopy = copy;
    }
127729
static String readMapping(String root, String index) throws IOException {
		if (root == null) {
			return readMapping(index);
		}
		String mappingFile = root + "/" + index + "/_doc" + Defaults.JsonFileExtension;
		return readFileFromClasspath(mappingFile);
	}
1203849
@Override
	protected void initServletContext(ServletContext servletContext) {
		super.initServletContext(servletContext);
		super.setExposeRequestAttributes(true);
		
		initBaseTemplatePath(servletContext);
		initSharedFunction();
	}
1069072
private void init(String xmlPath) throws MalformedURLException, IOException{
		
		XML xml = new XML(true, xmlPath);
		if(!xml.isInheritedMapped(configuredClass))
			Error.classNotMapped(configuredClass);
		
		for (Class<?> classe :getClasses(xml)){
			relationalManyToOneMapper.put(classe.getName(), new JMapper(configuredClass, classe,ChooseConfig.DESTINATION, xmlPath));
			relationalOneToManyMapper.put(classe.getName(), new JMapper(classe, configuredClass,ChooseConfig.SOURCE, xmlPath));
		}
	}
513287
void convertWith(Converter converter, String... attributes) {
        for (String attribute : attributes) {
            convertWith(converter, attribute);
        }
    }