mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Change minor and major version labels
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8168 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
|
||||
package org.alfresco.web.bean.coci;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.web.app.Application;
|
||||
|
||||
/**
|
||||
@@ -23,8 +28,8 @@ public class CCDoneEditingDialog extends CheckinCheckoutDialog
|
||||
*/
|
||||
public String getMajorNewVersionLabel()
|
||||
{
|
||||
Version curVersion = property.getVersionQueryService().getCurrentVersion(property.getDocument().getNodeRef());
|
||||
StringTokenizer st = new StringTokenizer(curVersion.getVersionLabel(), ".");
|
||||
String label = getCurrentVersionLabel();
|
||||
StringTokenizer st = new StringTokenizer(label, ".");
|
||||
return (Integer.valueOf(st.nextToken()) + 1) + ".0";
|
||||
}
|
||||
|
||||
@@ -33,17 +38,11 @@ public class CCDoneEditingDialog extends CheckinCheckoutDialog
|
||||
*/
|
||||
public String getMinorNewVersionLabel()
|
||||
{
|
||||
Version curVersion = property.getVersionQueryService().getCurrentVersion(property.getDocument().getNodeRef());
|
||||
StringTokenizer st = new StringTokenizer(curVersion.getVersionLabel(), ".");
|
||||
String label = getCurrentVersionLabel();
|
||||
StringTokenizer st = new StringTokenizer(label, ".");
|
||||
return st.nextToken() + "." + (Integer.valueOf(st.nextToken()) + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return checkinFileOK(context, outcome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
@@ -62,4 +61,28 @@ public class CCDoneEditingDialog extends CheckinCheckoutDialog
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_TITLE) + " '" + property.getDocument().getName() + "'";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return checkinFileOK(context, outcome);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return version label for source node for working copy.
|
||||
*/
|
||||
private String getCurrentVersionLabel()
|
||||
{
|
||||
NodeRef workingCopyNodeRef = property.getDocument().getNodeRef();
|
||||
if (this.nodeService.hasAspect(workingCopyNodeRef, ContentModel.ASPECT_COPIEDFROM) == true)
|
||||
{
|
||||
Map<QName, Serializable> workingCopyProperties = nodeService.getProperties(workingCopyNodeRef);
|
||||
NodeRef nodeRef = (NodeRef) workingCopyProperties.get(ContentModel.PROP_COPY_REFERENCE);
|
||||
|
||||
Version curVersion = property.getVersionQueryService().getCurrentVersion(nodeRef);
|
||||
return curVersion.getVersionLabel();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user