Skip to content

Commit

Permalink
Merge pull request #8096 from mandy-chessell/oak2024
Browse files Browse the repository at this point in the history
Improve actor and engine action beans
  • Loading branch information
mandy-chessell authored Mar 13, 2024
2 parents 2366562 + 5b505a0 commit 6f2eaca
Show file tree
Hide file tree
Showing 50 changed files with 630 additions and 396 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
public class ProfileIdentityElement
{
private ProfileIdentityProperties profileIdentity = null;
private UserIdentityElement properties = null;
private UserIdentityElement userIdentity = null;


/**
Expand All @@ -45,7 +45,7 @@ public ProfileIdentityElement(ProfileIdentityElement template)
if (template != null)
{
profileIdentity = template.getProfileIdentity();
properties = template.getProperties();
userIdentity = template.getUserIdentity();
}
}

Expand Down Expand Up @@ -77,20 +77,20 @@ public void setProfileIdentity(ProfileIdentityProperties profileIdentity)
*
* @return properties
*/
public UserIdentityElement getProperties()
public UserIdentityElement getUserIdentity()
{
return properties;
return userIdentity;
}


/**
* Set up the userId properties.
*
* @param properties properties
* @param userIdentity properties
*/
public void setProperties(UserIdentityElement properties)
public void setUserIdentity(UserIdentityElement userIdentity)
{
this.properties = properties;
this.userIdentity = userIdentity;
}


Expand All @@ -104,7 +104,7 @@ public String toString()
{
return "ProfileIdentityElement{" +
"profileIdentity=" + profileIdentity +
", properties=" + properties +
", properties=" + userIdentity +
'}';
}

Expand All @@ -128,7 +128,7 @@ public boolean equals(Object objectToCompare)
}
ProfileIdentityElement that = (ProfileIdentityElement) objectToCompare;
return Objects.equals(profileIdentity, that.profileIdentity) &&
Objects.equals(properties, that.properties);
Objects.equals(userIdentity, that.userIdentity);
}


