Package org.socialmusicdiscovery.server.business.model.classification

Examples of org.socialmusicdiscovery.server.business.model.classification.ClassificationEntity


                ClassificationReferenceEntity classificationReference = new ClassificationReferenceEntity();
                classificationReference.setReferenceTo(reference);
                classificationReference.setLastUpdated(new Date());
                classificationReference.setLastUpdatedBy(getId());
                if (existingClassifications.size() == 0) {
                    ClassificationEntity classification = new ClassificationEntity();
                    classification.setName(classificationName);
                    if (sortValues.containsKey(sortPrefix + classificationName)) {
                        classification.setSortAs(sortValues.get(sortPrefix + classificationName));
                    }
                    classification.setType(classificationType);
                    classification.setLastUpdated(new Date());
                    classification.setLastUpdatedBy(getId());
                    validate(classification);
                    classificationRepository.create(classification);
                    classification.addReference(classificationReference);
                    classificationReferenceRepository.create(classificationReference);
                    this.classificationCache.put(classificationId, Arrays.asList(classification.getId()));
                } else {
                    for (ClassificationEntity classification : existingClassifications) {
                        classification.addReference(classificationReference);
                        classificationReferenceRepository.create(classificationReference);
                    }
                }
            }
        }
View Full Code Here


        loadTestData(getClass().getPackage().getName(), "The Bodyguard.xml");
        em.getTransaction().begin();
        try {
            Release release = releaseRepository.findByName("The Bodyguard (Original Soundtrack Album)").iterator().next();

            ClassificationEntity classification = new ClassificationEntity();
            classification.setName("Pop");
            classification.setType(Classification.GENRE);
            ClassificationReferenceEntity classificationReference = new ClassificationReferenceEntity();
            classificationReference.setReferenceTo(SMDIdentityReferenceEntity.forEntity(release));
            classificationReference.setLastUpdated(new Date());
            classificationReference.setLastUpdatedBy("JUnit");
            classification.addReference(classificationReference);
            classification.setLastUpdated(new Date());
            classification.setLastUpdatedBy("JUnit");

            for (Track track : release.getTracks()) {
                classificationReference = new ClassificationReferenceEntity();
                classificationReference.setReferenceTo(SMDIdentityReferenceEntity.forEntity(track));
                classificationReference.setLastUpdated(new Date());
                classificationReference.setLastUpdatedBy("JUnit");
                classification.addReference(classificationReference);
            }
            classificationRepository.create(classification);

            Collection<ClassificationEntity> classifications = classificationRepository.findByNameAndType("Pop", Classification.GENRE);
            assert classifications != null;
            assert classifications.size() == 1;
            classification = classifications.iterator().next();
            assert classification.getLastUpdated() != null;
            assert classification.getLastUpdatedBy() != null;
            Collection<ClassificationReference> references = classification.getReferences();
            assert references != null;
            assert references.size() == 5;
            int releaseMatches = 0;
            int trackMatches = 0;
            for (ClassificationReference reference : references) {
View Full Code Here

TOP

Related Classes of org.socialmusicdiscovery.server.business.model.classification.ClassificationEntity

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.