Skip to content

Commit

Permalink
Added service to print the application without personal data, modify …
Browse files Browse the repository at this point in the history
…file acl permission
  • Loading branch information
mspasiano committed Jul 25, 2024
1 parent b4fd1a4 commit bf6e216
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3035,6 +3035,7 @@ public Integer printWithoutPersonalData(Session session, String callId, String c
criteriaApplications.add(Restrictions.isNull(JCONONPropertyIds.APPLICATION_ESCLUSIONE_RINUNCIA.value()));
ItemIterable<QueryResult> applications = criteriaApplications.executeQuery(session, false, session.getDefaultContext());
int index = 0;
final BindingSession adminSession = cmisService.getAdminSession();
for (QueryResult queryResult : applications.getPage(Integer.MAX_VALUE)) {
final Folder application = (Folder) session.getObject(queryResult.<String>getPropertyValueById(PropertyIds.OBJECT_ID));
LOGGER.info("Stampa domanda senza dati personali di: {} n. {}", application.getPropertyValue(JCONONPropertyIds.APPLICATION_USER.value()), index);
Expand All @@ -3052,7 +3053,11 @@ public Integer printWithoutPersonalData(Session session, String callId, String c
properties.put(PropertyIds.NAME, name);
ContentStream contentStream = new ContentStreamImpl(name, BigInteger.valueOf(is.available()), "application/pdf", is);
try {
application.createDocument(properties, contentStream, VersioningState.MAJOR);
final Document document = application.createDocument(properties, contentStream, VersioningState.MAJOR);
aclService.setInheritedPermission(adminSession, document.getPropertyValue(CoolPropertyIds.ALFCMIS_NODEREF.value()), false);
Map<String, ACLType> acesGroup = new HashMap<String, ACLType>();
acesGroup.put(JcononGroups.CONCORSI.group(), ACLType.Consumer);
aclService.addAcl(adminSession, document.getPropertyValue(CoolPropertyIds.ALFCMIS_NODEREF.value()), acesGroup);
} catch (CmisContentAlreadyExistsException _ex) {
StreamSupport.stream(application.getChildren().spliterator(), false)
.filter(cmisObject -> cmisObject.getName().equals(name))
Expand Down

0 comments on commit bf6e216

Please sign in to comment.