String[] a = fileName.split("\\.");
PackageItem pkg = repo.loadPackage(bits[1]);
if (a[1].equals("package")) {
//updating package header
if (lastModified != null && pkg.getLastModified().after(lastModified)) {
throw new RulesRepositoryException("The package was modified by: " + pkg.getLastContributor() + ", unable to write changes.");
}
pkg.updateStringProperty(readContent(in), PackageItem.HEADER_PROPERTY_NAME);
pkg.checkin(comment);
repo.save();
} else {
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));