public class Resource extends org.eclipse.core.runtime.PlatformObject implements IResource
Copyright (C) Micro Focus
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
_ID
The resource identifier.
|
java.lang.String |
_name
The name of the resource.
|
| Constructor and Description |
|---|
Resource()
Creates a new resource with a UUID.
|
Resource(java.lang.String pID)
Do not use this constructor for new instances (only in sub class
constructors).
|
Resource(java.lang.String pID,
IResource pParent)
Do not use this constructor for new instances (only in sub class
constructors).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChildResource(IResource pRes)
Adds a resource to the list of children resources.
|
void |
addPropertyValue(IPropertyValue pPropertyValue)
Set the value of the property associated with the given property value in
this resource to the given property value.
|
boolean |
addResourceChild(IResource pRes)
Adds a resource to the list of children resources.
|
void |
delete()
Removes this resource and all its children resources from cache.
|
boolean |
equals(java.lang.Object obj) |
java.util.Map<Property,IPropertyValue> |
getAllPropertyValues()
Get all property values of this resource.
|
java.util.List<IResource> |
getChildrenResources()
Returns a list of child resources.
|
java.lang.String |
getID()
Gets the unique ID of the resource.
|
java.lang.String |
getName()
Gets the name of the resource.
|
IResource |
getParentResource()
Returns the parent of this resource or
null if there is
none. |
IPropertyValue |
getPropertyValue(Property pProperty)
Get the value of the given property in this resource.
|
IPropertyValue |
getPropertyValueFromHierarchy(Property pProperty)
Returns a property value of this resource and (if existent) parent
resources.
|
java.util.Collection<? super IResource> |
getResourceChildren()
Returns an unmodifiable
Collection of child resources. |
static IPropertyValue |
getValueOfLinkedProperty(IResource pRes,
LinkedProperty pProp)
Gets the value of a linked property, where
IResource.getPropertyValue(Property) would return
null. |
int |
hashCode() |
void |
removeProperty(Property pProperty)
Removes the given property with its value from the resource.
|
boolean |
removeResourceChild(IResource pRes)
Removes a resource of the list of children resources.
|
void |
setName(java.lang.String pName)
Sets the name of the resource.
|
void |
setPropertyValues(java.util.Collection<IPropertyValue> pPropertyValues)
Sets the property values of this resource.
|
public java.lang.String _ID
public java.lang.String _name
public Resource()
Do not use this constructor for new instances (only in sub class constructors). Class is not declared as abstract for compatibility reasons.
Resource(String)public Resource(java.lang.String pID)
pID - the identifier for this resource.public Resource(java.lang.String pID,
IResource pParent)
pID - the identifier for this resource.pParent - the parent resource. Can be null.getParentResource()public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic IPropertyValue getPropertyValue(Property pProperty)
IResourcegetPropertyValue in interface IResourcepProperty - TAURUS propertypublic void addPropertyValue(IPropertyValue pPropertyValue)
IResourceaddPropertyValue in interface IResourcepPropertyValue - the new property valuepublic void setPropertyValues(java.util.Collection<IPropertyValue> pPropertyValues)
IResourcesetPropertyValues in interface IResourcepPropertyValues - the new property valuespublic java.util.Map<Property,IPropertyValue> getAllPropertyValues()
IResourceModifying the returned map will have no effect on the resource.
getAllPropertyValues in interface IResourcepublic java.lang.String getID()
IResourcepublic void setName(java.lang.String pName)
IResourcepublic java.lang.String getName()
IResourcepublic IResource getParentResource()
IResourcenull if there is
none.
Note: Parent/Child relationships will only be maintained if the
"Linked Element List" attribute (
ActionDescriptor.isLinkElementList()) is set to
true.
getParentResource in interface IResourcenull.public java.util.List<IResource> getChildrenResources()
IResource
Note: Parent/Child relationships will only be maintained if the
"Linked Element List" attribute (
ActionDescriptor.isLinkElementList()) is set to
true.
getChildrenResources in interface IResourcepublic void delete()
throws TaurusCoreException
IResourcedelete in interface IResourceTaurusCoreException - if the deletion of the resource failsIResource.getChildrenResources()public IPropertyValue getPropertyValueFromHierarchy(Property pProperty)
IResourceIResource.getPropertyValue(Property).
Otherwise IResource.getParentResource() will be called recursively until
IResource.getPropertyValue(Property) returns a value or the root parent is
reached.getPropertyValueFromHierarchy in interface IResourcepProperty - the desired propertyIPropertyValue or null if the value
cannot be found in the hierarchy.public boolean addResourceChild(IResource pRes)
IResourceaddResourceChild in interface IResourcepRes - the IResource to be added as child of this resource.true if an element was added as a result of this
callIResource.getResourceChildren()public void addChildResource(IResource pRes)
IResourceaddChildResource in interface IResourcepRes - the IResource to be added as child of this resource.IResource.getResourceChildren()public static IPropertyValue getValueOfLinkedProperty(IResource pRes, LinkedProperty pProp)
IResource.getPropertyValue(Property) would return
null. The reason is that we don't add linked properties to
resources directly, since they don't have a value that needs to be
persisted (more precisely, the value must not be persisted).pRes - the resource to get the linked property value frompProp - the linked propertypublic void removeProperty(Property pProperty)
pProperty - the property which should be removed from the resourcepublic java.util.Collection<? super IResource> getResourceChildren()
IResourceCollection of child resources. Can be an
empty Collection if there are no child resources.
Note: Parent/Child relationships will only be maintained if the
"Linked Element List" attribute (
ActionDescriptor.isLinkElementList()) is set to
true.
getResourceChildren in interface IResourceCollection of children resources. Can be
empty.public boolean removeResourceChild(IResource pRes)
IResourceremoveResourceChild in interface IResourcepRes - the IResource to be added as child of this resource.true if an element was removed as a result of this
callIResource.getResourceChildren()Copyright © 2015 Micro Focus GmbH. All rights reserved.