Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
BZ-1104237 - When the KPI is exported, the associated data source sho…
…uld too
  • Loading branch information
dgutierr committed Dec 9, 2014
1 parent 1e4276a commit d74f8cf
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
Expand Up @@ -219,6 +219,7 @@ protected String inferDatabaseName() throws Exception {
}

public String inferDatabaseName(DataSource ds) throws Exception {
if (ds == null) return null;
Connection connection = null;
try {
connection = ds.getConnection();
Expand Down
@@ -0,0 +1,28 @@
/**
* Copyright (C) 2012 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.dashboard.provider;

public class DefaultDataProperty extends AbstractDataProperty {

public DefaultDataProperty() {
super();
}

public DefaultDataProperty(String id) {
super();
super.setPropertyId(id);
}
}
Expand Up @@ -22,6 +22,7 @@
import org.jboss.dashboard.dataset.profiler.DataSetSortConstraints;
import org.jboss.dashboard.profiler.ProfilerHelper;
import org.jboss.dashboard.profiler.memory.SizeEstimations;
import org.jboss.dashboard.provider.DefaultDataProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.jboss.dashboard.DataProviderServices;
Expand Down Expand Up @@ -539,13 +540,30 @@ public void formatXMLProperties(PrintWriter out, int indent) throws Exception {
}

public void parseXMLProperties(NodeList nodes) throws Exception {
boolean update = getProperties().length > 0;
List<DataProperty> result = _parseXMLProperties(nodes, update);
if (!update) {
setPropertySize(result.size());
for (int i = 0; i < result.size(); i++) {
DataProperty p = result.get(i);
addProperty(p, i);
}
}
}

public List<DataProperty> _parseXMLProperties(NodeList nodes, boolean update) throws Exception {
List<DataProperty> result = new ArrayList<DataProperty>();
for (int x = 0; x < nodes.getLength(); x++) {
Node node = nodes.item(x);
if (node.getNodeName().equals("dataproperty")) {
String idDataProperty = StringEscapeUtils.unescapeXml(node.getAttributes().getNamedItem("id").getNodeValue());
DataProperty property = getPropertyById(idDataProperty);
if (property == null) continue; // Be aware of deleted properties.
if (property == null) {
if (update) continue; // Be aware of deleted properties.
else property = new DefaultDataProperty(idDataProperty);
}

result.add(property);
NodeList dataProperties = node.getChildNodes();
for (int y = 0; y < dataProperties.getLength(); y++) {
Node dataProperty = dataProperties.item(y);
Expand All @@ -562,6 +580,7 @@ public void parseXMLProperties(NodeList nodes) throws Exception {
}
}
}
return result;
}

protected void printIndent(PrintWriter out, int indent) {
Expand Down
Expand Up @@ -284,13 +284,13 @@ public void actionStoreDataProviderProperties(CommandRequest request) {
if (param_name.startsWith("name/")) {
String propId = param_name.substring(param_name.indexOf("/") + 1, param_name.lastIndexOf("/"));
String lang = param_name.substring(param_name.lastIndexOf("/") + 1, param_name.length());
AbstractDataProperty adp = (AbstractDataProperty) dataProvider.getDataSet().getPropertyById(propId);
DataProperty adp = dataProvider.getDataSet().getPropertyById(propId);
if (!"".equals(param_value)) adp.getNameI18nMap().put(new Locale(lang), param_value);
else adp.getNameI18nMap().remove(new Locale(lang));
}
if (param_name.startsWith(PARAM_PROPERTY_TYPE)) {
String pId = param_name.substring(param_name.indexOf("_") + 1, param_name.length());
AbstractDataProperty adp = (AbstractDataProperty) dataProvider.getDataSet().getPropertyById(pId);
DataProperty adp = dataProvider.getDataSet().getPropertyById(pId);
Domain domnain = (Domain) Class.forName(param_value).newInstance();
if (domnain instanceof LabelDomain) ((LabelDomain) domnain).setConvertedFromNumeric(true);
adp.setDomain(domnain);
Expand Down
Expand Up @@ -156,7 +156,7 @@ private void renderEditProperties(HttpServletRequest httpServletRequest, HttpSer
renderFragment("outputEndRow");
} else {
for (int i = 0; i < properties.length; i++) {
AbstractDataProperty property = (AbstractDataProperty) properties[i];
DataProperty property = properties[i];
setAttribute("index", new Integer(i));
renderFragment("outputStartRow");
setAttribute("propertyId", property.getPropertyId());
Expand Down
2 changes: 1 addition & 1 deletion scripts/buildandrun.sh
Expand Up @@ -9,7 +9,7 @@ else
echo "------------------------------------------------------------------"

cd ..
mvn clean install -P $1,jetty -DskipTests
mvn clean install -P $1,jetty $2 $3 $4

export MAVEN_OPTS="-Xms1024M -Xmx2048M -XX:MaxPermSize=512m -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
cd modules/dashboard-showcase/
Expand Down

0 comments on commit d74f8cf

Please sign in to comment.