List of usage examples for java.util Date after
public boolean after(Date when)
From source file:figs.treeVisualization.gui.PhyloDateAxis.java
protected List<DateTick> refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea) { List<DateTick> result = new ArrayList<DateTick>(); DateFormat formatter = getDateFormatOverride(); Font tickLabelFont = getTickLabelFont(); g2.setFont(tickLabelFont);/*from w ww . j a va 2s .co m*/ if (isAutoTickUnitSelection()) { selectAutoTickUnit(g2, dataArea, RectangleEdge.RIGHT); } DateTickUnit unit = getTickUnit(); // nextStandardDate is adding to the min which makes no sense, so just call previous Date tickDate = previousStandardDate(getMinimumDate(), unit); Date upperDate = getMaximumDate(); while (!tickDate.after(upperDate)) { if (!isHiddenValue(tickDate.getTime())) { // work out the value, label and position String tickLabel; if (formatter != null) { tickLabel = formatter.format(tickDate); } else { tickLabel = this.getTickUnit().dateToString(tickDate); } TextAnchor anchor = null; TextAnchor rotationAnchor = null; double angle = 0.0; if (isVerticalTickLabels()) { anchor = TextAnchor.BOTTOM_CENTER; rotationAnchor = TextAnchor.BOTTOM_CENTER; // RectangeEdge.RIGHT angle = Math.PI / 2.0; } else { // RectangeEdge.RIGHT anchor = TextAnchor.CENTER_LEFT; rotationAnchor = TextAnchor.CENTER_LEFT; } DateTick tick = new DateTick(tickDate, tickLabel, anchor, rotationAnchor, angle); result.add(tick); tickDate = unit.addToDate(tickDate); } else { tickDate = unit.rollDate(tickDate); } } return result; }
From source file:org.motechproject.server.service.PentaScheduleTest.java
public void testCreateExpected() { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/* ww w .j a v a 2 s. c o m*/ calendar.add(Calendar.MONTH, -2); // age is 2 months Patient patient = new Patient(); patient.setBirthdate(calendar.getTime()); patient.setDateCreated(calendar.getTime()); Capture<Date> minDateCapture = new Capture<Date>(); Capture<Date> dueDateCapture = new Capture<Date>(); Capture<Date> lateDateCapture = new Capture<Date>(); Capture<Date> maxDateCapture = new Capture<Date>(); List<Obs> obsList = new ArrayList<Obs>(); List<ExpectedObs> expectedObsList = new ArrayList<ExpectedObs>(); expect(registrarBean.getObs(patient, pentaSchedule.getConceptName(), pentaSchedule.getValueConceptName(), patient.getBirthdate())).andReturn(obsList); expect(registrarBean.getExpectedObs(patient, pentaSchedule.getName())).andReturn(expectedObsList); expect(registrarBean.createExpectedObs(eq(patient), eq(pentaSchedule.getConceptName()), eq(pentaSchedule.getValueConceptName()), eq(penta1Event.getNumber()), capture(minDateCapture), capture(dueDateCapture), capture(lateDateCapture), capture(maxDateCapture), eq(penta1Event.getName()), eq(pentaSchedule.getName()))).andReturn(new ExpectedObs()); calendar.set(2010, 03, 10); expect(registrarBean.getChildRegistrationDate()).andReturn(calendar.getTime()); calendar.set(2011, 03, 10); Encounter encounter = new Encounter(); encounter.setEncounterDatetime(calendar.getTime()); expect(registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.getBirthdate())).andReturn(Arrays.asList(encounter)); replay(registrarBean); pentaSchedule.updateSchedule(patient, date); verify(registrarBean); Date dueDate = dueDateCapture.getValue(); Date lateDate = lateDateCapture.getValue(); assertNotNull("Due date is null", dueDate); assertNotNull("Late date is null", lateDate); assertTrue("Late date is not after due date", lateDate.after(dueDate)); }
From source file:com.netflix.simianarmy.janitor.JanitorEmailNotifier.java
/** * Decides if it is time for sending notification for the resource. This method can be * overridden in subclasses so notifications can be send earlier or later. * @param resource the resource//from ww w. j a v a 2 s . c om * @return true if it is OK to send notification now, otherwise false. */ protected boolean canNotify(Resource resource) { Validate.notNull(resource); if (resource.getState() != CleanupState.MARKED || resource.isOptOutOfJanitor()) { return false; } Date notificationTime = resource.getNotificationTime(); // We don't want to send notification too early (since things may change) or too late (we need // to give owners enough time to take actions. Date windowStart = new Date( new DateTime(calendar.getBusinessDay(calendar.now().getTime(), daysBeforeTermination).getTime()) .minusHours(HOURS_IN_MARGIN).getMillis()); Date windowEnd = calendar.getBusinessDay(calendar.now().getTime(), daysBeforeTermination + 1); Date terminationDate = resource.getExpectedTerminationTime(); if (notificationTime == null || resource.getMarkTime().after(notificationTime)) { // remarked after a notification if (!terminationDate.before(windowStart) && !terminationDate.after(windowEnd)) { // The expected termination time is close enough for sending notification return true; } else if (terminationDate.before(windowStart)) { // The expected termination date is too close. To give the owner time to take possible actions, // we extend the expected termination time here. LOGGER.info(String.format( "It is less than %d days before the expected termination date," + " of resource %s, extending the termination time to %s.", daysBeforeTermination, resource.getId(), windowStart)); resource.setExpectedTerminationTime(windowStart); resourceTracker.addOrUpdate(resource); return true; } else { return false; } } return false; }
From source file:org.motechproject.server.service.TetanusScheduleTest.java
public void testCreateExpectedDose() { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//from w ww. j a v a2 s . c o m calendar.add(Calendar.YEAR, -30); // age is 30 years Patient patient = new Patient(); patient.setGender("F"); patient.setBirthdate(calendar.getTime()); Capture<ExpectedObs> expectedObsCapture = new Capture<ExpectedObs>(); Capture<Date> dueDateCapture = new Capture<Date>(); Capture<Date> lateDateCapture = new Capture<Date>(); List<Obs> obsList = new ArrayList<Obs>(); Obs obs3 = new Obs(); obs3.setObsDatetime(date); obs3.setValueNumeric(new Double(3)); obsList.add(obs3); Obs obs4 = new Obs(); obs4.setObsDatetime(date); obs4.setValueNumeric(new Double(4)); obsList.add(obs4); List<ExpectedObs> expectedObsList = new ArrayList<ExpectedObs>(); ExpectedObs expectedObs = new ExpectedObs(); expectedObs.setName(tt4Event.getName()); expectedObs.setId(1L); expectedObsList.add(expectedObs); expect(registrarBean.getObs(patient, ttSchedule.getConceptName(), ttSchedule.getValueConceptName(), patient.getBirthdate())).andReturn(obsList); expect(registrarBean.getExpectedObs(patient, ttSchedule.getName())).andReturn(expectedObsList); expect(registrarBean.saveExpectedObs(capture(expectedObsCapture))).andReturn(new ExpectedObs()); expect(registrarBean.createExpectedObs(eq(patient), eq(ttSchedule.getConceptName()), eq(ttSchedule.getValueConceptName()), eq(tt5Event.getNumber()), (Date) anyObject(), capture(dueDateCapture), capture(lateDateCapture), (Date) anyObject(), eq(tt5Event.getName()), eq(ttSchedule.getName()))).andReturn(new ExpectedObs()); replay(registrarBean); ttSchedule.updateSchedule(patient, date); verify(registrarBean); ExpectedObs tt4ExpectedObs = expectedObsCapture.getValue(); assertEquals(tt4Event.getName(), tt4ExpectedObs.getName()); assertEquals(Boolean.TRUE, tt4ExpectedObs.getVoided()); assertEquals(obs4, tt4ExpectedObs.getObs()); Date dueDate = dueDateCapture.getValue(); Date lateDate = lateDateCapture.getValue(); assertNotNull("Due date is null", dueDate); assertNotNull("Late date is null", lateDate); assertTrue("Late date is not after due date", lateDate.after(dueDate)); }
From source file:be.fedict.trust.service.bean.ValidationServiceBean.java
public Date validate(BigInteger serialNumber, byte[] issuerNameHash, byte[] issuerKeyHash) { LOG.debug("validate"); Date unknownRevocationDate = new Date(); CertificateAuthorityEntity certificateAuthority = this.certificateAuthorityLookupBean.lookup(issuerNameHash, issuerKeyHash);//w w w . j a v a 2 s. c om if (null == certificateAuthority) { LOG.error("no certificate authority found"); return unknownRevocationDate; } String caName = certificateAuthority.getName(); LOG.debug("CA: " + caName); Date thisUpdate = certificateAuthority.getThisUpdate(); Date nextUpdate = certificateAuthority.getNextUpdate(); Date validationDate = new Date(); if (Status.ACTIVE != certificateAuthority.getStatus()) { LOG.debug("CRL cache not active for CA: " + caName); return unknownRevocationDate; } if (null == thisUpdate || validationDate.before(thisUpdate)) { LOG.debug("validation date before this update: " + caName); return unknownRevocationDate; } if (null == nextUpdate || validationDate.after(nextUpdate)) { LOG.debug("validation date after next update: " + caName); return unknownRevocationDate; } RevokedCertificateEntity revokedCertificate = this.entityManager.find(RevokedCertificateEntity.class, new RevokedCertificatePK(caName, serialNumber.toString())); if (null == revokedCertificate) { return null; } LOG.debug("revoked certificate: " + caName + " " + serialNumber); return revokedCertificate.getRevocationDate(); }
From source file:org.motechproject.server.service.PentaScheduleTest.java
public void testSatisfyExpected() { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*ww w . j a v a 2 s . c o m*/ calendar.add(Calendar.MONTH, -2); // age is 2 months Patient patient = new Patient(); patient.setBirthdate(calendar.getTime()); patient.setDateCreated(calendar.getTime()); Capture<Date> minDateCapture = new Capture<Date>(); Capture<Date> dueDateCapture = new Capture<Date>(); Capture<Date> lateDateCapture = new Capture<Date>(); Capture<Date> maxDateCapture = new Capture<Date>(); Capture<ExpectedObs> expectedObsCapture = new Capture<ExpectedObs>(); List<Obs> obsList = new ArrayList<Obs>(); Obs obs = new Obs(); obs.setObsDatetime(date); obs.setValueNumeric(new Double(1)); obsList.add(obs); List<ExpectedObs> expectedObsList = new ArrayList<ExpectedObs>(); ExpectedObs expectedObs = new ExpectedObs(); expectedObs.setId(2L); expectedObs.setName(penta1Event.getName()); expectedObsList.add(expectedObs); expect(registrarBean.getObs(patient, pentaSchedule.getConceptName(), pentaSchedule.getValueConceptName(), patient.getBirthdate())).andReturn(obsList); expect(registrarBean.getExpectedObs(patient, pentaSchedule.getName())).andReturn(expectedObsList); expect(registrarBean.saveExpectedObs(capture(expectedObsCapture))).andReturn(new ExpectedObs()); expect(registrarBean.createExpectedObs(eq(patient), eq(pentaSchedule.getConceptName()), eq(pentaSchedule.getValueConceptName()), eq(penta2Event.getNumber()), capture(minDateCapture), capture(dueDateCapture), capture(lateDateCapture), capture(maxDateCapture), eq(penta2Event.getName()), eq(pentaSchedule.getName()))).andReturn(new ExpectedObs()); calendar.set(2010, 03, 10); expect(registrarBean.getChildRegistrationDate()).andReturn(calendar.getTime()); calendar.set(2011, 03, 10); Encounter encounter = new Encounter(); encounter.setEncounterDatetime(calendar.getTime()); expect(registrarBean.getEncounters(patient, MotechConstants.ENCOUNTER_TYPE_PATIENTREGVISIT, patient.getBirthdate())).andReturn(Arrays.asList(encounter)); replay(registrarBean); pentaSchedule.updateSchedule(patient, date); verify(registrarBean); ExpectedObs capturedExpectedObs = expectedObsCapture.getValue(); assertEquals(Boolean.TRUE, capturedExpectedObs.getVoided()); assertEquals(obs, capturedExpectedObs.getObs()); Date dueDate = dueDateCapture.getValue(); Date lateDate = lateDateCapture.getValue(); assertNotNull("Due date is null", dueDate); assertNotNull("Late date is null", lateDate); assertTrue("Late date is not after due date", lateDate.after(dueDate)); }
From source file:com.devnexus.ting.web.controller.RegisterController.java
@RequestMapping(value = "/s/register-overview", method = RequestMethod.GET) public String getRegistrationOverview(Model model) { EventSignup signUp = businessService.getEventSignup(); prepareHeader(signUp.getEvent(), model); List<TicketGroup> currentTickets = signUp.getGroups().stream().filter((TicketGroup group) -> { Date now = new Date(); return (now.after(group.getOpenDate()) && now.before(group.getCloseDate())); }).collect(Collectors.toList()); List<TicketGroup> invididualTicketGroups = currentTickets.stream().filter((TicketGroup group) -> { return group.getMinPurchase() == 1; }).collect(Collectors.toList()); List<TicketGroup> groupTicketGroups = currentTickets.stream().filter((TicketGroup group) -> { return group.getMinPurchase() > 1; }).collect(Collectors.toList()); model.addAttribute("invididualTicketGroups", invididualTicketGroups); model.addAttribute("groupTicketGroups", groupTicketGroups); return "register-overview"; }
From source file:com.appleframework.monitor.model.MetricDog.java
protected boolean inWorkTime(Date current) { Date now = null; try {//from ww w. j a v a 2 s .com now = sdf.parse(sdf.format(current)); Date start = sdf.parse(startTime); Date end = sdf.parse(endTime); //"?"? if (excludeTimeMode) { return !(now.after(start) && now.before(end)); } else { return now.after(start) && now.before(end); } } catch (ParseException e) { throw new RuntimeException(e); } }
From source file:ch.bfh.uniboard.accesscontrolled.AccessControlledService.java
@Override protected Attributes beforePost(byte[] message, Attributes alpha, Attributes beta) { //TODO Check if ATTRIBUTE_NAME_PUBLICKEY and ATTRIBUTE_NAME_SIG are set in alpha if (!alpha.containsKey(ATTRIBUTE_NAME_PUBLICKEY)) { logger.log(Level.INFO, "Publickey missing in alpha."); beta.add(Attributes.REJECTED, new StringValue("BAC-001 Publickey missing in alpha.")); return beta; }//w ww.j av a 2 s . c o m //Get the latest authorization with key and group in the current section in the authorization group //Contraint for the publickey List<Constraint> constraints = new ArrayList<>(); List<String> sListKey = new ArrayList<>(); sListKey.add(ATTRIBUTE_NAME_CRYPTO); sListKey.add(ATTRIBUTE_NAME_PUBLICKEY); Constraint cKey = new Equal(new MessageIdentifier(sListKey), alpha.getValue(ATTRIBUTE_NAME_PUBLICKEY)); constraints.add(cKey); //Contraint of the group in the message List<String> sListGroup = new ArrayList<>(); sListGroup.add(GROUPED); Constraint cGroup = new Equal(new MessageIdentifier(sListGroup), alpha.getValue(GROUPED)); constraints.add(cGroup); //Constraint of the section List<String> sListSection = new ArrayList<>(); sListSection.add(SECTIONED); Constraint cSection = new Equal(new AlphaIdentifier(sListSection), alpha.getValue(SECTIONED)); constraints.add(cSection); //Constraint of the group List<String> sListGroup2 = new ArrayList<>(); sListGroup2.add(GROUPED); Constraint cGroup2 = new Equal(new AlphaIdentifier(sListGroup2), new StringValue(AUTH)); constraints.add(cGroup2); //Sort by time of posting desc List<Order> orderBy = new ArrayList<>(); Order byTime = new Order(new BetaIdentifier(CHRONOLOGICAL), false); orderBy.add(byTime); //Limit to one result Query q = new Query(constraints, orderBy, 1); ResultContainer rc = this.getService.get(q); if (rc.getResult().isEmpty() || rc.getResult().size() != 1) { logger.log(Level.INFO, "No authorization for publickey {0}" + " section {1}" + " group {2}", new Object[] { alpha.getValue(ATTRIBUTE_NAME_PUBLICKEY), alpha.getValue(SECTIONED), alpha.getValue(GROUPED) }); beta.add(Attributes.REJECTED, new StringValue("BAC-002 No authorization for this publickey.")); return beta; } Post authPost = rc.getResult().get(0); DateValue currentPostTime = (DateValue) beta.getValue(CHRONOLOGICAL); try { JsonNode data = JsonLoader.fromString(new String(authPost.getMessage(), Charset.forName("UTF-8"))); ObjectMapper mapper = new ObjectMapper(); //Check the signature JsonNode key = data.get(ATTRIBUTE_NAME_CRYPTO); String type = key.get("type").textValue(); boolean signature = false; switch (type) { case "RSA": signature = this.checkRSASignature(key, message, alpha); break; case "DL": signature = this.checkDLSignature(key, message, alpha); break; case "ECDL": signature = this.checkECDLSignature(key, message, alpha); break; default: break; } if (!signature) { logger.log(Level.INFO, "Signature for group {0} and key {1} is not valid.", new Object[] { alpha.getValue(GROUPED), key.get("publickey").asText() }); beta.add(Attributes.REJECTED, new StringValue("BAC-003 Signature is not valid.")); return beta; } //Check if startTime and endTime are set and if the post time is in between. if (data.has(STARTTIME)) { Date startDate = mapper.readValue(data.get(STARTTIME).traverse(), Date.class); if (startDate.after(currentPostTime.getValue())) { logger.log(Level.INFO, "Authorization for key {0}" + " section {1}" + " group {2} is not active yet. Start at {3}", new Object[] { alpha.getValue(ATTRIBUTE_NAME_CRYPTO), alpha.getValue(SECTIONED), alpha.getValue(GROUPED), startDate }); beta.add(Attributes.REJECTED, new StringValue("BAC-004 Authorization is not active yet.")); return beta; } } if (data.has(ENDTIME)) { Date endDate = mapper.readValue(data.get(ENDTIME).traverse(), Date.class); if (endDate.before(currentPostTime.getValue())) { logger.log(Level.INFO, "Authorization for key {0}" + " section {1}" + " group {2} has expired at {3}.", new Object[] { alpha.getValue(ATTRIBUTE_NAME_CRYPTO), alpha.getValue(SECTIONED), alpha.getValue(GROUPED), endDate }); beta.add(Attributes.REJECTED, new StringValue("BAC-005 Authorization expired.")); return beta; } } //Check if the amount of allowed posts is not exceeded if (data.has(AMOUNT)) { //If check the group for the amount of existing posts List<Constraint> constraintsAmount = new ArrayList<>(); Constraint cASection = new Equal(new AlphaIdentifier(SECTIONED), alpha.getValue(SECTIONED)); constraintsAmount.add(cASection); Constraint cAGroup = new Equal(new AlphaIdentifier(GROUPED), alpha.getValue(GROUPED)); constraintsAmount.add(cAGroup); Constraint cAKey = new Equal(new AlphaIdentifier(ATTRIBUTE_NAME_PUBLICKEY), alpha.getValue(ATTRIBUTE_NAME_PUBLICKEY)); constraintsAmount.add(cAKey); Query qAmount = new Query(constraintsAmount); ResultContainer rcAmount = this.getService.get(qAmount); if (rcAmount.getResult().size() >= data.get(AMOUNT).asInt()) { logger.log(Level.INFO, "Authorization for key {0}" + " section {1}" + " group {2} has used the allowed posts {3}.", new Object[] { alpha.getValue(ATTRIBUTE_NAME_CRYPTO), alpha.getValue(SECTIONED), alpha.getValue(GROUPED), data.get("amount").asInt() }); beta.add(Attributes.REJECTED, new StringValue("BAC-007 Amount of allowed posts used up.")); return beta; } } } catch (IOException ex) { logger.log(Level.SEVERE, "Error occoured while parsing authorization {0}", ex.getMessage()); beta.add(Attributes.ERROR, new StringValue("BAC-006 Internal server error.")); return beta; } //accept message return beta; }
From source file:com.collabnet.ccf.teamforge.TFAttachmentHandler.java
/** * This method retrieves all the attachments for all the artifacts present * in the artifactRows Set and encoded them into GenericArtifact attachment * format.// ww w . j a v a2s .com * * @param sessionId * @param lastModifiedDate * @param username * artifacts from this user will be filtered out * @param resyncUsername * artifacts from this user will be filtered out * @param artifactRows * @param sourceForgeSoap * @param maxAttachmentSizePerArtifact * @param artifactData * @return * @throws RemoteException */ public List<GenericArtifact> listAttachments(Connection connection, Date lastModifiedDate, String username, String resyncUsername, List<String> artifactIds, long maxAttachmentSizePerArtifact, boolean shouldShipAttachmentsWithArtifact, GenericArtifact artifactData) throws RemoteException { List<GenericArtifact> attachmentGAs = new ArrayList<GenericArtifact>(); for (String artifactId : artifactIds) { // String folderId = artifact.getFolderId(); AttachmentList attachmentsList = connection.getTeamForgeClient().listAttachments(artifactId); AttachmentRow[] attachmentRows = attachmentsList.getDataRows(); for (AttachmentRow row : attachmentRows) { String fileName = row.getFileName(); String attachmentSizeStr = row.getFileSize(); // String attachmentId = row.getStoredFileId(); long attachmentSize = Long.parseLong(attachmentSizeStr); if (username.equalsIgnoreCase(row.getCreatedBy()) || fileName.startsWith(username + "_")) { continue; } if (resyncUsername != null && fileName.startsWith(resyncUsername + "_")) { continue; } if (attachmentSize > maxAttachmentSizePerArtifact) { log.warn("attachment size is more than the configured maxAttachmentSizePerArtifact " + attachmentSizeStr); continue; } Date createdDate = row.getDateCreated(); if (createdDate.after(lastModifiedDate)) { GenericArtifact ga = new GenericArtifact(); ga.setIncludesFieldMetaData(GenericArtifact.IncludesFieldMetaDataValue.FALSE); ga.setArtifactAction(GenericArtifact.ArtifactActionValue.CREATE); ga.setArtifactMode(GenericArtifact.ArtifactModeValue.CHANGEDFIELDSONLY); ga.setArtifactType(GenericArtifact.ArtifactTypeValue.ATTACHMENT); ga.setDepParentSourceArtifactId(artifactId); ga.setSourceArtifactId(row.getAttachmentId()); if (artifactData != null) { ga.setSourceArtifactVersion(artifactData.getSourceArtifactVersion()); ga.setSourceArtifactLastModifiedDate(artifactData.getSourceArtifactLastModifiedDate()); } else { ga.setSourceArtifactVersion("1"); ga.setSourceArtifactLastModifiedDate(DateUtil.format(createdDate)); } GenericArtifactField contentTypeField = ga.addNewField(AttachmentMetaData.ATTACHMENT_TYPE, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); contentTypeField.setFieldValue(AttachmentMetaData.AttachmentType.DATA); contentTypeField.setFieldAction(GenericArtifactField.FieldActionValue.REPLACE); contentTypeField.setFieldValueType(GenericArtifactField.FieldValueTypeValue.STRING); GenericArtifactField sourceURLField = ga.addNewField(AttachmentMetaData.ATTACHMENT_SOURCE_URL, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); sourceURLField.setFieldValue(AttachmentMetaData.AttachmentType.LINK); sourceURLField.setFieldAction(GenericArtifactField.FieldActionValue.REPLACE); sourceURLField.setFieldValueType(GenericArtifactField.FieldValueTypeValue.STRING); //gaAttachment.setAttachmentAction(GenericArtifactAttachment // .AttachmentActionValue.CREATE); GenericArtifactField nameField = ga.addNewField(AttachmentMetaData.ATTACHMENT_NAME, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); nameField.setFieldValue(row.getFileName()); nameField.setFieldAction(GenericArtifactField.FieldActionValue.REPLACE); nameField.setFieldValueType(GenericArtifactField.FieldValueTypeValue.STRING); // gaAttachment.setAttachmentDescription(row.getFileName()); GenericArtifactField sizeField = ga.addNewField(AttachmentMetaData.ATTACHMENT_SIZE, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); sizeField.setFieldValue(Long.parseLong(row.getFileSize())); sizeField.setFieldAction(GenericArtifactField.FieldActionValue.REPLACE); sizeField.setFieldValueType(GenericArtifactField.FieldValueTypeValue.STRING); // gaAttachment.setAttachmentType(); GenericArtifactField mimeTypeField = ga.addNewField(AttachmentMetaData.ATTACHMENT_MIME_TYPE, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); mimeTypeField.setFieldValue(row.getMimetype()); mimeTypeField.setFieldAction(GenericArtifactField.FieldActionValue.REPLACE); mimeTypeField.setFieldValueType(GenericArtifactField.FieldValueTypeValue.STRING); byte[] attachmentData = null; attachmentData = this.getAttachmentData(connection, row.getRawFileId(), Long.parseLong(row.getFileSize()), artifactId, shouldShipAttachmentsWithArtifact, ga); if (shouldShipAttachmentsWithArtifact) { if (attachmentData != null) { ga.setRawAttachmentData(attachmentData); } } attachmentGAs.add(ga); } } } return attachmentGAs; }