public Object getPropertyValue(Object source) throws Exception {
    Method objectMethodGetProperty = getPropertyGettor(source);
    if (objectMethodGetProperty == null)
      throw new NullPointerException(
          source.getClass().getName() + " has no get for property \"" + propertyName + "\"");
    Object value = objectMethodGetProperty.invoke(source, new Object[] {});

    ReferenceHolder refHolder = null;

    try {
      refHolder = (ReferenceHolder) value;
    } catch (ClassCastException e) {
      throw new Exception(
          "The source could not be cast into an ReferenceHolder for property \""
              + propertyName
              + "\"",
          e);
    }

    return refHolder.getBase().getId();
  }
Пример #2
0
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof WizardStyleItem)) {
      return false;
    }

    final WizardStyleItem styleItem = (WizardStyleItem) o;

    if (fullReference != null
        ? !fullReference.equals(styleItem.fullReference)
        : styleItem.fullReference != null) {
      return false;
    }
    if (wizard != null ? !wizard.equals(styleItem.wizard) : styleItem.wizard != null) {
      return false;
    }

    return true;
  }
Пример #3
0
  public String getDisplayName() {
    ContentResource resource = (ContentResource) baseReference.getBase().getEntity();

    String displayNameProp = resource.getProperties().getNamePropDisplayName();
    return resource.getProperties().getProperty(displayNameProp);
  }
Пример #4
0
 public int hashCode() {
   int result = 0;
   result = 29 * result + (wizard != null ? wizard.hashCode() : 0);
   result = 29 * result + (fullReference != null ? fullReference.hashCode() : 0);
   return result;
 }