All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bagri.server.hazelcast.task.doc.DocumentCollectionUpdater Maven / Gradle / Ivy

The newest version!
package com.bagri.server.hazelcast.task.doc;

import java.util.Map.Entry;

import org.springframework.beans.factory.annotation.Autowired;

import com.bagri.core.DocumentKey;
import com.bagri.core.api.BagriException;
import com.bagri.core.api.DocumentManagement;
import com.bagri.core.api.SchemaRepository;
import com.bagri.core.model.Document;
import com.bagri.core.system.Permission;
import com.bagri.server.hazelcast.impl.DocumentManagementImpl;
import com.hazelcast.map.EntryBackupProcessor;
import com.hazelcast.spring.context.SpringAware;

@SpringAware
public class DocumentCollectionUpdater extends com.bagri.client.hazelcast.task.doc.DocumentCollectionUpdater {

	private Document doc;
	private transient DocumentManagement docMgr;
    
    @Autowired
    @Override
	public void setRepository(SchemaRepository repo) {
		super.setRepository(repo);
		this.docMgr = repo.getDocumentManagement();
	}

	@Override
	public EntryBackupProcessor getBackupProcessor() {
		return new DocumentBackupProcessor(doc);
	}

	@Override
	public Object process(Entry entry) {
    	try {
    		checkPermission(Permission.Value.modify);
			doc = entry.getValue();
    		return ((DocumentManagementImpl) docMgr).updateDocumentCollections(add, entry, collections);
		} catch (BagriException ex) {
			throw new RuntimeException(ex);
		}
	}
   
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy