Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[higgins-dev] proposed fix for 228076

for this bug report, I propose the changes attached.  Please let me know if this is insufficient by tomorrow.


Jim

Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IAttributeValue.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IAttributeValue.java	(revision 17128)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IAttributeValue.java	(working copy)
@@ -13,9 +13,6 @@
 
 import java.net.URI;
 
-import org.eclipse.higgins.idas.api.model.IAttributeValueModel;
-import org.eclipse.higgins.idas.api.model.IModel;
-
 /**
  * Holds the value of an attribute.<p>
  * This interface is not intended to be instantiated (only used as a super-interface).
@@ -57,12 +54,4 @@
 	 */
 	public boolean equals(IAttributeValue value) throws IdASException;
 
-	/**
-	 * Returns the model for this type of attribute value as it is 
-	 * defined in the context's schema. 
-	 *  
-	 * @return the model for this attribute value
-	 * @throws IdASException
-	 */
-	public IAttributeValueModel getModel() throws IdASException;
 }
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IBlankEntity.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IBlankEntity.java	(revision 0)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IBlankEntity.java	(revision 0)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Novell, Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Jim Sermersheim
+ *******************************************************************************/
+package org.eclipse.higgins.idas.api;
+
+import org.eclipse.higgins.idas.api.model.IEntityModel;
+
+/**
+ * Supertype for IEntity and complex attributes.
+ *
+ */
+public interface IBlankEntity extends IHasAttributes {
+
+	/**
+	 * Returns a model of this type of Entities as it defined in the
+	 * context's schema. Returned model could be used to discover what
+	 * attributes are defined in the context's schema for this type of Entities.
+	 * 
+	 * @return the model of this Entity
+	 * @throws IdASException
+	 */
+	public IEntityModel getModel() throws IdASException;
+}
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IComplexAttrValue.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IComplexAttrValue.java	(revision 17128)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IComplexAttrValue.java	(working copy)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006 Novell, Inc..
+ * Copyright (c) 2006-2008 Novell, Inc..
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -15,7 +15,7 @@
 /**
  *
  */
-public interface IComplexAttrValue extends IAttributeValue, IHasAttributes
+public interface IComplexAttrValue extends IAttributeValue, IBlankEntity
 {
 
 }
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IContext.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IContext.java	(revision 17128)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IContext.java	(working copy)
@@ -20,7 +20,7 @@
  * As defined at <a href="http://spwiki.editme.com/Context";>http://spwiki.editme.com/Context</a> and <a href="http://spwiki.editme.com/ContextProvider";>http://spwiki.editme.com/ContextProvider</a>, This interface holds a set of {@link IEntity} objects.<p>
  * 
  */
