Class Helper

java.lang.Object
de.foellix.aql.helper.Helper

public class Helper extends Object
  • Field Details

  • Constructor Details

    • Helper

      public Helper()
  • Method Details

    • cut

      public static String cut(String input, String from, String to)
    • cutFromFirstToLast

      public static String cutFromFirstToLast(String input, String fromFirst, String toLast)
    • cut

      public static String cut(String input, String from)
    • cut

      public static String cut(String input, String from, String to, int fromOccurence)
    • cut

      public static String cut(String input, String from, int fromOccurence)
    • cutFromStart

      public static String cutFromStart(String input, String to)
    • cutFromStart

      public static String cutFromStart(String input, String to, int toOccurence)
    • countStringOccurences

      public static int countStringOccurences(String haystack, String needle)
    • replaceFirst

      public static String replaceFirst(String input, String needle, String replacement)
      Replace first no regEx!
      Parameters:
      input -
      needle -
      replacement -
      Returns:
      input with needle replaced by replacement
    • replaceAll

      public static String replaceAll(String input, String needle, String replacement)
      Replace all no regEx!
      Parameters:
      input -
      needle -
      replacement -
      Returns:
      input with needle replaced by replacement
    • soiToType

      public static int soiToType(String soi)
    • typeToSoi

      public static String typeToSoi(int type)
    • copy

      public static Answer copy(Answer answer)
    • copy

      public static Reference copy(Reference reference)
    • createReference

      public static Reference createReference(String aqlQueryReference)
    • createStatement

      public static Statement createStatement(String jimpleString)
    • createStatement

      public static Statement createStatement(String jimpleString, int linenumber)
    • createStatement

      public static Statement createStatement(String jimpleString, boolean assignValues)
    • createStatement

      public static Statement createStatement(String jimpleString, boolean assignValues, int linenumber)
    • getStatementfullSafe

      public static String getStatementfullSafe(Statement statement)
    • getStatementgenericSafe

      public static String getStatementgenericSafe(Statement statement)
    • toString

      public static String toString(Object item)
    • toString

      public static String toString(Answer answer)
    • toString

      public static String toString(Reference reference)
    • toString

      public static String toString(Reference reference, String separator)
    • toString

      public static String toString(Reference reference, boolean replaceQuotes)
    • toString

      public static String toString(Reference reference, String separator, boolean replaceQuotes)
    • toString

      public static String toString(Statement statement)
    • toString

      public static String toString(Statement statement, boolean replaceQuotes)
    • toStringStatement

      public static String toStringStatement(Statement statement)
    • toStringStatement

      public static String toStringStatement(Statement statement, boolean replaceQuotes)
    • toStringMethod

      public static String toStringMethod(String method)
    • toStringClass

      public static String toStringClass(String classname)
    • toStringApp

      public static String toStringApp(App app)
    • toRAW

      public static String toRAW(Object item)
    • toRAW

      public static String toRAW(Tool tool)
    • toRAW

      public static String toRAW(Flow flow)
    • toRAW

      public static String toRAW(Permission permission)
    • toRAW

      public static String toRAW(Intentsink intentsink)
    • toRAW

      public static String toRAW(Intentsource intentsource)
    • toRAW

      public static String toRAW(Reference from, Reference to)
    • toRAW

      public static String toRAW(Reference reference)
    • toRAW

      public static String toRAW(App app)
    • toString

      public static String toString(Permissions permissions)
    • toString

      public static String toString(Permission permission)
    • toString

      public static String toString(Flows flows)
    • toString

      public static String toString(Flow flow)
    • toString

      public static String toString(Sources sources)
    • toString

      public static String toString(Source source)
    • toString

      public static String toString(Sinks sinks)
    • toString

      public static String toString(Sink sink)
    • toString

      public static String toString(Intents intents)
    • toString

      public static String toString(Intents intents, boolean detailData)
    • toString

      public static String toString(Intent intent)
    • toString

      public static String toString(Intent intent, boolean detailData)
    • toString

      public static String toString(Intentfilters intentfilters)
    • toString

      public static String toString(Intentfilters intentfilters, boolean detailData)
    • toString

      public static String toString(Intentfilter intentfilter)
    • toString

      public static String toString(Intentfilter intentfilter, boolean detailData)
    • toString

      public static String toString(Intentsinks intentsinks)
    • toString

      public static String toString(Intentsinks intentsinks, boolean detailData)
    • toString

      public static String toString(Intentsink intentsink)
    • toString

      public static String toString(Intentsink intentsink, boolean detailData)
    • toString

      public static String toString(Intentsources intentsources)
    • toString

      public static String toString(Intentsources intentsources, boolean detailData)
    • toString

      public static String toString(Intentsource intentsource)
    • toString

      public static String toString(Intentsource intentsource, boolean detailData)
    • toString

      public static String toString(Attributes attributes)
    • toString

      public static String toString(Target target)
    • toString

      public static String toString(Target target, boolean detailData)
    • toString

      public static String toString(Data data)
    • toString

      public static String toString(List<Tool> tools)
    • toString

      public static String toString(Tool tool)
    • getQualifiedName

      public static String getQualifiedName(Tool tool)
    • getExternalAppFiles

      public static List<File> getExternalAppFiles(Task task)
    • getRunCommandAsArray

      public static String[] getRunCommandAsArray(String runCmd)
    • getExternalQuery

      public static String getExternalQuery(Task task)
    • getExternalQueryFiles

      public static List<File> getExternalQueryFiles(Task task)
    • getPreprocessorFiles

      public static List<File> getPreprocessorFiles(Task task)
    • replaceVariables

      public static String replaceVariables(String string, Task task)
    • replaceVariables

      public static String replaceVariables(String string, Task task, Map<String,String> customVariables)
    • replaceVariables

      public static String replaceVariables(String string, Task task, Map<String,String> customVariables, boolean useHashesAndNoDate)
    • replaceVariables

      public static String replaceVariables(String string, Task task, Map<String,String> customVariables, boolean useHashes, boolean noDate)
    • replaceCustomVariables

      public static String replaceCustomVariables(String string, Map<String,String> customVariables)
    • toVariableName

      public static String toVariableName(String variableName)
    • reportMissingVariables

      public static String reportMissingVariables(String runCmd, Task task)
    • reportMissingVariables

      public static String reportMissingVariables(String string)
    • getAnswerChildrenAsString

      public static List<FileWithHash> getAnswerChildrenAsString(Task task)
    • getAnswerFilesAsString

      public static String getAnswerFilesAsString(List<FileWithHash> answerFiles)
    • getAnswerFilesAsHash

      public static String getAnswerFilesAsHash(FileWithHash answerFile)
      Use this method to create %ANSWERSHASH% with SHA-256
      Parameters:
      answerFile - the input file
      Returns:
      the hash
    • getAnswerFilesAsHash

      public static String getAnswerFilesAsHash(FileWithHash answerFile, String hashAlgorithm)
      Use this method to create %ANSWERSHASH% of any type
      Parameters:
      answerFile - the input file
      Returns:
      the hash
    • getAnswerFilesAsHash

      public static String getAnswerFilesAsHash(List<FileWithHash> answerFiles)
      Use this method to create %ANSWERSHASH% with SHA-256
      Parameters:
      answerFiles - the input files
      Returns:
      the hash
    • getAnswerFilesAsHash

      public static String getAnswerFilesAsHash(List<FileWithHash> answerFiles, String hashAlgorithm)
      Use this method to create %ANSWERSHASH% of any type
      Parameters:
      answerFiles - the input files
      Returns:
      the hash
    • toHashedFileList

      public static List<FileWithHash> toHashedFileList(List<File> answerFiles)
      Create a hashed file list from ordinary file list
      Parameters:
      answerFiles -
      Returns:
      the hashed file list
    • toHashedFileList

      public static List<FileWithHash> toHashedFileList(List<File> answerFiles, String hashAlgorithm)
      Create a hashed file list from ordinary file list
      Parameters:
      answerFiles -
      Returns:
      the hashed file list
    • getMultipleApkName

      public static String getMultipleApkName(String name)
    • getDate

      public static String getDate()
    • getDate

      public static String getDate(long timestamp)
    • getDate

      public static String getDate(long timestamp, String format)
    • getTimestamp

      public static long getTimestamp(String dateStr, String format)
    • createApp

      public static App createApp(File file)
    • createApp

      public static App createApp(String value)
    • getAppFileString

      public static String getAppFileString(File appFile)
    • getPid

      public static long getPid(Process p)
    • getFrom

      public static Reference getFrom(Flow flow)
    • getFrom

      public static Reference getFrom(List<Reference> references)
    • getTo

      public static Reference getTo(Flow flow)
    • getTo

      public static Reference getTo(List<Reference> references)
    • removeRedundant

      public static Answer removeRedundant(Answer answer, EqualsOptions options)
    • maximizeInformation

      public static void maximizeInformation(Answer answer, EqualsOptions options, boolean parametersAndLinenumbersOnly)
    • getCardinality

      public static int getCardinality(Tool tool, String operator)
    • lastFileModified

      public static File lastFileModified(File directory)
    • replaceNull

      public static String replaceNull(String input, String replacement)
    • extractDataFromURI

      public static void extractDataFromURI(String uri, Data data)
    • extractDataFromAuthority

      public static void extractDataFromAuthority(String authority, Data data)
    • isEmpty

      public static boolean isEmpty(Answer answer)
    • isEmpty

      public static boolean isEmpty(Target target)
    • isEmpty

      public static boolean isEmpty(Reference reference)
    • getAllReferences

      public static Collection<Reference> getAllReferences(Answer answer)
    • getAllReferences

      public static Collection<Reference> getAllReferences(Answer answer, boolean doubleEntriesAllowed)
    • replaceAllWhiteSpaceChars

      public static String replaceAllWhiteSpaceChars(String string)
    • replaceAllWhiteSpaceChars

      public static String replaceAllWhiteSpaceChars(String string, boolean removeTrailingWhiteSpace)
    • replaceDoubleSpaces

      public static String replaceDoubleSpaces(String input)
    • getConverterParent

      public static ConverterTask getConverterParent(Task task)
    • autoformat

      public static String autoformat(String query)
    • autoformat

      public static String autoformat(String query, boolean breaklines)
    • getAppFromData

      public static String getAppFromData(TaskInfo taskInfo)
    • getLineNumberSafe

      public static int getLineNumberSafe(Reference reference)
    • getLineNumberSafe

      public static int getLineNumberSafe(Statement statement)
    • contains

      public static boolean contains(List<IStringOrQuestion> list, String needle)
      Checks if needle ist contained in the given list.
      Parameters:
      list -
      needle - Provide needle without "'" at start and end of the string.
      Returns:
      true if contained.
    • getAttributeByName

      public static Attribute getAttributeByName(Attributes attributes, String name)
    • getAttributeByName

      public static Attribute getAttributeByName(List<Attribute> attributes, String name)
    • cleanupParameters

      public static String cleanupParameters(String jimpleInvokeString)
    • getURL

      public static URL getURL(String url)
    • getAllDefaultVariableNames

      public static Set<String> getAllDefaultVariableNames()
    • addZeroDigits

      public static String addZeroDigits(int id)
      Appends zeros to the start of the id.
      Parameters:
      id - given id
      Returns:
      the required sequence of '0's and the given id
    • addZeroDigits

      public static String addZeroDigits(long id)
      Appends zeros to the start of the id.
      Parameters:
      id - given id
      Returns:
      the required sequence of '0's and the given id
    • addZeroDigits

      public static String addZeroDigits(int id, int length)
      Appends zeros to the start of the id until the given string length is reached.
      Parameters:
      id - given id
      length - targeted sting length
      Returns:
      the required sequence of '0's and the given id
    • addZeroDigits

      public static String addZeroDigits(long id, int length)
      Appends zeros to the start of the id until the given string length is reached.
      Parameters:
      id - given id
      length - targeted sting length
      Returns:
      the required sequence of '0's and the given id
    • shorten

      public static String shorten(String string, int numberOrLines)
    • getFeedbackFromFile

      public static String getFeedbackFromFile(File file)
      Returns feedback message if given file is a feedback file. Otherwise return null.
      Parameters:
      file - Potential feedback file
      Returns:
      feedback as String or null