Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,6 @@ public static final class Events {
public static final String RECORDPROCESSINGCHANGE = "60";
public static final String RECORDDELETED = "61";
public static final String RECORDIMPORTED = "62";
public static final String RECORDRESTORED = "63";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
* Rome - Italy. email: geonetwork@osgeo.org
*/

package org.fao.geonet.events.history;

import org.springframework.context.ApplicationContext;

public class RecordRestoredEvent extends AbstractHistoryEvent {

private static final long serialVersionUID = 1110999025730522535L;

private String xmlRecordBefore, xmlRecordAfter;

public RecordRestoredEvent(Integer mdId, Integer userId, String xmlRecordBefore, String xmlRecordAfter) {
super(mdId, userId);
this.xmlRecordBefore = xmlRecordBefore;
this.xmlRecordAfter = xmlRecordAfter;
}

public RecordRestoredEvent(Long mdId, Integer userId, String xmlRecordBefore, String xmlRecordAfter) {
super(mdId, userId);
this.xmlRecordBefore = xmlRecordBefore;
this.xmlRecordAfter = xmlRecordAfter;
}

@Override
public String getCurrentState() {
return xmlRecordAfter;
}

@Override
public String getPreviousState() {
return xmlRecordBefore;
}

@Override
public void publish(ApplicationContext appContext) {
appContext.publishEvent(this);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
* Rome - Italy. email: geonetwork@osgeo.org
*/
package org.fao.geonet.listener.history;

import org.fao.geonet.domain.StatusValue;
import org.fao.geonet.events.history.RecordRestoredEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class RecordRestoredListener extends GenericMetadataEventListener implements ApplicationListener<RecordRestoredEvent> {

private String changeMessage = "";
private String eventType = StatusValue.Events.RECORDRESTORED;

@Override
public String getChangeMessage() {
return changeMessage;
}

@Override
public String getEventType() {
return eventType;
}

@Override
public void onApplicationEvent(RecordRestoredEvent event) {
handleEvent(event);
}
}
Loading