Examples of NeighborConfig


Examples of org.dmlite.model.config.NeighborConfig

      if (entity.getConceptConfig() != null) {
        NeighborsConfig neighborsConfig = entity.getConceptConfig()
            .getNeighborsConfig();
        TextHandler textHandler = new TextHandler();
        for (IEntity config : neighborsConfig) {
          NeighborConfig neighborConfig = (NeighborConfig) config;
          if (neighborConfig.getType().equals("child")
              && neighborConfig.isInternal()) {
            String neigborProperty = textHandler
                .firstLetterToLower(neighborConfig.getCode());
            Element neighborChildElement = element
                .element(neigborProperty);
            ConceptConfig neighborChildConceptConfig = (ConceptConfig) persistentModel
                .getDomainModel().getModelConfig()
                .getConceptsConfig().retrieveByCode(
                    neighborConfig.getDestination());
            if (neighborChildConceptConfig != null) {
              String neighborChildClassName = neighborChildConceptConfig
                  .getEntitiesClass();
              IDomainModel domainModel = persistentModel
                  .getDomainModel();
              IEntities neighborChildEntities = domainModel
                  .getModelMeta().createEntities(
                      neighborChildClassName);
              String neighborCode = neighborConfig.getCode();
              String setChildMethodName = "set"
                  + textHandler
                      .firstLetterToUpper(neighborCode);
              Reflector.executeMethod(entity, setChildMethodName,
                  neighborChildEntities);
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

      if (entity.getConceptConfig() != null) {
        NeighborsConfig neighborsConfig = entity.getConceptConfig()
            .getNeighborsConfig();
        TextHandler textHandler = new TextHandler();
        for (IEntity config : neighborsConfig) {
          NeighborConfig neighborConfig = (NeighborConfig) config;
          if (neighborConfig.getType().equals("child")
              && neighborConfig.isInternal()) {
            String neigborProperty = textHandler
                .firstLetterToLower(neighborConfig.getCode());
            IEntities neighborChildEntities = (IEntities) Reflector
                .getField(entity, neigborProperty);
            if (neighborChildEntities != null) {
              if (!neighborChildEntities.getCollection()
                  .isEmpty()) {
                Element neighborChildElement = element
                    .addElement(neigborProperty);
                XmlEntities neighborChildXmlEntities = new XmlEntities(
                    neighborChildEntities, persistentModel);
                if (neighborChildElement != null) {
                  Object[] params = new Object[2];
                  params[0] = neighborChildElement;
                  params[1] = textHandler
                      .firstLetterToLower(neighborConfig
                          .getDestination());
                  Reflector.executeMethod(
                      neighborChildXmlEntities, "fill",
                      params);
                }
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

    try {
      ConceptConfig conceptConfig = entity.getConceptConfig();
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity config : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) config;
        if (neighborConfig.getType().equals("parent")
            && (neighborConfig.isInternal())) {
          String methodName = "get" + neighborConfig.getBigCode();
          parent = (IEntity) executeMethod(entity, methodName);
        }
      }
    } catch (Exception e) {
      log.error("Error in ModelMeta.getInternalParent: "
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

    try {
      ConceptConfig conceptConfig = entities.getConceptConfig();
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity config : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) config;
        if (neighborConfig.getType().equals("parent")
            && (neighborConfig.isInternal())) {
          String methodName = "get" + neighborConfig.getBigCode();
          parent = (IEntity) executeMethod(entities, methodName);
        }
      }
    } catch (Exception e) {
      log.error("Error in ModelMeta.getInternalParent: "
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

   * @param neighborConfig
   *            neighbor configuration
   */
  public NeighborConfig findOppositeNeighborConfig(
      NeighborConfig neighborConfig) {
    NeighborConfig oppositeNeighborConfig = null;
    ConceptConfig oppositeConceptConfig = neighborConfig
        .getNeighborDestinationConceptConfig();
    for (IEntity config : oppositeConceptConfig.getNeighborsConfig()) {
      NeighborConfig oppositeConfig = (NeighborConfig) config;
      if (oppositeConfig.getDestination().equals(
          neighborConfig.getContextConceptConfig().getCode())) {
        oppositeNeighborConfig = oppositeConfig;
        break;
      }
    }
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

      ConceptConfig conceptConfig = sourceEntities.getConceptConfig();
      if (conceptConfig != null) {
        NeighborsConfig neighborsConfig = conceptConfig
            .getNeighborsConfig();
        for (IEntity config : neighborsConfig) {
          NeighborConfig neighborConfig = (NeighborConfig) config;
          if (neighborConfig.getType().equals("parent")) {
            String getParentMethodName = "get"
                + neighborConfig.getBigCode();

            IEntity entitiesParentEntity = (IEntity) Reflector
                .executeMethod(sourceEntities,
                    getParentMethodName);
            if (entitiesParentEntity != null) {
              String setParentMethodName = "set"
                  + neighborConfig.getBigCode();
              Reflector.executeMethod(destinationEntities,
                  setParentMethodName, entitiesParentEntity);
            }

          }
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

      ConceptConfig conceptConfig = entity.getConceptConfig();
      if (conceptConfig != null) {
        NeighborsConfig neighborsConfig = conceptConfig
            .getNeighborsConfig();
        for (IEntity config : neighborsConfig) {
          NeighborConfig neighborConfig = (NeighborConfig) config;
          if (neighborConfig.getType().equals("parent")) {
            String getParentMethodName = "get"
                + neighborConfig.getBigCode();
            IEntity entitiesParentEntity = (IEntity) Reflector
                .executeMethod(entities, getParentMethodName);
            if (entitiesParentEntity != null) {
              IEntity entityParentEntity = (IEntity) Reflector
                  .executeMethod(entity, getParentMethodName);
              if (entityParentEntity == null) {
                String setParentMethodName = "set"
                    + neighborConfig.getBigCode();
                Reflector.executeMethod(entity,
                    setParentMethodName,
                    entitiesParentEntity);
              } else if ((entities.getSourceEntities() == null)
                  && (!entitiesParentEntity
                      .equals(entityParentEntity))) {
                String setParentMethodName = "set"
                    + neighborConfig.getBigCode();
                Reflector.executeMethod(entity,
                    setParentMethodName,
                    entitiesParentEntity);
              }
            }
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

      // Properties absorbed from parents.
      NeighborsConfig neighborsConfig = conceptConfig
          .getNeighborsConfig();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("parent")
            && neighborConfig.getMax().equals("1")
            && neighborConfig.isAbsorb()) {
          ConceptConfig parentConceptConfig = neighborConfig
              .getNeighborDestinationConceptConfig();
          if (parentConceptConfig != null) {
            if (conceptCode.equals(neighborConfig
                .getContextConceptConfig().getCode())
                && parentConceptConfig.getDisplayType().equals(
                    "slide")) {
              // Do not absorb the context parent properties when
              // the parent is displayed as a slide.
              continue;
            }
            PropertiesConfig parentConceptPropertiesConfig = parentConceptConfig
                .getPropertiesConfig();
            for (IEntity parentPropertyConfigEntity : parentConceptPropertiesConfig) {
              PropertyConfig parentConceptPropertyConfig = (PropertyConfig) parentPropertyConfigEntity;
              if (parentConceptPropertyConfig.isEssential()) {
                IEntity parentEntity = entity
                    .getNeighborEntity(neighborConfig
                        .getCode());
                if (parentEntity != null) {
                  String parentCode = parentEntity
                      .getConceptConfig().getCode();
                  String parentPropertyKey = parentCode
                      + "."
                      + parentConceptPropertyConfig
                          .getCode();
                  String parentPropertyName = getLocalizer()
                      .getString(parentPropertyKey, this);
                  Label parentPropertyNameLabel = new Label(
                      "propertyName", parentPropertyName);
                  PropertyNameLabelValuePanelPair propertyNameLabelValuePanelPair = new PropertyNameLabelValuePanelPair();
                  propertyNameLabelValuePanelPair
                      .setPropertyNameLabel(parentPropertyNameLabel);

                  ModelContext parentModelContext = new ModelContext(
                      modelContext);
                  parentModelContext.setEntity(parentEntity);
                  parentModelContext
                      .setPropertyConfig(parentConceptPropertyConfig);

                  ViewContext parentViewContext = new ViewContext(
                      viewContext);
                  parentViewContext.setWicketId("valuePanel");
                  Panel parentPropertyPanel;
                  if (parentConceptPropertyConfig
                      .getPropertyClass().equals(
                          "java.net.URL")
                      || parentConceptPropertyConfig
                          .getPropertyClass()
                          .equals(
                              "org.dmlite.type.email.Email")) {
                    parentPropertyPanel = new ExternalLinkPanel(
                        parentModelContext,
                        parentViewContext);
                  } else {
                    parentPropertyPanel = new LabelPanel(
                        parentModelContext,
                        parentViewContext);
                  } // if
                  if (!app.isNeighborDisplayAllowed(
                      getAppSession(), neighborConfig)) {
                    parentPropertyPanel.setVisible(false);
                  } else if (!app.isPropertyDisplayAllowed(
                      getAppSession(),
                      parentConceptPropertyConfig)) {
                    parentPropertyPanel.setVisible(false);
                  }

                  propertyNameLabelValuePanelPair
                      .setPropertyValuePanel(parentPropertyPanel);
                  propertyNameLabelValuePanelPairs
                      .add(propertyNameLabelValuePanelPair);
                } // if
              } // if
            } // for
          } // if
        } // if
      } // for

      PropertiesConfig propertiesConfig = conceptConfig
          .getPropertiesConfig();
      for (IEntity propertyConfigEntity : propertiesConfig) {
        PropertyConfig propertyConfig = (PropertyConfig) propertyConfigEntity;
        if (!propertyConfig.isReference()) {
          String propertyKey = conceptCode + "."
              + propertyConfig.getCode();
          String propertyName = getLocalizer().getString(propertyKey,
              this);
          Label propertyNameLabel = new Label("propertyName",
              propertyName);
          PropertyNameLabelValuePanelPair propertyNameLabelValuePanelPair = new PropertyNameLabelValuePanelPair();
          propertyNameLabelValuePanelPair
              .setPropertyNameLabel(propertyNameLabel);

          entityModelContext.setPropertyConfig(propertyConfig);
          ViewContext propertiesViewContext = new ViewContext(
              viewContext);
          propertiesViewContext.setWicketId("valuePanel");
          Panel propertyValuePanel;
          if (propertyConfig.getPropertyClass()
              .equals("java.net.URL")
              || propertyConfig.getPropertyClass().equals(
                  "org.dmlite.type.email.Email")) {
            propertyValuePanel = new ExternalLinkPanel(
                entityModelContext, propertiesViewContext);
          } else if (propertyConfig.getPropertyClass().equals(
              "java.lang.String")
              && propertyConfig.isValidateType()
              && (propertyConfig.getValidationType().equals(
                  "java.net.URL") || propertyConfig
                  .getValidationType().equals(
                      "org.dmlite.type.email.Email"))) {
            propertyValuePanel = new ExternalLinkPanel(
                entityModelContext, propertiesViewContext);
          } else {
            propertyValuePanel = new LabelPanel(entityModelContext,
                propertiesViewContext);
          }
          if (!app.isPropertyDisplayAllowed(getAppSession(),
              propertyConfig)) {
            propertyNameLabel.setVisible(false);
            propertyValuePanel.setVisible(false);
          }

          propertyNameLabelValuePanelPair
              .setPropertyValuePanel(propertyValuePanel);
          propertyNameLabelValuePanelPairs
              .add(propertyNameLabelValuePanelPair);
        }
      }

      ListView propertyNameLabelValuePanelListView = new PropertyNameLabelValuePanelListView(
          "propertyNameLabelValuePanelListView",
          propertyNameLabelValuePanelPairs);
      item.add(propertyNameLabelValuePanelListView);
      if (!app.isConceptDisplayAllowed(getAppSession(), conceptConfig)) {
        propertyNameLabelValuePanelListView.setVisible(false);
      }

      List<Panel> childList = new ArrayList<Panel>();
      for (IEntity neighborConfigEntity : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) neighborConfigEntity;
        if (neighborConfig.getType().equals("child")) {
          String childCode = neighborConfig.getCode();
          IDomainModel domainModel = app.getDomainModel();
          IOrderedEntities childEntities = (IOrderedEntities) domainModel
              .getModelMeta().getNeighborEntities(entity,
                  childCode);
          ModelContext childEntitiesContext = new ModelContext(
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

    }
    try {
      NeighborsConfig neighborsConfig = entityLeft.getConceptConfig()
          .getNeighborsConfig();
      for (IEntity config : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) config;
        String neighborCode = neighborConfig.getCode();
        Object entityLeftNeighbor = entityLeft
            .getNeighbor(neighborCode);
        Object entityRightNeighbor = entityRight
            .getNeighbor(neighborCode);
        if (entityLeftNeighbor == null) {
View Full Code Here

Examples of org.dmlite.model.config.NeighborConfig

    boolean updated = false;
    try {
      NeighborsConfig neighborsConfig = entityLeft.getConceptConfig()
          .getNeighborsConfig();
      for (IEntity config : neighborsConfig) {
        NeighborConfig neighborConfig = (NeighborConfig) config;
        String getMethodName = "get" + neighborConfig.getBigCode();
        Object getObject = Reflector.executeMethod(entityRight,
            getMethodName);
        String setMethodName = "set" + neighborConfig.getBigCode();
        if (getObject != null) {
          Reflector.executeMethod(entityLeft, setMethodName,
              getObject);
        } else {
          String destination = neighborConfig.getDestination();
          ModelConfig modelConfig = neighborConfig
              .getContextConceptConfig().getContextModelConfig();
          ConceptConfig neighborConcept = modelConfig
              .getConceptConfig(destination);
          Class paramClass;
          if (neighborConfig.getMax().equals("1")) {
            paramClass = Reflector.getClass(neighborConcept
                .getEntityClass());
          } else {
            paramClass = Reflector.getClass(neighborConcept
                .getEntitiesClass());
View Full Code Here
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.