From bb0462da74913ddcc8e9dc780070083f41fb839d Mon Sep 17 00:00:00 2001 From: Dustin Colvin Date: Thu, 21 Nov 2024 18:14:18 -0600 Subject: [PATCH] Updating Brightcove Metadata and logging --- current/core/pom.xml | 2 +- .../brightcove/wrapper/sling/ServiceUtil.java | 28 +++++++++++-------- current/pom.xml | 2 +- current/ui.apps/pom.xml | 4 +-- .../shared/autoDialog/autoDialog.jsp | 10 ++++--- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/current/core/pom.xml b/current/core/pom.xml index 641ca04..477e413 100644 --- a/current/core/pom.xml +++ b/current/core/pom.xml @@ -46,7 +46,7 @@ com.coresecure.brightcove.cq5 brightcove_connector - 6.0.9 + 6.0.10 ../pom.xml brightcove-services diff --git a/current/core/src/main/java/com/coresecure/brightcove/wrapper/sling/ServiceUtil.java b/current/core/src/main/java/com/coresecure/brightcove/wrapper/sling/ServiceUtil.java index 1384556..249112f 100644 --- a/current/core/src/main/java/com/coresecure/brightcove/wrapper/sling/ServiceUtil.java +++ b/current/core/src/main/java/com/coresecure/brightcove/wrapper/sling/ServiceUtil.java @@ -905,18 +905,22 @@ private void setSchedule(JSONObject objObject, ModifiableValueMap assetmap){ private void setLink(JSONObject objObject, ModifiableValueMap map) { try { - String link_url = objObject.getString(Constants.URL); - if (link_url != null && !link_url.toString().equals(Constants.NULLSTRING)) { - map.put(Constants.BRC_LINK_URL, link_url); - } else { - if (map.containsKey(Constants.BRC_LINK_URL)) map.remove(Constants.BRC_LINK_URL); - } - String link_text = objObject.getString(Constants.TEXT); - if (link_text != null && !link_text.toString().equals(Constants.NULLSTRING)) { - map.put(Constants.BRC_LINK_TEXT, link_text); - } else { - if (map.containsKey(Constants.BRC_LINK_TEXT)) map.remove(Constants.BRC_LINK_TEXT); - } + if (objObject.has(Constants.URL)) { + String link_url = objObject.getString(Constants.URL); + if (link_url != null && !link_url.toString().equals(Constants.NULLSTRING)) { + map.put(Constants.BRC_LINK_URL, link_url); + } else { + if (map.containsKey(Constants.BRC_LINK_URL)) map.remove(Constants.BRC_LINK_URL); + } + if (objObject.has(Constants.TEXT)) { + String link_text = objObject.getString(Constants.TEXT); + if (link_text != null && !link_text.toString().equals(Constants.NULLSTRING)) { + map.put(Constants.BRC_LINK_TEXT, link_text); + } else { + if (map.containsKey(Constants.BRC_LINK_TEXT)) map.remove(Constants.BRC_LINK_TEXT); + } + } + } } catch (JSONException e) { LOGGER.error(e.getClass().getName(), e); } diff --git a/current/pom.xml b/current/pom.xml index 7c80d41..53e0805 100644 --- a/current/pom.xml +++ b/current/pom.xml @@ -45,7 +45,7 @@ Copyright (C) 2019 3|SHARE Inc. com.coresecure.brightcove.cq5 brightcove_connector pom - 6.0.9 + 6.0.10 Parent Maven POM for the 'Adobe CQ5 Brightcove Connector API' project. diff --git a/current/ui.apps/pom.xml b/current/ui.apps/pom.xml index 7e60498..b3ebfc4 100644 --- a/current/ui.apps/pom.xml +++ b/current/ui.apps/pom.xml @@ -49,7 +49,7 @@ com.coresecure.brightcove.cq5 brightcove_connector - 6.0.9 + 6.0.10 ../pom.xml @@ -227,7 +227,7 @@ com.coresecure.brightcove.cq5 brightcove-services - 6.0.9 + 6.0.10 diff --git a/current/ui.apps/src/main/content/jcr_root/apps/brightcove/components/shared/autoDialog/autoDialog.jsp b/current/ui.apps/src/main/content/jcr_root/apps/brightcove/components/shared/autoDialog/autoDialog.jsp index d7c8740..71dd709 100644 --- a/current/ui.apps/src/main/content/jcr_root/apps/brightcove/components/shared/autoDialog/autoDialog.jsp +++ b/current/ui.apps/src/main/content/jcr_root/apps/brightcove/components/shared/autoDialog/autoDialog.jsp @@ -34,6 +34,7 @@ <%@ page import="org.apache.sling.commons.json.JSONObject" %> <%@ page import="com.coresecure.brightcove.wrapper.sling.ServiceUtil" %> <%@ page import="org.apache.sling.commons.json.JSONArray" %> +<%@ page import="org.apache.commons.lang3.StringUtils" %> <%@ page trimDirectiveWhitespaces="true" %> <%@include file="/libs/foundation/global.jsp" %> <% @@ -41,9 +42,11 @@ Resource asset_res = slingRequest.getParameter("item") != null ? resourceResolver.resolve(slingRequest.getParameter("item")) : resourceResolver.resolve(slingRequest.getRequestPathInfo().getSuffix()); - ValueMap parentProps = asset_res.getParent().getValueMap(); + Resource metadataRes = asset_res.getChild("jcr:content/metadata"); + ValueMap map = metadataRes.adaptTo(ValueMap.class); + String brcid = map.get("brc_id",""); - if ( parentProps != null && parentProps.get("jcr:createdBy").equals("brightcove_admin") ) { + if ( StringUtils.isNotBlank("brc_id")) { String requestedAccount; Node parentNode = asset_res.getParent().adaptTo(Node.class); @@ -54,8 +57,7 @@ requestedAccount = parentNode.getName(); } - Resource metadataRes = asset_res.getChild("jcr:content/metadata"); - ValueMap map = metadataRes.adaptTo(ValueMap.class); + ServiceUtil serviceUtil = new ServiceUtil(requestedAccount);