[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
|
||||
* necessary for exporting all entities of the current work environment.
|
||||
* Retrieves all objects of this type stored in the database. Has to
|
||||
* 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
|
||||
*/
|
||||
|
|
@ -332,18 +334,35 @@ public abstract class Party extends ACSObject {
|
|||
List<Party> partyList = new ArrayList<>();
|
||||
|
||||
final Session session = SessionManager.getSession();
|
||||
DomainCollection collection = new DomainCollection(session.retrieve(
|
||||
Party.BASE_DATA_OBJECT_TYPE));
|
||||
DomainCollection collection;
|
||||
|
||||
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()) {
|
||||
Party party = (Party) collection.getDomainObject();
|
||||
if (party != null) {
|
||||
partyList.add(party);
|
||||
}
|
||||
}
|
||||
|
||||
collection.close();
|
||||
return partyList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,25 +140,29 @@ public class PermissionConversion {
|
|||
trunkGranteeParty).getRoles();
|
||||
boolean multipleGrantees = false;
|
||||
while (granteeCollection.next()) {
|
||||
Role role = NgCollection.roles.get(granteeCollection
|
||||
Role grantee = NgCollection.roles.get(granteeCollection
|
||||
.getRole().getID().longValue());
|
||||
|
||||
// set grantee and opposed associations
|
||||
if (!multipleGrantees) {
|
||||
permission.setGrantee(role);
|
||||
role.addPermission(permission);
|
||||
permission.setGrantee(grantee);
|
||||
grantee.addPermission(permission);
|
||||
multipleGrantees = true;
|
||||
} else {
|
||||
Permission duplicatePermission = new Permission
|
||||
(permission);
|
||||
duplicatePermission.setGrantee(role);
|
||||
role.addPermission(duplicatePermission);
|
||||
duplicatePermission.setGrantee(grantee);
|
||||
grantee.addPermission(duplicatePermission);
|
||||
|
||||
long oldId = duplicatePermission.getObject().getObjectId()
|
||||
+ duplicatePermission.getGrantee().getRoleId();
|
||||
CcmObject object = duplicatePermission.getObject();
|
||||
long objectId = 0;
|
||||
if (object != null) {
|
||||
objectId = object.getObjectId();
|
||||
}
|
||||
|
||||
long oldId = objectId + grantee.getRoleId();
|
||||
PermissionIdMapper.map.put(oldId,
|
||||
duplicatePermission.getPermissionId());
|
||||
|
||||
}
|
||||
}
|
||||
// grantee instance of User, new Role necessary
|
||||
|
|
|
|||
Loading…
Reference in New Issue