@Test public void testDrafts() throws CvqException { this.createDrafts(2); List<Request> drafts = this.getDrafts(); assertEquals(2, drafts.size()); requestWorkflowService.delete(drafts.get(0).getId()); continueWithNewTransaction(); drafts = getDrafts(); assertEquals(1, drafts.size()); Request draft2 = drafts.get(0); draft2.setState(RequestState.PENDING); requestWorkflowService.modify(draft2); continueWithNewTransaction(); try { this.getDraftById(draft2.getId()); fail(); } catch (IndexOutOfBoundsException e) { } requestWorkflowService.delete(draft2.getId()); continueWithNewTransaction(); assertEquals(0, getDrafts().size()); }
public void sendRequests() { List<Request> requests = requestExternalService.getSendableRequests(edemandeService.getLabel()); for (Request request : requests) { try { requestExternalService.sendRequest(request); } catch (CvqException e) { logger.warn( "sendRequests() Unable to send request " + request.getId() + " to " + edemandeService.getLabel()); } } }
@Override public final TechnicalInterventionRequestDocument modelToXml() { Calendar calendar = Calendar.getInstance(); LocalTime localTime = new LocalTime(); Date date = null; TechnicalInterventionRequestDocument technicalInterventionRequestDoc = TechnicalInterventionRequestDocument.Factory.newInstance(); TechnicalInterventionRequestDocument.TechnicalInterventionRequest technicalInterventionRequest = technicalInterventionRequestDoc.addNewTechnicalInterventionRequest(); super.fillCommonXmlInfo(technicalInterventionRequest); int i = 0; technicalInterventionRequest.setInterventionDescription(getInterventionDescription()); if (getInterventionPlace() != null) technicalInterventionRequest.setInterventionPlace(Address.modelToXml(getInterventionPlace())); i = 0; if (getInterventionType() != null) { fr.cg95.cvq.xml.common.LocalReferentialDataType[] interventionTypeTypeTab = new fr.cg95.cvq.xml.common.LocalReferentialDataType[getInterventionType().size()]; for (LocalReferentialData object : getInterventionType()) { interventionTypeTypeTab[i++] = LocalReferentialData.modelToXml(object); } technicalInterventionRequest.setInterventionTypeArray(interventionTypeTypeTab); } technicalInterventionRequest.setOtherInterventionLabel(getOtherInterventionLabel()); return technicalInterventionRequestDoc; }
@Override public final CompostableWasteCollectionRequestDocument modelToXml() { Calendar calendar = Calendar.getInstance(); LocalTime localTime = new LocalTime(); Date date = null; CompostableWasteCollectionRequestDocument compostableWasteCollectionRequestDoc = CompostableWasteCollectionRequestDocument.Factory.newInstance(); CompostableWasteCollectionRequestDocument.CompostableWasteCollectionRequest compostableWasteCollectionRequest = compostableWasteCollectionRequestDoc.addNewCompostableWasteCollectionRequest(); super.fillCommonXmlInfo(compostableWasteCollectionRequest); int i = 0; if (getCollectionAddress() != null) compostableWasteCollectionRequest.setCollectionAddress( Address.modelToXml(getCollectionAddress())); i = 0; if (getCompostableWasteType() != null) { fr.cg95.cvq.xml.common.LocalReferentialDataType[] compostableWasteTypeTypeTab = new fr.cg95.cvq.xml.common.LocalReferentialDataType[getCompostableWasteType().size()]; for (LocalReferentialData object : getCompostableWasteType()) { compostableWasteTypeTypeTab[i++] = LocalReferentialData.modelToXml(object); } compostableWasteCollectionRequest.setCompostableWasteTypeArray(compostableWasteTypeTypeTab); } compostableWasteCollectionRequest.setOtherWaste(getOtherWaste()); return compostableWasteCollectionRequestDoc; }
void createDrafts(int step) throws CvqException { continueWithNewTransaction(); for (int i = 1; i <= step; i++) { SecurityContext.setCurrentContext(SecurityContext.FRONT_OFFICE_CONTEXT); SecurityContext.setCurrentEcitizen(fake.responsibleId); Request request = new SchoolRegistrationRequest(); request.setRequesterId(SecurityContext.getCurrentEcitizen().getId()); request.setSubjectId(fake.childId); request.setState(RequestState.DRAFT); Long id = requestWorkflowService.create(request, null); continueWithNewTransaction(); request = requestSearchService.getById(id, true); request.setCreationDate(DateUtils.getShiftedDate(Calendar.DAY_OF_YEAR, i * (-1))); SecurityContext.setCurrentContext(SecurityContext.BACK_OFFICE_CONTEXT); SecurityContext.setCurrentAgent(agentNameWithManageRoles); requestWorkflowService.modify(request); continueWithNewTransaction(); } }
@Override public final DeathDetailsRequestDocument modelToXml() { Calendar calendar = Calendar.getInstance(); LocalTime localTime = new LocalTime(); Date date = null; DeathDetailsRequestDocument deathDetailsRequestDoc = DeathDetailsRequestDocument.Factory.newInstance(); DeathDetailsRequestDocument.DeathDetailsRequest deathDetailsRequest = deathDetailsRequestDoc.addNewDeathDetailsRequest(); super.fillCommonXmlInfo(deathDetailsRequest); int i = 0; deathDetailsRequest.setComment(getComment()); if (getCopies() != null) deathDetailsRequest.setCopies(new BigInteger(getCopies().toString())); deathDetailsRequest.setDeathCity(getDeathCity()); date = getDeathDate(); if (date != null) { calendar.setTime(date); deathDetailsRequest.setDeathDate(calendar); } deathDetailsRequest.setDeathFirstNames(getDeathFirstNames()); deathDetailsRequest.setDeathLastName(getDeathLastName()); deathDetailsRequest.setDeathPostalCode(getDeathPostalCode()); if (getFormat() != null) deathDetailsRequest.setFormat( fr.cg95.cvq.xml.request.civil.DeathCertificateFormatType.Enum.forString( getFormat().toString())); if (getMotive() != null) deathDetailsRequest.setMotive( fr.cg95.cvq.xml.request.civil.DeathCertificateMotiveType.Enum.forString( getMotive().toString())); return deathDetailsRequestDoc; }
@Override public final AlignmentCertificateRequestDocument modelToXml() { Calendar calendar = Calendar.getInstance(); LocalTime localTime = new LocalTime(); Date date = null; AlignmentCertificateRequestDocument alignmentCertificateRequestDoc = AlignmentCertificateRequestDocument.Factory.newInstance(); AlignmentCertificateRequestDocument.AlignmentCertificateRequest alignmentCertificateRequest = alignmentCertificateRequestDoc.addNewAlignmentCertificateRequest(); super.fillCommonXmlInfo(alignmentCertificateRequest); int i = 0; if (getRequesterQuality() != null) alignmentCertificateRequest.setRequesterQuality( fr.cg95.cvq.xml.request.urbanism.AcrRequesterQualityType.Enum.forString( getRequesterQuality().toString())); alignmentCertificateRequest.setSection(getSection()); alignmentCertificateRequest.setTransportationRoute(getTransportationRoute()); alignmentCertificateRequest.setOwnerFirstNames(getOwnerFirstNames()); alignmentCertificateRequest.setLocality(getLocality()); if (getNumber() != null) alignmentCertificateRequest.setNumber(new BigInteger(getNumber().toString())); alignmentCertificateRequest.setOwnerLastName(getOwnerLastName()); if (getOwnerAddress() != null) alignmentCertificateRequest.setOwnerAddress(Address.modelToXml(getOwnerAddress())); return alignmentCertificateRequestDoc; }
@Override public final MarriageDetailsRequestDocument modelToXml() { Calendar calendar = Calendar.getInstance(); LocalTime localTime = new LocalTime(); Date date = null; MarriageDetailsRequestDocument marriageDetailsRequestDoc = MarriageDetailsRequestDocument.Factory.newInstance(); MarriageDetailsRequestDocument.MarriageDetailsRequest marriageDetailsRequest = marriageDetailsRequestDoc.addNewMarriageDetailsRequest(); super.fillCommonXmlInfo(marriageDetailsRequest); int i = 0; if (getFormat() != null) marriageDetailsRequest.setFormat( fr.cg95.cvq.xml.request.civil.MarriageCertificateFormatType.Enum.forString( getFormat().toString())); if (getCopies() != null) marriageDetailsRequest.setCopies(new BigInteger(getCopies().toString())); MarriageHusbandInformationType marriageHusbandInformationTypeMarriageHusband = marriageDetailsRequest.addNewMarriageHusband(); marriageHusbandInformationTypeMarriageHusband.setMarriageHusbandLastName( getMarriageHusbandLastName()); MarriageWifeInformationType marriageWifeInformationTypeMarriageWife = marriageDetailsRequest.addNewMarriageWife(); marriageWifeInformationTypeMarriageWife.setMarriageWifeFirstNames(getMarriageWifeFirstNames()); marriageDetailsRequest.setComment(getComment()); marriageDetailsRequest.setRequesterQualityPrecision(getRequesterQualityPrecision()); MarriageFatherInformationType marriageFatherInformationTypeFatherInformation = marriageDetailsRequest.addNewFatherInformation(); marriageFatherInformationTypeFatherInformation.setFatherFirstNames(getFatherFirstNames()); MarriageInformationType marriageInformationTypeMarriage = marriageDetailsRequest.addNewMarriage(); marriageInformationTypeMarriage.setMarriagePostalCode(getMarriagePostalCode()); MarriageMotherInformationType marriageMotherInformationTypeMotherInformation = marriageDetailsRequest.addNewMotherInformation(); marriageMotherInformationTypeMotherInformation.setMotherMaidenName(getMotherMaidenName()); marriageHusbandInformationTypeMarriageHusband.setMarriageHusbandFirstNames( getMarriageHusbandFirstNames()); if (getRequesterQuality() != null) marriageDetailsRequest.setRequesterQuality( fr.cg95.cvq.xml.request.civil.MarriageRequesterQualityType.Enum.forString( getRequesterQuality().toString())); marriageInformationTypeMarriage.setMarriageCity(getMarriageCity()); marriageWifeInformationTypeMarriageWife.setMarriageWifeLastName(getMarriageWifeLastName()); date = getMarriageDate(); if (date != null) { calendar.setTime(date); marriageInformationTypeMarriage.setMarriageDate(calendar); } marriageFatherInformationTypeFatherInformation.setFatherLastName(getFatherLastName()); if (getRelationship() != null) marriageDetailsRequest.setRelationship( fr.cg95.cvq.xml.request.civil.MarriageRelationshipType.Enum.forString( getRelationship().toString())); marriageMotherInformationTypeMotherInformation.setMotherFirstNames(getMotherFirstNames()); if (getMotive() != null) marriageDetailsRequest.setMotive( fr.cg95.cvq.xml.request.civil.MarriageCertificateMotiveType.Enum.forString( getMotive().toString())); return marriageDetailsRequestDoc; }