[FEATURE]
- adds export feature for core objects - removes last runtime errors of export routine git-svn-id: https://svn.libreccm.org/ccm/trunk@4384 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
ccd7121896
commit
baf6350ece
|
|
@ -323,8 +323,10 @@ public abstract class Party extends ACSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all objects of this type stored in the database. Very
|
* Retrieves all objects of this type stored in the database. Has to
|
||||||
* necessary for exporting all entities of the current work environment.
|
* retrieve Groups and Users separately, because Parties can not be
|
||||||
|
* instantiated due to abstract constraint. Very necessary for exporting
|
||||||
|
* all entities of the current work environment.
|
||||||
*
|
*
|
||||||
* @return List of all parties
|
* @return List of all parties
|
||||||
*/
|
*/
|
||||||
|
|
@ -332,18 +334,35 @@ public abstract class Party extends ACSObject {
|
||||||
List<Party> partyList = new ArrayList<>();
|
List<Party> partyList = new ArrayList<>();
|
||||||
|
|
||||||
final Session session = SessionManager.getSession();
|
final Session session = SessionManager.getSession();
|
||||||
DomainCollection collection = new DomainCollection(session.retrieve(
|
DomainCollection collection;
|
||||||
Party.BASE_DATA_OBJECT_TYPE));
|
|
||||||
|
|
||||||
|
collection= new DomainCollection(session.retrieve(Group
|
||||||
|
.BASE_DATA_OBJECT_TYPE));
|
||||||
|
addToPartyList(partyList, collection);
|
||||||
|
|
||||||
|
collection = new DomainCollection(session.retrieve(User
|
||||||
|
.BASE_DATA_OBJECT_TYPE));
|
||||||
|
addToPartyList(partyList, collection);
|
||||||
|
|
||||||
|
collection.close();
|
||||||
|
return partyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assisting method. Adds all objects of a DomainCollection to a given
|
||||||
|
* list of parties.
|
||||||
|
*
|
||||||
|
* @param partyList List of parties
|
||||||
|
* @param collection A DomainCollection
|
||||||
|
*/
|
||||||
|
private static void addToPartyList(List<Party> partyList,
|
||||||
|
DomainCollection collection) {
|
||||||
while (collection.next()) {
|
while (collection.next()) {
|
||||||
Party party = (Party) collection.getDomainObject();
|
Party party = (Party) collection.getDomainObject();
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
partyList.add(party);
|
partyList.add(party);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
collection.close();
|
|
||||||
return partyList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,25 +140,29 @@ public class PermissionConversion {
|
||||||
trunkGranteeParty).getRoles();
|
trunkGranteeParty).getRoles();
|
||||||
boolean multipleGrantees = false;
|
boolean multipleGrantees = false;
|
||||||
while (granteeCollection.next()) {
|
while (granteeCollection.next()) {
|
||||||
Role role = NgCollection.roles.get(granteeCollection
|
Role grantee = NgCollection.roles.get(granteeCollection
|
||||||
.getRole().getID().longValue());
|
.getRole().getID().longValue());
|
||||||
|
|
||||||
// set grantee and opposed associations
|
// set grantee and opposed associations
|
||||||
if (!multipleGrantees) {
|
if (!multipleGrantees) {
|
||||||
permission.setGrantee(role);
|
permission.setGrantee(grantee);
|
||||||
role.addPermission(permission);
|
grantee.addPermission(permission);
|
||||||
multipleGrantees = true;
|
multipleGrantees = true;
|
||||||
} else {
|
} else {
|
||||||
Permission duplicatePermission = new Permission
|
Permission duplicatePermission = new Permission
|
||||||
(permission);
|
(permission);
|
||||||
duplicatePermission.setGrantee(role);
|
duplicatePermission.setGrantee(grantee);
|
||||||
role.addPermission(duplicatePermission);
|
grantee.addPermission(duplicatePermission);
|
||||||
|
|
||||||
long oldId = duplicatePermission.getObject().getObjectId()
|
CcmObject object = duplicatePermission.getObject();
|
||||||
+ duplicatePermission.getGrantee().getRoleId();
|
long objectId = 0;
|
||||||
|
if (object != null) {
|
||||||
|
objectId = object.getObjectId();
|
||||||
|
}
|
||||||
|
|
||||||
|
long oldId = objectId + grantee.getRoleId();
|
||||||
PermissionIdMapper.map.put(oldId,
|
PermissionIdMapper.map.put(oldId,
|
||||||
duplicatePermission.getPermissionId());
|
duplicatePermission.getPermissionId());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// grantee instance of User, new Role necessary
|
// grantee instance of User, new Role necessary
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue