Package org.fao.geonet.exceptions

Examples of org.fao.geonet.exceptions.MetadataNotFoundEx


        DataManager dm = gc.getBean(DataManager.class);

        if (info == null) {
            String mdId = Utils.getIdentifierFromParameters(params, context);
            if (mdId == null)
                throw new MetadataNotFoundEx("Metadata not found.");

            uuid = dm.getMetadataUuid(mdId);
            if (uuid == null)
                throw new MetadataNotFoundEx("Metadata not found.");

            id = mdId;
            iId = Integer.parseInt(mdId);
        } else {
            uuid = info.getChildText(Params.UUID);
View Full Code Here


      throws Exception {

        final Metadata metadata = context.getBean(MetadataRepository.class).findOneByUuid(uuid);

    if (metadata == null) {
      throw new MetadataNotFoundEx("uuid=" + uuid);
        }

        DataManager dm = context.getBean(DataManager.class);

    String id = ""+metadata.getId();
View Full Code Here

    //--- check access

    Metadata info = context.getBean(MetadataRepository.class).findOne(id);

    if (info == null)
      throw new MetadataNotFoundEx(id);

    //-----------------------------------------------------------------------
    //--- remove old operations

    boolean skip = false;
View Full Code Here

      String skip = Util.getParam(params, "skipPopularity", "n");
      skipPopularity = skip.equals("y");
    }

    if (id == null)
      throw new MetadataNotFoundEx("Metadata not found.");

    Lib.resource.checkPrivilege(context, id, ReservedOperation.view);

    // -----------------------------------------------------------------------
    // --- get metadata

    Element elMd;
    boolean addEditing = false;
    if (!skipInfo) {
            boolean withValidationErrors = false, keepXlinkAttributes = false;
      elMd = dm.getMetadata(context, id, addEditing, withValidationErrors, keepXlinkAttributes);
    } else {
      elMd = dm.getMetadataNoInfo(context, id);
    }

    if (elMd == null)
      throw new MetadataNotFoundEx(id);

    if (addRefs) { // metadata.show for GeoNetwork needs geonet:element
      elMd = dm.enumerateTree(elMd);
    }
View Full Code Here

    //--- get metadata
        boolean forEditing = false, withValidationErrors = false, keepXlinkAttributes = false;
        Element elMd = dm.getMetadata(context, id, forEditing, withValidationErrors, keepXlinkAttributes);

    if (elMd == null)
      throw new MetadataNotFoundEx("Metadata not found - deleted?");

        //--- manage the download hook
        IResourceDownloadHandler downloadHook = (IResourceDownloadHandler) context.getApplicationContext().getBean("resourceDownloadHandler");
        Element response = downloadHook.onDownloadMultiple(context, params, Integer.parseInt(id), files);
View Full Code Here

    //--- check access

    Metadata info = context.getBean(MetadataRepository.class).findOne(metadataId);

    if (info == null)
      throw new MetadataNotFoundEx(metadataId);

        Element ownerId = new Element("ownerid").setText(info.getSourceInfo().getOwner() + "");
        Element groupOwner = new Element("groupOwner").setText(info.getSourceInfo().getGroupOwner() + "");
        Element hasOwner = new Element("owner");
        if (am.isOwner(context, metadataId))
View Full Code Here

    boolean witholdWithheldElements = Util.getParam(params, "hide_withheld", false);
    if (XmlSerializer.getThreadLocal(false) != null || witholdWithheldElements) {
       XmlSerializer.getThreadLocal(true).setForceFilterEditOperation(witholdWithheldElements);
    }
    if (id == null) {
            throw new MetadataNotFoundEx("Metadata not found.");
        }
   
    Lib.resource.checkPrivilege(context, id, ReservedOperation.view);

    //-----------------------------------------------------------------------
    //--- get metadata
   
    Element elMd;
    boolean addEditing = false;
    if (!skipInfo) {
            boolean withValidationErrors = false, keepXlinkAttributes = false;
            elMd = gc.getBean(DataManager.class).getMetadata(context, id, addEditing, withValidationErrors, keepXlinkAttributes);
    } else {
      elMd = dm.getMetadataNoInfo(context, id);
    }

    if (elMd == null) {
            throw new MetadataNotFoundEx(id);
        }

    if (addRefs) { // metadata.show for GeoNetwork needs geonet:element
      elMd = dm.enumerateTree(elMd);
    }
View Full Code Here

        final Metadata metadata = context.getBean(MetadataRepository.class).findOne(id);

    //--- if we don't have any metadata, just return

    if (metadata == null) {
      throw new MetadataNotFoundEx("id:"+ id);
        }

    String harvUuid = metadata.getHarvestInfo().getUuid();

    //--- metadata not harvested
View Full Code Here

  {
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    SchemaManager sm = gc.getBean(SchemaManager.class);

    String id = Utils.getIdentifierFromParameters(params, context);
    if (id == null) throw new MetadataNotFoundEx("Metadata not found.");

    Element elMd = new Show().exec(params, context);
    if (elMd == null) throw new MetadataNotFoundEx(id);

    //--- get XSLT converter name from params
    String styleSheet = Util.getParam(params, Params.STYLESHEET);

    //--- get metadata info and create an env that works with oai translators
View Full Code Here

   
    //--- the request should contain an ID or UUID
    String id = Utils.getIdentifierFromParameters(params, context);

    if (id == null) {
      throw new MetadataNotFoundEx("No record has this UUID");
    }
   
    //--- check download access
    Lib.resource.checkPrivilege(context, id, ReservedOperation.download);

    //--- get metadata
        boolean withValidationErrors = false, keepXlinkAttributes = false;
        Element elMd = dataManager.getMetadata(context, id, addEdit, withValidationErrors, keepXlinkAttributes);

    if (elMd == null) {
      throw new MetadataNotFoundEx("Metadata not found - deleted?");
        }

    response.addContent(new Element("id").setText(id));

    //--- transform record into brief version
View Full Code Here

TOP

Related Classes of org.fao.geonet.exceptions.MetadataNotFoundEx

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.