isForcePush = bundle.isForcePush();
}
if ( !isForcePush && !isDownload && isPublish ) {
for (Environment env : envs) {
PushedAsset asset = cache.getPushedAsset(assetId, env.getId());
modified = (asset==null || (assetModDate!=null && asset.getPushDate().before(assetModDate)));
try {
if(!modified && assetType.equals("content")) {
// check for versionInfo TS on content
for(Language lang : APILocator.getLanguageAPI().getLanguages()) {
ContentletVersionInfo info=APILocator.getVersionableAPI().getContentletVersionInfo(assetId, lang.getId());
if(info!=null && InodeUtils.isSet(info.getIdentifier())) {
modified = modified || assetModDate.before(info.getVersionTs());
}
}
}
if(!modified && (assetType.equals("template") || assetType.equals("links") || assetType.equals("container") || assetType.equals("htmlpage"))) {
// check for versionInfo TS
VersionInfo info=APILocator.getVersionableAPI().getVersionInfo(assetId);
if(info!=null && InodeUtils.isSet(info.getIdentifier())) {
modified = assetModDate.before(info.getVersionTs());
}
}
} catch (Exception e) {
Logger.warn(getClass(), "Error checking versionInfo for assetType:"+assetType+" assetId:"+assetId+
" process continues without checking versionInfo.ts",e);
}
if(modified) {
try {
//We need to check if the assetID is already in the bundle.
//1.Get all the pushed assests records with same Asset ID.
List<PushedAsset> pushedAssests = APILocator.getPushedAssetsAPI().getPushedAssets(assetId);
boolean isAlreadyInPushedBunble = false;
//Check through the records to see if match env and bundle ID.
for(PushedAsset pushedAsset : pushedAssests){
if(pushedAsset.getBundleId().equals(bundleId)
&& pushedAsset.getEnvironmentId().equals(env.getId())){
isAlreadyInPushedBunble = true;
}
}
//If it is not already in the bundle, we can push the record.
if(!isAlreadyInPushedBunble){
asset = new PushedAsset(bundleId, assetId, assetType, new Date(), env.getId());
APILocator.getPushedAssetsAPI().savePushedAsset(asset);
}
cache.add(asset);