PublishedLink
Korrektur der Methode zum Speichern von LinkAttributen git-svn-id: https://svn.libreccm.org/ccm/trunk@872 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c5b1c11bf9
commit
f1bbba529f
|
|
@ -151,7 +151,16 @@ class PublishedLink extends DomainObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sourceObject != null) && sourceObject.getObjectType().getProperty(propertyName).isCollection()) {
|
if ((sourceObject != null) && sourceObject.getObjectType().getProperty(propertyName).isCollection()) {
|
||||||
link.saveLinkAttributes((DataCollection) sourceObject.get(propertyName + "@link"));
|
|
||||||
|
DataCollection coll = (DataCollection) sourceObject.get(propertyName + "@link");
|
||||||
|
while (coll.next()) {
|
||||||
|
|
||||||
|
DataObject linkObj = coll.getDataObject();
|
||||||
|
if (linkTarget.getID() == link.getLinkTarget().getID()) {
|
||||||
|
link.saveLinkAttributes(linkObj);
|
||||||
|
coll.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
|
|
@ -317,41 +326,33 @@ class PublishedLink extends DomainObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveLinkAttributes(DataCollection coll) {
|
private void saveLinkAttributes(DataObject linkObj) {
|
||||||
|
|
||||||
if (coll.next()) {
|
Iterator properties = linkObj.getObjectType().getDeclaredProperties();
|
||||||
|
HashMap<String, Object> linkAttributes = new HashMap();
|
||||||
|
|
||||||
DataObject linkObj = coll.getDataObject();
|
while (properties.hasNext()) {
|
||||||
|
|
||||||
Iterator properties = linkObj.getObjectType().getDeclaredProperties();
|
Property prop = (Property) properties.next();
|
||||||
HashMap<String, Object> linkAttributes = new HashMap();
|
String key = prop.getName();
|
||||||
|
|
||||||
while (properties.hasNext()) {
|
// Teste Property: Es darf kein Key und muß ein simples Attribute sein
|
||||||
|
if (prop.isAttribute() && !prop.isKeyProperty()) {
|
||||||
|
|
||||||
Property prop = (Property) properties.next();
|
Object value = linkObj.get(key);
|
||||||
String key = prop.getName();
|
linkAttributes.put(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Teste Property: Es darf kein Key und muß ein simples Attribute sein
|
if (linkAttributes.size() > 0) {
|
||||||
if (prop.isAttribute() && !prop.isKeyProperty()) {
|
ByteArrayOutputStream data = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
Object value = linkObj.get(key);
|
ObjectOutputStream out = new ObjectOutputStream(data);
|
||||||
linkAttributes.put(key, value);
|
out.writeObject(linkAttributes);
|
||||||
}
|
} catch (IOException ex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linkAttributes.size() > 0) {
|
set(LINK_ATTRIBUTES, data.toByteArray());
|
||||||
ByteArrayOutputStream data = new ByteArrayOutputStream();
|
|
||||||
try {
|
|
||||||
ObjectOutputStream out = new ObjectOutputStream(data);
|
|
||||||
out.writeObject(linkAttributes);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
}
|
|
||||||
|
|
||||||
set(LINK_ATTRIBUTES, data.toByteArray());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
coll.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue