Utils (The Data transfer common objects 2.0.0-3.7.0 API)
Date: 2015-05-19

org.gcube.datatransfer.common.utils

## Class Utils

- java.lang.Object
- - org.gcube.datatransfer.common.utils.Utils

-     public class Utils
      extends Object

  Author:
    Fabio Simeoni (FAO), Andrea Manzi (CERN)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Utils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `copyfile(File f1, File f2)`
    `static void` | `copyfileToFolder(File file, File outFolder, String fileName)`
    `static <T extends TransferOutcome> ArrayList<T>` | `getFileOutcomes(String outcomeRSURI)`
    `static org.gcube.data.trees.patterns.Pattern` | `getPattern(Types.AnyHolder h)` Converts a `Types.AnyHolder` returned by the service into a `Pattern`.
    `static <T extends TransferOutcome> ArrayList<T>` | `getTreeOutcomes(String outcomeRSURI)`
    `static <E extends org.gcube.common.core.faults.GCUBEFault> E` | `newFault(E fault, Throwable cause)` Returns a given fault after serialising into it an original cause.
    `static Types.AnyHolder` | `toHolder(Element e)`
    `static Types.AnyHolder` | `toHolder(org.gcube.data.trees.data.Node n)` Transforms a `Node` into a `Types.AnyHolder` accepted by the service.
    `static Types.AnyHolder` | `toHolder(org.gcube.data.trees.patterns.Pattern p)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Utils

          public Utils()

  - ### Method Detail

    - #### getPattern

          public static org.gcube.data.trees.patterns.Pattern getPattern(Types.AnyHolder h)
                                                                  throws Exception

      Converts a `Types.AnyHolder` returned by the service into a `Pattern`.
      Parameters:
        `h` - the holder
      Returns:
        the pattern
      Throws:
        `Exception` - if the conversion fails

    - #### toHolder

          public static Types.AnyHolder toHolder(org.gcube.data.trees.patterns.Pattern p)
                                          throws Exception

      Throws:
        `Exception`

    - #### toHolder

          public static Types.AnyHolder toHolder(Element e)

    - #### toHolder

          public static Types.AnyHolder toHolder(org.gcube.data.trees.data.Node n)
                                          throws Exception

      Transforms a `Node` into a `Types.AnyHolder` accepted by the service.
      Parameters:
        `n` - the node
      Returns:
        the holder
      Throws:
        `Exception` - if the conversion fails

    - #### copyfile

          public static void copyfile(File f1,
                      File f2)
                               throws IOException

      Throws:
        `IOException`

    - #### newFault

          public static <E extends org.gcube.common.core.faults.GCUBEFault> E newFault(E fault,
                                                                       Throwable cause)

      Returns a given fault after serialising into it an original cause.
      Type Parameters:
        `E` - the type of the fault
      Parameters:
        `fault` - the fault
        `cause` - the cause
      Returns:
        the fault

    - #### copyfileToFolder

          public static void copyfileToFolder(File file,
                              File outFolder,
                              String fileName)
                                       throws IOException

      Throws:
        `IOException`

    - #### getFileOutcomes

          public static <T extends TransferOutcome> ArrayList<T> getFileOutcomes(String outcomeRSURI)
                                                                      throws Exception

      Throws:
        `Exception`

    - #### getTreeOutcomes

          public static <T extends TransferOutcome> ArrayList<T> getTreeOutcomes(String outcomeRSURI)
                                                                      throws Exception

      Throws:
        `Exception`

Copyright © 2015. All Rights Reserved.