Examples of DocumentMetadata


Examples of org.exist.dom.DocumentMetadata

   
    public static CompiledXQuery compile(final DBBroker broker, final DocumentImpl document) throws RestXqServiceCompilationException {
       
        try {
            if(document instanceof BinaryDocument) {
                final DocumentMetadata metadata = document.getMetadata();
                if(metadata.getMimeType().equals(XQUERY_MIME_TYPE)){
           
                    //compile the query
                    final XQuery xquery = broker.getXQueryService();
                    final XQueryContext context = xquery.newContext(AccessContext.REST);
                    final Source source = new DBSource(broker, (BinaryDocument)document, true);

                    //set the module load path for any module imports that are relative
                    context.setModuleLoadPath(XmldbURI.EMBEDDED_SERVER_URI_PREFIX + ((XmldbURI)source.getKey()).removeLastSegment());
                   
                    return broker.getXQueryService().compile(context, source);
                } else {
                    throw new RestXqServiceCompilationException("Invalid mimetype '" +  metadata.getMimeType() + "' for XQuery: "  + document.getURI().toString().toString());
                }
            } else {
                throw new RestXqServiceCompilationException("Invalid document location for XQuery: " + document.getURI().toString());
            }
        } catch(XPathException xpe) {
View Full Code Here

Examples of org.exist.dom.DocumentMetadata

            if (resource != null) {
                if (!resource.getPermissions().validate(broker.getSubject(), Permission.READ)) {
                    throw new PermissionDeniedException(
                            "Permission to read resource " + path + " denied");
                }
                final DocumentMetadata metadata = resource.getMetadata();
                response.setContentType(metadata.getMimeType());
                // As HttpServletResponse.setContentLength is limited to integers,
                // (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4187336)
                // next sentence:
                //  response.setContentLength(resource.getContentLength());
                // must be set so
                response.addHeader("Content-Length", Long.toString(resource.getContentLength()));
                setCreatedAndLastModifiedHeaders(response, metadata.getCreated(), metadata.getLastModified());
            } else {
                final Collection col = broker.getCollection(pathUri);
                //no resource or collection
                if (col == null) {
                    response.sendError(HttpServletResponse.SC_NOT_FOUND, "No resource at location: " + path);
View Full Code Here

Examples of org.exist.dom.DocumentMetadata

        if (!resource.getPermissions().validate(broker.getSubject(), Permission.READ)) {
            throw new PermissionDeniedException("Not allowed to read resource");
        }

        //get the document metadata
        final DocumentMetadata metadata = resource.getMetadata();
        final long lastModified = metadata.getLastModified();
        setCreatedAndLastModifiedHeaders(response, metadata.getCreated(), lastModified);


        /**
         * HTTP 1.1 RFC 2616 Section 14.25 *
         */
 
View Full Code Here

Examples of org.exist.dom.DocumentMetadata

            for (final Iterator<DocumentImpl> i = collection.iterator(broker); i.hasNext();) {
                final DocumentImpl doc = i.next();
                if (doc.getPermissions().validate(broker.getSubject(), Permission.READ)) {
                    final XmldbURI resource = doc.getFileURI();
                    final DocumentMetadata metadata = doc.getMetadata();
                    attrs.clear();
                    attrs.addAttribute("", "name", "name", "CDATA", resource.toString());

                    // add an attribute for the creation date as an xs:dateTime
                    try {
                        final DateTimeValue dtCreated =
                                new DateTimeValue(new Date(metadata.getCreated()));
                        attrs.addAttribute("", "created", "created", "CDATA",
                                dtCreated.getStringValue());
                    } catch (final XPathException e) {
                        // fallback to long value
                        attrs.addAttribute("", "created", "created", "CDATA",
                                String.valueOf(metadata.getCreated()));
                    }

                    // add an attribute for the last modified date as an
                    // xs:dateTime
                    try {
                        final DateTimeValue dtLastModified = new DateTimeValue(
                                new Date(metadata.getLastModified()));
                        attrs.addAttribute("", "last-modified",
                                "last-modified", "CDATA", dtLastModified.getStringValue());
                    } catch (final XPathException e) {
                        // fallback to long value
                        attrs.addAttribute("", "last-modified",
                                "last-modified", "CDATA", String.valueOf(metadata.getLastModified()));
                    }

                    addPermissionAttributes(attrs, doc.getPermissions());
                    serializer.startElement(Namespaces.EXIST_NS, "resource", "exist:resource", attrs);
                    serializer.endElement(Namespaces.EXIST_NS, "resource", "exist:resource");
View Full Code Here

Examples of org.pentaho.reporting.libraries.docbundle.DocumentMetaData

    }

    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    if (StringUtils.isEmpty(tabText))
    {
      final DocumentMetaData documentMetaData = rfc.getProcessingContext().getDocumentMetaData();
      tabText = (String) documentMetaData.getBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE);
      if (StringUtils.isEmpty(tabText))
      {
        final Object o = rfc.getDataRow().get("report.name");
        if (o != null)
View Full Code Here

Examples of org.pentaho.reporting.libraries.docbundle.DocumentMetaData

    }
  }

  public static void resetDocumentMetaData(final MasterReport masterReport)
  {
    final DocumentMetaData metaData = masterReport.getBundle().getMetaData();
    if (metaData instanceof WriteableDocumentMetaData)
    {
      final WriteableDocumentMetaData wmd = (WriteableDocumentMetaData) metaData;
      wmd.setBundleAttribute(ODFMetaAttributeNames.Meta.NAMESPACE,
          ODFMetaAttributeNames.Meta.INITIAL_CREATOR, wmd.getBundleAttribute
View Full Code Here

Examples of org.pentaho.reporting.libraries.docbundle.DocumentMetaData

    final boolean maxLineHeightUsed =
        metaData.isFeatureSupported(OutputProcessorFeature.LEGACY_LINEHEIGHT_CALC) == false;
    final boolean imageResolutionMapping =
        metaData.isFeatureSupported(OutputProcessorFeature.IMAGE_RESOLUTION_MAPPING) == false;
    final MasterReport report = getReport();
    final DocumentMetaData documentMetaData;
    final DocumentBundle bundle = report.getBundle();
    if (bundle != null)
    {
      documentMetaData = bundle.getMetaData();
    }
View Full Code Here

Examples of org.pentaho.reporting.libraries.docbundle.DocumentMetaData

    if (context instanceof ReportFormulaContext == false)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
    }
    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    final DocumentMetaData data = rfc.getProcessingContext().getDocumentMetaData();

    if (parameterCount == 1)
    {
      final String metaName = context.getTypeRegistry().convertToText(parameters.getType(0), parameters.getValue(0));
      final String[] namespaces = data.getMetaDataNamespaces();
      for (int i = 0; i < namespaces.length; i++)
      {
        final String namespace = namespaces[i];
        final Object attribute = data.getBundleAttribute(namespace, metaName);
        if (attribute != null)
        {
          return new TypeValuePair(AnyType.TYPE, attribute);
        }
      }
    }
    else
    {
      final String metaNamespace = context.getTypeRegistry().convertToText(parameters.getType(0), parameters.getValue(0));
      final String metaName = context.getTypeRegistry().convertToText(parameters.getType(1), parameters.getValue(1));
      {
        final Object o = data.getBundleAttribute(metaNamespace, metaName);
        return new TypeValuePair(AnyType.TYPE, o);
      }
    }

    throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
View Full Code Here

Examples of org.pentaho.reporting.libraries.docbundle.DocumentMetaData

    {
      try
      {
        super.inspect(report);
        final DocumentBundle bundle = report.getBundle();
        final DocumentMetaData metaData = bundle.getMetaData();
        if (metaData instanceof WriteableDocumentMetaData)
        {
          WriteableDocumentMetaData w = (WriteableDocumentMetaData) metaData;
          w.setBundleAttribute(ODFMetaAttributeNames.Meta.NAMESPACE, ODFMetaAttributeNames.Meta.KEYWORDS, null);
          w.setBundleAttribute(ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.CREATOR, null);
View Full Code Here

Examples of org.pentaho.reporting.libraries.docbundle.DocumentMetaData

    try
    {
      final MasterReport report = activeContext.getContextRoot();
      final DocumentBundle bundle = report.getBundle();
      final DocumentMetaData oldMetaData = (DocumentMetaData) bundle.getMetaData().clone();
      final DocumentMetaData result = dialog.performEdit(oldMetaData,
          report.getResourceManager(),
          report.getDefinitionSource());

      if (result == null)
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.