Ejemplo n.º 1
0
  public net.sf.ahtutils.xml.security.Category build(C category) {
    Category xml = new Category();
    if (q.isSetCode()) {
      xml.setCode(category.getCode());
    }
    if (q.isSetPosition()) {
      xml.setPosition(category.getPosition());
    }
    if (q.isSetVisible()) {
      xml.setVisible(category.isVisible());
    }
    if (q.isSetDocumentation() && category.getDocumentation() != null) {
      xml.setDocumentation(category.getDocumentation());
    }

    if (q.isSetLangs()) {
      XmlLangsFactory<L> f = new XmlLangsFactory<L>(q.getLangs());
      xml.setLangs(f.getUtilsLangs(category.getName()));
    }

    if (q.isSetDescriptions()) {
      XmlDescriptionsFactory<D> f = new XmlDescriptionsFactory<D>(q.getDescriptions());
      xml.setDescriptions(f.create(category.getDescription()));
    }

    if (q.isSetLabel() && lang != null) {
      if (category.getName() != null) {
        if (category.getName().containsKey(lang)) {
          xml.setLabel(category.getName().get(lang).getLang());
        } else {
          String msg = "No translation " + lang + " available in " + category;
          logger.warn(msg);
          xml.setLabel(msg);
        }
      } else {
        String msg = "No @name available in " + category;
        logger.warn(msg);
        xml.setLabel(msg);
      }
    }

    return xml;
  }
Ejemplo n.º 2
0
  public <
          L extends UtilsLang,
          G extends JeeslGraphic<L, D, G, GT, GS>,
          GT extends UtilsStatus<GT, L, D>,
          GS extends UtilsStatus<GS, L, D>,
          CATEGORY extends
              GeoJsfCategory<
                      L,
                      D,
                      G,
                      GT,
                      GS,
                      CATEGORY,
                      SERVICE,
                      LAYER,
                      MAP,
                      VIEW,
                      VP,
                      DS,
                      SLDTEMPLATE,
                      SLDTYPE,
                      SLD,
                      RULE>,
          SERVICE extends
              GeoJsfService<
                      L,
                      D,
                      G,
                      GT,
                      GS,
                      CATEGORY,
                      SERVICE,
                      LAYER,
                      MAP,
                      VIEW,
                      VP,
                      DS,
                      SLDTEMPLATE,
                      SLDTYPE,
                      SLD,
                      RULE>,
          LAYER extends
              GeoJsfLayer<
                      L,
                      D,
                      G,
                      GT,
                      GS,
                      CATEGORY,
                      SERVICE,
                      LAYER,
                      MAP,
                      VIEW,
                      VP,
                      DS,
                      SLDTEMPLATE,
                      SLDTYPE,
                      SLD,
                      RULE>,
          MAP extends
              GeoJsfMap<
                      L,
                      D,
                      G,
                      GT,
                      GS,
                      CATEGORY,
                      SERVICE,
                      LAYER,
                      MAP,
                      VIEW,
                      VP,
                      DS,
                      SLDTEMPLATE,
                      SLDTYPE,
                      SLD,
                      RULE>,
          VIEW extends
              GeoJsfView<
                      L,
                      D,
                      G,
                      GT,
                      GS,
                      CATEGORY,
                      SERVICE,
                      LAYER,
                      MAP,
                      VIEW,
                      VP,
                      DS,
                      SLDTEMPLATE,
                      SLDTYPE,
                      SLD,
                      RULE>,
          VP extends
              GeoJsfViewPort<
                      L,
                      D,
                      G,
                      GT,
                      GS,
                      CATEGORY,
                      SERVICE,
                      LAYER,
                      MAP,
                      VIEW,
                      VP,
                      DS,
                      SLDTEMPLATE,
                      SLDTYPE,
                      SLD,
                      RULE>,
          DS extends
              GeoJsfDataSource<
                      L,
                      D,
                      G,
                      GT,
                      GS,
                      CATEGORY,
                      SERVICE,
                      LAYER,
                      MAP,
                      VIEW,
                      VP,
                      DS,
                      SLDTEMPLATE,
                      SLDTYPE,
                      SLD,
                      RULE>,
          SLDTYPE extends UtilsStatus<SLDTYPE, L, D>,
          SLDTEMPLATE extends GeoJsfSldTemplate<L, D, SLDTEMPLATE, SLDTYPE>,
          SLD extends GeoJsfSld<L, D, G, GT, GS, SLDTEMPLATE, SLDTYPE, SLD, RULE>,
          RULE extends GeoJsfSldRule<L, D, G, GT, GS, SLDTEMPLATE, SLDTYPE, SLD, RULE>>
      Layer build(
          GeoJsfLayer<
                  L,
                  D,
                  G,
                  GT,
                  GS,
                  CATEGORY,
                  SERVICE,
                  LAYER,
                  MAP,
                  VIEW,
                  VP,
                  DS,
                  SLDTEMPLATE,
                  SLDTYPE,
                  SLD,
                  RULE>
              ejb) {
    Layer xml = new Layer();

    if (q.isSetCode()) {
      xml.setCode(ejb.getCode());
    }
    if (q.isSetTemporal()) {
      xml.setTemporal(ejb.isTemporalLayer());
    }
    if (q.isSetSql()) {
      if (ejb.isSqlLayer() != null) {
        xml.setSql(ejb.isSqlLayer());
      } else {
        xml.setSql(false);
      }
    }

    if (q.isSetService()) {
      XmlServiceFactory f = new XmlServiceFactory(q.getService());
      xml.setService(f.build(ejb.getService()));
    }

    if (q.isSetCategory() && ejb.getCategory() != null) {
      XmlCategoryFactory f = new XmlCategoryFactory(q.getCategory());
      xml.setCategory(f.build(ejb.getCategory()));
    }

    if (q.isSetLangs()) {
      XmlLangsFactory<L> f = new XmlLangsFactory<L>(q.getLangs());
      xml.setLangs(f.getUtilsLangs(ejb.getName()));
    }

    if (q.isSetDescriptions()) {
      XmlDescriptionsFactory<D> f = new XmlDescriptionsFactory<D>(q.getDescriptions());
      xml.setDescriptions(f.create(ejb.getDescription()));
    }

    if (q.isSetViewPort() && ejb.getViewPort() != null) {
      XmlViewPortFactory f = new XmlViewPortFactory(q.getViewPort());
      xml.setViewPort(f.build(ejb.getViewPort()));
    }

    return xml;
  }