view src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentAliasBean.java @ 211:631864bfec2e

add methods for lost misattributions and misidentifications.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Fri, 04 Oct 2019 17:42:27 +0200
parents eee2e0ca4032
children
line wrap: on
line source

package de.mpiwg.itgroup.ismi.entry.beans;

import java.io.Serializable;

import org.apache.log4j.Logger;
import org.mpi.openmind.repository.bo.Entity;
import org.mpi.openmind.repository.bo.Node;
import org.mpi.openmind.repository.services.utils.EditIntent;


public class CurrentAliasBean extends AbstractISMIBean  implements Serializable{
	private static final long serialVersionUID = 3420778447263527153L;
	
	private static Logger logger = Logger.getLogger(CurrentAliasBean.class);
	
	/** intent to edit all attributes and relations in the form */
	public static EditIntent editAliasIntent = new EditIntent(
			AbstractISMIBean.ALIAS,
			// attributes
			new String[]{"alias", "alias_translit"},
			// source relations
			new String[]{},
			// target relations
			new String[]{});
	
	public CurrentAliasBean(){
		this.entity = new Entity(Node.TYPE_ABOX, ALIAS, false);
		setDefObjectClass(ALIAS);
	}

	@Override
	public void setEntity(Entity alias) {		
		this.entity = alias;
		if(this.entity.isLightweight()){
			this.entity = getWrapper().getEntityContent(this.entity);
		}
		this.loadAttributes(this.entity);	
	}
	
	@Override
	public String save(){
		super.save();
		try {
			this.entity = updateEntityAttributes(this.entity);
			this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), editAliasIntent);
			getAppBean().getSimpleSearchCache().setMapDirty(true);
			
			logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity);
			this.printSuccessSavingEntity();	
			
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			this.printInternalError(e);
		}		
		saveEnd();
		return PAGE_EDITOR;
	}
}