Package org.openxmlformats.schemas.xpackage.x2006.relationships

Examples of org.openxmlformats.schemas.xpackage.x2006.relationships.CTRelationships


        fmt.setTimeZone(TimeZone.getTimeZone("UTC"));
        String nowStr = fmt.format(signatureConfig.getExecutionTime());
        LOG.log(POILogger.DEBUG, "now: " + nowStr);

        SignatureTimeDocument sigTime = SignatureTimeDocument.Factory.newInstance();
        CTSignatureTime ctTime = sigTime.addNewSignatureTime();
        ctTime.setFormat("YYYY-MM-DDThh:mm:ssTZD");
        ctTime.setValue(nowStr);

        Element n = (Element)document.importNode(ctTime.getDomNode(),true);
        List<XMLStructure> signatureTimeContent = new ArrayList<XMLStructure>();
        signatureTimeContent.add(new DOMStructure(n));
        SignatureProperty signatureTimeSignatureProperty = getSignatureFactory()
            .newSignatureProperty(signatureTimeContent, "#" + signatureConfig.getPackageSignatureId(),
            "idSignatureTime");
View Full Code Here


        Element parentNode = (Element)domParent.getNode();
        // parentNode.setAttributeNS(XML_NS, "xmlns:mdssi", XML_DIGSIG_NS);
        Document doc = parentNode.getOwnerDocument();
       
        for (String sourceId : this.sourceIds) {
            RelationshipReferenceDocument relRef = RelationshipReferenceDocument.Factory.newInstance();
            relRef.addNewRelationshipReference().setSourceId(sourceId);
            Node n = relRef.getRelationshipReference().getDomNode();
            n = doc.importNode(n, true);
            parentNode.appendChild(n);
        }
    }
View Full Code Here

        DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
        fmt.setTimeZone(TimeZone.getTimeZone("UTC"));
        String nowStr = fmt.format(signatureConfig.getExecutionTime());
        LOG.log(POILogger.DEBUG, "now: " + nowStr);

        SignatureTimeDocument sigTime = SignatureTimeDocument.Factory.newInstance();
        CTSignatureTime ctTime = sigTime.addNewSignatureTime();
        ctTime.setFormat("YYYY-MM-DDThh:mm:ssTZD");
        ctTime.setValue(nowStr);

        Element n = (Element)document.importNode(ctTime.getDomNode(),true);
        List<XMLStructure> signatureTimeContent = new ArrayList<XMLStructure>();
View Full Code Here

       
        CTRelationships rels = relDoc.getRelationships();
        List<CTRelationship> relList = rels.getRelationshipList();
        Iterator<CTRelationship> relIter = rels.getRelationshipList().iterator();
        while (relIter.hasNext()) {
            CTRelationship rel = relIter.next();
            /*
             * See: ISO/IEC 29500-2:2008(E) - 13.2.4.24 Relationships Transform
             * Algorithm.
             */
            if (!this.sourceIds.contains(rel.getId())) {
                LOG.log(POILogger.DEBUG, "removing element: " + rel.getId());
                relIter.remove();
            } else {
                if (!rel.isSetTargetMode()) {
                    rel.setTargetMode(STTargetMode.INTERNAL);
                }
            }
        }
       
        // TODO: remove non element nodes ???
View Full Code Here

        } catch (Exception e) {
            throw new TransformException(e.getMessage(), e);
        }
        LOG.log(POILogger.DEBUG, "relationships document", relDoc);
       
        CTRelationships rels = relDoc.getRelationships();
        List<CTRelationship> relList = rels.getRelationshipList();
        Iterator<CTRelationship> relIter = rels.getRelationshipList().iterator();
        while (relIter.hasNext()) {
            CTRelationship rel = relIter.next();
            /*
             * See: ISO/IEC 29500-2:2008(E) - 13.2.4.24 Relationships Transform
             * Algorithm.
 
View Full Code Here

        LOG.log(POILogger.DEBUG, "data java type: " + data.getClass().getName());
        OctetStreamData octetStreamData = (OctetStreamData) data;
        LOG.log(POILogger.DEBUG, "URI: " + octetStreamData.getURI());
        InputStream octetStream = octetStreamData.getOctetStream();
       
        RelationshipsDocument relDoc;
        try {
            relDoc = RelationshipsDocument.Factory.parse(octetStream);
        } catch (Exception e) {
            throw new TransformException(e.getMessage(), e);
        }
        LOG.log(POILogger.DEBUG, "relationships document", relDoc);
       
        CTRelationships rels = relDoc.getRelationships();
        List<CTRelationship> relList = rels.getRelationshipList();
        Iterator<CTRelationship> relIter = rels.getRelationshipList().iterator();
        while (relIter.hasNext()) {
            CTRelationship rel = relIter.next();
            /*
             * See: ISO/IEC 29500-2:2008(E) - 13.2.4.24 Relationships Transform
             * Algorithm.
             */
            if (!this.sourceIds.contains(rel.getId())) {
                LOG.log(POILogger.DEBUG, "removing element: " + rel.getId());
                relIter.remove();
            } else {
                if (!rel.isSetTargetMode()) {
                    rel.setTargetMode(STTargetMode.INTERNAL);
                }
            }
        }
       
        // TODO: remove non element nodes ???
        LOG.log(POILogger.DEBUG, "# Relationship elements", relList.size());
       
        XmlSort.sort(rels, new Comparator<XmlCursor>(){
            public int compare(XmlCursor c1, XmlCursor c2) {
                String id1 = ((CTRelationship)c1.getObject()).getId();
                String id2 = ((CTRelationship)c2.getObject()).getId();
                return id1.compareTo(id2);
            }
        });

        try {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            XmlOptions xo = new XmlOptions();
            xo.setSaveNoXmlDecl();
            relDoc.save(bos, xo);
            return new OctetStreamData(new ByteArrayInputStream(bos.toByteArray()));
        } catch (IOException e) {
            throw new TransformException(e.getMessage(), e);
        }
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.xpackage.x2006.relationships.CTRelationships

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.