Package org.dmlite.model.config

Examples of org.dmlite.model.config.ConceptConfig


      final IEntity entity = (IEntity) item.getModelObject();
     
      final App app = viewContext.getApp();
     
      final IEntities entities = modelContext.getEntities();
      final ConceptConfig conceptConfig = entity.getConceptConfig();

      final Integer currentPageBlock = new Integer(getCurrentPage());

      final ModelContext entityModelContext = new ModelContext(
          modelContext);
      entityModelContext.setEntity(entity);
      Link copyLink = new Link("copy") {
        static final long serialVersionUID = 200741L;

        public void onClick() {
          getAppSession().getClipboard().setEntity(entity);
          ViewContext entityCopyPageContext = new ViewContext(
              viewContext);
          entityCopyPageContext.setPageBlock(currentPageBlock);
          setResponsePage(app.getViewMeta().getPage(
              "EntityUpdateTablePage", entityModelContext,
              entityCopyPageContext));
        }
      };
      item.add(copyLink);

      final ViewContext entityUpdatePageContext = new ViewContext(
          viewContext);
      entityUpdatePageContext.setPageBlock(currentPageBlock);
      Link editLink = new PageLink("edit", new IPageLink() {
        static final long serialVersionUID = 200742L;

        public Page getPage() {
          return app.getViewMeta().getPage("EntityEditFormPage",
              entityModelContext, entityUpdatePageContext);
        }

        public Class getPageIdentity() {
          return app.getViewMeta().getPageClass("EntityEditFormPage",
              entityModelContext, entityUpdatePageContext);
        }
      });
      item.add(editLink);

      final ViewContext entityRemovePageContext = new ViewContext(
          viewContext);
      entityRemovePageContext.setPageBlock(currentPageBlock);
      item.add(new Link("remove") {
        static final long serialVersionUID = 200743L;

        public void onClick() {
          try {
            if (app.isConceptUpdateAllowed(
                getAppSession(), conceptConfig, entity, "remove")) {
              entities.getErrors().empty();
              if (app.getModelConfig().isConfirmRemove()) {
                setResponsePage(app.getViewMeta().getPage(
                    "EntityConfirmRemovePage",
                    entityModelContext,
                    entityRemovePageContext));
              } else if (entities.remove(entity)) {
                setResponsePage(app.getViewMeta().getPage(
                    "EntityUpdateTablePage",
                    entityModelContext,
                    entityRemovePageContext));
              } else {
                addDmLiteErrorKeys(entities);
              }
            } else {
              String error = getLocalizer().getString(
                  "entities.config.remove", this);
              error(error);
            }
          } catch (DmException e) {
            log.error("Error in EntityUpdateTableListView: "
                + modelContext.getEntitiesCode() + " - "
                + e.getMessage());
          }
        }
      });

      // Neighbor update links
      List<NeighborNameLabelLinkPair> neighborNameLabelLinkPairs = new ArrayList<NeighborNameLabelLinkPair>();
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("child")
            && neighborConfig.isInternal()) {
          NeighborNameLabelLinkPair neighborNameLabelLinkPair = new NeighborNameLabelLinkPair();
          String conceptCode = conceptConfig.getCode();
          String neighborKey = conceptCode + "."
              + neighborConfig.getCode();
          String neighborName = getLocalizer().getString(neighborKey,
              this);
          Label neighborNameLabel = new Label("neighborName",
View Full Code Here


    try {
      App app = viewContext.getApp();
     
      IEntities entities = modelContext.getEntities();
      IEntity entity = modelContext.getEntity();
      ConceptConfig conceptConfig = entities.getConceptConfig();

      if (app.isConceptUpdateAllowed(getAppSession(), conceptConfig, entity,
          "add")) {
        entities.getErrors().empty();
        if (entities.add(entity)) {
View Full Code Here

   */
  public void setPropertyCode(String propertyCode) {
    if (propertyCode == null) {
      setPropertyConfig(null);
    } else if (getPropertyConfig() == null) {
      ConceptConfig conceptConfig = null;
      if (getEntities() != null) {
        conceptConfig = getEntities().getConceptConfig();
      } else if (getEntity() != null) {
        conceptConfig = getEntity().getConceptConfig();
      }
      if (conceptConfig != null) {
        PropertyConfig propertyConfig = conceptConfig
            .getPropertiesConfig().getPropertyConfig(propertyCode);
        if (propertyConfig != null) {
          setPropertyConfig(propertyConfig);
        }
      }
View Full Code Here

    try {
      App app = viewContext.getApp();
     
      IEntities entities = modelContext.getEntities();

      ConceptConfig conceptConfig = entities.getConceptConfig();
      String conceptsKey = conceptConfig.getEntitiesCode();
      String conceptsName = getLocalizer().getString(conceptsKey, this);
      add(new Label("conceptsName", conceptsName));

      ModelContext entityDisplayListListModelContext = new ModelContext(
          modelContext);
View Full Code Here

    this.modelContext = modelContext;
    this.viewContext = viewContext;
    try {
      App app = viewContext.getApp();
     
      ConceptConfig conceptConfig = modelContext.getEntities()
          .getConceptConfig();
      String conceptCode = conceptConfig.getCode();

      PropertyConfig propertyConfig = modelContext.getPropertyConfig();
      String propertyCode = propertyConfig.getCode();
      String propertyKey = conceptCode + "." + propertyCode;
      String propertyName = getLocalizer().getString(propertyKey, this);
View Full Code Here

    super(modelContext, viewContext);
    try {
      final App app = viewContext.getApp();
     
      final IEntities entities = modelContext.getEntities();
      final ConceptConfig conceptConfig = entities.getConceptConfig();

      // Table title
      String conceptsKey = conceptConfig.getEntitiesCode();
      String conceptsName = getLocalizer().getString(conceptsKey, this);
      add(new Label("conceptsName", conceptsName));

      // Absorbed parent essential property names
      List<String> parentEssentialPropertyNames = new ArrayList<String>();
      List<String> parentEssentialPropertyCodes = entities
          .getConceptConfig().getParentCodeEssentialPropertyCodes();
      for (String parentPropertyKey : parentEssentialPropertyCodes) {
        String parentPropertyName = getLocalizer().getString(
            parentPropertyKey, this);
        parentEssentialPropertyNames.add(parentPropertyName);
      }

      // Concept essential property names
      List<String> conceptEssentialPropertyNames = new ArrayList<String>();
      List<String> conceptEssentiaPropertyCodes = entities
          .getConceptConfig().getConceptCodeEssentialPropertyCodes();
      for (String conceptPropertyKey : conceptEssentiaPropertyCodes) {
        String conceptPropertyName = getLocalizer().getString(
            conceptPropertyKey, this);
        conceptEssentialPropertyNames.add(conceptPropertyName);
      }

      List<String> essentialPropertyNames = parentEssentialPropertyNames;
      essentialPropertyNames.addAll(conceptEssentialPropertyNames);
      add(new PropertyNameLabelListView("propertyNameLabelListView",
          essentialPropertyNames));

      // Neighbor empty labels
      List<String> childInternalNeighborNames = conceptConfig
          .getInternalChildNeighborNames();
      add(new NeighborEmptyNameLabelListView(
          "neighborEmptyNameLabelListViewHead",
          childInternalNeighborNames));
View Full Code Here

TOP

Related Classes of org.dmlite.model.config.ConceptConfig

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.