Skip to content

Migrate lyo-client-samples to oslc-domains#274

Open
google-labs-jules[bot] wants to merge 9 commits intomainfrom
migrate-lyo-client-samples-to-oslc-domains
Open

Migrate lyo-client-samples to oslc-domains#274
google-labs-jules[bot] wants to merge 9 commits intomainfrom
migrate-lyo-client-samples-to-oslc-domains

Conversation

@google-labs-jules
Copy link
Contributor

Migrate lyo-client-samples to use oslc-domains artifact instead of oslc-java-client-resources.
This involves updating imports, handling API differences (e.g., Set for relationships), and defining missing constants.


PR created automatically by Jules for task 12524346837297004216 started by @berezovskyi

Updated lyo-client-samples to use domain classes from oslc-domains artifact instead of the legacy oslc-java-client-resources.
Updated pom.xml to depend on oslc-domains.
Modified samples to handle API changes:
- Package changes for QM, CM, RM, Automation domains.
- Set types handling (Set<Link> instead of arrays).
- Added missing constants in IConstants.java.
- Handled ParameterInstance type change in AutomationRequest (changed from array to Set<Link>).
- Replaced getRdfTypes() with getTypes().iterator().next().
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

Updated lyo-client-samples to use domain classes from oslc-domains artifact instead of the legacy oslc-java-client-resources.
Updated pom.xml to depend on oslc-domains.
Modified samples to handle API changes:
- Package changes for QM, CM, RM, Automation domains.
- Set types handling (Set<Link> instead of arrays).
- Added missing constants in IConstants.java.
- Handled ParameterInstance type change in AutomationRequest (changed from array to Set<Link>).
- Replaced getRdfTypes() with setting rdf:type via setTypes() and retrieving it via getTypes().
- Verified with mvn verify.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates lyo-client-samples from the legacy oslc-java-client-resources artifact to the standard-compliant oslc-domains artifact. The migration addresses API differences where the new library uses Set<Link> for relationships instead of arrays, and requires explicit handling of extended properties for vendor-specific attributes.

  • Updated Maven dependency from oslc-java-client-resources to oslc-domains
  • Migrated resource class imports to new package structure (e.g., org.eclipse.lyo.oslc.domains.cm.ChangeRequest)
  • Adapted code to handle Set<Link> for relationships and state properties instead of URI arrays
  • Defined missing OSLC Automation constants that were previously in AutomationConstants

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pom.xml Updated Maven dependency to use oslc-domains instead of legacy oslc-java-client-resources
RMSample.java Fixed incorrect use of setTitle() to setDescription() and updated Requirement import
CMSample.java Fixed incorrect use of setTitle() to setDescription() and updated ChangeRequest import
IConstants.java Added OSLC Automation constants previously available in removed AutomationConstants class
IAutomationRequestHandler.java Updated imports for AutomationRequest and AutomationResult to new package
AutomationRequestCanceledException.java Updated AutomationRequest import to new package
AutomationAdapter.java Adapted to use Set<Link> for state/parameter properties, added defensive handling for dcterms:relation, and used newly defined constants
ETMAutomationSample.java Updated to handle Set<Link> for input parameters and verdicts instead of arrays
EWMSample.java Used extended properties for non-standard attributes and fully-qualified Collections.singleton() calls
ETMSample.java Added setTypes() call for resource type and imported Collections
ERMSample.java Defined Jazz-specific RM constants and adapted setInstanceShape() and collection methods to use Set<Link>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 217 to 226
// testedByTestCase is not part of standard OSLC CM 2.0 ChangeRequest, so we use extended properties.
// Note: In oslc-java-client-resources it was available, but in oslc-domains it is strict to spec.
// Jazz uses http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/testedByTestCase ?
// Actually, the original code used addTestedByTestCase(Link).
// We'll use the QName for it.
// However, the property name in Jazz might be "http://open-services.net/ns/cm#testedByTestCase" or similar
// if it was generated.
// The method name `addTestedByTestCase` suggests `testedByTestCase`.
// Let's assume it is in the oslc_cm namespace or rtc_cm namespace.
// Based on previous resources, it was often `oslc_cm:testedByTestCase`.
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This verbose comment block contains speculative reasoning and uncertainty. Consider condensing to a single clear statement: 'testedByTestCase is a vendor-specific extension not in standard OSLC CM 2.0, stored in extended properties using the oslc_cm namespace.'

Suggested change
// testedByTestCase is not part of standard OSLC CM 2.0 ChangeRequest, so we use extended properties.
// Note: In oslc-java-client-resources it was available, but in oslc-domains it is strict to spec.
// Jazz uses http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/testedByTestCase ?
// Actually, the original code used addTestedByTestCase(Link).
// We'll use the QName for it.
// However, the property name in Jazz might be "http://open-services.net/ns/cm#testedByTestCase" or similar
// if it was generated.
// The method name `addTestedByTestCase` suggests `testedByTestCase`.
// Let's assume it is in the oslc_cm namespace or rtc_cm namespace.
// Based on previous resources, it was often `oslc_cm:testedByTestCase`.
// testedByTestCase is a vendor-specific extension not in standard OSLC CM 2.0, stored in extended properties using the oslc_cm namespace.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Note: The new oslc-domains AutomationRequest maps inputParameter to Set<Link>.
// If the parameter is an inline resource (as is common in Automation), the Link might
// not contain the detailed properties (name, value) unless we fetch it or parse the model manually.
// For now, we log the link.
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This comment clearly explains a limitation in the migration. However, consider adding a TODO or FIXME to indicate this is incomplete functionality that should be addressed in the future.

