Package cli_fmw.delegate.directory.complex

Source Code of cli_fmw.delegate.directory.complex.DirectoryKladrType

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package cli_fmw.delegate.directory.complex;

import cli_fmw.delegate.directory.*;
import cli_fmw.main.ClipsException;
import framework.beans.address.DirectoryKladrTypeBean;
import framework.beans.address.DirectoryKladrTypeBeanRemote;
import framework.beans.directory.DirectoryItemDetails;
import framework.beans.address.entities.AddressObjectTypeDetails;
import java.util.List;

/**
* справочник типов адресуемых объектов
* @author petr
*/
public class DirectoryKladrType extends
        DirectoryMagic<DirectoryKladrTypeBeanRemote, DirectoryKladrTypeItem> {


    public static final int LAST_USING_LEVEL = 5;
    public static final int MIN_LEVEL_HAS_BUILDINGS = 5;
    public static final String TYPE_STREET = "Улица";

    public static final int LEVEL_COUNTRY = 0;
    public static final int LEVEL_REGION = 1;
    public static final int LEVEL_AREA = 2;
    public static final int LEVEL_CITY = 3;
    public static final int LEVEL_VILLAGE = 4;
    public static final int LEVEL_STREET = 5;
    public static final int LEVEL_BLOCK = 6;


    DirectoryKladrType() throws ClipsException {
        super(DirectoryKladrTypeBean.class.getSimpleName());
    }

    @Override
    protected DirectoryKladrTypeItem createFromLoadedDetails(DirectoryItemDetails details) {
        AddressObjectTypeDetails d = (AddressObjectTypeDetails) details;
        return new DirectoryKladrTypeItem(d);
    }

    @Override
    public String getDirectoryTitle() {
        return "Типы адресуемых объектов";
    }

    public void syncDirectory(List<AddressObjectTypeDetails> items) throws ClipsException{
        try {
            System.out.println("DIRECTORYKLADRTYPE: синхронизация данных справочника сокращённых названий");
            System.out.println("DIRECTORYKLADRTYPE: список сокращённых названий отправлен на сервер");
            getBean().get().syncAddressObjectTypes(items);
            System.out.println("DIRECTORYKLADRTYPE: обновление сокращённых названий выполнено");
        } catch (Exception ex) {
            clearBean();
            throw new ClipsException("Не удалось выполнить синхронизацию справочника "+ getDirectoryTitle(), ex);
        }
    }

    @Override
    protected DirectoryKladrTypeItem createNullItem() {
        AddressObjectTypeDetails details = new AddressObjectTypeDetails();
        details.title = "";
        details.abbrivation = "";
        return new DirectoryKladrTypeItem(details);
    }



}
TOP

Related Classes of cli_fmw.delegate.directory.complex.DirectoryKladrType

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.