Example usage for javax.transaction NotSupportedException getClass

List of usage examples for javax.transaction NotSupportedException getClass

Introduction

In this page you can find the example usage for javax.transaction NotSupportedException getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:it.doqui.index.ecmengine.business.job.move.MoveAggregationJob.java

private void moveAggregation() throws MoveException {

    logger.debug("[MoveAggregationJob::moveAggregation] BEGIN");

    start(); // Avvia stopwatch

    try {//w w  w .j a v a2s.  c o m

        //bisogna ricercare nel repository quei nodi marcati come "spostabili"
        //solo questi dovranno essere spostati
        // 1) ricerca dei nodi spostabili
        // 2) ciclo per ogni nodo trovato, effettuare lo spostamento
        // 3) nodo spostato viene cancellato dalla source oppure viene marcato
        // come non visibile (aspect state valore riclassificato)

        List<NodeRef> listaNodi = searchNodeWithProp();
        int size = (listaNodi != null ? listaNodi.size() : 0);
        dumpElapsed("MoveAggregationJob", "moveAggregation", "Numero Nodi da Spostare: " + size,
                "Fine SearchNodeWithProp");

        logger.debug("[MoveAggregationJob::moveAggregation] Numero Nodi da Spostare: " + size);

        if (listaNodi != null) {

            MoveAggregation aggregation = null;

            String idDestinationParent = null;
            String idSourceNode = null;
            String destinationRepository = null;
            String sourceRepository = null;

            for (NodeRef sourceNodeRef : listaNodi) {

                aggregation = getPropertiesFromAspect(sourceNodeRef);

                if (aggregation != null) {
                    idDestinationParent = aggregation.getIdDestinationParent();
                    idSourceNode = aggregation.getIdSourceNode();

                    destinationRepository = aggregation.getDestinationRepository();
                    sourceRepository = aggregation.getSourceRepository();
                }

                boolean crossRepo = isCrossRepository(sourceRepository, destinationRepository);

                if (crossRepo) {
                    //spostamento da corrente a deposito
                    logger.debug("[MoveAggregationJob::moveAggregation] Spostamento da corrente a deposito");
                    long start = System.currentTimeMillis();
                    moveCrossRepo(sourceRepository, idSourceNode, destinationRepository, idDestinationParent,
                            sourceNodeRef);
                    long finished = System.currentTimeMillis();
                    logger.debug(
                            "[MoveAggregationJob::moveAggregation] Tempo Spostamento da corrente a deposito: "
                                    + (finished - start) + " ms");
                    dumpElapsed("MoveAggregationJob", "moveAggregation",
                            "Spostamento Cross Repository da " + idSourceNode + " a " + idDestinationParent,
                            "Fine Move Cross Repository");

                } else {

                    //spostamento da corrente a corrente
                    logger.debug("[MoveAggregationJob::moveAggregation] Spostamento da corrente a corrente");
                    long start = System.currentTimeMillis();
                    moveIntraRepo(sourceNodeRef, sourceRepository, idSourceNode, idDestinationParent);
                    long finished = System.currentTimeMillis();
                    logger.debug(
                            "[MoveAggregationJob::moveAggregation] Tempo Spostamento da corrente a corrente: "
                                    + (finished - start) + " ms");
                    dumpElapsed("MoveAggregationJob", "moveAggregation",
                            "Spostamento da " + idSourceNode + " a " + idDestinationParent,
                            "Fine Move Intra Repository");

                }
            }
        }
        // prima di fare una modifica bisogna controllare se il nodo padre possiede l'aspect state
        // con valore spostabile;  se e` cosi non e` possibile effettuare nessuna modifica al nodo
        // bisogna modificare i servizi fin qui fatti inserendo prima di tutto questo controllo
        // Quando poi l'aspect diventa spostato , il nodo e i suoi figli non sono visibili
    } catch (NotSupportedException e) {
        logger.error("[MoveAggregationJob::moveAggregation] " + "FATAL: transaction not supported: "
                + e.getMessage());
        throw new MoveException("Transaction not supported.", e);
    } catch (SystemException e) {
        logger.error("[MoveAggregationJob::moveAggregation] " + "FATAL: transaction manager error: "
                + e.getMessage());
        throw new MoveException("Transaction manager error.", e);
    } catch (EcmEngineFoundationException e) {
        logger.error("[MoveAggregationJob::moveAggregation] " + "FATAL: backend services error: "
                + e.getClass().getName() + " - " + e.getCode());
        throw new MoveException("Backend services error: " + e.getClass().getName() + " - " + e.getCode());
    } catch (SecurityException e) {
        logger.error(
                "[MoveAggregationJob::moveAggregation] " + "FATAL: SecurityException error: " + e.getMessage());
        throw new MoveException("SecurityException.", e);
    } catch (IllegalStateException e) {
        logger.error("[MoveAggregationJob::moveAggregation] " + "FATAL: IllegalStateException error: "
                + e.getMessage());
        throw new MoveException("IllegalStateException.", e);
    } catch (RollbackException e) {
        logger.error("[MoveAggregationJob::moveAggregation] " + "Transaction rolled back: " + e.getMessage());
        throw new MoveException("Transaction rolled back.", e);
    } catch (HeuristicMixedException e) {
        logger.error("[MoveAggregationJob::moveAggregation] "
                + "Transaction partially rolled back (heuristic rollback): " + e.getMessage());
        throw new MoveException("Transaction partially rolled back (heuristic rollback).", e);
    } catch (HeuristicRollbackException e) {
        logger.error("[MoveAggregationJob::moveAggregation] " + "Transaction rolled back (heuristic rollback): "
                + e.getMessage());
        throw new MoveException("Transaction rolled back (heuristic rollback).", e);
    } finally {
        stop(); // Ferma stopwatch
        logger.debug("[MoveAggregationJob::moveAggregation] END");
    }
}