Author: fmui
Date: Sat Jan 26 16:16:02 2013
New Revision: 1438909
URL: http://svn.apache.org/viewvc?rev=1438909&view=rev
Log:
Workbench: added support for updating secondary type properties
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java?rev=1438909&r1=1438908&r2=1438909&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java
Sat Jan 26 16:16:02 2013
@@ -62,6 +62,7 @@ import javax.swing.event.ChangeListener;
import org.apache.chemistry.opencmis.client.api.CmisObject;
import org.apache.chemistry.opencmis.client.api.ObjectId;
+import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.enums.Action;
import org.apache.chemistry.opencmis.commons.enums.Cardinality;
@@ -120,6 +121,8 @@ public class PropertyEditorFrame extends
propertyPanels = new
ArrayList<PropertyEditorFrame.PropertyInputPanel>();
int position = 0;
+
+ // primary type
for (PropertyDefinition<?> propDef :
object.getType().getPropertyDefinitions().values()) {
boolean isUpdatable = (propDef.getUpdatability() ==
Updatability.READWRITE)
|| (propDef.getUpdatability() ==
Updatability.WHENCHECKEDOUT && object.getAllowableActions()
@@ -134,6 +137,27 @@ public class PropertyEditorFrame extends
}
}
+ // secondary types
+ if (object.getSecondaryTypes() != null) {
+ for (ObjectType secType : object.getSecondaryTypes()) {
+ if (secType.getPropertyDefinitions() != null) {
+ for (PropertyDefinition<?> propDef :
secType.getPropertyDefinitions().values()) {
+ boolean isUpdatable = (propDef.getUpdatability() ==
Updatability.READWRITE)
+ || (propDef.getUpdatability() ==
Updatability.WHENCHECKEDOUT && object
+
.getAllowableActions().getAllowableActions().contains(Action.CAN_CHECK_IN));
+
+ if (isUpdatable) {
+ PropertyInputPanel propertyPanel = new
PropertyInputPanel(propDef,
+ object.getPropertyValue(propDef.getId()),
position++);
+
+ propertyPanels.add(propertyPanel);
+ panel.add(propertyPanel);
+ }
+ }
+ }
+ }
+ }
+
JButton updateButton = new JButton("Update");
updateButton.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
updateButton.setDefaultCapable(true);