Skip to content

Commit

Permalink
[KNOWAGE-8577] The user cannot create csv dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
masseb974 committed Oct 3, 2024
1 parent a1fded1 commit fe0034c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public class DecryptionDataStoreTransformer extends AbstractDataStoreTransformer
private final IMetaData dataStoreMetadata;

public DecryptionDataStoreTransformer(IDataSet dataSet) {
this(dataSet.getDsMetadata() != null ? dataSet.getMetadata() : new MetaData());
this(dataSet.getDsMetadata() != null && !dataSet.getDsMetadata().equals("") && !dataSet.getDsMetadata().equals("[]")
&& !dataSet.getDsMetadata().startsWith("{") ? dataSet.getMetadata() : new MetaData());
}

public DecryptionDataStoreTransformer(IDataStore dataStore) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public class PrivacyManagerDataStoreTransformer extends AbstractDataStoreTransfo
private final Map paramsMap = new LinkedHashMap<>();

public PrivacyManagerDataStoreTransformer(IDataSet dataSet) {
this(dataSet.getDsMetadata() != null ? dataSet.getMetadata() : new MetaData(), dataSet.getParamsMap());
this(dataSet.getDsMetadata() != null && !dataSet.getDsMetadata().equals("") && !dataSet.getDsMetadata().equals("[]")
&& !dataSet.getDsMetadata().startsWith("{") ? dataSet.getMetadata() : new MetaData(), dataSet.getParamsMap());
}

public PrivacyManagerDataStoreTransformer(IDataStore dataStore, Map paramsMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public void setDsMetadata(String dsMetadata) {
public IMetaData getMetadata() {
IMetaData toReturn = null;
String xmlMetadata = this.getDsMetadata();
if (xmlMetadata == null || xmlMetadata.trim().equals("")) {
if (xmlMetadata == null || xmlMetadata.trim().equals("") || xmlMetadata.trim().equals("[]") || xmlMetadata.trim().startsWith("{")) {
logger.error("This dataset has no metadata");
throw new SpagoBIRuntimeException("This dataset has no metadata");
}
Expand Down Expand Up @@ -457,13 +457,15 @@ private List<String> encapsulateValues(JSONObject parameter, String[] values) {
String newValuesFromArray = "";
for (int i = 0; i < valuesArray.length; i++) {
String temp = valuesArray[i];
if (!delim.isEmpty() && temp.startsWith(delim) && temp.endsWith(delim))
if (!delim.isEmpty() && temp.startsWith(delim) && temp.endsWith(delim)) {
temp = temp.substring(1, temp.length() - 1);
}
temp = temp.replaceAll("'", "''");
if (i == 0)
if (i == 0) {
newValuesFromArray = (delim + temp + delim);
else
} else {
newValuesFromArray = newValuesFromArray + "," + (delim + temp + delim);
}

}
newValues.add(newValuesFromArray);
Expand Down

0 comments on commit fe0034c

Please sign in to comment.