package com.perforce.p4java_ext; import com.perforce.p4java.exception.P4JavaException; import java.util.Map; /** * Access to the "p4 protect" command. The P4Connection should have correct * permissions. */ public interface P4Protect extends P4Connection, P4Errors { static P4Protect fromConnection(P4Connection conn) { return new DefaultP4Protect(conn); } /** * Loads the protect table via "p4 protect -o" */ default ProtectSpec load() { try { String[] opts = new String[]{"-o"}; Map<String, Object>[] results = getOptionsServer().execMapCmd("protect", opts, null); checkError(results); if (results.length != 1) { throw new IllegalStateException("results.length != 1"); } return new ProtectSpec(results[0]); } catch (P4JavaException e) { throw new P4Exception(e); } } /** * Updates the protect table using "p4 protect -i" */ default void save(ProtectSpec protectSpec) { try { String[] opts = new String[]{"-i"}; Map<String, Object>[] results = getOptionsServer().execMapCmd("protect", opts, protectSpec.getProtectionsMap()); checkError(results); } catch (P4JavaException e) { throw new P4Exception(e); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 9086 | tjuricek |
0.1.0 Initial release of p4java_ext Mostly just contains enough of the P4 API to build the test data initializer. About 4 commands have minimal testing, so it works. Kind of. |
||
#1 | 9085 | tjuricek | First import of the project, before package refactoring. |