juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject svn commit: r1560572 - in /juddi/trunk/juddi-gui/src/main: java/org/apache/juddi/webconsole/hub/ resources/org/apache/juddi/webconsole/resources/ webapp/ webapp/ajax/
Date Thu, 23 Jan 2014 01:56:39 GMT
Author: alexoree
Date: Thu Jan 23 01:56:39 2014
New Revision: 1560572

URL: http://svn.apache.org/r1560572
Log:
JUDDI-803 fixed
JUDDI-804 fixed

Modified:
    juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java
    juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties
    juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties
    juddi/trunk/juddi-gui/src/main/webapp/ajax/tmodel.jsp
    juddi/trunk/juddi-gui/src/main/webapp/tmodelPartitions.jsp

Modified: juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java?rev=1560572&r1=1560571&r2=1560572&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java (original)
+++ juddi/trunk/juddi-gui/src/main/java/org/apache/juddi/webconsole/hub/UddiHub.java Thu Jan
23 01:56:39 2014
@@ -417,12 +417,13 @@ public class UddiHub implements Serializ
                 return nodename;
         }
 
-        private boolean NodeExists(String newnode){
+        private boolean NodeExists(String newnode) {
                 try {
                         List<Node> uddiNodeList = GetJuddiClientConfig().getUDDINodeList();
-                        for (int i=0; i < uddiNodeList.size(); i++){
-                                if (uddiNodeList.get(i).getName().equals(newnode))
+                        for (int i = 0; i < uddiNodeList.size(); i++) {
+                                if (uddiNodeList.get(i).getName().equals(newnode)) {
                                         return true;
+                                }
                         }
                 } catch (ConfigurationException ex) {
                         log.error(ex);
@@ -430,13 +431,15 @@ public class UddiHub implements Serializ
                 }
                 return false;
         }
+
         public String switchNodes(String newnode) {
                 if (!this.nodename.equalsIgnoreCase(newnode) && NodeExists(newnode))
{
                         this.die();
                         clientConfig = null;
                         this.nodename = newnode;
+                } else {
+                        return ResourceLoader.GetResource(session, "error.nodeexists");
                 }
-                else return ResourceLoader.GetResource(session, "error.nodeexists");
                 EnsureConfig();
                 return this.nodename;
         }
@@ -535,7 +538,7 @@ public class UddiHub implements Serializ
                         } catch (Exception ex) {
                                 log.error(ex);
                         }
-                        if (session!=null && session.getAttribute("username") !=
null
+                        if (session != null && session.getAttribute("username") !=
null
                                 && session.getAttribute("password") != null) {
                                 req.setUserID((String) session.getAttribute("username"));
                                 req.setCred(AES.Decrypt((String) session.getAttribute("password"),
(String) properties.get("key")));
@@ -1204,12 +1207,15 @@ public class UddiHub implements Serializ
          * @return string
          */
         public String AddTmodelKenGenerator(String partitionName, String name, String lang)
{
+                if (partitionName == null || partitionName.equalsIgnoreCase(ResourceLoader.GetResource(session,
"items.clicktoedit"))) {
+                        return ToErrorAlert(ResourceLoader.GetResource(session, "errors.noinput"));
+                }
                 try {
-                        if (!partitionName.startsWith("uddi:")) {
+                        if (!partitionName.toLowerCase().startsWith("uddi:")) {
                                 return ResourceLoader.GetResource(session, "errors.tmodel.prefix");
 
                         }
-                        if (!partitionName.endsWith(":keygenerator")) {
+                        if (!partitionName.toLowerCase().endsWith(":keygenerator")) {
                                 return ResourceLoader.GetResource(session, "errors.tmodel.postfix");
                         }
 
@@ -1237,11 +1243,13 @@ public class UddiHub implements Serializ
                         tm.getOverviewDoc().add(overviewDoc);
                         tm.setTModelKey(partitionName.toLowerCase());
                         st.getTModel().add(tm);
-                        publish.saveTModel(st);
-                        return ResourceLoader.GetResource(session, "messages.success");
+                        TModelDetail saveTModel = publish.saveTModel(st);
+                        return "<div class=\"alert alert-success\"><i class=\"icon-2x
icon-thumbs-up\"></i> " + ResourceLoader.GetResource(session, "messages.success")
+ " <a href=\"tmodelEditor.jsp?id="
+                                + URLEncoder.encode(saveTModel.getTModel().get(0).getTModelKey(),
"UTF8") + "\">"
+                                + StringEscapeUtils.escapeHtml(saveTModel.getTModel().get(0).getTModelKey())
+ "</a></div>";
                         // "Success";
                 } catch (Exception ex) {
-                        return HandleException(ex);
+                        return ToErrorAlert(HandleException(ex));
                 }
         }
 
@@ -1579,10 +1587,12 @@ public class UddiHub implements Serializ
                                         fb.getTModelBag().getTModelKey().add(parameters);
                                         break;
                                 case uid:
-                                        BusinessEntity t = GetBusinessDetails(parameters);
+                                        //BusinessEntity t = GetBusinessDetails(parameters);
                                         findBusiness = new BindingDetail();
                                         BindingTemplate bt = GetBindingDetailsAsObject(parameters);
-                                        findBusiness.getBindingTemplate().add(bt);
+                                        if (bt != null) {
+                                                findBusiness.getBindingTemplate().add(bt);
+                                        }
 
                                         break;
 
@@ -1602,7 +1612,7 @@ public class UddiHub implements Serializ
                                 }
 
                         }
-                        if (findBusiness != null && findBusiness.getBindingTemplate()
!= null) {
+                        if (findBusiness != null && !findBusiness.getBindingTemplate().isEmpty())
{
                                 StringBuilder sb = new StringBuilder();
                                 sb.append("<table class=\"table\">");
                                 for (int i = 0; i < findBusiness.getBindingTemplate().size();
i++) {
@@ -1666,12 +1676,13 @@ public class UddiHub implements Serializ
                                 case uid:
                                         BusinessEntity t = GetBusinessDetails(parameters);
                                         findBusiness = new BusinessList();
-                                        findBusiness.setBusinessInfos(new BusinessInfos());
-
-                                        BusinessInfo bd = new BusinessInfo();
-                                        bd.setBusinessKey(t.getBusinessKey());
-                                        bd.getName().addAll(t.getName());
-                                        findBusiness.getBusinessInfos().getBusinessInfo().add(bd);
+                                        if (t != null) {
+                                                findBusiness.setBusinessInfos(new BusinessInfos());
+                                                BusinessInfo bd = new BusinessInfo();
+                                                bd.setBusinessKey(t.getBusinessKey());
+                                                bd.getName().addAll(t.getName());
+                                                findBusiness.getBusinessInfos().getBusinessInfo().add(bd);
+                                        }
                                         break;
 
                         }
@@ -1805,11 +1816,12 @@ public class UddiHub implements Serializ
                                         fb.getTModelBag().getTModelKey().add(parameters);
                                         break;
                                 case uid:
-                                        BusinessEntity t = GetBusinessDetails(parameters);
+
                                         findBusiness = new ServiceList();
-                                        findBusiness.setServiceInfos(new ServiceInfos());
+                                        
                                         BusinessService GetServiceDetail = GetServiceDetail(parameters);
                                         if (GetServiceDetail != null) {
+                                                findBusiness.setServiceInfos(new ServiceInfos());
                                                 ServiceInfo si = new ServiceInfo();
                                                 si.setBusinessKey(GetServiceDetail.getBusinessKey());
                                                 si.setServiceKey(GetServiceDetail.getServiceKey());
@@ -1834,7 +1846,7 @@ public class UddiHub implements Serializ
                                 }
 
                         }
-                        if (findBusiness.getServiceInfos() != null) {
+                        if (findBusiness!=null && findBusiness.getServiceInfos()
!= null) {
                                 StringBuilder sb = new StringBuilder();
                                 sb.append("<table class=\"table\">");
                                 for (int i = 0; i < findBusiness.getServiceInfos().getServiceInfo().size();
i++) {
@@ -1866,11 +1878,11 @@ public class UddiHub implements Serializ
                         fb.setAuthInfo(GetToken());
                         if (fq != null) {
                                 fb.setFindQualifiers(new org.uddi.api_v3.FindQualifiers());
-                                if (fq != null) {
-                                        for (int i = 0; i < fq.length; i++) {
-                                                fb.getFindQualifiers().getFindQualifier().add(fq[i]);
-                                        }
+
+                                for (int i = 0; i < fq.length; i++) {
+                                        fb.getFindQualifiers().getFindQualifier().add(fq[i]);
                                 }
+
                         }
                         TModelList findBusiness = null;
                         switch (criteria) {
@@ -1891,18 +1903,18 @@ public class UddiHub implements Serializ
                                         KeyedReference kr2 = new KeyedReference();
                                         kr2.setTModelKey(parameters);
                                         fb.getCategoryBag().getKeyedReference().add(kr2);
-                                        //TODO
                                         break;
                                 case uid:
-                                        BusinessEntity t = GetBusinessDetails(parameters);
                                         TModel tmodelDetails = this.getTmodelDetails(parameters);
-                                        TModelInfo tmi = new TModelInfo();
-                                        tmi.setName(tmodelDetails.getName());
-                                        tmi.setTModelKey(tmodelDetails.getTModelKey());
-                                        tmi.getDescription().addAll(tmodelDetails.getDescription());
-                                        findBusiness.setTModelInfos(new TModelInfos());
-                                        findBusiness.getTModelInfos().getTModelInfo().add(tmi);
-
+                                        findBusiness = new TModelList();
+                                        if (tmodelDetails != null) {
+                                                findBusiness.setTModelInfos(new TModelInfos());
+                                                TModelInfo tmi = new TModelInfo();
+                                                tmi.setName(tmodelDetails.getName());
+                                                tmi.setTModelKey(tmodelDetails.getTModelKey());
+                                                tmi.getDescription().addAll(tmodelDetails.getDescription());
+                                                findBusiness.getTModelInfos().getTModelInfo().add(tmi);
+                                        }
                                         break;
 
                         }

Modified: juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties?rev=1560572&r1=1560571&r2=1560572&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties
(original)
+++ juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web.properties
Thu Jan 23 01:56:39 2014
@@ -404,3 +404,4 @@ items.nowconnectedto=Now connected to th
 error.nodeexists=The proposed node does not exist!
 error.nopassword=Please enter a password
 error.nousername=Please enter a username
+actions.result=Results

Modified: juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties?rev=1560572&r1=1560571&r2=1560572&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties
(original)
+++ juddi/trunk/juddi-gui/src/main/resources/org/apache/juddi/webconsole/resources/web_es.properties
Thu Jan 23 01:56:39 2014
@@ -406,3 +406,4 @@ items.nowconnectedto=Ahora conectado al 
 error.nodeexists=El nodo propuesto no existe!
 error.nopassword=Por favor, ingrese una contrase\u00f1a
 error.nousername=Por favor, introduzca un nombre de usuario
+actions.result=Resultados

Modified: juddi/trunk/juddi-gui/src/main/webapp/ajax/tmodel.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/webapp/ajax/tmodel.jsp?rev=1560572&r1=1560571&r2=1560572&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/webapp/ajax/tmodel.jsp (original)
+++ juddi/trunk/juddi-gui/src/main/webapp/ajax/tmodel.jsp Thu Jan 23 01:56:39 2014
@@ -6,13 +6,22 @@
 
 <%@page import="org.apache.juddi.webconsole.hub.UddiHub"%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
-<!DOCTYPE html>
-<%    
-    UddiHub hub = UddiHub.getInstance(application, session);
-    if (request.getParameter("action") != null) { 
-        String action = request.getParameter("action");
-        if (action.equalsIgnoreCase("createKeyGen")) {
-            out.write(hub.AddTmodelKenGenerator(request.getParameter("key"),request.getParameter("name"),
request.getParameter("lang")));
+<%@include  file="../csrf.jsp" %>
+<%        UddiHub hub = UddiHub.getInstance(application, session);
+        if (request.getMethod().equalsIgnoreCase("POST")) {
+                if (request.getParameter("action") != null) {
+                        String action = request.getParameter("action");
+                        if (action.equalsIgnoreCase("createKeyGen")) {
+                                out.write(hub.AddTmodelKenGenerator(request.getParameter("keygen"),

+                                        request.getParameter("keyname"), 
+                                        request.getParameter("keylang")));
+                        } else {
+                                response.sendRedirect("/index.jsp");
+                        }
+                } else {
+                        response.sendRedirect("/index.jsp");
+                }
+        } else {
+                response.sendRedirect("/index.jsp");
         }
-    }
 %>

Modified: juddi/trunk/juddi-gui/src/main/webapp/tmodelPartitions.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/webapp/tmodelPartitions.jsp?rev=1560572&r1=1560571&r2=1560572&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/webapp/tmodelPartitions.jsp (original)
+++ juddi/trunk/juddi-gui/src/main/webapp/tmodelPartitions.jsp Thu Jan 23 01:56:39 2014
@@ -10,48 +10,100 @@
 <%@include file="header-top.jsp" %>
 <div class="container">
 
-    <!-- Main hero unit for a primary marketing message or call to action -->
-    <div class="well" >
-        <h1><%=ResourceLoader.GetResource(session, "pages.tmodelpart.title")%></h1>
-    </div>
-
-    <!-- Example row of columns -->
-    <div class="row">
-        <div class="span12" >
-            
-            <div id="container">
-                <%=ResourceLoader.GetResource(session, "pages.tmodelpart.content")%>
-                <br><br>
-                <div class="alert alert-info">
-                <i class="icon-info-sign  icon-large"></i> <%=ResourceLoader.GetResource(session,
"pages.tmodelpart.juddinote")%></div>
-                <br><Br>
-                <table class="table">
-                    <tr><td><%=ResourceLoader.GetResource(session, "pages.tmodelpart.key")%></td><td><input
type="text" value="uddi:www.mycompany.com:keyGenerator" id="keyGeneratorKey"  style="width:100%"></td></tr>
-                    <tr><td><%=ResourceLoader.GetResource(session, "pages.thmodepart.name")%></td><td><input
type="text" value="My business's key generator" id="keyGeneratorName" style="width:100%"></td></tr>
-                    <tr><td><%=ResourceLoader.GetResource(session, "items.lang")%></td><td><input
type="text" value="<%=ResourceLoader.GetResource(session, "language")%>" id="keyGeneratorLang"
style="width:100%"></td></tr>
-                </table>
-                                
-                <a class="btn btn-primary" title="Save" id="savekeygen" onclick="javascript:savekeygen();">
-                   <i class="icon-save icon-large"></i> 
-                    <%=ResourceLoader.GetResource(session, "actions.save")%></a>
-            </div>
-            <div id="results"></div>
-            <script type="text/javascript">
-                function savekeygen()
-                {
-                     $("#results").html("<img src=\"img");
-                    $("#savekeygen").addClass("disabled");
-                    var keygen=$("#keyGeneratorKey").val();
-                    var keyname=$("#keyGeneratorName").val();
-                    var keylang=$("#keyGeneratorLang").val();
-                    $.get("ajax/tmodel.jsp?action=createKeyGen&key=" + keygen + "&name="
+ keyname + "&lang=" + keylang,
-                    function(data) {
-                        $("#results").html(data);
-                        $("#savekeygen").removeClass("disabled");
-                    });
-                }
-            </script>
+        <!-- Main hero unit for a primary marketing message or call to action -->
+        <div class="well" >
+                <h1><%=ResourceLoader.GetResource(session, "pages.tmodelpart.title")%></h1>
+        </div>
+
+        <!-- Example row of columns -->
+        <div class="row">
+                <div class="span12" >
+
+                        <div id="container">
+                                <%=ResourceLoader.GetResource(session, "pages.tmodelpart.content")%>
+                                <br><br>
+                                <div class="alert alert-info">
+                                        <i class="icon-info-sign  icon-large"></i>
<%=ResourceLoader.GetResource(session, "pages.tmodelpart.juddinote")%></div>
+                                <br><Br>
+                                <table class="table">
+                                        <tr><td><%=ResourceLoader.GetResource(session,
"pages.tmodelpart.key")%></td><td><input type="text" value="uddi:www.mycompany.com:keygenerator"
id="keyGeneratorKey"  style="width:100%"></td></tr>
+                                        <tr><td><%=ResourceLoader.GetResource(session,
"pages.thmodepart.name")%></td><td><input type="text" value="My business's
key generator" id="keyGeneratorName" style="width:100%"></td></tr>
+                                        <tr><td><%=ResourceLoader.GetResource(session,
"items.lang")%></td><td><input type="text" value="<%=ResourceLoader.GetResource(session,
"language")%>" id="keyGeneratorLang" style="width:100%"></td></tr>
+                                </table>
+
+                                <a class="btn btn-primary" title="Save" id="savekeygen"
onclick="javascript:savekeygen();">
+                                        <i class="icon-save icon-large"></i>

+                                        <%=ResourceLoader.GetResource(session, "actions.save")%></a>
+                        </div><br>
+                        <script type="text/javascript">
+                                function savekeygen()
+                                {
+                                        //$("#results").html("<img src=\"img");
+                                        $("#savekeygen").addClass("disabled");
+                                        var keygen = $("#keyGeneratorKey").val();
+                                        var keyname = $("#keyGeneratorName").val();
+                                        var keylang = $("#keyGeneratorLang").val();
+                                        var postbackdata = new Array();
+
+                                        postbackdata.push({
+                                                name: "action",
+                                                value: "createKeyGen"
+                                        });
+                                        postbackdata.push({
+                                                name: "keygen",
+                                                value: keygen
+                                        });
+                                        postbackdata.push({
+                                                name: "keyname",
+                                                value: keyname
+                                        });
+                                        postbackdata.push({
+                                                name: "keylang",
+                                                value: keylang
+                                        });
+                                        postbackdata.push({
+                                                name: "nonce",
+                                                value: $("#nonce").val()
+                                        });
+                                        var request = $.ajax({
+                                                url: 'ajax/tmodel.jsp',
+                                                type: "POST",
+                                                //  dataType: "html", 
+                                                cache: false,
+                                                //  processData: false,f
+                                                data: postbackdata
+                                        });
+
+                                        request.done(function(msg) {
+                                                window.console && console.log('postback
done ');
+                                                $("#results").html(msg);
+                                                $("#savekeygen").removeClass("disabled");
+                                                $("#createtmodelkeygen").modal();
+                                        });
+
+                                        request.fail(function(jqXHR, textStatus) {
+                                                window.console && console.log('postback
failed ');
+                                                $("#results").text(textStatus + " " + jqXHR.responseText);
+                                                $("#savekeygen").removeClass("disabled");
+                                                $("#createtmodelkeygen").modal();
+
+                                        });
+                                }
+                        </script>
+
+                </div>
+        </div>
 
+        <div class="modal hide fade container" id="createtmodelkeygen">
+                <div class="modal-header">
+                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                        <h3><%=ResourceLoader.GetResource(session, "actions.result")%></h3>
+                </div>
+                <div class="modal-body">
+                        <div id="results"></div>
+                </div>
+                <div class="modal-footer">
+                        <button type="button" class="btn" data-dismiss="modal" ><%=ResourceLoader.GetResource(session,
"modal.close")%></button>
+                </div>
         </div>
-    </div>
-    <%@include file="header-bottom.jsp" %>
+        <%@include file="header-bottom.jsp" %>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org


Mime
View raw message