use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UpsCSV method createUPSRecords.
private int createUPSRecords(Map<String, IDWithIssuer> studyPatientMap, String movescp) {
int count = 0;
for (Map.Entry<String, IDWithIssuer> studyPatient : studyPatientMap.entrySet()) {
try {
UPSContext ctx = upsService.newUPSContext(httpServletRequestInfo, arcAE);
ctx.setUPSInstanceUID(UIDUtils.createUID());
UPSUtils.updateUPSTemplateAttrs(arcAE, upsTemplateAttrs, studyPatient, movescp);
ctx.setAttributes(upsTemplateAttrs);
UPS ups = upsService.createUPS(ctx);
LOG.info("UPSTemplateWorkitem[uid={}]: created {}", upsTemplateAttrs.getString(Tag.SOPInstanceUID), ups);
count++;
} catch (Exception e) {
LOG.info("UPSTemplateWorkitem[uid={}]: create UPS failed for Study[uid={}] of Patient[id={}]\n", upsTemplateAttrs.getString(Tag.SOPInstanceUID), studyPatient.getKey(), studyPatient.getValue(), e);
}
}
return count;
}
use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UpsMatchingRS method upsTemplateAttrs.
private Attributes upsTemplateAttrs(String upsTemplateUID, ArchiveAEExtension arcAE) throws DicomServiceException {
UPSContext ctx = upsService.newUPSContext(HttpServletRequestInfo.valueOf(request), arcAE);
ctx.setUPSInstanceUID(upsTemplateUID);
Attributes upsAttrs = upsService.findUPS(ctx).getAttributes();
upsAttrs.setDate(Tag.ScheduledProcedureStepStartDateTime, VR.DT, scheduledTime());
if (upsLabel != null)
upsAttrs.setString(Tag.ProcedureStepLabel, VR.LO, upsLabel);
return upsAttrs;
}
use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UpsMatchingRS method createUPS.
private void createUPS(ArchiveAEExtension arcAE, Attributes ups, AtomicInteger count) {
UPSContext ctx = upsService.newUPSContext(HttpServletRequestInfo.valueOf(request), arcAE);
ctx.setUPSInstanceUID(UIDUtils.createUID());
ctx.setAttributes(ups);
try {
upsService.createUPS(ctx);
count.getAndIncrement();
} catch (DicomServiceException e) {
LOG.info("Failed to create UPS record for Study[uid={}]\n", ups.getSequence(Tag.InputInformationSequence).get(0).getString(Tag.StudyInstanceUID), e);
}
}
use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UPSServiceImpl method createUPSOnUPSCompleted.
private void createUPSOnUPSCompleted(UPSContext ctx, UPS prevUPS, UPSOnUPSCompleted rule, Calendar now) {
UPSContext upsCtx = newUPSContext(ctx);
upsCtx.setUPSInstanceUID(rule.getInstanceUID(prevUPS.getAttributes()));
upsCtx.setAttributes(upsOnCompleted(upsCtx, prevUPS, now, rule));
try {
createUPS(upsCtx);
} catch (DicomServiceException e) {
LOG.info("Failed to apply {} create on completion of {}", rule, prevUPS, e);
}
}
use of org.dcm4chee.arc.ups.UPSContext in project dcm4chee-arc-light by dcm4che.
the class UPSServiceImpl method onUPSCompleted.
private void onUPSCompleted(UPSContext ctx, UPS ups) {
Calendar now = Calendar.getInstance();
ctx.getArchiveAEExtension().upsOnUPSCompletedStream().filter(rule -> rule.getConditions().match(ctx.getRemoteHostName(), ctx.getRequesterAET(), ctx.getLocalHostName(), ctx.getApplicationEntity().getAETitle(), ups.getAttributes())).peek(rule -> LOG.info("Apply {} on completion of {}", rule, ups)).filter(rule -> isRequiredOtherUPSCompleted(ctx, ups, rule)).forEach(rule -> createUPSOnUPSCompleted(ctx, ups, rule, now));
}
Aggregations