Package org.dmlite.model

Examples of org.dmlite.model.IEntity


    super(modelContext, viewContext);
    try {
      final App app = viewContext.getApp();
     
      final IOrderedEntities entities = modelContext.getOrderedEntities();
      final IEntity entity = modelContext.getEntity();

      ConceptConfig conceptConfig = entity.getConceptConfig();
      ModelContext slideNavigateModelContext = new ModelContext(
          modelContext);

      ViewContext slideNavigateViewContext = new ViewContext(viewContext);
      slideNavigateViewContext.setWicketId("slideNavigatePanel");
View Full Code Here


  protected void onSubmit() {
    try {
      App app = viewContext.getApp();
     
      IEntities<IEntity> entities = modelContext.getEntities();
      IEntity entity = modelContext.getEntity();
      IEntity updateEntity = modelContext.getUpdateEntity();
      ConceptConfig conceptConfig = entities.getConceptConfig();

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

   */
  public int compare(IEntity object1, IEntity object2)
      throws IllegalArgumentException {
    int result = 0;
    if (object1 instanceof IEntity && object2 instanceof IEntity) {
      IEntity entity1 = (IEntity) object1;
      IEntity entity2 = (IEntity) object2;
      IEntity neighbor1 = (IEntity) entity1
          .getNeighborEntity(neighborCode);
      IEntity neighbor2 = (IEntity) entity2
          .getNeighborEntity(neighborCode);
      if (neighbor1 != null && neighbor2 != null) {
        if (comparator == null) {
          PropertyComparator propertyComparator = new PropertyComparator(
              neighborPropertyCode);
View Full Code Here

   */
  public PropertyValueDropDownChoicePanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(viewContext.getWicketId());
    try {
      IEntity entity;
      String action = modelContext.getAction();
      if (action != null && action.equals("update")) {
        entity = modelContext.getUpdateEntity();
      } else {
        entity = modelContext.getEntity();
View Full Code Here

      final ViewContext viewContext) {
    super(viewContext.getWicketId());
    try {
      App app = viewContext.getApp();
     
      IEntity entity = modelContext.getEntity();

      ConceptConfig conceptConfig = entity.getConceptConfig();
      String conceptKey = conceptConfig.getCode();
      String conceptName = getLocalizer().getString(conceptKey, this);
      add(new Label("conceptName", conceptName));

      ModelContext entityContext = new ModelContext(modelContext);

      List<PropertyNameLabelValuePanelPair> propertyNameLabelValuePanelPairs = new ArrayList<PropertyNameLabelValuePanelPair>();

      // 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) {
            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();
View Full Code Here

   */
  public ExternalLinkPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(viewContext.getWicketId());
    try {
      IEntity entity = modelContext.getEntity();

      PropertyConfig propertyConfig = modelContext.getPropertyConfig();
      String displayText = null;
      if (!viewContext.getMoreArgs().isEmpty()) {
        displayText = (String) viewContext.getMoreArgs().get(
            "displayText");
      }

      Class propertyClass = propertyConfig.getPropertyClassObject();
      String propertyCode = propertyConfig.getCode();
      TextHandler textExtractor = new TextHandler();
      Object property = entity.getProperty(propertyCode);
      String link;
      String linkDisplayText;
      if (entity != null) {
        if (propertyClass == URL.class) {
          URL url = (URL) property;
View Full Code Here

      final ViewContext viewContext) {
    super(modelContext, viewContext);
    try {
      final App app = viewContext.getApp();
     
      final IEntity entity = modelContext.getEntity();
      final IDomainModel domainModel = modelContext.getDomainModel();

      ConceptConfig conceptConfig = entity.getConceptConfig();
      String conceptKey = conceptConfig.getCode();
      String conceptName = getLocalizer().getString(conceptKey, this);
      add(new Label("conceptName", conceptName));

      List<PropertyNameLabelValuePanelPair> propertyNameLabelValuePanelPairs = new ArrayList<PropertyNameLabelValuePanelPair>();

      // 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) {
            PropertiesConfig parentConceptPropertiesConfig = parentConceptConfig
                .getPropertiesConfig();
            for (IEntity propertyConfigEntity : parentConceptPropertiesConfig) {
              PropertyConfig parentConceptPropertyConfig = (PropertyConfig) propertyConfigEntity;
              if (parentConceptPropertyConfig.isEssential()) {
                IEntity parentEntity = entity
                    .getNeighborEntity(neighborConfig
                        .getCode());
                if (parentEntity != null) {
                  String parentCode = parentEntity
                      .getConceptConfig().getCode();
                  String parentPropertyKey = parentCode
                      + "."
                      + parentConceptPropertyConfig
                          .getCode();
View Full Code Here

   *            entity class name
   * @throws dmLite
   *             order exception if there is a problem
   */
  public IEntity createEntity(String entityClassName) throws DmException {
    IEntity entity = null;
    try {
      Class entityClass = Reflector.getClass(entityClassName);
      Constructor constructor = Reflector.getConstructor(entityClass,
          IDomainModel.class);
      Object object = Reflector.getInstance(constructor, domainModel);
      entity = (IEntity) object;
      if (entity == null) {
        String error = "Error in ModelMeta.createEntities: "
            + entityClassName;
        throw new DmException(error);
      }
      ConceptConfig conceptConfig = entity.getConceptConfig();
      if (conceptConfig != null) {
        PropertiesConfig propertiesConfig = conceptConfig
            .getPropertiesConfig();
        for (IEntity config : propertiesConfig) {
          PropertyConfig propertyConfig = (PropertyConfig) config;
          if (propertyConfig.getDefaultValue() != null) {
            String propertyCode = propertyConfig.getCode();
            Object property = entity.getProperty(propertyCode);
            setPropertyDefaultValue(entity, propertyConfig,
                property);
          }
        }
      }
View Full Code Here

    try {
      if (entity.getConceptConfig().isEntry()) {
        entry = domainModel.getEntry(entity.getConceptConfig()
            .getCode());
      } else {
        IEntity parent = getInternalParent(entity);
        if (parent != null) {
          entry = getEntry(parent);
        }
      }
    } catch (Exception e) {
View Full Code Here

   */
  public LabelPanel(final ModelContext modelContext,
      final ViewContext viewContext) {
    super(viewContext.getWicketId());
    try {
      IEntity entity = modelContext.getEntity();
      PropertyConfig propertyConfig = modelContext.getPropertyConfig();
      boolean shortContext = false;
      if (!viewContext.getMoreArgs().isEmpty()) {
        Boolean shortTextBoolean = (Boolean) viewContext.getMoreArgs()
            .get("shortText");
        shortContext = shortTextBoolean.booleanValue();
      }

      String propertyCode = propertyConfig.getCode();
      Class propertyClass = propertyConfig.getPropertyClassObject();
      String propertyValueText = "";
      if (entity != null) {
        if (propertyConfig.isReference()) {
          String neighborCode = propertyConfig.getReferenceNeighbor();
          NeighborConfig neighborConfig = entity.getConceptConfig()
              .getNeighborsConfig().getNeighborConfig(
                  neighborCode);
          String neighborConceptCode = neighborConfig
              .getDestination();
          App app = (App) getApplication();
          IPersistentEntities persistentEntities = app.getDbContext()
              .getPersistentModel().getPersistentEntry(
                  neighborConceptCode);
          IOrderedEntities neighborEntities = null;
          if (persistentEntities != null) {
            neighborEntities = (IOrderedEntities) persistentEntities
                .getEntities();
          }
          if (neighborEntities != null) {
            Long referenceOid = (Long) entity
                .getProperty(propertyCode);
            Oid neighborParentOid = new Oid(referenceOid);
            IEntity neighborParent = neighborEntities
                .retrieveByOid(neighborParentOid);
            if (neighborParent != null) {
              PropertyConfig uniquelPropertyConfig = neighborParent
                  .getConceptConfig().getPropertiesConfig()
                  .getFirstUniquePropertyConfig();
              if (uniquelPropertyConfig != null
                  && uniquelPropertyConfig.getPropertyClass()
                      .equals("java.lang.String")) {
                propertyValueText = (String) neighborParent
                    .getProperty(uniquelPropertyConfig
                        .getCode());
              }
            }
          }
View Full Code Here

TOP

Related Classes of org.dmlite.model.IEntity

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.