// check if SNS and a helper uuid if needed
boolean addMixRef = false;
if (!ni.label.equals(ni.name) && ni.uuid == null) {
ni.uuid = UUID.randomUUID().toString();
ni.props.put(JcrConstants.JCR_UUID, new DocViewProperty(
JcrConstants.JCR_UUID, new String[]{ni.uuid}, false, PropertyType.STRING));
// check mixins
DocViewProperty mix = ni.props.get(JcrConstants.JCR_MIXINTYPES);
addMixRef = true;
if (mix == null) {
mix = new DocViewProperty(JcrConstants.JCR_MIXINTYPES, new String[]{JcrConstants.MIX_REFERENCEABLE}, true, PropertyType.NAME);
ni.props.put(mix.name, mix);
} else {
for (String v: mix.values) {
if (v.equals(JcrConstants.MIX_REFERENCEABLE)) {
addMixRef = false;
break;
}
}
if (addMixRef) {
String[] vs = new String[mix.values.length+1];
System.arraycopy(mix.values, 0, vs, 0, mix.values.length);
vs[mix.values.length] = JcrConstants.MIX_REFERENCEABLE;
mix = new DocViewProperty(JcrConstants.JCR_MIXINTYPES, vs, true, PropertyType.NAME);
ni.props.put(mix.name, mix);
}
}
}
// add the properties