MyTetra Share
Делитесь знаниями!
Отладка метода
Время создания: 14.02.2020 10:04
Раздел: INFO - JOB - rtneo - Работа над задачами - Категоризация
Запись: wwwlir/Tetra/master/base/1581645874cj6saguurf/text.html на raw.githubusercontent.com

import com.groupstp.rtneo.entity.*

import com.haulmont.cuba.core.global.*;

import com.groupstp.rtneo.core.bean.CategorizationWorker;


CategorizationWorker worker = AppBeans.get(CategorizationWorker.NAME)



ContragentRealEstate cre = dataManager.load(ContragentRealEstate.class).id(UUID.fromString('0ac27bf2-fbe5-0221-892d-c7d412b9cfd5')).view("contragentRealEstate-apartmentBuildingEdit").one();


//RealEstateIndicator indicator = worker.getIndicator(cre)


//RealEstateCategory category3 = worker.indicator3(cre.getRealEstate(), indicator)

RealEstateCategory category = worker.determineContragentRealEstateCategory(cre)


_(category, "json")


/**

* Логирование

*/

import com.haulmont.cuba.core.app.serialization.EntitySerializationAPI;

import com.groupstp.rtneo.util.JsonUtil;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

private _(Object obj, String... options){

if(obj == null){log("LOG.ERROR: Object is null!!!");return}

if(options.size() == 0){log(obj)}

for(def option : options){

if(option.equals("str")){log(obj)}

if(option.equals("for")){obj.each({_(it)})}

if(option.equals("json")){

EntitySerializationAPI entitySerializationAPI = AppBeans.get(EntitySerializationAPI.NAME)

try{log(entitySerializationAPI.toJson(obj))}

catch(Exception e){log("LOG.ERROR: JSON entity serialization failed")}

}

if(option.equals("objJson")){

JsonUtil jsonUtil = AppBeans.get(JsonUtil.NAME)

try{log.(jsonUtil.toJson(obj))}

catch(Exception e){log("LOG.ERROR: JSON object serialization failed")}

}

if(option.equals("date")){

DateFormat df = new SimpleDateFormat("dd.MM.yyyy");

try{log(df.format(obj))}

catch(Exception e){log("LOG.ERROR: Failed date format")}

}

}

}

private log(Object obj){log.debug(obj)}

 
MyTetra Share v.0.65
Яндекс индекс цитирования