From: <b_c...@us...> - 2011-08-17 20:24:55
|
Revision: 5480 http://jaffa.svn.sourceforge.net/jaffa/?rev=5480&view=rev Author: b_calderwood Date: 2011-08-17 20:24:48 +0000 (Wed, 17 Aug 2011) Log Message: ----------- Add web service API UI and required service components. Modified Paths: -------------- trunk/JaffaCore/source/java/org/jaffa/metadata/PropertyRuleIntrospectorUsingFieldMetaData.java trunk/JaffaCore/source/java/org/jaffa/presentation/portlet/widgets/model/PropertyRuleIntrospectorUsingWidgetModel.java trunk/JaffaCore/source/java/org/jaffa/rules/IPropertyRuleIntrospector.java Modified: trunk/JaffaCore/source/java/org/jaffa/metadata/PropertyRuleIntrospectorUsingFieldMetaData.java =================================================================== --- trunk/JaffaCore/source/java/org/jaffa/metadata/PropertyRuleIntrospectorUsingFieldMetaData.java 2011-08-17 20:24:16 UTC (rev 5479) +++ trunk/JaffaCore/source/java/org/jaffa/metadata/PropertyRuleIntrospectorUsingFieldMetaData.java 2011-08-17 20:24:48 UTC (rev 5480) @@ -68,12 +68,12 @@ * Additionally it'll use the supplied FieldMetaData for additional info where required. */ public class PropertyRuleIntrospectorUsingFieldMetaData implements IPropertyRuleIntrospector { - + private static Logger log = Logger.getLogger(PropertyRuleIntrospectorUsingFieldMetaData.class); - + private IPropertyRuleIntrospector m_sourcePropertyRuleIntrospector = null; private FieldMetaData m_fieldMetaData = null; - + private Class m_propertyType = null; private Integer m_minLength = null; private Integer m_maxLength = null; @@ -85,7 +85,7 @@ private String m_layout = null; private String[] m_pattern = null; private Boolean m_mandatory = null; - + private boolean m_checkedPropertyType = false; private boolean m_checkedMinLength = false; private boolean m_checkedMaxLength = false; @@ -96,7 +96,7 @@ private boolean m_checkedLabel = false; private boolean m_checkedLayout = false; private boolean m_checkedPattern = false; - + /** * Creates an instance. * @param sourcePropertyRuleIntrospector The source introspector. @@ -106,7 +106,7 @@ m_sourcePropertyRuleIntrospector = sourcePropertyRuleIntrospector; m_fieldMetaData = fieldMetaData; } - + /** Returns a Class object that identifies the declared type for the property. * @return a Class object that identifies the declared type for the property. */ @@ -120,22 +120,22 @@ } return m_propertyType; } - + /** Returns a true if the property is marked as Hidden. * @return a true if the property is marked as Hidden. */ public boolean isHidden() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.isHidden() : false; } - - + + /** Returns a true if the property is marked as ReadOnly. * @return a true if the property is marked as ReadOnly. */ public boolean isReadOnly() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.isReadOnly() : false; } - + /** Returns the annotation for the property. * @return the annotation for the property. */ @@ -163,21 +163,21 @@ public Properties getForeignKeyInfo() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getForeignKeyInfo() : null; } - + /** Returns the hyperlink info for the property. * @return the hyperlink info for the property. */ public Properties getHyperlinkInfo() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getHyperlinkInfo() : null; } - + /** Returns the info for the property. * @return the info for the property. */ public Properties getPropertyInfo() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getPropertyInfo() : null; } - + /** Returns the minLength for the property. * @return the minLength for the property. */ @@ -186,14 +186,14 @@ m_checkedMinLength = true; if (m_sourcePropertyRuleIntrospector != null) m_minLength = m_sourcePropertyRuleIntrospector.getMinLength(); - + // Assign the upper of the values from the FieldMetaData and the Rules Integer x = getMinLengthFromFieldMetaData(); m_minLength = x == null ? m_minLength : (m_minLength == null ? x : (x.intValue() > m_minLength.intValue() ? x : m_minLength)); } return m_minLength; } - + /** Returns the maxLength for the property. * @return the maxLength for the property. */ @@ -202,14 +202,14 @@ m_checkedMaxLength = true; if (m_sourcePropertyRuleIntrospector != null) m_maxLength = m_sourcePropertyRuleIntrospector.getMaxLength(); - + // Assign the lower of the values from the FieldMetaData and the Rules Integer x = getMaxLengthFromFieldMetaData(); m_maxLength = x == null ? m_maxLength : (m_maxLength == null ? x : (x.intValue() < m_maxLength.intValue() ? x : m_maxLength)); } return m_maxLength; } - + /** Returns the maxFracLength for the property. * @return the maxFracLength for the property. */ @@ -218,14 +218,14 @@ m_checkedMaxFracLength = true; if (m_sourcePropertyRuleIntrospector != null) m_maxFracLength = m_sourcePropertyRuleIntrospector.getMaxFracLength(); - + // Assign the lower of the values from the FieldMetaData and the Rules Integer x = getMaxFracLengthFromFieldMetaData(); m_maxFracLength = x == null ? m_maxFracLength : (m_maxFracLength == null ? x : (x.intValue() < m_maxFracLength.intValue() ? x : m_maxFracLength)); } return m_maxFracLength; } - + /** Returns the minValue for the property. * @return the minValue for the property. */ @@ -234,7 +234,7 @@ m_checkedMinValue = true; if (m_sourcePropertyRuleIntrospector != null) m_minValue = m_sourcePropertyRuleIntrospector.getMinValue(); - + // Assign the maximum of the values from the FieldMetaData and the Rules Object x = getMinValueFromFieldMetaData(); if (x != null) { @@ -246,7 +246,7 @@ } return m_minValue; } - + /** Returns the maxValue for the property. * @return the maxValue for the property. */ @@ -255,7 +255,7 @@ m_checkedMaxValue = true; if (m_sourcePropertyRuleIntrospector != null) m_maxValue = m_sourcePropertyRuleIntrospector.getMaxValue(); - + // Assign the minimum of the values from the FieldMetaData and the Rules Object x = getMaxValueFromFieldMetaData(); if (x != null) { @@ -267,7 +267,7 @@ } return m_maxValue; } - + /** Returns the caseType for the property. * If multiple caseType rules are defined for a property, then the caseType from the first rule will be returned. * @return the caseType for the property. @@ -282,7 +282,7 @@ } return m_caseType; } - + /** Returns the label for the property. * If multiple label rules are defined for a property, then the label from the last rule will be returned. * @return the label for the property. @@ -297,7 +297,7 @@ } return m_label; } - + /** Returns the layout for the property. * If multiple layout rules are defined for a property, then the layout from the last rule will be returned. * @return the layout for the property. @@ -314,7 +314,7 @@ } return m_layout; } - + /** Looks up the layout rules defined for the property and formats the input object using the associated formatterClass. * If multiple layout rules are defined for a property, then the layout from the last rule will be used. * @param property the property instance to be formatted. @@ -323,7 +323,7 @@ public String format(Object property) { return Formatter.format(property, getLayout()); } - + /** Returns the pattern(s) for the property. * @return the pattern(s) for the property. */ @@ -332,7 +332,7 @@ m_checkedPattern = true; if (m_sourcePropertyRuleIntrospector != null) m_pattern = m_sourcePropertyRuleIntrospector.getPattern(); - + String pattern = getPatternFromFieldMetaData(); if (pattern != null) { if (m_pattern == null) @@ -349,7 +349,7 @@ } return m_pattern; } - + /** Returns a true if the property is marked as mandatory. * @return a true if the property is marked as mandatory. */ @@ -364,18 +364,18 @@ } return m_mandatory.booleanValue(); } - + /** Returns the client rule for the property. * @return the client rule for the property. */ public String getClientRule() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getClientRule() : null; } - + public String getCommentStyle() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getCommentStyle() : null; } - + /** Returns the in-list values for the property. * Each entry in the Map will be a value/label pair. * @return the in-list values for the property. @@ -384,7 +384,7 @@ return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getInListValues() : null; } - + private Class getPropertyTypeFromFieldMetaData() { if (m_fieldMetaData != null) { String dataType = m_fieldMetaData.getDataType(); @@ -393,7 +393,7 @@ } return null; } - + private Integer getMinLengthFromFieldMetaData() { if (m_fieldMetaData != null) { try { @@ -411,7 +411,7 @@ } return null; } - + private Integer getMaxLengthFromFieldMetaData() { if (m_fieldMetaData != null) { try { @@ -440,7 +440,7 @@ } return null; } - + private Integer getMaxFracLengthFromFieldMetaData() { if (m_fieldMetaData != null) { try { @@ -458,7 +458,7 @@ } return null; } - + private Object getMinValueFromFieldMetaData() { if (m_fieldMetaData != null) { try { @@ -470,7 +470,7 @@ } return null; } - + private Object getMaxValueFromFieldMetaData() { if (m_fieldMetaData != null) { try { @@ -482,15 +482,15 @@ } return null; } - + private String getCaseTypeFromFieldMetaData() { return m_fieldMetaData != null && m_fieldMetaData instanceof StringFieldMetaData ? ((StringFieldMetaData) m_fieldMetaData).getCaseType() : null; } - + private String getLabelFromFieldMetaData() { return m_fieldMetaData != null ? m_fieldMetaData.getLabelToken() : null; } - + private String getLayoutFromFieldMetaData() { String layout = null; if (m_fieldMetaData != null) { @@ -520,16 +520,20 @@ */ return layout; } - + private String getPatternFromFieldMetaData() { return m_fieldMetaData != null && m_fieldMetaData instanceof StringFieldMetaData ? ((StringFieldMetaData) m_fieldMetaData).getPattern() : null; } - + private boolean getMandatoryFromFieldMetaData() { return m_fieldMetaData != null && m_fieldMetaData.isMandatory() != null ? m_fieldMetaData.isMandatory().booleanValue() : false; } - + + public Map<String, Object> getServiceInfo(){ + return null; + } + public String toString() { StringBuffer s=new StringBuffer("PropertyRuleIntrospectorUsingFieldMetaData@").append(hashCode()); if(log.isDebugEnabled()) @@ -553,4 +557,5 @@ .append("\n sourcePropertyRuleIntrospector = ").append(StringHelper.linePad(""+m_sourcePropertyRuleIntrospector,8," ",true) ); return s.toString(); } + } Modified: trunk/JaffaCore/source/java/org/jaffa/presentation/portlet/widgets/model/PropertyRuleIntrospectorUsingWidgetModel.java =================================================================== --- trunk/JaffaCore/source/java/org/jaffa/presentation/portlet/widgets/model/PropertyRuleIntrospectorUsingWidgetModel.java 2011-08-17 20:24:16 UTC (rev 5479) +++ trunk/JaffaCore/source/java/org/jaffa/presentation/portlet/widgets/model/PropertyRuleIntrospectorUsingWidgetModel.java 2011-08-17 20:24:48 UTC (rev 5480) @@ -76,21 +76,21 @@ * Additionally it'll use the supplied SimpleWidgetModel for additional info where required. */ public class PropertyRuleIntrospectorUsingWidgetModel implements IPropertyRuleIntrospector { - + private static Logger log = Logger.getLogger(PropertyRuleIntrospectorUsingWidgetModel.class); - + private IPropertyRuleIntrospector m_sourcePropertyRuleIntrospector = null; private SimpleWidgetModel m_widgetModel = null; - + private Class m_propertyType = null; private String m_caseType = null; private String m_layout = null; private Boolean m_mandatory = null; - + private boolean m_checkedPropertyType = false; private boolean m_checkedCaseType = false; private boolean m_checkedLayout = false; - + /** * Creates an instance. * @param sourcePropertyRuleIntrospector The source introspector. @@ -101,10 +101,10 @@ m_sourcePropertyRuleIntrospector = new PropertyRuleIntrospectorUsingFieldMetaData(sourcePropertyRuleIntrospector, widgetModel.getFieldMetaData()); else m_sourcePropertyRuleIntrospector = sourcePropertyRuleIntrospector; - + m_widgetModel = widgetModel; } - + /** Returns a Class object that identifies the declared type for the property. * @return a Class object that identifies the declared type for the property. */ @@ -119,26 +119,26 @@ m_propertyType = getPropertyTypeFromWidgetModel(); log.debug("getPropertyType()::WidgetModel -> " + m_propertyType); } - + } return m_propertyType; } - + /** Returns a true if the property is marked as Hidden. * @return a true if the property is marked as Hidden. */ public boolean isHidden() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.isHidden() : false; } - - + + /** Returns a true if the property is marked as ReadOnly. * @return a true if the property is marked as ReadOnly. */ public boolean isReadOnly() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.isReadOnly() : false; } - + /** Returns the annotation for the property. * @return the annotation for the property. */ @@ -152,7 +152,7 @@ public Properties getAuditInfo() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getAuditInfo() : null; } - + /** Returns the flex info for the property. * @return the flex info for the property. */ @@ -166,56 +166,56 @@ public Properties getForeignKeyInfo() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getForeignKeyInfo() : null; } - + /** Returns the hyperlink info for the property. * @return the hyperlink info for the property. */ public Properties getHyperlinkInfo() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getHyperlinkInfo() : null; } - + /** Returns the info for the property. * @return the info for the property. */ public Properties getPropertyInfo() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getPropertyInfo() : null; } - + /** Returns the minLength for the property. * @return the minLength for the property. */ public Integer getMinLength() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getMinLength() : null; } - + /** Returns the maxLength for the property. * @return the maxLength for the property. */ public Integer getMaxLength() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getMaxLength() : null; } - + /** Returns the maxFracLength for the property. * @return the maxFracLength for the property. */ public Integer getMaxFracLength() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getMaxFracLength() : null; } - + /** Returns the minValue for the property. * @return the minValue for the property. */ public Object getMinValue() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getMinValue() : null; } - + /** Returns the maxValue for the property. * @return the maxValue for the property. */ public Object getMaxValue() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getMaxValue() : null; } - + /** Returns the caseType for the property. * If multiple caseType rules are defined for a property, then the caseType from the first rule will be returned. * @return the caseType for the property. @@ -230,7 +230,7 @@ } return m_caseType; } - + /** Returns the label for the property. * If multiple label rules are defined for a property, then the label from the last rule will be returned. * @return the label for the property. @@ -238,7 +238,7 @@ public String getLabel() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getLabel() : null; } - + /** Returns the layout for the property. * If multiple layout rules are defined for a property, then the layout from the last rule will be returned. * @return the layout for the property. @@ -254,7 +254,7 @@ m_layout = getLayoutFromWidgetModel(); log.debug("getLayout(): WidgetModel's Layout -> " + m_layout); } - + // Get the default layout based on the datatype if(m_layout==null && getPropertyType()!=null) { if (getPropertyType() == Float.class || @@ -277,7 +277,7 @@ } return m_layout; } - + /** Looks up the layout rules defined for the property and formats the input object using the associated formatterClass. * If multiple layout rules are defined for a property, then the layout from the last rule will be used. * @param property the property instance to be formatted. @@ -286,14 +286,14 @@ public String format(Object property) { return Formatter.format(property, getLayout()); } - + /** Returns the pattern(s) for the property. * @return the pattern(s) for the property. */ public String[] getPattern() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getPattern() : null; } - + /** Returns a true if the property is marked as mandatory. * @return a true if the property is marked as mandatory. */ @@ -313,14 +313,14 @@ } return m_mandatory.booleanValue(); } - + /** Returns the client rule for the property. * @return the client rule for the property. */ public String getClientRule() { return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getClientRule() : null; } - + /** Returns the comment type for the property. * @return the comment type for the property. */ @@ -328,7 +328,7 @@ //log.info("&&& PropertyRuleIntrospectorUsingWidgetModel.getCommentStyle(): m_sourcePropertyRuleIntrospector="+m_sourcePropertyRuleIntrospector); return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getCommentStyle() : null; } - + /** Returns the in-list values for the property. * Each entry in the Map will be a value/label pair. * @return the in-list values for the property. @@ -337,7 +337,7 @@ return m_sourcePropertyRuleIntrospector != null ? m_sourcePropertyRuleIntrospector.getInListValues() : null; } - + private Class getPropertyTypeFromWidgetModel() { if (m_widgetModel != null) { String dataType = m_widgetModel.getDataType(); @@ -346,19 +346,23 @@ } return null; } - + private String getCaseTypeFromWidgetModel() { return m_widgetModel != null ? m_widgetModel.getStringCase() : null; } - + private String getLayoutFromWidgetModel() { return m_widgetModel != null ? m_widgetModel.getLayout() : null; } - + private boolean getMandatoryFromWidgetModel() { return m_widgetModel != null ? m_widgetModel.isMandatory() : false; } - + + public Map<String, Object> getServiceInfo(){ + return null; + } + public String toString() { StringBuffer s=new StringBuffer("PropertyRuleIntrospectorUsingWidgetModel@").append(hashCode()); if(log.isDebugEnabled()) Modified: trunk/JaffaCore/source/java/org/jaffa/rules/IPropertyRuleIntrospector.java =================================================================== --- trunk/JaffaCore/source/java/org/jaffa/rules/IPropertyRuleIntrospector.java 2011-08-17 20:24:16 UTC (rev 5479) +++ trunk/JaffaCore/source/java/org/jaffa/rules/IPropertyRuleIntrospector.java 2011-08-17 20:24:48 UTC (rev 5480) @@ -57,22 +57,22 @@ * @author GautamJ */ public interface IPropertyRuleIntrospector { - + /** Returns a Class object that identifies the declared type for the property. * @return a Class object that identifies the declared type for the property. */ public Class getPropertyType(); - + /** Returns a true if the property is marked as Hidden. * @return a true if the property is marked as Hidden. */ public boolean isHidden(); - + /** Returns a true if the property is marked as ReadOnly. * @return a true if the property is marked as ReadOnly. */ public boolean isReadOnly(); - + /** Returns the annotation for the property. * @return the annotation for the property. */ @@ -92,12 +92,12 @@ * @return the foreignkey info for the property. */ public Properties getForeignKeyInfo(); - + /** Returns the hyperlink info for the property. * @return the hyperlink info for the property. */ public Properties getHyperlinkInfo(); - + /** Returns the info for the property. * @return the info for the property. */ @@ -107,63 +107,63 @@ * @return the minLength for the property. */ public Integer getMinLength(); - + /** Returns the maxLength for the property. * @return the maxLength for the property. */ public Integer getMaxLength(); - + /** Returns the maxFracLength for the property. * @return the maxFracLength for the property. */ public Integer getMaxFracLength(); - + /** Returns the minValue for the property. * @return the minValue for the property. */ public Object getMinValue(); - + /** Returns the maxValue for the property. * @return the maxValue for the property. */ public Object getMaxValue(); - + /** Returns the caseType for the property. * @return the caseType for the property. */ public String getCaseType(); - + /** Returns the label for the property. * @return the label for the property. */ public String getLabel(); - + /** Returns the layout for the property. * @return the layout for the property. */ public String getLayout(); - + /** Looks up the layout rules defined for the property and formats the input object using the associated formatterClass. * @param property the property instance to be formatted. * @return the formatted property. */ public String format(Object property); - + /** Returns the pattern(s) for the property. * @return the pattern(s) for the property. */ public String[] getPattern(); - + /** Returns a true if the property is marked as mandatory. * @return a true if the property is marked as mandatory. */ public boolean isMandatory(); - + /** Returns the client rule for the property. * @return the client rule for the property. */ public String getClientRule(); - + /** Returns the comment style for the property. * @return the comment style for the property. */ @@ -174,4 +174,10 @@ * @return the in-list values for the property. */ public Map<String, String> getInListValues(); + + /** Returns the in-list values for the property. + * Each entry in the Map will be a value/label pair. + * @return the service values for the property. + */ + public Map<String, Object> getServiceInfo(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |