com.perforce.p4java.impl.mapbased.rpc.func.helper
Class MapUnmapper

java.lang.Object
  extended by 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 Summary
MapUnmapper()
           
 
Method Summary
static String replaceNewlines(String str)
          Replace all but the last newline in the incoming string with newline / tab pairs.
static void unmapBranchMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a BranchSpec spec.
static void unmapChangelistMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a change list.
static void unmapClientMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a client map.
static void unmapDepotMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a depot map.
static void unmapJobMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a job.
static void unmapLabelMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a Label Perforce label.
static void unmapProtectionEntriesMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a list of protection entries.
static void unmapStreamMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a stream map.
static void unmapTriggerEntriesMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a list of trigger entries.
static void unmapUserGroupMap(Map<String,Object> inMap, StringBuffer strBuf)
          Unmap a Perforce user group map.
static void unmapUserMap(Map<String,Object> inMap, 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(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 -
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 -
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 -
strBuf -

unmapUserMap

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

Parameters:
inMap -
strBuf -

unmapUserGroupMap

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

Parameters:
inMap -
strBuf -

unmapLabelMap

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

Parameters:
inMap -
strBuf -

unmapBranchMap

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

Parameters:
inMap -
strBuf -

unmapDepotMap

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

Parameters:
inMap -
strBuf -

unmapProtectionEntriesMap

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

Parameters:
inMap -
strBuf -

unmapStreamMap

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

Parameters:
inMap -
strBuf -

unmapTriggerEntriesMap

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

Parameters:
inMap -
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 -
Returns:
replaced string


Copyright © 2015 Perforce Software. All Rights Reserved.