Examples of FileData


Examples of org.jresearch.gossip.beans.forum.attachment.FileData

        User user = (User) session.getAttribute(IConst.SESSION.USER_KEY);
        ForumDAO dao = ForumDAO.getInstance();
        ProcessAttachForm paForm = (ProcessAttachForm) form;
        if (Configurator.getInstance().getBoolean(
                IConst.CONFIG.ENABLE_FILE_UPLOAD)) {
            FileData fData = dao
                    .getAttachment(Integer.parseInt(paForm.getId()));
            String mime = fData.getInfo().getContentType();
            response.setContentType(mime);
            if (!(IConst.JSP.JPG_CONTENT_TYPE.equals(mime)
                    || IConst.JSP.GIF_CONTENT_TYPE.equals(mime) || IConst.JSP.PNG_CONTENT_TYPE
                    .equals(mime))) {
                response.setHeader("Content-disposition",
                        "attachment;filename=\"" + fData.getInfo().getName()
                                + "\"");
            }
            response.addHeader("Content-description", fData.getInfo()
                    .getDescription());
            ServletOutputStream outStream = response.getOutputStream();
            outStream.write(fData.getData());
            outStream.flush();
            outStream.close();
        } else {
            return (mapping.findForward(IConst.TOKEN.DENIED));
        }
View Full Code Here

Examples of org.mifosplatform.infrastructure.documentmanagement.data.FileData

        return StorageType.S3;
    }

    @Override
    public FileData fetchFile(final DocumentData documentData) throws DocumentNotFoundException {
        FileData fileData = null;
        final String fileName = documentData.fileName();
        try {
            logger.info("Downloading an object");
            final S3Object s3object = this.s3Client.getObject(new GetObjectRequest(this.s3BucketName, documentData.fileLocation()));
            fileData = new FileData(s3object.getObjectContent(), fileName, documentData.contentType());
        } catch (final AmazonClientException ace) {
            logger.error(ace.getMessage());
            throw new DocumentNotFoundException(documentData.getParentEntityType(), documentData.getParentEntityId(), documentData.getId());
        }
        return fileData;
View Full Code Here

Examples of org.mifosplatform.infrastructure.documentmanagement.data.FileData

    public Response downloadFile(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId,
            @PathParam("documentId") final Long documentId) {

        this.context.authenticatedUser().validateHasReadPermission(this.SystemEntityType);

        final FileData fileData = this.documentReadPlatformService.retrieveFileData(entityType, entityId, documentId);
        final ResponseBuilder response = Response.ok(fileData.file());
        response.header("Content-Disposition", "attachment; filename=\"" + fileData.name() + "\"");
        response.header("Content-Type", fileData.contentType());

        return response.build();
    }
View Full Code Here

Examples of org.mifosplatform.infrastructure.documentmanagement.data.FileData

    }

    @Override
    public FileData fetchFile(final DocumentData documentData) {
        final File file = new File(documentData.fileLocation());
        return new FileData(file, documentData.fileName(), documentData.contentType());
    }
View Full Code Here

Examples of org.sonar.batch.protocol.input.FileData

            revisions = ((MeasureModel) measureByKey[1]).getData(CoreMetrics.SCM_REVISIONS_BY_LINE);
          } else if (measureByKey[0].equals(CoreMetrics.SCM_AUTHORS_BY_LINE_KEY)) {
            authors = ((MeasureModel) measureByKey[1]).getData(CoreMetrics.SCM_AUTHORS_BY_LINE);
          }
        }
        ref.addFileData(module.getKeyWithBranch(), path, new FileData(hash, lastCommits, revisions, authors));
      }
    }
    ref.setLastAnalysisDate(lastSnapshotCreationDate(projectKey));
    return ref;
  }
View Full Code Here

Examples of org.sonar.batch.protocol.input.FileData

      profiler.stop();
    }
  }

  private void copyPreviousMeasuresForUnmodifiedFiles(final SensorContext context, List<InputFile> filesToBlame, InputFile f) {
    FileData fileData = projectReferentials.fileData(projectDefinition.getKeyWithBranch(), f.relativePath());

    if (f.status() == Status.SAME && fileData != null) {
      String scmAuthorsByLine = fileData.scmAuthorsByLine();
      String scmLastCommitDatetimesByLine = fileData.scmLastCommitDatetimesByLine();
      String scmRevisionsByLine = fileData.scmRevisionsByLine();
      if (scmAuthorsByLine != null
        && scmLastCommitDatetimesByLine != null
        && scmRevisionsByLine != null) {
        saveMeasures(context, f, scmAuthorsByLine, scmLastCommitDatetimesByLine, scmRevisionsByLine);
      } else {
View Full Code Here

Examples of org.sonar.batch.protocol.input.FileData

public class StatusDetectionTest {
  @Test
  public void detect_status() throws Exception {
    ProjectReferentials ref = new ProjectReferentials();
    ref.addFileData("foo", "src/Foo.java", new FileData("ABCDE", null, null, null));
    ref.addFileData("foo", "src/Bar.java", new FileData("FGHIJ", null, null, null));
    StatusDetection statusDetection = new StatusDetection(ref);

    assertThat(statusDetection.status("foo", "src/Foo.java", "ABCDE")).isEqualTo(InputFile.Status.SAME);
    assertThat(statusDetection.status("foo", "src/Foo.java", "XXXXX")).isEqualTo(InputFile.Status.CHANGED);
    assertThat(statusDetection.status("foo", "src/Other.java", "QWERT")).isEqualTo(InputFile.Status.ADDED);
View Full Code Here

Examples of org.sonar.batch.protocol.input.FileData

  StatusDetection(ProjectReferentials projectReferentials) {
    this.projectReferentials = projectReferentials;
  }

  InputFile.Status status(String projectKey, String relativePath, String hash) {
    FileData fileDataPerPath = projectReferentials.fileData(projectKey, relativePath);
    if (fileDataPerPath == null) {
      return InputFile.Status.ADDED;
    }
    String previousHash = fileDataPerPath.hash();
    if (StringUtils.equals(hash, previousHash)) {
      return InputFile.Status.SAME;
    }
    if (StringUtils.isEmpty(previousHash)) {
      return InputFile.Status.ADDED;
View Full Code Here

Examples of org.springframework.data.FileData

  public void saveProfilePicture(Long accountId, byte[] imageBytes) throws IOException {
    assertBytesLength(imageBytes);
    String contentType = guessContentType(imageBytes);
    assertContentType(contentType);
    storage.storeFile(new FileData("profile-pics/" + accountId + "/small.jpg", ImageUtils.scaleImageToWidth(imageBytes, 50), contentType));
    storage.storeFile(new FileData("profile-pics/" + accountId + "/normal.jpg", ImageUtils.scaleImageToWidth(imageBytes, 100), contentType));
    storage.storeFile(new FileData("profile-pics/" + accountId + "/large.jpg", ImageUtils.scaleImageToWidth(imageBytes, 200), contentType));
    jdbcTemplate.update("update Member set pictureSet = true where id = ?", accountId);   
  }
View Full Code Here

Examples of org.tamacat.dao.rdb.FileData

  public void tearDown() throws Exception {
  }
 
  @Test
  public void testGetInsertSQL() {
    FileData data = new FileData();
    data.setValue(FileData.FILE_ID, "123")
   
    query.addUpdateColumn(FileData.FILE_ID)
      .addUpdateColumn(FileData.DATA);
   
    assertEquals(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.