public static boolean differentIds(PrismValue v1, PrismValue v2) { Long id1 = v1 instanceof PrismContainerValue ? ((PrismContainerValue) v1).getId() : null; Long id2 = v2 instanceof PrismContainerValue ? ((PrismContainerValue) v2).getId() : null; return id1 != null && id2 != null && id1.longValue() != id2.longValue(); } }
private SmartAssignmentElement lookup(PrismContainerValue<AssignmentType> assignmentCVal) { if (assignmentCVal.getId() != null) { // shortcut. But also important for deltas that specify correct id, but the value // does not match exactly (e.g. small differences in relation, e.g. null vs default) return idMap.get(assignmentCVal.getId()); } SmartAssignmentKey key = new SmartAssignmentKey(assignmentCVal); return aMap.get(key); }
public Long getSourceContainerValueId() { if (isContainerValue()) { return sourceValue.getId(); } else { return null; } }
public PrismContainerValue<C> findValue(long id) { for (PrismContainerValue<C> pval : getValues()) { if (id == pval.getId()) { return pval; } } return null; }
public static<C extends Containerable> void assertValueId(Long expectedId, PrismContainer<C> container) { List<Long> ids = new ArrayList<>(); for (PrismContainerValue<C> value: container.getValues()) { if (MiscUtil.equals(expectedId, value.getId())) { return; } ids.add(value.getId()); } assert false : "Expected that container "+container+" will have value id '"+expectedId+"' but it has not; existing IDs: "+ids; }
private SmartAssignmentElement put(PrismContainerValue<AssignmentType> assignmentCVal, boolean virtual) { SmartAssignmentElement element = new SmartAssignmentElement(assignmentCVal, virtual); aMap.put(element.getKey(), element); if (assignmentCVal.getId() != null) { idMap.put(assignmentCVal.getId(), element); } return element; }
@XmlAttribute(name = "id") public Long getId() { return asPrismContainerValue().getId(); }
@XmlAttribute(name = "id") public Long getId() { return asPrismContainerValue().getId(); }
@XmlAttribute(name = "id") public Long getId() { return asPrismContainerValue().getId(); }
@XmlAttribute(name = "id") public Long getId() { return asPrismContainerValue().getId(); }
private PrismValue fixEmptyContainerValue(PrismContainerValue pcv, ItemPath path, PrismObject objectOld) { if (pcv.getId() == null || CollectionUtils.isNotEmpty(pcv.getItems())) { return pcv; } PrismContainer oldContainer = objectOld.findContainer(path); if (oldContainer == null) { return pcv; } PrismContainerValue oldValue = oldContainer.getValue(pcv.getId()); return oldValue != null ? oldValue : pcv; }
@SuppressWarnings("unused") public static AccessCertificationCaseType findCase(AccessCertificationCampaignType campaign, long caseId) { for (AccessCertificationCaseType _case : campaign.getCase()) { if (_case.asPrismContainerValue().getId() != null && _case.asPrismContainerValue().getId() == caseId) { return _case; } } return null; }
@Override public Long getAssignmentId() { Item<PrismContainerValue<AssignmentType>, PrismContainerDefinition<AssignmentType>> any = assignmentIdi.getAnyItem(); return any != null && !any.getValues().isEmpty() ? any.getAnyValue().getId() : null; }
@Override public boolean containsEquivalentValue(PrismContainerValue<C> value, @Nullable Comparator<PrismContainerValue<C>> comparator) { if (value.isIdOnly()) { return findValue(value.getId()) != null; } else { return contains(value, EquivalenceStrategy.IGNORE_METADATA_CONSIDER_DIFFERENT_IDS, comparator); } }
protected boolean assignmentMatches(PrismContainerValue<AssignmentType> assignmentValue, Long expectedId, String expectedDescription) { if (assignmentValue.getId() != expectedId) { return false; } String description = assignmentValue.getPropertyRealValue(AssignmentType.F_DESCRIPTION, String.class); if (!MiscUtil.equals(expectedDescription, description)) { return false; } return true; }
private ItemDelta createStageEndTimeDelta(AccessCertificationCampaignType campaign, XMLGregorianCalendar now) throws SchemaException { AccessCertificationStageType stage = CertCampaignTypeUtil.findStage(campaign, campaign.getStageNumber()); Long stageId = stage.asPrismContainerValue().getId(); assert stageId != null; return prismContext.deltaFor(AccessCertificationCampaignType.class) .item(F_STAGE, stageId, F_END_TIMESTAMP).replace(now) .asItemDelta(); }
protected void assertPrismValue(PrismContainerValue<AccessCertificationCaseType> pcv) { assertEquals("Wrong id", (Long) 4L, pcv.getId()); ComplexTypeDefinition ctd = pcv.getComplexTypeDefinition(); assertNotNull("No CTD", ctd); //noinspection ConstantConditions assertEquals("Wrong CTD typeName", AccessCertificationAssignmentCaseType.COMPLEX_TYPE, ctd.getTypeName()); assertEquals("Wrong real class in PCV", AccessCertificationAssignmentCaseType.class, pcv.getRealClass()); }