Package com.music.model.persistent

Examples of com.music.model.persistent.Piece


        sharedData.getListeningRequests().incrementAndGet();
        return id;
    }

    private long getRandomPieceId() {
        Piece piece;
        long maxId = sharedData.getMaxId();
        if (maxId == 0) {
            maxId = dao.getMaxPieceId();
        }
        long id = 0;
        int attempts = 0;
        while (attempts < 5) {
            id = (long) (1 + (Math.random() * maxId));
            piece = dao.getById(Piece.class, id);
            if (piece != null && piece.getLikes() >= -3) {
                break;
            }
            attempts++;
        }
        return id;
View Full Code Here


        return dao.getByIds(Piece.class, pieceIds);
    }

    @Transactional
    public void incrementDownloads(long id, boolean midi) {
        Piece piece = dao.getById(Piece.class, id);
        if (midi) {
            piece.setMidiDownloads(piece.getMidiDownloads() + 1);
        } else {
            piece.setMp3Downloads(piece.getMp3Downloads() + 1);
        }
        dao.persist(piece);
    }
View Full Code Here

            stop();
            return;
        }

        Long pieceId = pieceService.getNextPieceId(prefs);
        Piece piece = pieceService.getPiece(pieceId);
        pieces.add(piece);
        currentPieceId = pieceId;
        fillCurrentCorrectAnswer(piece);

        PossibleAnswers possibleAnswers = generatePossibleAnswers(piece);
View Full Code Here

TOP

Related Classes of com.music.model.persistent.Piece

Copyright © 2018 www.massapicom. 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.