mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Fix history bug.
This commit is contained in:
parent
81d3d591fa
commit
dce29eda19
@ -27,6 +27,7 @@ import org.hibernate.criterion.Junction;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.Criteria;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Calendar;
|
||||
|
||||
@ -234,10 +235,10 @@ public class MindmapManagerImpl
|
||||
getHibernateTemplate().delete(mindMap);
|
||||
}
|
||||
|
||||
private void saveHistory(@NotNull final Mindmap mindMap) {
|
||||
private void saveHistory(@NotNull final Mindmap mindMap) throws IOException {
|
||||
final MindMapHistory history = new MindMapHistory();
|
||||
|
||||
history.setXml(mindMap.getXml());
|
||||
history.setZippedXml(mindMap.getZippedXml());
|
||||
history.setCreationTime(Calendar.getInstance());
|
||||
history.setEditor(mindMap.getLastEditor());
|
||||
history.setMindmapId(mindMap.getId());
|
||||
|
@ -29,7 +29,7 @@ public class MindMapHistory {
|
||||
private int id;
|
||||
private Calendar creationTime;
|
||||
private User editor;
|
||||
private byte[] xml;
|
||||
private byte[] zippedXml;
|
||||
private int mindmapId;
|
||||
|
||||
public MindMapHistory() {
|
||||
@ -69,15 +69,15 @@ public class MindMapHistory {
|
||||
this.editor = editor;
|
||||
}
|
||||
|
||||
public byte[] getXml() {
|
||||
return xml;
|
||||
public byte[] getZippedXml() {
|
||||
return zippedXml;
|
||||
}
|
||||
|
||||
public void setXml(byte[] value) {
|
||||
xml = value;
|
||||
public void setZippedXml(byte[] value) {
|
||||
zippedXml = value;
|
||||
}
|
||||
|
||||
public byte[] getUnzipXml() throws IOException {
|
||||
return ZipUtils.zipToBytes(getXml());
|
||||
return ZipUtils.zipToBytes(getZippedXml());
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ public class MindmapController extends BaseController {
|
||||
List<MindMapHistory> mindmapHistory = mindmapService.findMindmapHistory(id);
|
||||
if (mindmapHistory.size() > 0) {
|
||||
final MindMapHistory mindMapHistory = mindmapHistory.get(0);
|
||||
mindmap.setZippedXml(mindMapHistory.getXml());
|
||||
mindmap.setZippedXml(mindMapHistory.getZippedXml());
|
||||
saveMindmapDocument(true, mindmap, user);
|
||||
}
|
||||
} else {
|
||||
|
@ -263,7 +263,7 @@ public class MindmapServiceImpl
|
||||
public void revertChange(@NotNull Mindmap mindmap, int historyId)
|
||||
throws WiseMappingException, IOException {
|
||||
final MindMapHistory history = mindmapManager.getHistory(historyId);
|
||||
mindmap.setZippedXml(history.getXml());
|
||||
mindmap.setZippedXml(history.getZippedXml());
|
||||
updateMindmap(mindmap, true);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
</id>
|
||||
|
||||
<property name="mindmapId" column="mindmap_id"/>
|
||||
<property name="xml" column="xml"/>
|
||||
<property name="getZippedXml" column="xml"/>
|
||||
<property name="creationTime" column="creation_date"/>
|
||||
<many-to-one name="editor" column="editor_id" unique="false" not-null="false" lazy="proxy"/>
|
||||
</class>
|
||||
|
Loading…
Reference in New Issue
Block a user