当前位置: 首页>>代码示例>>Java>>正文


Java Picture.getMimeType方法代码示例

本文整理汇总了Java中org.activiti.engine.identity.Picture.getMimeType方法的典型用法代码示例。如果您正苦于以下问题:Java Picture.getMimeType方法的具体用法?Java Picture.getMimeType怎么用?Java Picture.getMimeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.identity.Picture的用法示例。


在下文中一共展示了Picture.getMimeType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initPicture

import org.activiti.engine.identity.Picture; //导入方法依赖的package包/类
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);
      image.setWidth(30, Embedded.UNITS_PIXELS);
      image.addListener(new MouseEvents.ClickListener() {
        private static final long serialVersionUID = 7341560240277898495L;
        public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
          viewManager.showProfilePopup(userName);
        }
      });
      
      addComponent(image);
      setComponentAlignment(image, Alignment.MIDDLE_LEFT);
    } else {
     // TODO: what when no image is available?
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:UserProfileLink.java

示例2: setPicture

import org.activiti.engine.identity.Picture; //导入方法依赖的package包/类
public void setPicture(Picture picture) {
  if (pictureByteArrayId!=null) {
    Context
      .getCommandContext()
      .getDbSqlSession()
      .delete(ByteArrayEntity.class, pictureByteArrayId);
  }
  if (picture!=null) {
    pictureByteArray = new ByteArrayEntity(picture.getMimeType(), picture.getBytes());
    Context
      .getCommandContext()
      .getDbSqlSession()
      .insert(pictureByteArray);
    pictureByteArrayId = pictureByteArray.getId();
  } else {
    pictureByteArrayId = null;
    pictureByteArray = null;
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:UserEntity.java

示例3: getPicture

import org.activiti.engine.identity.Picture; //导入方法依赖的package包/类
@Get
public InputRepresentation getPicture() {
  if(authenticate() == false) return null;
  
  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;
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:24,代码来源:UserPictureResource.java


注:本文中的org.activiti.engine.identity.Picture.getMimeType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。