Publizieren Assoiziation GenericContact <-> GenericOrganizatzationalUnit
git-svn-id: https://svn.libreccm.org/ccm/trunk@1565 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
355f54236f
commit
07dd42dc28
|
|
@ -34,27 +34,27 @@ public class GenericContactBundle
|
|||
setContentType(primary.getContentType());
|
||||
addInstance(primary);
|
||||
|
||||
super.setName(primary.getName());
|
||||
super.setName(primary.getName());
|
||||
}
|
||||
|
||||
public GenericContactBundle(final OID oid) throws
|
||||
DataObjectNotFoundException {
|
||||
super(oid);
|
||||
super(oid);
|
||||
}
|
||||
|
||||
public GenericContactBundle(final BigDecimal id) throws
|
||||
DataObjectNotFoundException {
|
||||
super(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
super(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
public GenericContactBundle(final DataObject dobj) {
|
||||
super(dobj);
|
||||
super(dobj);
|
||||
}
|
||||
|
||||
public GenericContactBundle(final String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p> Copy association properties. These are for example the associations
|
||||
* between GenericPerson and GenericContact, or between
|
||||
|
|
@ -76,7 +76,6 @@ public class GenericContactBundle
|
|||
(GenericContactBundle) source;
|
||||
|
||||
if (PERSON.equals(attribute)) {
|
||||
|
||||
final DataCollection persons = (DataCollection) contactBundle.
|
||||
get(PERSON);
|
||||
|
||||
|
|
@ -85,7 +84,16 @@ public class GenericContactBundle
|
|||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
} else if ("organizationalunit".equals(attribute)) {
|
||||
final DataCollection orgaunits = (DataCollection) contactBundle.
|
||||
get("organizationalunit");
|
||||
|
||||
while (orgaunits.next()) {
|
||||
createOrgaUnitAssoc(orgaunits);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return super.copyProperty(source, property, copier);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -114,6 +122,28 @@ public class GenericContactBundle
|
|||
}
|
||||
}
|
||||
|
||||
private void createOrgaUnitAssoc(final DataCollection orgaunits) {
|
||||
final GenericOrganizationalUnitBundle draftOrga =
|
||||
(GenericOrganizationalUnitBundle) DomainObjectFactory.
|
||||
newInstance(orgaunits.getDataObject());
|
||||
final GenericOrganizationalUnitBundle liveOrga =
|
||||
(GenericOrganizationalUnitBundle) draftOrga.
|
||||
getLiveVersion();
|
||||
|
||||
if (liveOrga != null) {
|
||||
final DataObject link = add("organizationalunit", liveOrga);
|
||||
|
||||
link.set(GenericOrganizationalUnitContactCollection.CONTACT_TYPE,
|
||||
orgaunits.get(
|
||||
GenericOrganizationalUnitContactCollection.LINK_CONTACT_TYPE));
|
||||
link.set(GenericOrganizationalUnitContactCollection.CONTACT_ORDER,
|
||||
orgaunits.get(
|
||||
GenericOrganizationalUnitContactCollection.LINK_CONTACT_ORDER));
|
||||
|
||||
link.save();
|
||||
}
|
||||
}
|
||||
|
||||
public GenericPerson getPerson() {
|
||||
DataCollection collection;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue