Package org.drools.repository

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


            //But we can do our best to guess the format here, i.e., assume the format is equal to the extension type. User can always update
            //the format later on
            if (extension != null) {
                ai.updateFormat(extension);
            }
            ai.updateBinaryContentAttachment(is);
            ai.getModule().updateBinaryUpToDate(false);
            ai.checkin("update binary");
            rulesRepository.save();
            return toAssetEntryAbdera(ai, uriInfo);
        } catch (Exception e) {
View Full Code Here


                    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

                        }
                    }
                    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

                } 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

                    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

                        }
                    }
                    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

                } 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

                        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

                    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.updateValid(assetValidator.validate(asset));
                asset.checkin(comment);
            }
View Full Code Here

                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.updateValid(assetValidator.validate(as));
                as.checkin(comment);
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.