Skip to content

Commit

Permalink
Remote publish fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto committed Jan 25, 2013
1 parent a9e6e53 commit 6885f12
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2080,10 +2080,6 @@ private Contentlet checkin(Contentlet contentlet, ContentletRelationships conten
String contentPushExpireTime = contentlet.getStringProperty("wfExpireTime");
String contentPushNeverExpire = contentlet.getStringProperty("wfNeverExpire");

if(saveWithExistingID)
contentlet = conFac.save(contentlet, existingInode);
else
contentlet = conFac.save(contentlet);

if (!InodeUtils.isSet(contentlet.getIdentifier())) {
Treeable parent = null;
Expand All @@ -2099,7 +2095,7 @@ private Contentlet checkin(Contentlet contentlet, ContentletRelationships conten
else
ident = APILocator.getIdentifierAPI().createNew(contPar, parent);
contentlet.setIdentifier(ident.getId());
contentlet = conFac.save(contentlet);
//contentlet = conFac.save(contentlet);
} else {
Identifier ident = APILocator.getIdentifierAPI().find(contentlet);

Expand All @@ -2126,6 +2122,11 @@ private Contentlet checkin(Contentlet contentlet, ContentletRelationships conten
}
APILocator.getIdentifierAPI().save(ident);
}

if(saveWithExistingID)
contentlet = conFac.save(contentlet, existingInode);
else
contentlet = conFac.save(contentlet);


APILocator.getVersionableAPI().setWorking(contentlet);
Expand Down
9 changes: 2 additions & 7 deletions src/com/dotcms/publisher/pusher/bundler/ContentBundler.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,8 @@ public void generate(File bundleRoot, BundlerStatus status)
if(UtilMethods.isSet(contentsIds) && !contentsIds.isEmpty()) { // this content set is a dependency of other assets, like htmlpages
Set<Contentlet> contents = new HashSet<Contentlet>();
for (String contentIdentifier : contentsIds) {
try{
contents.add(APILocator.getContentletAPI().findContentletByIdentifier(contentIdentifier, true, APILocator.getLanguageAPI().getDefaultLanguage().getId(), systemUser, false));
}catch (Exception e) {
try{
contents.add(APILocator.getContentletAPI().findContentletByIdentifier(contentIdentifier, false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), systemUser, false));
}catch (Exception e1) { }
}
contents.addAll(conAPI.search("+identifier:"+contentIdentifier+" +live:true +deleted:false", 0, -1, null, systemUser, false));
contents.addAll(conAPI.search("+identifier:"+contentIdentifier+" +working:true +deleted:false", 0, -1, null, systemUser, false));
}

//Delete duplicate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ private void publish(Contentlet content, File folderOut, User userToUse, Content
if(binaryFolder != null && binaryFolder.exists() && binaryFolder.listFiles().length > 0)
content.setBinary(ff.getVelocityVarName(), binaryFolder.listFiles()[0]);
}

}

content = conAPI.checkin(content, userToUse, false);
Expand Down
4 changes: 2 additions & 2 deletions src/com/dotcms/publisher/util/DependencyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,14 @@ private void setContentDependencies(List<String> luceneQueries) throws DotBundle

//Getting all related content
for (Contentlet con : cs) {
contentsToProcess.add(con);

Map<Relationship, List<Contentlet>> contentRel =
APILocator.getContentletAPI().findContentRelationships(con, user);

for (Relationship rel : contentRel.keySet()) {
contentsToProcess.addAll(contentRel.get(rel));
}

contentsToProcess.add(con);
}

// Adding the Contents (including related) and adding filesAsContent
Expand Down
13 changes: 8 additions & 5 deletions src/com/dotmarketing/business/VersionableFactoryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,14 @@ private VersionInfo refreshVersionInfoFromDb(VersionInfo info) throws DotDataExc

Identifier ident = APILocator.getIdentifierAPI().find(info.getIdentifier());
Class clazz = UtilMethods.getVersionInfoType(ident.getAssetType());
HibernateUtil dh = new HibernateUtil(clazz);
dh.setQuery("from "+clazz.getName()+" where identifier=?");
dh.setParam(info.getIdentifier());
Logger.debug(this.getClass(), "getVersionInfo query: "+dh.getQuery());
VersionInfo vi=(VersionInfo)dh.load();
VersionInfo vi= null;
if(clazz != null) {
HibernateUtil dh = new HibernateUtil(clazz);
dh.setQuery("from "+clazz.getName()+" where identifier=?");
dh.setParam(info.getIdentifier());
Logger.debug(this.getClass(), "getVersionInfo query: "+dh.getQuery());
vi=(VersionInfo)dh.load();
}
if(vi ==null || !UtilMethods.isSet(vi.getIdentifier())) {
try {
vi = (VersionInfo) clazz.newInstance();
Expand Down

0 comments on commit 6885f12

Please sign in to comment.