/**
* 下载主附件-(用于在线预览)
*
* @param osName
* @param docId
* @param response
* @param request
* @throws EcmException
*/
public static void downloadPrimaryAttach(String osName, String docId, HttpServletResponse response, HttpServletRequest request) throws EcmException {
EntityManager em = null;
OutputStream out = null;
try {
out = response.getOutputStream();
em = DaoManager.getEntityManager();
ObjectStore os = ObjectStoreHelper.getObjectStore(osName);
Document doc = P8DocumentDao.fetchDocumentById(os, docId);
Collection collection = EngineCollectionUtils.c(doc.get_ContentElements(), ContentTransfer.class);
if (collection.size() == 0) {// 没有附件
throw new EcmException(ErrorCode.ATTACHMENT_NULL_ERROR, "attach is null e