Package org.activiti.engine.identity

Examples of org.activiti.engine.identity.Picture


  public Picture getPicture() {
    if (pictureByteArrayId==null) {
      return null;
    }
    ByteArrayEntity pictureByteArray = getPictureByteArray();
    Picture picture = null;
    if (pictureByteArray != null) {
      picture = new Picture(pictureByteArray.getBytes(), pictureByteArray.getName());
    }
    return picture;
  }
View Full Code Here


    initUserLink(userId);
  }

  protected void initPicture(IdentityService identityService, boolean renderPicture, final String userName) {
    if(renderPicture) {
      Picture picture = identityService.getUserPicture(userName);
      if(picture != null) {
        Resource imageResource = new StreamResource(new InputStreamStreamSource(picture.getInputStream()),
          userName + picture.getMimeType(), ExplorerApp.get());
       
        Embedded image = new Embedded(null, imageResource);
        image.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        image.setType(Embedded.TYPE_IMAGE);
        image.setHeight(30, Embedded.UNITS_PIXELS);
View Full Code Here

   
    String userId = (String) getRequest().getAttributes().get("userId");
    if(userId == null) {
      throw new ActivitiException("No userId provided");
    }
    Picture picture = ActivitiUtil.getIdentityService().getUserPicture(userId);
   
    String contentType = picture.getMimeType();
    MediaType mediatType = MediaType.IMAGE_PNG;
    if(contentType != null) {
      if(contentType.contains(";")) {
        contentType = contentType.substring(0, contentType.indexOf(";"));
      }
      mediatType = MediaType.valueOf(contentType);
    }
    InputRepresentation output = new InputRepresentation(picture.getInputStream(), mediatType);
    getResponse().getCacheDirectives().add(CacheDirective.maxAge(28800));
   
    return output;
  }
View Full Code Here

    // Following data is not set by demo setup script
     
    // image
    if (imageResource != null) {
      byte[] pictureBytes = IoUtil.readInputStream(this.getClass().getClassLoader().getResourceAsStream(imageResource), null);
      Picture picture = new Picture(pictureBytes, "image/jpeg");
      identityService.setUserPicture(userId, picture);
    }
     
    // user info
    if (userInfo != null) {
View Full Code Here

    // Following data is not set by demo setup script
     
    // image
    if (imageResource != null) {
      byte[] pictureBytes = IoUtil.readInputStream(this.getClass().getClassLoader().getResourceAsStream(imageResource), null);
      Picture picture = new Picture(pictureBytes, "image/jpeg");
      identityService.setUserPicture(userId, picture);
    }
     
    // user info
    if (userInfo != null) {
View Full Code Here

    // Following data is not set by demo setup script
     
    // image
    if (imageResource != null) {
      byte[] pictureBytes = IoUtil.readInputStream(this.getClass().getClassLoader().getResourceAsStream(imageResource), null);
      Picture picture = new Picture(pictureBytes, "image/jpeg");
      identityService.setUserPicture(userId, picture);
    }
     
    // user info
    if (userInfo != null) {
View Full Code Here

    // Following data is not set by demo setup script
     
    // image
    if (imageResource != null) {
      byte[] pictureBytes = IoUtil.readInputStream(this.getClass().getClassLoader().getResourceAsStream(imageResource), null);
      Picture picture = new Picture(pictureBytes, "image/jpeg");
      identityService.setUserPicture(userId, picture);
    }
     
    // user info
    if (userInfo != null) {
View Full Code Here

      newUser.setEmail("no-reply@activiti.org");
      identityService.saveUser(newUser);
      savedUser = newUser;
     
      // Create picture for user
      Picture thePicture = new Picture("this is the picture raw byte stream".getBytes(), "image/png");
      identityService.setUserPicture(newUser.getId(), thePicture);
     
      CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX +
          RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_PICTURE, newUser.getId())), HttpStatus.SC_OK);
     
View Full Code Here

          RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_PICTURE, newUser.getId()));
      httpPut.setEntity(HttpMultipartHelper.getMultiPartEntity("myPicture.png", "image/png",
              new ByteArrayInputStream("this is the picture raw byte stream".getBytes()), null));
      closeResponse(executeBinaryRequest(httpPut, HttpStatus.SC_NO_CONTENT));
     
      Picture picture = identityService.getUserPicture(newUser.getId());
      assertNotNull(picture);
      assertEquals("image/png", picture.getMimeType());
      assertEquals("this is the picture raw byte stream", new String(picture.getBytes()));
     
    } finally {
     
      // Delete user after test passes or fails
      if (savedUser != null) {
View Full Code Here

          RestUrls.createRelativeResourceUrl(RestUrls.URL_USER_PICTURE, newUser.getId()));
      httpPut.setEntity(HttpMultipartHelper.getMultiPartEntity("myPicture.png", "image/png",
              new ByteArrayInputStream("this is the picture raw byte stream".getBytes()), additionalFields));
      closeResponse(executeBinaryRequest(httpPut, HttpStatus.SC_NO_CONTENT));
     
      Picture picture = identityService.getUserPicture(newUser.getId());
      assertNotNull(picture);
      assertEquals("image/png", picture.getMimeType());
      assertEquals("this is the picture raw byte stream", new String(picture.getBytes()));
     
    } finally {
     
      // Delete user after test passes or fails
      if(savedUser != null) {
View Full Code Here

TOP

Related Classes of org.activiti.engine.identity.Picture

Copyright © 2018 www.massapicom. 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.