use of it.cnr.si.opencmis.criteria.Criteria in project cool-jconon by consiglionazionaledellericerche.
the class ApplicationService method finalCall.
public void finalCall(Session cmisSession, String objectId) {
Criteria criteriaDomande = CriteriaFactory.createCriteria(JCONONFolderType.JCONON_APPLICATION.queryName());
criteriaDomande.add(Restrictions.inTree(objectId));
criteriaDomande.add(Restrictions.eq(JCONONPropertyIds.APPLICATION_STATO_DOMANDA.value(), StatoDomanda.CONFERMATA.getValue()));
OperationContext context = cmisSession.getDefaultContext();
context.setMaxItemsPerPage(1000);
ItemIterable<QueryResult> domande = criteriaDomande.executeQuery(cmisSession, false, context);
for (QueryResult queryResultDomande : domande) {
String applicationAttach = competitionService.findAttachmentId(cmisSession, (String) queryResultDomande.getPropertyById(PropertyIds.OBJECT_ID).getFirstValue(), JCONONDocumentType.JCONON_ATTACHMENT_APPLICATION);
if (applicationAttach != null) {
Folder folderId = createFolderFinal(cmisSession, objectId);
try {
((FileableCmisObject) cmisSession.getObject(applicationAttach)).addToFolder(folderId, true);
} catch (CmisRuntimeException _ex) {
LOGGER.error("Cannot find folder", _ex);
}
}
}
}
use of it.cnr.si.opencmis.criteria.Criteria in project cool-jconon by consiglionazionaledellericerche.
the class ApplicationService method loadApplicationByCall.
protected Folder loadApplicationByCall(Session cmisSession, String callId, Map<String, Object> model, String userId) {
if (model != null && !model.isEmpty() && model.get("application") != null)
return (Folder) model.get("application");
Folder call = loadCallById(cmisSession, callId, model);
Criteria criteria = CriteriaFactory.createCriteria(JCONONFolderType.JCONON_APPLICATION.queryName());
criteria.addColumn(PropertyIds.OBJECT_ID);
criteria.add(Restrictions.inFolder(call.getId()));
criteria.add(Restrictions.eq(JCONONPropertyIds.APPLICATION_USER.value(), userId));
ItemIterable<QueryResult> iterable = criteria.executeQuery(cmisSession, false, cmisSession.getDefaultContext());
if (iterable.getTotalNumItems() == 0 || iterable.getTotalNumItems() == -1) {
return null;
} else if (iterable.getTotalNumItems() > 1)
throw new ClientMessageException("message.error.domanda.multipla");
for (QueryResult queryResult : iterable) {
Folder folder = (Folder) cmisSession.getObject((String) queryResult.getPropertyById(PropertyIds.OBJECT_ID).getFirstValue());
folder.refresh();
model.put("folder", folder);
return folder;
}
throw new ClientMessageException("message.error.domanda.multipla");
}
use of it.cnr.si.opencmis.criteria.Criteria in project cool-jconon by consiglionazionaledellericerche.
the class CallService method estraiGraduatorie.
public Map<String, List<?>> estraiGraduatorie(Session session, String codice) {
if (!Optional.ofNullable(codice).isPresent())
throw new ClientMessageException("Valorizzare il codice del Bando");
Criteria criteriaCalls = CriteriaFactory.createCriteria(JCONONFolderType.JCONON_CALL.queryName());
criteriaCalls.addColumn(PropertyIds.OBJECT_ID);
criteriaCalls.addColumn(JCONONPropertyIds.CALL_CODICE.value());
criteriaCalls.add(Restrictions.like(JCONONPropertyIds.CALL_CODICE.value(), "%".concat(codice.trim()).concat("%")));
ItemIterable<QueryResult> calls = criteriaCalls.executeQuery(session, false, session.getDefaultContext());
Map<String, List<?>> result = new HashMap<String, List<?>>();
for (QueryResult call : calls.getPage(Integer.MAX_VALUE)) {
List<Object> apps = new ArrayList<>();
result.put(call.getPropertyValueById(JCONONPropertyIds.CALL_CODICE.value()), apps);
Criteria criteriaApplications = CriteriaFactory.createCriteria(JCONONFolderType.JCONON_APPLICATION.queryName());
criteriaApplications.addColumn(JCONONPropertyIds.APPLICATION_USER.value());
criteriaApplications.addColumn(JCONONPropertyIds.APPLICATION_NOME.value());
criteriaApplications.addColumn(JCONONPropertyIds.APPLICATION_COGNOME.value());
criteriaApplications.addColumn(JCONONPropertyIds.APPLICATION_CODICE_FISCALE.value());
criteriaApplications.addColumn(JCONONPropertyIds.APPLICATION_TOTALE_PUNTEGGIO.value());
criteriaApplications.addColumn(JCONONPropertyIds.APPLICATION_GRADUATORIA.value());
criteriaApplications.addColumn(JCONONPropertyIds.APPLICATION_ESITO_CALL.value());
criteriaApplications.add(Restrictions.inTree(call.getPropertyValueById(PropertyIds.OBJECT_ID)));
criteriaApplications.add(Restrictions.eq(JCONONPropertyIds.APPLICATION_STATO_DOMANDA.value(), ApplicationService.StatoDomanda.CONFERMATA.getValue()));
criteriaApplications.add(Restrictions.isNull(JCONONPropertyIds.APPLICATION_ESCLUSIONE_RINUNCIA.value()));
criteriaApplications.addOrder(Order.asc(JCONONPropertyIds.APPLICATION_GRADUATORIA.value()));
ItemIterable<QueryResult> applications = criteriaApplications.executeQuery(session, false, session.getDefaultContext());
for (QueryResult application : applications.getPage(Integer.MAX_VALUE)) {
apps.add(application.getProperties().stream().collect(Collectors.toMap(PropertyData::getId, PropertyData::getFirstValue, (oldValue, newValue) -> oldValue, Hashtable::new)));
}
}
return result;
}
use of it.cnr.si.opencmis.criteria.Criteria in project cool-jconon by consiglionazionaledellericerche.
the class CallService method getApplicationConfirmed.
public ItemIterable<QueryResult> getApplicationConfirmed(Session session, Folder call) {
Criteria criteriaDomande = CriteriaFactory.createCriteria(JCONONFolderType.JCONON_APPLICATION.queryName());
criteriaDomande.add(Restrictions.inTree(call.getId()));
criteriaDomande.add(Restrictions.eq(JCONONPropertyIds.APPLICATION_STATO_DOMANDA.value(), ApplicationService.StatoDomanda.CONFERMATA.getValue()));
criteriaDomande.addOrder(Order.asc(JCONONPropertyIds.APPLICATION_COGNOME.value()));
return criteriaDomande.executeQuery(session, false, session.getDefaultContext());
}
use of it.cnr.si.opencmis.criteria.Criteria in project cool-jconon by consiglionazionaledellericerche.
the class CallService method isCallAttachmentPresent.
protected boolean isCallAttachmentPresent(Session cmisSession, Folder source, JCONONDocumentType documentType) {
Criteria criteria = CriteriaFactory.createCriteria(documentType.queryName());
criteria.add(Restrictions.inFolder(source.getId()));
return criteria.executeQuery(cmisSession, false, cmisSession.getDefaultContext()).getTotalNumItems() != 0;
}
Aggregations