コード例 #1
0
 private Object convertValue(
     final ClassAttributeAssignmentModel assignment, final String stringValue) {
   final String typeCode = assignment.getAttributeType().getCode();
   if (ClassificationAttributeTypeEnum.BOOLEAN.getCode().equals(typeCode)) {
     return Boolean.valueOf(stringValue);
   } else if (ClassificationAttributeTypeEnum.ENUM.getCode().equals(typeCode)) {
     // YTODO
     final Item item = JaloSession.getCurrentSession().getItem(PK.parse(stringValue));
     final Object value = load(item);
     validateParameterNotNull(value, "No such value with PK: " + stringValue);
     return value;
   } else if (ClassificationAttributeTypeEnum.NUMBER.getCode().equals(typeCode)) {
     return Double.valueOf(stringValue);
   } else if (ClassificationAttributeTypeEnum.STRING.getCode().equals(typeCode)) {
     return stringValue;
   } else if (ClassificationAttributeTypeEnum.DATE.getCode().equals(typeCode)) {
     try {
       return Utilities.getDateTimeInstance().parse(stringValue);
     } catch (final ParseException e) {
       throw new IllegalArgumentException(e.getMessage(), e);
     }
   } else {
     throw new IllegalArgumentException("Invalid classifcation attribute type code: " + typeCode);
   }
 }
コード例 #2
0
  @Override
  public void handleEvent(
      final UICockpitPerspective perspective, final Map<String, String[]> params) {
    final String itemParam = this.getParameter(params, COMPETITION_KEY);

    CompetitionModel competition = null;
    try {
      final TypedObject item =
          UISessionUtils.getCurrentSession().getTypeService().wrapItem(PK.parse(itemParam));
      if (item != null) {
        competition = (CompetitionModel) item.getObject();
      }
    } catch (final Exception e) {
      LOG.warn("competition specified in jumpin URL not forund: " + itemParam, e);
    }

    if (competition != null) {
      getFrontendController().changeCompetition(competition.getCode());
    }
  }
 /**
  * Gets the {@link CsTicketChangeEventStringEntryModel} resource which is addressed by current
  * resource request.
  *
  * @see de.hybris.platform.webservices.AbstractYResource#readResource(String)
  */
 @Override
 protected CsTicketChangeEventStringEntryModel readResource(final String resourceId)
     throws Exception {
   return serviceLocator.getModelService().get(PK.parse(resourceId));
 }
コード例 #4
0
 /**
  * Gets the {@link AbstractPromotionModel} resource which is addressed by current resource
  * request.
  *
  * @see de.hybris.platform.webservices.AbstractYResource#readResource(String)
  */
 @Override
 protected AbstractPromotionModel readResource(final String resourceId) throws Exception {
   return serviceLocator.getModelService().get(PK.parse(resourceId));
 }
 /**
  * Gets the {@link PromotionOrderChangeDeliveryModeActionModel} resource which is addressed by
  * current resource request.
  *
  * @see de.hybris.platform.webservices.AbstractYResource#readResource(String)
  */
 @Override
 protected PromotionOrderChangeDeliveryModeActionModel readResource(final String resourceId)
     throws Exception {
   return serviceLocator.getModelService().get(PK.parse(resourceId));
 }