ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-11813 500 errors for wigdet (dsen)
Date Tue, 09 Jun 2015 14:25:00 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 75b87d648 -> 3726656ec


AMBARI-11813 500 errors for wigdet (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3726656e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3726656e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3726656e

Branch: refs/heads/trunk
Commit: 3726656ec6eb93a66db3fda6e2df2246ee2d3632
Parents: 75b87d6
Author: Dmytro Sen <dsen@apache.org>
Authored: Tue Jun 9 17:24:43 2015 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Tue Jun 9 17:24:43 2015 +0300

----------------------------------------------------------------------
 .../api/resources/WidgetLayoutResourceDefinition.java     | 10 ++++++----
 .../server/controller/AmbariManagementControllerImpl.java |  5 ++++-
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3726656e/ambari-server/src/main/java/org/apache/ambari/server/api/resources/WidgetLayoutResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/WidgetLayoutResourceDefinition.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/WidgetLayoutResourceDefinition.java
index a9bbd9c..cc7df23 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/WidgetLayoutResourceDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/WidgetLayoutResourceDefinition.java
@@ -74,10 +74,12 @@ public class WidgetLayoutResourceDefinition extends BaseResourceDefinition
{
           ArrayList widgetsList = (ArrayList) node.getObject().getPropertiesMap().get("WidgetLayoutInfo").get("widgets");
           for (Object widgetObject : widgetsList) {
             HashMap<String, Object> widgetMap = (HashMap) widgetObject;
-            String widgetId = ((WidgetResponse) widgetMap.get("WidgetInfo")).getId().toString();
-            String widgetHref = href.substring(0, href.indexOf("/widget_layouts") + 1) +
-                    "widgets/" + widgetId;
-            widgetMap.put("href", widgetHref);
+            if (((WidgetResponse) widgetMap.get("WidgetInfo")).getId() != null) {
+              String widgetId = ((WidgetResponse) widgetMap.get("WidgetInfo")).getId().toString();
+              String widgetHref = href.substring(0, href.indexOf("/widget_layouts") + 1)
+
+                      "widgets/" + widgetId;
+              widgetMap.put("href", widgetHref);
+            }
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3726656e/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index a675c26..9e8a5e5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -4156,6 +4156,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
           }
           layoutEntity.setListWidgetLayoutUserWidgetEntity(widgetLayoutUserWidgetEntityList);
           widgetLayoutDAO.create(layoutEntity);
+          widgetLayoutDAO.refresh(layoutEntity);
         } else {
           if (existingEntities.size() > 1) {
             LOG.warn("Skip updating layout since multiple widget layouts " +
@@ -4182,10 +4183,12 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
                   widgetLayoutUserWidgetEntity.setWidgetOrder(order++);
                   widgetLayoutUserWidgetEntity.setWidgetLayout(existingLayoutEntity);
                   layoutUserWidgetEntities.add(widgetLayoutUserWidgetEntity);
+                  widgetEntity.getListWidgetLayoutUserWidgetEntity().add(widgetLayoutUserWidgetEntity);
                 }
               }
             }
-            widgetLayoutDAO.merge(existingLayoutEntity);
+            widgetLayoutDAO.mergeWithFlush(existingLayoutEntity);
+            widgetLayoutDAO.refresh(existingLayoutEntity);
           }
         }
       }


Mime
View raw message