Package org.socialmusicdiscovery.server.support.copy

Examples of org.socialmusicdiscovery.server.support.copy.CopyHelper


            transactionManager.begin();
            ((WorkEntity)work).setLastUpdated(new Date());
            ((WorkEntity)work).setLastUpdatedBy(super.CHANGED_BY);
            WorkEntity updatedEntity = super.updateEntity(id, ((WorkEntity)work));
            getRepository().refresh(updatedEntity);
            return new CopyHelper().copy(updatedEntity, Expose.class);
        }catch (RuntimeException e) {
            transactionManager.setRollbackOnly();
            throw e;
        }finally {
            transactionManager.end();
View Full Code Here


            criteriaList.add(0, object);
            object = object.substring(0, object.indexOf("."));
        }

        BrowseService browseService = browseServiceManager.getBrowseService(object);
        org.socialmusicdiscovery.server.business.service.browse.Result result = new CopyHelper().detachedCopy(browseService.findChildren(criteriaList, new ArrayList<String>(), offset, size, childs));

        List<ItemResult.Item> genericResultItems = new ArrayList<ItemResult.Item>(result.getItems().size());
        for (Object o : result.getItems()) {
            ResultItem resultItem = (ResultItem) o;
            Object item = null;
View Full Code Here

            org.socialmusicdiscovery.server.business.service.browse.Result<TrackEntity> result = null;
            if (trackId != null) {
                // Special case for track since it's not supported to look for Track objects in TrackBrowseService
                ResultItem<TrackEntity> track = browseService.findById(trackId);
                if (track != null) {
                    result = new CopyHelper().detachedCopy(new org.socialmusicdiscovery.server.business.service.browse.Result<TrackEntity>(1, new ArrayList<ResultItem<TrackEntity>>(Arrays.asList(track))));
                } else {
                    result = new org.socialmusicdiscovery.server.business.service.browse.Result<TrackEntity>();
                }
            } else {
                // Lookup track objects matching the search criteria
                result = new CopyHelper().detachedCopy(browseService.findChildren(criteriaList, new ArrayList<String>(), offset, size, false));
            }

            // Extract the first playable element for each found track object
            for (ResultItem<TrackEntity> resultItem : result.getItems()) {
                PlayableElement playableElement = resultItem.getItem().getPlayableElements().iterator().next();
View Full Code Here

        if (size != null && offset == null) {
            offset = 0;
        }

        LibraryBrowseService browseService = InjectHelper.instance(LibraryBrowseService.class);
        org.socialmusicdiscovery.server.business.service.browse.Result result = new CopyHelper().detachedCopy(browseService.findChildren(clientType, objectId, offset, size, childs));

        List<String> parentObjects = new ArrayList<String>();
        if (objectId != null) {
            parentObjects = Arrays.asList(objectId.split("/"));
        }
View Full Code Here

    public Collection<ImageEntity> search(@QueryParam("relatedTo") String relatedToSMDId, @QueryParam("imageType") String imageType) {
      logger.debug("ImageFacade 'search' called!");
      try {
            transactionManager.begin();
            if ( (relatedToSMDId) != null &&  (imageType == null) ) {
                return new CopyHelper().detachedCopy(repository.findByRelatedToSMDId(relatedToSMDId), Expose.class);
            } else if ( (relatedToSMDId) != null &&  (imageType != null) ) {
                    return new CopyHelper().detachedCopy(repository.findByRelatedToSMDIdAndType(relatedToSMDId, imageType), Expose.class);
            } else if ( (imageType == null) && (relatedToSMDId == null)) {
              return new CopyHelper().detachedCopy(repository.findAll(), Expose.class);
            } else {
                return null;
            }
        }finally {
            transactionManager.end();
View Full Code Here

        if (size != null && offset == null) {
            offset = 0;
        }

        ContextBrowseService browseService = InjectHelper.instance(ContextBrowseService.class);
        org.socialmusicdiscovery.server.business.service.browse.Result result = new CopyHelper().detachedCopy(browseService.findChildren(clientType, objectId, offset, size, childs));

        List<String> parentObjects = new ArrayList<String>(Arrays.asList(objectId.split("/")));
        parentObjects.remove(0);

        List<ItemResult.Item> genericResultItems = new ArrayList<ItemResult.Item>(result.getItems().size());
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{id}")
    public ImageEntity get(@PathParam("id") String id) {
        try {
            transactionManager.begin();
            return new CopyHelper().copy(super.getEntity(id), Expose.class);
        }finally {
            transactionManager.end();
        }
    }
View Full Code Here

      }
        try {
            transactionManager.begin();
            image.setLastUpdated(new Date());
            image.setLastUpdatedBy(super.CHANGED_BY);
            return new CopyHelper().copy(super.createEntity(image), Expose.class);
        }catch (RuntimeException e) {
            transactionManager.setRollbackOnly();
            throw e;
        }finally {
            transactionManager.end();
View Full Code Here

    public ImageEntity update(@PathParam("id") String id, ImageEntity artist) {
        try {
            transactionManager.begin();
            artist.setLastUpdated(new Date());
            artist.setLastUpdatedBy(super.CHANGED_BY);
            return new CopyHelper().copy(super.updateEntity(id, artist), Expose.class);
        }catch (RuntimeException e) {
            transactionManager.setRollbackOnly();
            throw e;
        }finally {
            transactionManager.end();
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    public Collection<PlayableElementEntity> search(@QueryParam("uri") String uri, @QueryParam("uriContains") String uriContains, @QueryParam("smdID") String smdID) {
        try {
            transactionManager.begin();
            if (uri != null) {
                return new CopyHelper().detachedCopy(repository.findByURIWithRelations(uri, Arrays.asList("reference"), null),Expose.class);
            }else if (uriContains != null) {
                return new CopyHelper().detachedCopy(repository.findByPartialURIWithRelations(uriContains, Arrays.asList("reference"), null),Expose.class);
            } else if (smdID != null) {
                return new CopyHelper().detachedCopy(repository.findBySmdIDWithRelations(smdID, Arrays.asList("reference"), null),Expose.class);
            } else {
                return new CopyHelper().detachedCopy(repository.findAllWithRelations(Arrays.asList("reference"), null),Expose.class);
            }
        }finally {
            transactionManager.end();
        }
    }
View Full Code Here

TOP

Related Classes of org.socialmusicdiscovery.server.support.copy.CopyHelper

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.