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