[Pki-devel] [PATCH] 535 Removed profile input/output IDs from CLI output.

Endi Sukma Dewata edewata at redhat.com
Fri Nov 21 21:52:40 UTC 2014


The current profile inputs/outputs do not have meaningful IDs
(e.g. i1, i2, o1) and are not used by the client so they should
not be displayed in the CLI output.

In the future the IDs should be renamed into something meaningful
(e.g. keygen, sn, cert) and the inputs/outputs should be retrieved
by ID. New methods have been added to retrieve by ID.

https://fedorahosted.org/pki/ticket/1147

-- 
Endi S. Dewata
-------------- next part --------------
From 98a336c6fc89c5205b3324447800fc2ea326408f Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata at redhat.com>
Date: Fri, 21 Nov 2014 16:16:33 -0500
Subject: [PATCH] Removed profile input/output IDs from CLI output.

The current profile inputs/outputs do not have meaningful IDs
(e.g. i1, i2, o1) and are not used by the client so they should
not be displayed in the CLI output.

In the future the IDs should be renamed into something meaningful
(e.g. keygen, sn, cert) and the inputs/outputs should be retrieved
by ID. New methods have been added to retrieve by ID.

https://fedorahosted.org/pki/ticket/1147
---
 .../certsrv/cert/CertEnrollmentRequest.java        | 26 ++++++++++++++++++++++
 .../com/netscape/cmstools/profile/ProfileCLI.java  |  4 ----
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/base/common/src/com/netscape/certsrv/cert/CertEnrollmentRequest.java b/base/common/src/com/netscape/certsrv/cert/CertEnrollmentRequest.java
index 732efae0a638a2abd4a330881abef5c2c3b1655d..72aad330fecc63290c9e6d82e576971df499028e 100644
--- a/base/common/src/com/netscape/certsrv/cert/CertEnrollmentRequest.java
+++ b/base/common/src/com/netscape/certsrv/cert/CertEnrollmentRequest.java
@@ -144,7 +144,12 @@ public class CertEnrollmentRequest {
         return newInput;
     }
 
+    // TODO: deprecate this method in 10.3
     public ProfileInput getInput(String name) {
+        return getInputByName(name);
+    }
+
+    public ProfileInput getInputByName(String name) {
         for (ProfileInput input : inputs) {
             if (input.getName().equals(name))
                 return input;
@@ -152,6 +157,14 @@ public class CertEnrollmentRequest {
         return null;
     }
 
+    public ProfileInput getInputByID(String id) {
+        for (ProfileInput input : inputs) {
+            if (input.getId().equals(id))
+                return input;
+        }
+        return null;
+    }
+
     public void addOutput(ProfileOutput output) {
         ProfileOutput curOutput = getOutput(output.getName());
         if (curOutput != null) {
@@ -167,7 +180,12 @@ public class CertEnrollmentRequest {
         }
     }
 
+    // TODO: deprecate this method in 10.3
     public ProfileOutput getOutput(String name) {
+        return getOutputByName(name);
+    }
+
+    public ProfileOutput getOutputByName(String name) {
         for (ProfileOutput output : outputs) {
             if (output.getName().equals(name))
                 return output;
@@ -175,6 +193,14 @@ public class CertEnrollmentRequest {
         return null;
     }
 
+    public ProfileOutput getOutputByID(String id) {
+        for (ProfileOutput output : outputs) {
+            if (output.getId().equals(id))
+                return output;
+        }
+        return null;
+    }
+
     public HashMap<String, String> toParams() {
         HashMap<String, String> ret = new HashMap<String, String>();
         ret.put("isRenewal", Boolean.valueOf(renewal).toString());
diff --git a/base/java-tools/src/com/netscape/cmstools/profile/ProfileCLI.java b/base/java-tools/src/com/netscape/cmstools/profile/ProfileCLI.java
index 732b597afd1dbb5b9440d451f34b2f39e20fb904..6d8c6b655ced3807ac01364fe304b422986de567 100644
--- a/base/java-tools/src/com/netscape/cmstools/profile/ProfileCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/profile/ProfileCLI.java
@@ -79,7 +79,6 @@ public class ProfileCLI extends CLI {
 
         for (ProfileInput input: data.getInputs()) {
             System.out.println();
-            System.out.println("  Input ID: " + input.getId());
             System.out.println("  Name: " + input.getName());
             System.out.println("  Class: " + input.getClassId());
             for (ProfileAttribute attr : input.getAttributes()) {
@@ -94,7 +93,6 @@ public class ProfileCLI extends CLI {
 
         for (ProfileOutput output: data.getOutputs()) {
             System.out.println();
-            System.out.println("  Output ID: " + output.getId());
             System.out.println("  Name: " + output.getName());
             System.out.println("  Class: " + output.getClassId());
             for (ProfileAttribute attr: output.getAttrs()) {
@@ -148,7 +146,6 @@ public class ProfileCLI extends CLI {
 
         for (ProfileInput input: request.getInputs()) {
             System.out.println();
-            System.out.println("  Input ID: " + input.getId());
             System.out.println("  Name: " + input.getName());
             System.out.println("  Class: " + input.getClassId());
             for (ProfileAttribute attr : input.getAttributes()) {
@@ -163,7 +160,6 @@ public class ProfileCLI extends CLI {
 
         for (ProfileOutput output: request.getOutputs()) {
             System.out.println();
-            System.out.println("  Output ID: " + output.getId());
             System.out.println("  Name: " + output.getName());
             System.out.println("  Class: " + output.getClassId());
             for (ProfileAttribute attr: output.getAttrs()) {
-- 
1.8.4.2



More information about the Pki-devel mailing list