MyTetra Share
Делитесь знаниями!
Dom4J(Андрюхин скрипт in to FileDescription)
Время создания: 05.02.2020 15:06
Раздел: INFO - Development - JAVA - XML
Запись: wwwlir/Tetra/master/base/15808863694jwcahxeqo/text.html на raw.githubusercontent.com
import com.haulmont.cuba.core.global.*
import com.groupstp.rtneo.entity.*
import com.groupstp.rtneo.core.bean.tools.DatePeriodTools
import java.text.SimpleDateFormat
import com.groupstp.rtneo.core.bean.calculation.CalculationWorkerHelper
import java.util.*
import com.haulmont.cuba.core.global.ViewRepository;\
import com.haulmont.cuba.core.entity.FileDescriptor;
import com.haulmont.cuba.core.global.DataManager;
import com.haulmont.cuba.core.global.FileLoader;
import com.haulmont.cuba.core.global.FileStorageException;
import com.haulmont.cuba.core.global.Metadata;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.upload.*;
import org.apache.commons.io.IOUtils;
import com.haulmont.cuba.core.app.FileStorageAPI;
import com.groupstp.rtneo.core.bean.apirosreestr.order_report.processor.ApiRosreestrReportProcessor;

import org.dom4j.*
import com.haulmont.bali.util.Dom4j;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.File;

import javax.inject.Inject;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;

def cad = '38:36:000033:31519'
FileStorageAPI fileStorageAPI = AppBeans.get(FileStorageAPI.NAME)
APIOrders api = dataManager.load(APIOrders.class).query('select e from rtneo$APIOrders e where e.kn=:cad').view('full').parameter("cad",cad).one()
FileDescriptor fd = api.file
byte[] raw = fileStorageAPI.loadFile(fd)
InputStream is = new ByteArrayInputStream(raw)
Document document = Dom4j.readDocument(is)

def kn, adress, appointment, ownership, owner, typeFias, area, cityName, streetName, levelNum, copyrightHolder
def xml=document.getRootElement().asXML()
Element elem = document.getRootElement().element("Realty").element("Flat").element("Assignation").element()
//def flat=document.getRootElement().element("Realty").element("Flat").element("Assignation").attributeValue("AssignationCode").

//log.debug(xml.dump())
log.debug(elem)
//def kodApp = flat.element("Assignation")
//log.debug(flat)
//log.debug(kodApp)
Так же в этом разделе:
 
MyTetra Share v.0.65
Яндекс индекс цитирования