Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hling committed Sep 2, 2019
1 parent 2136f8b commit 6fb75bb
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions jackrabbitexplorer/src/com/priocept/jcr/server/JcrServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -377,8 +378,12 @@ public List<JcrNode> getNode(String path) throws SerializedException {
//added a Binary Value text to the jcr:data property, as displaying raw binary in the value cell isn't desirable
if (null != property.getName() && property.getName().equalsIgnoreCase("jcr:data")) {
properties.put(property.getName() + " (Click to open)", "Binary Value");

//Any property of value which starts with http:// will be openable in the frontend
// multi-value properties
} else if (property.isMultiple()) {
if (property.getValues() != null) {
properties.put(property.getName(), Arrays.toString(property.getValues()));
}
//Any property of value which starts with http:// will be openable in the frontend
} else if (null != property.getValue() && property.getValue().getString().startsWith("http://")) {
properties.put(property.getName() + " (Click to open)", property.getValue().getString());
} else {
Expand Down Expand Up @@ -643,11 +648,17 @@ public String addNewProperty(String sourcePath, String name, String value) throw
}
try {
Item item = getJcrSession().getItem(sourcePath);
if (null == item && !(item instanceof Node)) {
if (null == item || !(item instanceof Node)) {
return null;
}
Node pathNode = (Node) item;
pathNode.setProperty(name, value);
if (value.startsWith("[") && value.endsWith("]")) {
value = value.substring(1, value.length() - 1);
String[] values = value.split(",");
pathNode.setProperty(name, values);
} else {
pathNode.setProperty(name, value);
}

getJcrSession().save();
} catch (Exception e) {
Expand Down Expand Up @@ -714,7 +725,13 @@ public String savePropertyStringValue(String sourcePath, String property, String
return null;
}
Node pathNode = (Node) item;
pathNode.setProperty(property, (String) value);
if (value.startsWith("[") && value.endsWith("]") && pathNode.getProperty(property).isMultiple()) {
value = value.substring(1, value.length() - 1);
String[] values = value.split(",");
pathNode.setProperty(property, values);
} else {
pathNode.setProperty(property, value);
}

getJcrSession().save();
} catch (Exception e) {
Expand Down

0 comments on commit 6fb75bb

Please sign in to comment.