use of org.akaza.openclinica.domain.datamap.StudyParameterValue in project OpenClinica by OpenClinica.
the class StudyEventController method mayProceed.
private boolean mayProceed(Study study) throws Exception {
boolean accessPermission = false;
StudyParameterValue pStatus = studyParameterValueDao.findByStudyIdParameter(study.getStudyId(), "participantPortal");
ParticipantPortalRegistrar participantPortalRegistrar = new ParticipantPortalRegistrar();
// ACTIVE,PENDING,INACTIVE
String pManageStatus = participantPortalRegistrar.getRegistrationStatus(study.getOc_oid()).toString();
// enabled , disabled
String participateStatus = pStatus.getValue().toString();
// available , pending , frozen , locked
String studyStatus = study.getStatus().getName().toString();
logger.info("pManageStatus: " + pManageStatus + " participantStatus: " + participateStatus + " studyStatus: " + studyStatus);
System.out.println("pManageStatus: " + pManageStatus + " participantStatus: " + participateStatus + " studyStatus: " + studyStatus);
if (participateStatus.equalsIgnoreCase("enabled") && studyStatus.equalsIgnoreCase("available") && pManageStatus.equalsIgnoreCase("ACTIVE")) {
accessPermission = true;
}
return accessPermission;
}
use of org.akaza.openclinica.domain.datamap.StudyParameterValue in project OpenClinica by OpenClinica.
the class OdmImportServiceImpl method importOdmToOC.
@Transactional
public void importOdmToOC(ODM odm) {
UserAccount userAccount = getCurrentUser();
// TODO add validation to all entities
ODMcomplexTypeDefinitionStudy odmStudy = odm.getStudy().get(0);
Study study = saveOrUpdateStudy(odm, userAccount, odmStudy);
ParticipantPortalRegistrar portal = new ParticipantPortalRegistrar();
portal.registerStudy(study.getOc_oid(), study.getOc_oid(), study.getName());
StudyParameterValue spv = getStudyParameterValueDao().findByStudyIdParameter(study.getStudyId(), "participantPortal");
// Update OC Study configuration
if (spv == null) {
spv = new StudyParameterValue();
spv.setStudy(study);
}
spv.setValue("enabled");
spv = getStudyParameterValueDao().saveOrUpdate(spv);
StudyUserRole studyUserRole = null;
StudyUserRoleId studyUserRoleId = null;
Form[] fmCrfs = getAllCrfsByProtIdFromFormManager(study);
ArrayList<StudyUserRole> surRoles = getStudyUserRoleDao().findAllUserRolesByUserAccount(userAccount, study.getStudyId(), study.getStudyId());
if (surRoles.size() == 0) {
studyUserRoleId = new StudyUserRoleId();
studyUserRole = new StudyUserRole();
studyUserRole = getStudyUserRoleDao().saveOrUpdate(populateUserRole(study, userAccount, studyUserRole, studyUserRoleId));
}
StudyEventDefinition studyEventDefinition = null;
List<ODMcomplexTypeDefinitionMetaDataVersion> odmMetadataVersions = odmStudy.getMetaDataVersion();
List<ODMcomplexTypeDefinitionStudyEventDef> odmStudyEventDefs = saveOrUpdateEvent(userAccount, study, odmMetadataVersions);
CrfBean crf = null;
FormLayout formLayout = null;
saveOrUpdateCrf(userAccount, study, odmMetadataVersions, fmCrfs);
List<ODMcomplexTypeDefinitionStudyEventRef> odmStudyEventRefs = odmMetadataVersions.get(0).getProtocol().getStudyEventRef();
for (ODMcomplexTypeDefinitionStudyEventRef odmStudyEventRef : odmStudyEventRefs) {
for (ODMcomplexTypeDefinitionStudyEventDef odmStudyEventDef : odmStudyEventDefs) {
if (odmStudyEventDef.getOID().equals(odmStudyEventRef.getStudyEventOID())) {
studyEventDefinition = getStudyEventDefDao().findByOcOID(odmStudyEventDef.getOID());
studyEventDefinition.setOrdinal(odmStudyEventRef.getOrderNumber().intValue());
studyEventDefinition = getStudyEventDefDao().saveOrUpdate(studyEventDefinition);
List<EventDefinitionCrf> jsonEventDefCrfList = new ArrayList<>();
EventDefinitionCrf eventDefinitionCrf = null;
for (ODMcomplexTypeDefinitionFormRef odmFormRef : odmStudyEventDef.getFormRef()) {
crf = getCrfDao().findByOcOID(odmFormRef.getFormOID());
eventDefinitionCrf = getEventDefinitionCrfDao().findByStudyEventDefinitionIdAndCRFIdAndStudyId(studyEventDefinition.getStudyEventDefinitionId(), crf.getCrfId(), study.getStudyId());
String defaultVersionName = null;
OCodmComplexTypeDefinitionConfigurationParameters conf = odmFormRef.getConfigurationParameters();
List<OCodmComplexTypeDefinitionFormLayoutRef> formLayoutRefs = odmFormRef.getFormLayoutRef();
if (formLayoutRefs.size() == 1 && formLayoutRefs.get(0).getIsDefaultVersion() == null) {
defaultVersionName = formLayoutRefs.get(0).getOID();
} else {
for (OCodmComplexTypeDefinitionFormLayoutRef formLayoutRef : formLayoutRefs) {
if (formLayoutRef.getIsDefaultVersion().equalsIgnoreCase("Yes")) {
defaultVersionName = formLayoutRef.getOID();
}
}
}
if (defaultVersionName == null) {
defaultVersionName = formLayoutRefs.get(0).getOID();
}
formLayout = getFormLayoutDao().findByNameCrfId(defaultVersionName, crf.getCrfId());
EventDefinitionCrfDTO edcObj = new EventDefinitionCrfDTO();
edcObj.setUserAccount(userAccount);
edcObj.setConf(conf);
edcObj.setCrf(crf);
edcObj.setEventDefinitionCrf(eventDefinitionCrf);
edcObj.setOdmFormRef(odmFormRef);
edcObj.setStudy(study);
edcObj.setFormLayout(formLayout);
edcObj.setStudyEventDefinition(studyEventDefinition);
EDCTagDTO populateEDCTagParameter = new EDCTagDTO();
populateEDCTagParameter.setConf(conf);
populateEDCTagParameter.setConf(conf);
populateEDCTagParameter.setEventDefinitionCrf(eventDefinitionCrf);
populateEDCTagParameter.setUserAccount(userAccount);
eventDefinitionCrf = saveOrUpdateEventDefnCrf(new EventDefinitionCrfDTO(edcObj));
saveOrUpdateEDCTag(new EDCTagDTO(populateEDCTagParameter), studyEventDefinition, crf);
jsonEventDefCrfList.add(eventDefinitionCrf);
}
List<EventDefinitionCrf> ocEventDefCrfList = getEventDefinitionCrfDao().findAvailableByStudyEventDefStudy(studyEventDefinition.getStudyEventDefinitionId(), study.getStudyId());
for (EventDefinitionCrf ocEventDefCrf : ocEventDefCrfList) {
if (!jsonEventDefCrfList.contains(ocEventDefCrf)) {
ocEventDefCrf.setStatusId(Status.DELETED.getCode());
getEventDefinitionCrfDao().saveOrUpdate(ocEventDefCrf);
}
}
}
}
}
}
use of org.akaza.openclinica.domain.datamap.StudyParameterValue in project OpenClinica by OpenClinica.
the class OpenRosaSubmissionController method mayProceed.
private boolean mayProceed(Study childStudy, StudySubjectBean ssBean) throws Exception {
boolean accessPermission = false;
ParticipantPortalRegistrar participantPortalRegistrar = new ParticipantPortalRegistrar();
Study study = getParentStudy(childStudy);
StudyParameterValue pStatus = studyParameterValueDao.findByStudyIdParameter(study.getStudyId(), "participantPortal");
// ACTIVE, PENDING, or INACTIVE
String pManageStatus = participantPortalRegistrar.getRegistrationStatus(childStudy.getOc_oid()).toString();
// enabled or disabled
String participateStatus = pStatus.getValue().toString();
// available, pending, frozen, or locked
String studyStatus = study.getStatus().getName().toString();
if (ssBean == null) {
logger.info("pManageStatus: " + pManageStatus + " participantStatus: " + participateStatus + " studyStatus: " + studyStatus);
if (participateStatus.equalsIgnoreCase("enabled") && studyStatus.equalsIgnoreCase("available") && pManageStatus.equalsIgnoreCase("ACTIVE"))
accessPermission = true;
} else {
logger.info("pManageStatus: " + pManageStatus + " participantStatus: " + participateStatus + " studyStatus: " + studyStatus + " studySubjectStatus: " + ssBean.getStatus().getName());
// pManageStatus.equalsIgnoreCase("ACTIVE")
if (participateStatus.equalsIgnoreCase("enabled") && studyStatus.equalsIgnoreCase("available") && ssBean.getStatus() == Status.AVAILABLE)
accessPermission = true;
}
return accessPermission;
}
Aggregations