/** * {@inheritDoc} */ public final boolean equals(final Object arg0) { if (arg0 instanceof Property) { final Property p = (Property) arg0; return getName().equals(p.getName()) && new EqualsBuilder().append(getValue(), p.getValue()).append(getParameters(), p.getParameters()).isEquals(); } return super.equals(arg0); }
private static String getTzid(final Property p) { TzId tzidParam = (TzId)p.getParameter(Parameter.TZID); if (tzidParam == null) { return null; } return tzidParam.getValue(); }
/** * Creates a deep copy of the specified property. That is, the name, parameter list, and value are duplicated from * the specified property. This constructor should only be called from sub-classes to ensure type integrity is * maintained. * @param property a property to copy * @throws URISyntaxException where the specified property contains an invalid URI value * @throws ParseException where the specified property has invalid data * @throws IOException where an error occurs reading data from the specified property * @deprecated Use {@link #copy()} instead */ protected Property(final Property property) throws IOException, URISyntaxException, ParseException { this(property.getName(), new ParameterList(property.getParameters(), false), property.factory); setValue(property.getValue()); }
/** * * @param property The property. * @param buffer The string buffer. */ private void chompPropertyValue(Property property, StringBuilder buffer) { buffer.append(property.getName()). append(property.getParameters()). append(':'). append("\n"); }
/** * {@inheritDoc} */ public final boolean test(final Component component) { boolean match = false; final PropertyList<Property> properties = component.getProperties(property.getName()); for (final Property p : properties) { if (matchEquals && property.equals(p)) { match = true; } else if (property.getValue().equals(p.getValue())) { match = true; } } return match; } }
/** * @param comp * @param name * @return String */ public static String getPropertyVal(final Component comp, final String name) { Property prop = getProperty(comp, name); if (prop == null) { return null; } return prop.getValue(); }
protected static void loadPartyAssignment(Property property, GenericValue partyAssign, Map<String, Object> context) { getPartyUrl(property, partyAssign, context); if (UtilValidate.isEmpty(property.getValue())) { try { // RFC 2445 4.8.4.1 and 4.8.4.3 Value must be a URL property.setValue("MAILTO:ofbiz-test@example.com"); } catch (Exception e) { Debug.logError(e, "Error while setting Property value: ", module); } } ParameterList parameterList = property.getParameters(); replaceParameter(parameterList, toXParameter(partyIdXParamName, partyAssign.getString("partyId"))); replaceParameter(parameterList, new Cn(makePartyName(partyAssign))); replaceParameter(parameterList, toParticipationStatus(partyAssign.getString("assignmentStatusId"))); }
protected static void setPartyIdFromUrl(Property property, Map<String, Object> context) { Map<String, ? extends Object> serviceMap = UtilMisc.toMap("address", property.getValue(), "caseInsensitive", "Y"); Map<String, Object> resultMap = invokeService("findPartyFromEmailAddress", serviceMap, context); String partyId = (String) resultMap.get("partyId"); if (partyId != null) { replaceParameter(property.getParameters(), toXParameter(partyIdXParamName, partyId)); } }
/** * Test deep copy of properties. */ public void testCopy() throws IOException, URISyntaxException, ParseException { Property copy = property.copy(); assertEquals(property, copy); copy.getParameters().add(Value.BOOLEAN); assertFalse(property.equals(copy)); assertFalse(copy.equals(property)); }
/** * Convenience method for retrieving a list of named parameters. * * @param name name of parameters to retrieve * @return a parameter list containing only parameters with the specified name */ public final ParameterList getParameters(final String name) { return getParameters().getParameters(name); }
private void fixDateTimeProperties(Component component) { PropertyList<Property> props = component.getProperties(); for(Property prop : props) { if(prop instanceof DateProperty || prop instanceof DateListProperty) { Value v = (Value) prop.getParameter(Parameter.VALUE); if(Value.DATE_TIME.equals(v)) { prop.getParameters().remove(v); } } } }
/** * Invoke validation on the component properties in its current state. * * @throws ValidationException where any of the component properties is not in a valid state */ protected final void validateProperties() throws ValidationException { for (final Property property : getProperties()) { property.validate(); } }
/** * Creates a deep copy of the specified property list. * @param properties a property list * @throws ParseException where property data cannot be parsed * @throws IOException where property data cannot be read * @throws URISyntaxException where a property contains an invalid URI */ public PropertyList(PropertyList properties) throws ParseException, IOException, URISyntaxException { super(); for (Property p : properties) { add(p.copy()); } }
protected VAlarm getDisplayAlarm(VEvent event) { ComponentList<VAlarm> alarmsList = event.getAlarms(); for(VAlarm alarm: alarmsList) { if (alarm.getProperties().getProperty(Property.ACTION).equals( Action.DISPLAY)) { return alarm; } } return null; }
/** * {@inheritDoc} */ public final boolean match(final Component component) { boolean match = false; final PropertyList<Property> properties = component.getProperties(property.getName()); for (final Property p : properties) { if (matchEquals && property.equals(p)) { match = true; } else if (property.getValue().equals(p.getValue())) { match = true; } } return match; } }
private String getPval(String name) { Property prop = getProp(name); if (prop == null) { return null; } return prop.getValue(); }
/** * Convenience method for retrieving a single parameter. * * @param name name of the parameter to retrieve * @return the first parameter from the parameter list with the specified name */ public final Parameter getParameter(final String name) { return getParameters().getParameter(name); }
/** * * @param property The property. * @param buffer The string buffer. */ private void chompPropertyValue(Property property, StringBuilder buffer) { buffer.append(property.getName()). append(property.getParameters()). append(':'). append("\n"); }