use of org.wso2.carbon.identity.configuration.mgt.core.search.Condition in project charon by wso2.
the class GroupResourceManager method updateWithPATCH.
/**
* Updates the group based on the operations defined in the patchRequest. The updated group information is not
* sent back in the response.
*
* @param existingGroupId SCIM2 ID of the existing group
* @param patchRequest SCIM2 patch request
* @param userManager SCIM UserManager that handles the persistence layer.
* @return
*/
@Override
public SCIMResponse updateWithPATCH(String existingGroupId, String patchRequest, UserManager userManager) {
try {
if (userManager == null) {
String error = "Provided user manager handler is null.";
throw new InternalErrorException(error);
}
SCIMResourceTypeSchema schema = SCIMResourceSchemaManager.getInstance().getGroupResourceSchema();
Map<String, Boolean> requestAttributes = ResourceManagerUtil.getAllAttributeURIs(schema);
Group oldGroup = userManager.getGroup(existingGroupId, requestAttributes);
if (oldGroup == null) {
throw new NotFoundException("No group with the id : " + existingGroupId + " exists in the user store.");
}
// Make a copy of original group. This will be used to restore to the original condition if failure occurs.
Group originalGroup = (Group) CopyUtil.deepCopy(oldGroup);
Group patchedGroup = doPatchGroup(oldGroup, schema, patchRequest);
userManager.updateGroup(originalGroup, patchedGroup);
// Build the 204 response.
Map<String, String> httpHeaders = new HashMap<>();
httpHeaders.put(SCIMConstants.CONTENT_TYPE_HEADER, SCIMConstants.APPLICATION_JSON);
return new SCIMResponse(ResponseCodeConstants.CODE_NO_CONTENT, null, httpHeaders);
} catch (NotFoundException | BadRequestException | NotImplementedException | CharonException | InternalErrorException e) {
return AbstractResourceManager.encodeSCIMException(e);
} catch (RuntimeException e) {
CharonException ex = new CharonException("Error in performing the patch operation on group resource.", e);
return AbstractResourceManager.encodeSCIMException(ex);
}
}
use of org.wso2.carbon.identity.configuration.mgt.core.search.Condition in project carbon-business-process by wso2.
the class IfImpl method isSimpleLayout.
/**
* @return false- if the subActivities are instances of ElseIf or Else
* true - otherwise
*/
private boolean isSimpleLayout() {
boolean simple = true;
ActivityInterface activity = null;
// Iterates through the subActivities
Iterator<ActivityInterface> itr = getSubActivities().iterator();
while (itr.hasNext()) {
activity = itr.next();
// if the activity is an instance of ElseIf or Else, break the if condition
if (activity instanceof ElseIfImpl || activity instanceof ElseImpl) {
simple = false;
break;
}
}
return simple;
}
use of org.wso2.carbon.identity.configuration.mgt.core.search.Condition in project carbon-business-process by wso2.
the class IfImpl method getArrows.
/**
* Get the arrow coordinates of the activities
*
* @param doc SVG document which defines the components including shapes, gradients etc. of the activity
* @return An element which contains the arrow coordinates of the If activity and its subActivities
*/
protected Element getArrows(SVGDocument doc) {
if (subActivities != null) {
ActivityInterface prevActivity = null;
ActivityInterface prevElseActivity = null;
ActivityInterface activity = null;
ActivityInterface seqActivity = null;
boolean throwOrNot = true;
String id = null;
// Coordinates of the start icon exit arrow
SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
// Coordinates of the end icon entry arrow
SVGCoordinates myExitCoords = getEndIconEntryArrowCoords();
// Coordinates of the Else activity start icon entry arrow
SVGCoordinates myStartElseCoords = getStartIconElseArrowCoords();
SVGCoordinates exitCoords = null;
SVGCoordinates activityEntryCoords = null;
SVGCoordinates activityExitCoords = null;
Iterator<ActivityInterface> itr = subActivities.iterator();
Element subGroup = doc.createElementNS(SVGNamespace.SVG_NAMESPACE, "g");
// Iterates through all the subActivities
while (itr.hasNext()) {
activity = itr.next();
// Gets the entry and exit coordinates of the iterated activity
activityEntryCoords = activity.getEntryArrowCoords();
activityExitCoords = activity.getExitArrowCoords();
// Checks if the iterated activity is an instance of ElseIf or Else activity
if (activity instanceof ElseIfImpl || activity instanceof ElseImpl) {
// Checks whether there is a previous activity and if so whether that activity is an ElseIf
if (prevActivity != null && prevActivity instanceof ElseIfImpl) {
// Get the exit arrow coordinates of the ElseIf activity
exitCoords = ((ElseIfInterface) prevActivity).getNextElseExitArrowCoords();
// id is assigned with the id of the previous activity + id of the current activity
id = prevActivity.getId() + "-" + activity.getId();
// Checks whether the activity is an instance of Else
if (activity instanceof ElseImpl) {
// Gets the boolean value assigned inside ElseImpl when a throw activity is in Else
boolean check = ((ElseImpl) activity).throwOrNot;
// Define the entry arrow flow coordinates for the activity
subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(), activityEntryCoords.getXLeft() - getEndIconWidth() / 2, exitCoords.getYTop(), id));
// If there is a Throw activity inside Else, no exit arrow from Throw activity
if (check != true) {
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
} else if (activity instanceof ElseIfImpl) {
// Checks whether the activity is an instance of ElseIf
// Gets the boolean value assigned inside ElseIfImpl when a throw activity is in ElseIf
boolean check = ((ElseIfImpl) activity).throwOrNot;
// Define the entry arrow flow coordinates for the activity
subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
// If there is a Throw activity inside ElseIf, no exit arrow from Throw activity
if (check != true) {
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
} else {
// Entry and exit arrow flows defined for other activities except for instances of Elseif and
// Else
subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
} else if (prevActivity instanceof ThrowImpl && activity instanceof ElseImpl) {
// IF conditon fifnished --> ELSE IF ( previous activity is null and its is not an instance of
// ElseIf)
/*Checks if the previous activity is a Throw and if the current activity an Else, if so no exit
arrow flows only entry arrow flows.
*/
subGroup.appendChild(getArrowDefinition(doc, myStartElseCoords.getXLeft(), myStartElseCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
} else if (activity instanceof ElseIfImpl) {
// Checks whether the activity is an instance of ElseIf
// Gets the boolean value assigned inside ElseIfImpl when a throw activity is in ElseIf
boolean check = ((ElseIfImpl) activity).throwOrNot;
// Define the entry arrow flow coordinates for the activity
subGroup.appendChild(getArrowDefinition(doc, myStartElseCoords.getXLeft(), myStartElseCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
// If there is a Throw activity inside ElseIf, no exit arrow from Throw activity
if (check != true) {
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
} else if (activity instanceof ElseImpl) {
// Checks whether the activity is an instance of Else
// Gets the boolean value assigned inside ElseIfImpl when a throw activity is in Else
boolean check = ((ElseImpl) activity).throwOrNot;
// Define the entry arrow flow coordinates for the activity
subGroup.appendChild(getArrowDefinition(doc, myStartElseCoords.getXLeft(), myStartElseCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
// If there is a Throw activity inside Else, no exit arrow from Throw activity
if (check != true) {
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
} else {
id = prevActivity.getId() + "-" + activity.getId();
// flows
if (activity instanceof ThrowImpl) {
subGroup.appendChild(getArrowDefinition(doc, myStartElseCoords.getXLeft(), myStartElseCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
} else {
// Define both the entry and the exit arrow flows to the activity
subGroup.appendChild(getArrowDefinition(doc, myStartElseCoords.getXLeft(), myStartElseCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
}
} else if (activity instanceof ThrowImpl) {
// Checks if the current activity a Throw activity, if so no exit arrow flows only entry arrow flows
subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
} else if (activity instanceof SourceImpl || activity instanceof TargetImpl || activity instanceof SourcesImpl || activity instanceof TargetsImpl) {
// Checks if the current activity a Source/s or Target/s activity, if so no exit or entry arrow flows
// as no icons are defined
// No arrow flows for Sources or Targets..
} else {
if (prevActivity != null) {
// Gets the coordinates of the exit arrows of the previous activity
exitCoords = prevActivity.getExitArrowCoords();
id = prevActivity.getId() + "-" + activity.getId();
// arrow flows as no icons are defined
if (prevActivity instanceof SourceImpl || prevActivity instanceof TargetImpl || prevActivity instanceof SourcesImpl || prevActivity instanceof TargetsImpl) {
// No arrow flows for Sources or Targets..
} else {
subGroup.appendChild(getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
}
} else {
// Checks whether the activity is a Sequence
if (activity instanceof SequenceImpl) {
List<ActivityInterface> sub = activity.getSubActivities();
// Iterates through the subActivities
Iterator<ActivityInterface> as = sub.iterator();
while (as.hasNext()) {
seqActivity = as.next();
// Checks if the subActivity is a Throw activity
if (seqActivity instanceof ThrowImpl) {
throwOrNot = true;
// if condition breaks if the subActivity is a Throw activity
break;
} else {
throwOrNot = false;
}
}
// If its a Throw activity , no exit arrow flow only entry arrow flow to the activity
if (throwOrNot == true) {
subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
} else {
// If not, define both the entry and the exit arrow flows to the activity
subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
} else {
// Define both the entry and the exit arrow flows to the activity
subGroup.appendChild(getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.getYTop(), activityEntryCoords.getXLeft(), activityEntryCoords.getYTop(), id));
subGroup.appendChild(getArrowDefinition(doc, activityExitCoords.getXLeft(), activityExitCoords.getYTop(), myExitCoords.getXLeft(), myExitCoords.getYTop(), id));
}
}
}
// current activity is assigned to the previous activity
prevActivity = activity;
}
return subGroup;
}
return null;
}
use of org.wso2.carbon.identity.configuration.mgt.core.search.Condition in project carbon-business-process by wso2.
the class HumanTaskStore method deploy.
/**
* This will simply deploy the new task and will not perform removal of existing tasks, which should be done prior to
* deploying this task
* @param humanTaskDU
* @return List of task configuration Qnames deployed
* @throws HumanTaskDeploymentException
*/
public List<QName> deploy(HumanTaskDeploymentUnit humanTaskDU) throws HumanTaskDeploymentException {
List<QName> taskConfigsInPackage = new ArrayList<QName>();
TTask[] tasks = humanTaskDU.getTasks();
List<HumanTaskBaseConfiguration> configurations = new ArrayList<HumanTaskBaseConfiguration>();
if (tasks != null) {
for (TTask task : tasks) {
QName taskQName = new QName(humanTaskDU.getNamespace(), task.getName());
if (log.isDebugEnabled()) {
log.debug(" Adding task " + task.getName() + "to task configuration");
}
TaskConfiguration taskConf = new TaskConfiguration(task, humanTaskDU.getTaskServiceInfo(taskQName), humanTaskDU.getHumanInteractionsDefinition(), humanTaskDU.getWSDLs(), humanTaskDU.getNamespace(), humanTaskDU.getName(), getTenantAxisConfig(), humanTaskDU.getPackageName(), humanTaskDU.getVersion(), humanTaskDU.getHumanTaskDefinitionFile());
taskConf.setPackageStatus(humanTaskDU.getTaskPackageStatus());
configurations.add(taskConf);
if (!taskConf.isErroneous()) {
createCallBackService(taskConf);
if (taskConf.getPackageStatus() == TaskPackageStatus.ACTIVE) {
deploy(taskConf);
// activeTaskConfigurationQNameMap.put(taskQName, taskConf.getName());
}
}
}
}
TNotification[] notifications = humanTaskDU.getNotifications();
if (notifications != null) {
for (TNotification notification : notifications) {
QName notificationQName = new QName(humanTaskDU.getNamespace(), notification.getName());
NotificationConfiguration notificationConf = new NotificationConfiguration(notification, humanTaskDU.getNotificationServiceInfo(notificationQName), humanTaskDU.getHumanInteractionsDefinition(), humanTaskDU.getWSDLs(), humanTaskDU.getNamespace(), humanTaskDU.getName(), getTenantAxisConfig(), humanTaskDU.getPackageName(), humanTaskDU.getVersion(), humanTaskDU.getHumanTaskDefinitionFile());
notificationConf.setPackageStatus(humanTaskDU.getTaskPackageStatus());
configurations.add(notificationConf);
if (!notificationConf.isErroneous()) {
// Deploy the axis2 service only for the active version of the task/notification
if (notificationConf.getPackageStatus() == TaskPackageStatus.ACTIVE) {
deploy(notificationConf);
// activeTaskConfigurationQNameMap.put(notificationQName, notificationConf.getName());
}
}
}
}
// condition if a service name is deployed with same name outside of this task package
for (HumanTaskBaseConfiguration configuration : configurations) {
taskConfigurations.add(configuration);
taskBaseConfigurationHashMap.put(configuration.getName(), configuration);
taskConfigsInPackage.add(configuration.getName());
if (configuration.getPackageStatus() == TaskPackageStatus.ACTIVE) {
activeTaskConfigurationQNameMap.put(configuration.getDefinitionName(), configuration.getName());
}
}
for (TNotification inlineNotification : humanTaskDU.getInlineNotifications()) {
QName notificationQName = new QName(humanTaskDU.getNamespace(), inlineNotification.getName());
NotificationConfiguration notificationConf = new NotificationConfiguration(inlineNotification, humanTaskDU.getNotificationServiceInfo(notificationQName), humanTaskDU.getHumanInteractionsDefinition(), humanTaskDU.getWSDLs(), humanTaskDU.getNamespace(), humanTaskDU.getName(), getTenantAxisConfig(), humanTaskDU.getPackageName(), humanTaskDU.getVersion(), humanTaskDU.getHumanTaskDefinitionFile());
notificationConf.setPackageStatus(humanTaskDU.getTaskPackageStatus());
taskConfigurations.add(notificationConf);
taskConfigsInPackage.add(notificationConf.getName());
taskBaseConfigurationHashMap.put(notificationConf.getName(), notificationConf);
if (notificationConf.getPackageStatus() == TaskPackageStatus.ACTIVE) {
activeTaskConfigurationQNameMap.put(notificationQName, notificationConf.getName());
}
}
taskConfigurationsInTaskPackage.put(humanTaskDU.getName(), taskConfigsInPackage);
return taskConfigsInPackage;
}
use of org.wso2.carbon.identity.configuration.mgt.core.search.Condition in project carbon-identity-framework by wso2.
the class TestUtils method getSampleSearchCondition.
public static ComplexCondition getSampleSearchCondition() {
PrimitiveCondition tenantDomainEqSuper = new PrimitiveCondition(RESOURCE_SEARCH_BEAN_FIELD_TENANT_DOMAIN, ConditionType.PrimitiveOperator.EQUALS, SUPER_TENANT_DOMAIN_NAME);
PrimitiveCondition tenantDomainEqABC = new PrimitiveCondition(RESOURCE_SEARCH_BEAN_FIELD_TENANT_DOMAIN, ConditionType.PrimitiveOperator.EQUALS, SAMPLE_TENANT_DOMAIN_ABC);
PrimitiveCondition attributeKeyEqFrom = new PrimitiveCondition(RESOURCE_SEARCH_BEAN_FIELD_ATTRIBUTE_KEY, ConditionType.PrimitiveOperator.EQUALS, SAMPLE_ATTRIBUTE_NAME1);
List<Condition> tenantDomainConditions = new ArrayList<>();
tenantDomainConditions.add(tenantDomainEqSuper);
tenantDomainConditions.add(tenantDomainEqABC);
ComplexCondition eitherTenantDomain = new ComplexCondition(ConditionType.ComplexOperator.OR, tenantDomainConditions);
List<Condition> conditions = new ArrayList<>();
conditions.add(eitherTenantDomain);
conditions.add(attributeKeyEqFrom);
return new ComplexCondition(ConditionType.ComplexOperator.AND, conditions);
}
Aggregations