Examples of updateBinaryContentAttachment()


Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

            ai.checkout();
            ai.updateBinaryContentAttachmentFileName(fileName);
            if(extension != null) {
                ai.updateFormat(extension);
            }
            ai.updateBinaryContentAttachment(is);
            ai.getPackage().updateBinaryUpToDate(false);
            ai.checkin("update binary");
            repository.save();
            return ToAssetEntryAbdera(ai, uriInfo);
        } catch (Exception e) {
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

    public void updateAssetBinary(@PathParam("packageName") String packageName, @PathParam("assetName") String assetName, InputStream is) {
        try {
            //Throws RulesRepositoryException if the package or asset does not exist
            AssetItem asset = repository.loadPackage(packageName).loadAsset(assetName);
            asset.checkout();
            asset.updateBinaryContentAttachment(is);
            asset.checkin("Update binary");
            repository.save();
        } catch (Exception e) {
            throw new WebApplicationException(e);
        }
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

            asset.archiveItem(false);
          } else {
            throw new RulesRepositoryException("The file " + path + " already exists, and was not archived.");
          }
          if (asset.isBinary()) {
            asset.updateBinaryContentAttachment(in);
          } else {
            asset.updateContent(readContent(in));
          }
        } else {
          asset = pkg.addAsset(a[0], "<added remotely>");
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

          asset = pkg.addAsset(a[0], "<added remotely>");
          asset.updateFormat(a[1]);
          if (TEXT_ASSET_TYPES.containsKey(a[1])) {
            asset.updateContent(readContent(in));
          } else {
            asset.updateBinaryContentAttachment(in);
          }
        }

        asset.checkin(comment);
      }
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

        AssetItem as = pkg.loadAsset(a[0]);
        if (lastModified != null && as.getLastModified().after(lastModified)) {
          throw new RulesRepositoryException("The asset was modified by: " + as.getLastContributor() + ", unable to write changes.");
        }
        if (as.isBinary()) {
          as.updateBinaryContentAttachment(in);
        } else {
          as.updateContent(readContent(in));
        }
        as.checkin(comment);
      }
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

        //here we should mark the binary data as invalid on the package (which means moving something into repo modle)

        AssetItem item = repository.loadAssetByUUID( uuid );

        item.updateBinaryContentAttachment( fileData );
        item.updateBinaryContentAttachmentFileName( fileName );
        item.getPackage().updateBinaryUpToDate( false );
        item.checkin( "Attached file: " + fileName );

        // Special treatment for model and ruleflow attachments.
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

                    while ((line = reader.readLine()) != null) {
                        if (!line.startsWith("package ")) {
                            sb.append(line).append("\n");
                        }
                    }
                    asset.updateBinaryContentAttachment(new ByteArrayInputStream(sb.toString().getBytes("UTF-8")));
                } catch (Exception e) {
                    //default
                    asset.updateBinaryContentAttachment(content);
                }
            } else {
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

                        }
                    }
                    asset.updateBinaryContentAttachment(new ByteArrayInputStream(sb.toString().getBytes("UTF-8")));
                } catch (Exception e) {
                    //default
                    asset.updateBinaryContentAttachment(content);
                }
            } else {
                asset.updateBinaryContentAttachment(content);
            }
            //here we could save, or check in, depending on if enough time has passed to justify
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

                } catch (Exception e) {
                    //default
                    asset.updateBinaryContentAttachment(content);
                }
            } else {
                asset.updateBinaryContentAttachment(content);
            }
            //here we could save, or check in, depending on if enough time has passed to justify
            //a new version. Otherwise we will pollute the version history with lots of trivial versions.
            //if (shouldCreateNewVersion(asset.getLastModified())) {
            asset.checkin("<content from webdav>");
View Full Code Here

Examples of org.drools.repository.AssetItem.updateBinaryContentAttachment()

                    while ((line = reader.readLine()) != null) {
                        if (!line.startsWith("package ")) {
                            sb.append(line).append("\n");
                        }
                    }
                    asset.updateBinaryContentAttachment(new ByteArrayInputStream(sb.toString().getBytes("UTF-8")));
                } catch (Exception e) {
                    //default
                    asset.updateBinaryContentAttachment(content);
                }
            } else {
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.