RegistryProperty regProp = null;
String prop = "";
List<String> propList = null;
String propName = tempArr[tempArr.length - 1];
ResourceImpl res = null;
boolean resFlag = false;
try {
regProp = new RegistryProperty((CollectionImpl) registrySession.getUserRegistry().get(tempPath), registrySession, tempArr[tempArr.length - 1]);
if ((registrySession.getUserRegistry().resourceExists(absPath)) && (registrySession.getUserRegistry().get(absPath) != null)) {
res = (ResourceImpl) registrySession.getUserRegistry().get(absPath);
resFlag = true;
}
if ((!resFlag) && (registrySession.getUserRegistry().resourceExists(tempPath)) && (registrySession.getUserRegistry().get(tempPath) != null)) {
propList = registrySession.getUserRegistry().get(tempPath).getPropertyValues(propName);
if ((propList != null) && (propList.size() == 1)) {
prop = propList.get(0);
regProp.setValue(prop);
} else {
if (propList != null) {
String[] arr = new String[propList.size()];
int i = 0;
for (Object ob : propList) {
arr[i] = ob.toString();
i++;
}
regProp.setValue(arr);
}
}
} else if (res != null) {
if ((res.getProperty("registry.jcr.property.type") != null) && (res.getProperty("registry.jcr.property.type").equals("input_stream"))) {
regProp.setValue(res.getContentStream());
} else if ((res.getProperty("registry.jcr.property.type") != null) && (res.getProperty("registry.jcr.property.type").equals("values_type"))) {
List<String> valuesProp = res.getPropertyValues(propName);
if (valuesProp != null) {
int i = 0;
Value[] values = new RegistryValue[valuesProp.size()];
for (int j = 0; j < values.length; j++) {
values[j] = new RegistryValue(valuesProp.get(j));
}
regProp.setValue(values);
}
} else if (res.getContent() instanceof String) {
prop = res.getContent().toString();
} else if (res.getContent() instanceof byte[]) {
prop = new String((byte[]) res.getContent());
} else if (prop.equals("")) {
throw new PathNotFoundException();
}
regProp = RegistrySession.getRegistryProperty(res.getProperty("registry.jcr.property.type"), prop, regProp);
resFlag = false;
}