java.lang.Object
com.perforce.p4java.impl.mapbased.rpc.func.helper.MapUnmapper

public class MapUnmapper extends Object
Provides unmapping services to the P4Java RPC implementation. These are not what they probably sound like -- they're basically a way to serialise an input map for something like a changelist or job onto a single byte buffer to be sent to the server as a single data argument with newlines, tabs, etc.

The need for this will probably go away when we refactor the upper levels of P4Java to optimise and rationalise the use of maps overall.

  • Constructor Details

    • MapUnmapper

      public MapUnmapper()
  • Method Details

    • unmapChangelistMap

      public static void unmapChangelistMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a change list. Absolutely no sanity or other checks are done on the passed-in map...
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapJobMap

      public static void unmapJobMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a job. Jobs basically have free format defined by the associated jobspec (which we don't have access to here), so we have to try to the best we can with what we've got -- which is to dump the map to the strbuf while guessing at things like string formats, etc. This may prove error-prone in the long run.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapSpecMap

      public static void unmapSpecMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a spec. specs basically have free format so we have to try to the best we can with what we've got -- which is to dump the map to the strbuf while guessing at things like string formats, etc. This may prove error-prone in the long run.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapLicenseMap

      public static void unmapLicenseMap(Map<String,Object> inMap, StringBuffer strBuf)
    • unmapExtensionMap

      public static void unmapExtensionMap(Map<String,Object> inMap, StringBuffer strBuf)
    • unmapClientMap

      public static void unmapClientMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a client map. Similar in intent and execution to unmapJobMap.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapUserMap

      public static void unmapUserMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a Perforce user map.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapUserGroupMap

      public static void unmapUserGroupMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a Perforce user group map.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapLabelMap

      public static void unmapLabelMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a Label Perforce label.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapBranchMap

      public static void unmapBranchMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a BranchSpec spec.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapDepotMap

      public static void unmapDepotMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a depot map.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapProtectionEntriesMap

      public static void unmapProtectionEntriesMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a list of protection entries.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapStreamMap

      public static void unmapStreamMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a stream map.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • unmapTriggerEntriesMap

      public static void unmapTriggerEntriesMap(Map<String,Object> inMap, StringBuffer strBuf)
      Unmap a list of trigger entries.
      Parameters:
      inMap - inMap
      strBuf - strBuf
    • replaceNewlines

      public static String replaceNewlines(String str)
      Replace all but the last newline in the incoming string with newline / tab pairs. Useful for various multi-line form inputs.
      Parameters:
      str - string
      Returns:
      replaced string