package com.perforce.p4java_ext; import java.util.Map; /** * Wraps the output of P4User with some helper methods to access common * attributes. */ public class UserSpec { private Map<String, Object> userMap; public UserSpec(Map<String, Object> userMap) { this.userMap = userMap; } public Map<String, Object> getUserMap() { return userMap; } public void setUserMap(Map<String, Object> userMap) { this.userMap = userMap; } /** * A lot of values come out of the API with space, etc, appended, so this just makes sure the * value is just a normal string, cleaning up most client calls. * * @param key The client property, e.g., "Client", "Owner" * @return String value of the property */ public String get(String key) { return ((String) userMap.get(key)).trim(); } public void put(String key, String value) { userMap.put(key, value); } public String getLogin() { return get("User"); } public void setLogin(String login) { put("User", login); } public String getEmail() { return get("Email"); } public void setEmail(String email) { put("Email", email); } public String getFullName() { return get("FullName"); } public void setFullName(String fullName) { put("FullName", fullName); } public String getPassword() { // TODO I'm not sure this returns anything return get("Password"); } public void setPassword(String password) { put("Password", password); } public String getType() { return get("Type"); } public void setType(String type) { put("Type", type); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserSpec userSpec = (UserSpec) o; if (userMap != null ? !userMap.equals(userSpec.userMap) : userSpec.userMap != null) return false; return true; } @Override public int hashCode() { return userMap != null ? userMap.hashCode() : 0; } @Override public String toString() { return "UserSpec{" + "userMap=" + userMap + '}'; } }
# | 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. |