Suggested change
// For now, we log the link.
// TODO: For now, we log the link. Improve this to fetch or parse inline resource properties if needed.

Copilot uses AI. Check for mistakes.
google-labs-jules bot and others added 7 commits November 22, 2025 17:04
Updated lyo-client-samples to use domain classes from oslc-domains artifact instead of the legacy oslc-java-client-resources.
Updated pom.xml to depend on oslc-domains.
Refactored samples to:
- Use oslc-domains classes (AutomationRequest, AutomationResult, etc.)
- Use oslc-domains constants where available (Oslc_autoDomainConstants, Oslc_qmDomainConstants).
- Handle API changes (e.g. Set<Link> for relationships).
- Explicitly set rdf:type using setTypes() for CreationFactory lookups.
- Ensure tests pass.
…mples-to-oslc-domains

Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
…t/jazz/automation/impl/AutomationAdapter.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

serviceProviderUrl,
OSLCConstants.OSLC_CM_V2,
defect.getRdfTypes()[0].toString(),
defect.getTypes().iterator().next().toString(),
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code calls getTypes().iterator().next() without first checking if the Set is empty. If setTypes was never called or was called with an empty Set, this will throw a NoSuchElementException. Add a null/empty check before accessing the iterator, or ensure setTypes is always called with a non-empty Set.

Suggested change
defect.getTypes().iterator().next().toString(),
OSLCConstants.CM_CHANGE_REQUEST_TYPE,

Copilot uses AI. Check for mistakes.
assertNotCanceled(request);

request.setStates(new URI[] {URI.create(AutomationConstants.STATE_COMPLETE)});
// oslc-domains AutomationRequest.setState uses Set<Link>
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment references "oslc-domains AutomationRequest.setState uses Set<Link>" but doesn't mention that the old API used URI[]. While the comment is helpful, consider clarifying that this is a migration from the previous API (e.g., "The old API used URI[], but oslc-domains AutomationRequest.setState uses Set<Link>").

Suggested change
// oslc-domains AutomationRequest.setState uses Set<Link>
// Migration note: the old API used URI[], but oslc-domains AutomationRequest.setState now uses Set<Link>

Copilot uses AI. Check for mistakes.
// Constants for States and Verdicts are not in Oslc_autoDomainConstants, but defined in spec.
// We keep them here or use hardcoded strings if not available in domains library.
// The constants AUTOMATION_NAMSPACE is available.
String STATE_COMPLETE = Oslc_autoDomainConstants.AUTOMATION_NAMSPACE + "Complete";
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the constant name from the oslc-domains library: 'AUTOMATION_NAMSPACE' should be 'AUTOMATION_NAMESPACE' (missing 'E'). This appears to be an issue in the oslc-domains library itself, not this PR. The comment correctly notes this constant is available and being used. Consider filing an issue with the oslc-domains project to fix this typo in their constant names.

Copilot uses AI. Check for mistakes.
serviceProviderUrl, OSLCConstants.OSLC_QM_V2, testcase.getRdfTypes()[0].toString());
serviceProviderUrl,
OSLCConstants.OSLC_QM_V2,
testcase.getTypes().iterator().next().toString());
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code calls getTypes().iterator().next() without first checking if the Set is empty. If setTypes was never called or was called with an empty Set, this will throw a NoSuchElementException. Add a null/empty check before accessing the iterator, or ensure setTypes is always called with a non-empty Set.

Suggested change
testcase.getTypes().iterator().next().toString());
OSLCConstants.OSLC_QM_V2 + "TestCase");

Copilot uses AI. Check for mistakes.
// PROPERTY_PARENT_FOLDER = new QName(JAZZ_RM_NAMESPACE, "parent")
// NAMESPACE_URI_XHTML = "http://www.w3.org/1999/xhtml"

public static final String JAZZ_RM_NAMESPACE = "http://jazz.net/ns/rm#";
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JAZZ_RM_NAMESPACE has been changed from "http://jazz.net/xmlns/prod/jazz/rm/1.0/" to "http://jazz.net/ns/rm#". This is a significant namespace change that could break compatibility with existing IBM ERM deployments. The old namespace appears to be the vendor-specific Jazz/IBM namespace, while the new one appears different. Verify that this namespace change is intentional and correct for the migration to oslc-domains. If the old RmConstants used the vendor-specific namespace, this change might cause the properties (primaryText, parent) to not be recognized by the server.

Suggested change
public static final String JAZZ_RM_NAMESPACE = "http://jazz.net/ns/rm#";
public static final String JAZZ_RM_NAMESPACE = "http://jazz.net/xmlns/prod/jazz/rm/1.0/";

Copilot uses AI. Check for mistakes.
serviceProviderUrl,
OSLCConstants.OSLC_CM_V2,
task.getRdfTypes()[0].toString(),
task.getTypes().iterator().next().toString(),
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code calls getTypes().iterator().next() without first checking if the Set is empty. If setTypes was never called or was called with an empty Set, this will throw a NoSuchElementException. Add a null/empty check before accessing the iterator, or ensure setTypes is always called with a non-empty Set.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant