if (VersionUtil.isLatest(context, item) && item.isArchived()) {
hasVersionButton = true;
}
}
} catch (SQLException e) {
throw new PluginException(e.getMessage());
}
if (VersionUtil.hasVersionHistory(context, item)) {
hasVersionHistory = true;
history = VersionUtil.retrieveVersionHistory(context, item);
for(Version versRow : history.getVersions()) {
//Skip items currently in submission
try {
if(VersionUtil.isItemInSubmission(context, versRow.getItem()))
{
continue;
}
else {
historyVersions.add(versRow);
}
} catch (SQLException e) {
throw new PluginException(e.getMessage());
}
}
}
// Check if we have a history for the item
Version latestVersion;
try {
latestVersion = VersionUtil.checkLatestVersion(context, item);
} catch (SQLException e) {
throw new PluginException(e.getMessage());
}
if (latestVersion != null) {
if (latestVersion != null
&& latestVersion.getItemID() != item.getID()) {
// We have a newer version
Item latestVersionItem = latestVersion.getItem();
if (latestVersionItem.isArchived()) {
// Available, add a link for the user alerting him that
// a new version is available
newVersionAvailable = true;
try {
latestVersionURL = HandleManager.resolveToURL(
context, latestVersionItem.getHandle());
} catch (SQLException e) {
throw new PluginException(e.getMessage());
}
latestVersionHandle = latestVersionItem.getHandle();
} else {
// We might be dealing with a workflow/workspace item
showVersionWorkflowAvailable = true;