Class MapUnmapper


  • public class MapUnmapper
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      MapUnmapper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String replaceNewlines​(java.lang.String str)
      Replace all but the last newline in the incoming string with newline / tab pairs.
      static void unmapBranchMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a BranchSpec spec.
      static void unmapChangelistMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a change list.
      static void unmapClientMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a client map.
      static void unmapDepotMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a depot map.
      static void unmapExtensionMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)  
      static void unmapJobMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a job.
      static void unmapLabelMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a Label Perforce label.
      static void unmapLicenseMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)  
      static void unmapProtectionEntriesMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a list of protection entries.
      static void unmapSpecMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a spec.
      static void unmapStreamMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a stream map.
      static void unmapTriggerEntriesMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a list of trigger entries.
      static void unmapUserGroupMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a Perforce user group map.
      static void unmapUserMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap, java.lang.StringBuffer strBuf)
      Unmap a Perforce user map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MapUnmapper

        public MapUnmapper()
    • Method Detail

      • unmapChangelistMap

        public static void unmapChangelistMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                              java.lang.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​(java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                       java.lang.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​(java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                        java.lang.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​(java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                           java.lang.StringBuffer strBuf)
      • unmapExtensionMap

        public static void unmapExtensionMap​(java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                             java.lang.StringBuffer strBuf)
      • unmapClientMap

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

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

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

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

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

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

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

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

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

        public static java.lang.String replaceNewlines​(java.lang.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