Expand All @@ -140,6 +140,6 @@ public boolean equals(Object objectToCompare)
@Override
public int hashCode()
{
return Objects.hash(super.hashCode(), profileIdentity, properties);
return Objects.hash(super.hashCode(), profileIdentity, userIdentity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

public class ActorProfileProperties extends ReferenceableProperties
{
private static final long serialVersionUID = 1L;

private String knownName = null;
private String description = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
@JsonIgnoreProperties(ignoreUnknown=true)
public class UserIdentityProperties extends ReferenceableProperties
{
private static final long serialVersionUID = 1L;

private String userId = null;
private String distinguishedName = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ private ElementProperties getToDoProperties(ToDoProperties toDoProperties)

elementProperties = propertyHelper.addDateProperty(elementProperties,
OpenMetadataType.COMPLETION_TIME_PROPERTY_NAME,
toDoProperties.getDueTime());
toDoProperties.getCompletionTime());

elementProperties = propertyHelper.addStringMapProperty(elementProperties,
OpenMetadataProperty.ADDITIONAL_PROPERTIES.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public B getNewComplexBean(Class<B> beanClass,
toDoProperties.setQualifiedName(this.removeQualifiedName(elementProperties));
toDoProperties.setAdditionalProperties(this.removeAdditionalProperties(elementProperties));
toDoProperties.setName(this.removeName(elementProperties));
toDoProperties.setToDoType(this.removeToDoType(elementProperties));
toDoProperties.setDescription(this.removeDescription(elementProperties));
toDoProperties.setCreationTime(this.removeCreationTime(elementProperties));
toDoProperties.setPriority(this.removeIntPriority(elementProperties));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ public B getNewComplexBean(Class<B> beanClass,
*/
B returnBean = beanClass.getDeclaredConstructor().newInstance();

if (returnBean instanceof ActorProfileElement)
if (returnBean instanceof ActorProfileElement bean)
{
ActorProfileElement bean = (ActorProfileElement) returnBean;
ActorProfileProperties profileProperties = new ActorProfileProperties();

if (primaryEntity != null)
Expand Down Expand Up @@ -131,8 +130,8 @@ public B getNewComplexBean(Class<B> beanClass,
InstanceProperties entityProperties = new InstanceProperties(entity.getProperties());

userProperties.setQualifiedName(this.removeQualifiedName(entityProperties));
userProperties.setUserId(this.removeUserId(instanceProperties));
userProperties.setDistinguishedName(this.removeDistinguishedName(instanceProperties));
userProperties.setUserId(this.removeUserId(entityProperties));
userProperties.setDistinguishedName(this.removeDistinguishedName(entityProperties));
userProperties.setAdditionalProperties(this.removeAdditionalProperties(entityProperties));

userProperties.setEffectiveFrom(entityProperties.getEffectiveFromTime());
Expand Down Expand Up @@ -302,7 +301,7 @@ else if (repositoryHelper.isTypeOf(serviceName, relationshipTypeName, OpenMetada
profileIdentityProperties.setDescription(this.removeDescription(relationshipProperties));

profileIdentityElement.setProfileIdentity(profileIdentityProperties);
profileIdentityElement.setProperties(userIdentities.get(entityProxy.getGUID()));
profileIdentityElement.setUserIdentity(userIdentities.get(entityProxy.getGUID()));

profileIdentities.add(profileIdentityElement);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public B getNewBean(Class<B> beanClass,

roleProperties.setQualifiedName(this.removeQualifiedName(instanceProperties));
roleProperties.setRoleId(this.removeIdentifier(instanceProperties));
roleProperties.setTitle(this.removeTitle(instanceProperties));
roleProperties.setTitle(this.removeName(instanceProperties));
roleProperties.setDescription(this.removeDescription(instanceProperties));
roleProperties.setScope(this.removeScope(instanceProperties));
roleProperties.setDomainIdentifier(this.removeDomainIdentifier(instanceProperties));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ public B getNewBean(Class<B> beanClass,
*/
B returnBean = beanClass.getDeclaredConstructor().newInstance();

if (returnBean instanceof UserIdentityElement)
if (returnBean instanceof UserIdentityElement bean)
{
UserIdentityElement bean = (UserIdentityElement) returnBean;
UserIdentityProperties properties = new UserIdentityProperties();

if (entity != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException;
import org.odpi.openmetadata.frameworks.governanceaction.GeneralGovernanceActionService;
import org.odpi.openmetadata.frameworks.governanceaction.VerificationGovernanceActionService;
import org.odpi.openmetadata.frameworks.governanceaction.properties.ActionTargetElement;
import org.odpi.openmetadata.frameworks.governanceaction.properties.CompletionStatus;
import org.odpi.openmetadata.frameworks.governanceaction.properties.NewActionTarget;
import org.odpi.openmetadata.frameworks.surveyaction.controls.SurveyActionTarget;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* EvaluateAnnotationsGovernanceActionConnector is currently a placeholder for a governance action service
Expand Down Expand Up @@ -44,5 +43,41 @@ public void start() throws ConnectorCheckedException

List<String> outputGuards = new ArrayList<>();
CompletionStatus completionStatus = null;
ActionTargetElement surveyReport = null;

if (governanceContext.getActionTargetElements() != null)
{
for (ActionTargetElement actionTargetElement : governanceContext.getActionTargetElements())
{
if (actionTargetElement != null)
{
if (SurveyActionTarget.SURVEY_REPORT.getName().equals(actionTargetElement.getActionTargetName()))
{
surveyReport = actionTargetElement;
}
}
}
}

if (surveyReport == null)
{
outputGuards.add(EvaluateAnnotationsGuard.NO_SURVEY_REPORT.getName());
completionStatus = EvaluateAnnotationsGuard.NO_SURVEY_REPORT.getCompletionStatus();
}
else
{

}


try
{
governanceContext.recordCompletionStatus(completionStatus,
outputGuards);
}
catch (Exception error)
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.odpi.openmetadata.frameworks.connectors.properties.beans.ConnectorType;
import org.odpi.openmetadata.frameworks.governanceaction.GovernanceActionServiceProviderBase;
import org.odpi.openmetadata.frameworks.surveyaction.controls.SurveyActionTarget;

/**
* EvaluateAnnotationsGovernanceActionProvider is the OCF connector provider for the "Evaluate Annotations"
Expand All @@ -15,7 +16,7 @@ public class EvaluateAnnotationsGovernanceActionProvider extends GovernanceActio
private static final String connectorTypeGUID = "02e8bace-0035-4e80-afef-f5677a8c5ba4";
private static final String connectorTypeQualifiedName = "Egeria:GovernanceActionService:Verification:EvaluateAnnotations";
private static final String connectorTypeDisplayName = "Evaluate Annotations Governance Action Service";
private static final String connectorTypeDescription = "Verification Governance Action Service that checks whether there are Request For Action Annotations in a survey report.";
private static final String connectorTypeDescription = "Governance Action Service that checks whether there are Request For Action Annotations in a survey report.";

private static final String connectorClassName = EvaluateAnnotationsGovernanceActionConnector.class.getName();

Expand All @@ -29,8 +30,9 @@ public EvaluateAnnotationsGovernanceActionProvider()
super();
super.setConnectorClassName(connectorClassName);

super.producedGuards = EvaluateAnnotationsGuard.getGuardTypes();
super.producedActionTargetTypes = StewardshipHandoverActionTarget.getActionTargetTypes();
super.supportedActionTargetTypes = SurveyActionTarget.getActionTargetTypes();
super.producedGuards = EvaluateAnnotationsGuard.getGuardTypes();
super.producedActionTargetTypes = StewardshipHandoverActionTarget.getActionTargetTypes();

ConnectorType connectorType = new ConnectorType();
connectorType.setType(ConnectorType.getConnectorTypeType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

package org.odpi.openmetadata.adapters.connectors.governanceactions.stewardship;

import org.odpi.openmetadata.frameworks.governanceaction.controls.ActionTarget;
import org.odpi.openmetadata.frameworks.governanceaction.controls.ActionTargetType;
import org.odpi.openmetadata.frameworks.governanceaction.mapper.OpenMetadataType;

Expand Down
Loading

0 comments on commit 6f2eaca

Please sign in to comment.