Package org.socialmusicdiscovery.server.business.model.core

Examples of org.socialmusicdiscovery.server.business.model.core.ReleaseEntity


            if(criteria.contains(":") && !criteria.startsWith(MenuLevelFolder.TYPE+":") && !criteria.startsWith(MenuLevelImageFolder.TYPE+":")) {
                currentId = criteria;
            }
        }

        ReleaseEntity entity = null;
        if (criteriaList.size() == 1 && currentId.startsWith("Release:")) {
            BrowseService browseService = browseServiceManager.getBrowseService("Release");
            if (browseService != null) {
                ResultItem currentItem = browseService.findById(currentId.substring(currentId.indexOf(":") + 1));
                entity = (ReleaseEntity) currentItem.getItem();
            }
        }
        Result<SpotifyAlbum> result = new Result<SpotifyAlbum>();

        if (entity != null) {
            try {
                JSONObject object = Client.create().resource("http://ws.spotify.com/search/1/album.json?q=album:" + URLEncoder.encode(entity.getName(), "utf8")).accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
                result.setCount(object.getJSONObject("info").getInt("num_results"));
                List<ResultItem<SpotifyAlbum>> albums = new ArrayList<ResultItem<SpotifyAlbum>>();
                JSONArray array = object.getJSONArray("albums");
                for (int i = 0; i < array.length(); i++) {
                    ResultItem<SpotifyAlbum> item = createFromJSON(array.getJSONObject(i));
View Full Code Here


    public ReleaseEntity create(ReleaseEntity release) {
        try {
            transactionManager.begin();
            release.setLastUpdated(new Date());
            release.setLastUpdatedBy(super.CHANGED_BY);
            ReleaseEntity createdEntity = super.createEntity(release);
            getRepository().refresh(createdEntity);
            return new CopyHelper().copy(createdEntity, Expose.class);
        }catch (RuntimeException e) {
            transactionManager.setRollbackOnly();
            throw e;
View Full Code Here

    public ReleaseEntity update(@PathParam("id") String id, ReleaseEntity release) {
        try {
            transactionManager.begin();
            release.setLastUpdated(new Date());
            release.setLastUpdatedBy(super.CHANGED_BY);
            ReleaseEntity updatedEntity = super.updateEntity(id, release);
            getRepository().refresh(updatedEntity);
            return new CopyHelper().copy(updatedEntity, Expose.class);
        }catch (RuntimeException e) {
            transactionManager.setRollbackOnly();
            throw e;
View Full Code Here

            if(criteria.contains(":") && !criteria.startsWith(MenuLevelFolder.TYPE+":") && !criteria.startsWith(MenuLevelImageFolder.TYPE+":")) {
                currentId = criteria;
            }
        }

        ReleaseEntity entity = null;
        if (criteriaList.size() == 1 && currentId.startsWith("Release:")) {
            BrowseService browseService = browseServiceManager.getBrowseService("Release");
            if (browseService != null) {
                ResultItem currentItem = browseService.findById(currentId.substring(currentId.indexOf(":") + 1));
                entity = (ReleaseEntity) currentItem.getItem();
            }
        }
        Result<LastFMAlbum> result = new Result<LastFMAlbum>();

        if (entity != null) {
            try {
                JSONObject object = Client.create().resource(getLastFmUrl("album.search&album=" + urlEncode(entity.getName()))).accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
                List<ResultItem<LastFMAlbum>> albums = new ArrayList<ResultItem<LastFMAlbum>>();
                JSONArray array = object.getJSONObject("results").getJSONObject("albummatches").getJSONArray("album");
                result.setCount(array.length());
                for (int i = 0; i < array.length(); i++) {
                    if((firstItem==null || i>=firstItem) && (maxItems==null || maxItems>albums.size())) {
View Full Code Here

TOP

Related Classes of org.socialmusicdiscovery.server.business.model.core.ReleaseEntity

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.