Package org.fao.geonet.domain

Examples of org.fao.geonet.domain.MetadataStatus


    @Autowired
    private MetadataStatusRepository _repo;

    @Test
    public void testHasMetadataId() throws Exception {
        MetadataStatus md1 = _repo.save(newMetadataStatus());
        _repo.save(newMetadataStatus());

        final List<MetadataStatus> found = _repo.findAll(hasMetadataId(md1.getId().getMetadataId()));
        assertEquals(1, found.size());
        assertEquals(md1.getId(), found.get(0).getId());
    }
View Full Code Here


        assertEquals(md1.getId(), found.get(0).getId());
    }

    @Test
    public void testHasUserId() throws Exception {
        MetadataStatus md1 = _repo.save(newMetadataStatus());
        _repo.save(newMetadataStatus());

        final List<MetadataStatus> found = _repo.findAll(hasUserId(md1.getId().getUserId()));
        assertEquals(1, found.size());
        assertEquals(md1.getId(), found.get(0).getId());
    }
View Full Code Here

            // get status
            Sort statusSort = new Sort(Sort.Direction.DESC, MetadataStatus_.id.getName() + "." + MetadataStatusId_.changeDate.getName());
            List<MetadataStatus> statuses = statusRepository.findAllById_MetadataId(id$, statusSort);
            if (!statuses.isEmpty()) {
                MetadataStatus stat = statuses.get(0);
                String status = String.valueOf(stat.getId().getStatusId());
                moreFields.add(SearchManager.makeField("_status", status, true, true));
                String statusChangeDate = stat.getId().getChangeDate().getDateAndTime();
                moreFields.add(SearchManager.makeField("_statusChangeDate", statusChangeDate, true, true));
            }

            // getValidationInfo
            // -1 : not evaluated
View Full Code Here

     * @return
     * @throws Exception
     *
     */
    public String getCurrentStatus(int metadataId) throws Exception {
        MetadataStatus status = getStatus(metadataId);
        if (status == null) {
            return Params.Status.UNKNOWN;
        }

        return String.valueOf(status.getId().getStatusId());
    }
View Full Code Here

     * @throws Exception
     *
     * @return the saved status entity object
     */
    public MetadataStatus setStatus(ServiceContext context, int id, int status, ISODate changeDate, String changeMessage) throws Exception {
        MetadataStatus statusObject = setStatusExt(context, id, status, changeDate, changeMessage);
        indexMetadata(Integer.toString(id), true);
        return statusObject;
    }
View Full Code Here

     * @return the saved status entity object
     */
    public MetadataStatus setStatusExt(ServiceContext context, int id, int status, ISODate changeDate, String changeMessage) throws Exception {
        final StatusValueRepository statusValueRepository = _applicationContext.getBean(StatusValueRepository.class);

        MetadataStatus metatatStatus = new MetadataStatus();
        metatatStatus.setChangeMessage(changeMessage);
        metatatStatus.setStatusValue(statusValueRepository.findOne(status));
        int userId = context.getUserSession().getUserIdAsInt();
        MetadataStatusId mdStatusId = new MetadataStatusId()
                .setStatusId(status)
                .setMetadataId(id)
                .setChangeDate(changeDate)
                .setUserId(userId);
        mdStatusId.setChangeDate(changeDate);

        metatatStatus.setId(mdStatusId);

        return _applicationContext.getBean(MetadataStatusRepository.class).save(metatatStatus);
    }
View Full Code Here

      throw new IllegalArgumentException("You are not the owner of metadata --> "+id);

    //-----------------------------------------------------------------------
    //--- retrieve metadata status

    MetadataStatus stats = dataMan.getStatus(iLocalId);

    String status = Params.Status.UNKNOWN;
    String userId = "-1"; // no userId
    if (stats != null) {
        status = String.valueOf(stats.getId().getStatusId());
            userId = String.valueOf(stats.getId().getUserId());
    }

    //-----------------------------------------------------------------------
    //--- retrieve status values
View Full Code Here

        final ServiceContext serviceContext = createServiceContext();
        loginAsAdmin(serviceContext);

        final int metadataId = importMetadata(this, serviceContext);

        final MetadataStatus status = _dataManager.getStatus(metadataId);

        assertEquals(null, status);

        final ISODate changeDate = new ISODate();
        final String changeMessage = "Set to draft";
        _dataManager.setStatus(serviceContext, metadataId, 0, changeDate, changeMessage);

        final MetadataStatus loadedStatus = _dataManager.getStatus(metadataId);

        assertEquals(changeDate, loadedStatus.getId().getChangeDate());
        assertEquals(changeMessage, loadedStatus.getChangeMessage());
        assertEquals(0, loadedStatus.getStatusValue().getId());
        assertEquals(metadataId, loadedStatus.getId().getMetadataId());
        assertEquals(0, loadedStatus.getId().getStatusId());
        assertEquals(serviceContext.getUserSession().getUserIdAsInt(), loadedStatus.getId().getUserId());
    }
View Full Code Here

        assertEquals(0, _metadataNotificationRepo.count());
        _metadataNotificationRepo.saveAndFlush(MetadataNotificationRepositoryTest.newMetadataNotification(_inc, _metadataNotificatierRepo));
        assertEquals(6, _statusValueRepo.count());
        _statusValueRepo.saveAndFlush(StatusValueRepositoryTest.newStatusValue(_inc));
        assertEquals(1, _metadataStatusRepo.count());
        final MetadataStatus metadataStatus = MetadataStatusRepositoryTest.newMetadataStatus(_inc, _statusValueRepo);
        metadataStatus.getId().setMetadataId(metadata.getId());
        _metadataStatusRepo.saveAndFlush(metadataStatus);
        assertEquals(3, _metadataValidationRepo.count());
        _metadataValidationRepo.saveAndFlush(MetadataValidationRepositoryTest.newValidation(_inc, _mdRepo));
        assertEquals(6, _operationRepo.count());
        Operation operation = _operationRepo.saveAndFlush(OperationRepositoryTest.newOperation(_inc));
View Full Code Here

TOP

Related Classes of org.fao.geonet.domain.MetadataStatus

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.