-public interface IContext
+public interface IContext extends IHasAttributes
 {
 	/*
 	 * Context-wide methods
@@ -134,7 +134,7 @@
 	 * @param representationFormat Indicates the format of the external data string being specified in external. TODO (Arch)(Doc): Specify format type. Give example
 	 * @throws IdASException
 	 */
-	public void	importData(String filter, String representationFormat) throws IdASException;
+	public void importData(String filter, String representationFormat) throws IdASException;
 
 	/*
 	 * Factory-like methods for creating various IdAS elements 
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IEntity.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IEntity.java	(revision 17128)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/IEntity.java	(working copy)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2006 Novell, Inc..
+ * Copyright (c) 2006-2008 Novell, Inc..
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -13,9 +13,6 @@
 
 import java.net.URI;
 
-import org.eclipse.higgins.idas.api.model.IEntityModel;
-import org.eclipse.higgins.idas.api.model.IModel;
-
 /**
  * As defined at 
  * <a href="http://wiki.eclipse.org/Entity";>http://wiki.eclipse.org/Entity</a> 
@@ -27,7 +24,7 @@
  * provides a shortcut to access the value of this attribute.
  * TODO (Doc): Finish javadoc on methods   
  */
-public interface IEntity extends IHasMetadata, IHasAttributes
+public interface IEntity extends IHasMetadata, IBlankEntity
 {
 	/**
 	 * @return The Context holding this Entity.
@@ -66,13 +63,4 @@
 	 */
 	void remove() throws IdASException;	
 	
-	/**
-	 * Returns a model of this type of Entities as it defined in the
-	 * context's schema. Returned model could be used to discover what
-	 * attributes are defined in the context's schema for this type of Entities.
-	 * 
-	 * @return the model of this Entity
-	 * @throws IdASException
-	 */
-	public IEntityModel getModel() throws IdASException;
 }
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/ISimpleAttrValue.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/ISimpleAttrValue.java	(revision 17128)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/ISimpleAttrValue.java	(working copy)
@@ -1,5 +1,25 @@
-package org.eclipse.higgins.idas.api;
+/*******************************************************************************
+ * Copyright (c) 2008 Novell, Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Jim Sermersheim
+ *******************************************************************************/
+ package org.eclipse.higgins.idas.api;
+
+import org.eclipse.higgins.idas.api.model.IAttributeSimpleValueModel;
 
 public interface ISimpleAttrValue extends ITypedValue, IAttributeValue {
 
+	/**
+	 * Returns the model for this type of attribute value as it is 
+	 * defined in the context's schema. 
+	 *  
+	 * @return the model for this attribute value
+	 * @throws IdASException
+	 */
+	public IAttributeSimpleValueModel getModel() throws IdASException;
 }
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeComplexValueModel.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeComplexValueModel.java	(revision 17128)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeComplexValueModel.java	(working copy)
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Parity Communications, Inc.
- * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     Valery Kokhan - Initial cut of interfaces
- *******************************************************************************/
-
-package org.eclipse.higgins.idas.api.model;
-
-import java.net.URI;
-import java.util.Iterator;
-
-/**
- * Represents a model of value for complex attributes as it defined in the
- * context's ontology model.
- * 
- * @see org.eclipse.higgins.idas.api.IComplexAttrValue
- * @see <a
- *      href="http://www.eclipse.org/higgins/ontologies/2006/higgins#ComplexValue";>http://www.eclipse.org/higgins/ontologies/2006/higgins#ComplexValue</a>
- */
-public interface IAttributeComplexValueModel extends IAttributeValueModel {
-
-	/**
-	 * Returns list of sub-attributes in represented complex attribute as it
-	 * defined in the context's ontology model.
-	 * @return Iterator of {@link IAttributeModel}s
-	 */
-	public Iterator getAttributes();
-
-	/**
-	 * Returns attribute's model of requested type.
-	 * 
-	 * @param attrID
-	 *            the type of attribute.
-	 * @return attribute's model of requested type or <code>null</code> if
-	 *         requested type of attributes is not defined in the context's
-	 *         schema for represented type of complex attributes.
-	 */
-	public IAttributeModel getAttribute(URI attrID);
-}
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeModel.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeModel.java	(revision 17128)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeModel.java	(working copy)
@@ -33,6 +33,7 @@
 	/**
 	 * Returns value model of represented type of attribute as it defined in the
 	 * context's ontology model.
+	 * @deprecated Attribute values can all have different value models now 
 	 */
 	public IAttributeValueModel getValueModel();
 	
@@ -38,7 +39,7 @@
 	
 	/**
 	 * TODO: What is this for?
-	 * 
+	 * @deprecated Don't know what this is 
 	 */
 	public boolean isDirect();
 
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeValueModel.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeValueModel.java	(revision 17128)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.api/src/org/eclipse/higgins/idas/api/model/IAttributeValueModel.java	(working copy)
@@ -20,16 +20,6 @@
  */
 public interface IAttributeValueModel extends IModel {
 	/**
-	 * Returns XSD datatype of represented value as it defined in the context's
-	 * schema. Please note that XSD:ENTITY, XSD:ID and XSD:IDREF are not
-	 * currently supported by context's ontology models.
-	 * 
-	 * @return <code>URI</code> of value's datatype.
-	 * @see <a href="http://www.w3.org/2001/XMLSchema#";>XML Schema</a>
-	 */
-	public URI getType();
-
-	/**
 	 * Returns non negative integer value which represents maximum cardinality
 	 * of represented attribute's value or <code>-1</code> if not defined.
 	 * 
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/AbstractComplexValue.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/AbstractComplexValue.java	(revision 15827)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/AbstractComplexValue.java	(working copy)
@@ -23,7 +23,7 @@
 import org.eclipse.higgins.idas.api.IdASException;
 import org.eclipse.higgins.idas.api.InvalidTypeException;
 import org.eclipse.higgins.idas.api.NotImplementedException;
-import org.eclipse.higgins.idas.api.model.IAttributeValueModel;
+import org.eclipse.higgins.idas.api.model.IEntityModel;
 
 /**
  * Basic implementation of {@link IComplexAttrValue}. Uses {@link IAttributeValueContainer}. 
@@ -98,7 +98,7 @@
 		return _metaSet.getMetadataSet();
 	}
 
-	public IAttributeValueModel getModel() throws IdASException {
+	public IEntityModel getModel() throws IdASException {
 		throw new NotImplementedException();
 	}
 	
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/AbstractSimpleValue.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/AbstractSimpleValue.java	(revision 15827)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/AbstractSimpleValue.java	(working copy)
@@ -18,7 +18,7 @@
 import org.eclipse.higgins.idas.api.ISimpleAttrValue;
 import org.eclipse.higgins.idas.api.IdASException;
 import org.eclipse.higgins.idas.api.NotImplementedException;
-import org.eclipse.higgins.idas.api.model.IAttributeValueModel;
+import org.eclipse.higgins.idas.api.model.IAttributeSimpleValueModel;
 
 public abstract class AbstractSimpleValue extends BasicMetadataSet implements ISimpleAttrValue {
 	private URI _type;
@@ -101,7 +101,7 @@
 		return this.getCanonical().equals(val.getCanonical());
 	}
 	
-	public IAttributeValueModel getModel() throws IdASException {
+	public IAttributeSimpleValueModel getModel() throws IdASException {
 		throw new NotImplementedException();
 	}
 	
Index: /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/BasicAttribute.java
===================================================================
--- /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/BasicAttribute.java	(revision 15827)
+++ /home/jimse/dev/higgins/org.eclipse.higgins.idas.spi/src/org/eclipse/higgins/idas/spi/BasicAttribute.java	(working copy)
@@ -26,7 +26,9 @@
 import org.eclipse.higgins.idas.api.InvalidTypeException;
 import org.eclipse.higgins.idas.api.NotImplementedException;
 import org.eclipse.higgins.idas.api.model.IAttributeModel;
+import org.eclipse.higgins.idas.api.model.IAttributeSimpleValueModel;
 import org.eclipse.higgins.idas.api.model.IAttributeValueModel;
+import org.eclipse.higgins.idas.api.model.IModel;
 
 /**
  * Implements IAttribute using {@link BasicAttribute} and {@link BasicMetadata}
@@ -211,9 +213,9 @@
 	}
 
 	public IAttributeValue addValue(URI type) throws IdASException, InvalidTypeException {
-		IAttributeValueModel valueModel = this.getModel().getValueModel();
+		IModel valueModel = this.getModel().getValueModel();
 		IAttributeValue val;
-		if (valueModel.isSimple())
+		if (valueModel instanceof IAttributeSimpleValueModel)
 			val = new BasicSimpleValue(type, null, this);
 		else
 			val = new BasicComplexValue(type, null, this);

Back to the top