Package org.dspace.app.cris.model.listener

Source Code of org.dspace.app.cris.model.listener.NestedPositionListener

/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* https://github.com/CILEA/dspace-cris/wiki/License
*/
package org.dspace.app.cris.model.listener;

import it.cilea.osd.common.listener.NativePreInsertEventListener;
import it.cilea.osd.common.model.Identifiable;
import it.cilea.osd.jdyna.model.ANestedObject;

import org.dspace.app.cris.util.ResearcherPageUtils;

public class NestedPositionListener implements NativePreInsertEventListener
{
       
    private Integer INCREMENT_POSITION = 10000;
       
    @Override
    public <T extends Identifiable> void onPreInsert(T entity)
    {
       
        if (entity instanceof ANestedObject)
        {
           
            ANestedObject object = (ANestedObject) entity;          
            object.setPositionDef(ResearcherPageUtils.getNestedMaxPosition(object)+INCREMENT_POSITION);
           
        }
               
    }

}
TOP

Related Classes of org.dspace.app.cris.model.listener.NestedPositionListener

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.