Skip to content

Commit

Permalink
#12716 something like this
Browse files Browse the repository at this point in the history
  • Loading branch information
wezell committed Nov 17, 2017
1 parent f4a569d commit b43b999
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,13 @@ public interface VersionableAPI {
*/
public void removeVersionInfoFromCache(String identifier);

/**
* Will return a list of all ContentletVersionInfo for a given piece of content (if there are multiple languages)
* @param identifier
* @return
* @throws DotDataException
* @throws DotStateException
*/
public List<ContentletVersionInfo> findContentletVersionInfos(String identifier) throws DotDataException, DotStateException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,16 @@ public ContentletVersionInfo getContentletVersionInfo(final String identifier,
final long lang) throws DotDataException, DotStateException {
return versionableFactory.getContentletVersionInfo(identifier, lang);
}

@Override
@CloseDBIfOpened
public List<ContentletVersionInfo> findContentletVersionInfos(final String identifier) throws DotDataException, DotStateException {
return versionableFactory.findAllContentletVersionInfos(identifier);
}




@WrapInTransaction
@Override
public void saveVersionInfo(final VersionInfo vInfo) throws DotDataException, DotStateException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,7 @@ public abstract class VersionableFactory {
*/
protected abstract VersionInfo findVersionInfoFromDb(Identifier identifier) throws DotDataException, DotStateException;

protected abstract List<ContentletVersionInfo> findAllContentletVersionInfos(String identifier)
throws DotDataException, DotStateException ;

}
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,17 @@ protected ContentletVersionInfo findContentletVersionInfoInDB(String identifier,
contv = (ContentletVersionInfo)dh.load();
return contv;
}
@Override
protected List<ContentletVersionInfo> findAllContentletVersionInfos(final String identifier)throws DotDataException, DotStateException {

HibernateUtil dh = new HibernateUtil(ContentletVersionInfo.class);
dh.setQuery("from "+ContentletVersionInfo.class.getName()+" where identifier=? ");
dh.setParam(identifier);

Logger.debug(this.getClass(), "getContentletVersionInfo query: "+dh.getQuery());
return (List<ContentletVersionInfo>)dh.list();

}
@Override
protected void saveContentletVersionInfo(ContentletVersionInfo cvInfo, boolean updateVersionTS) throws DotDataException, DotStateException {
Identifier ident = this.iapi.find(cvInfo.getIdentifier());
Expand Down

0 comments on commit b43b999

Please sign in to comment.