/** * Updates a definition in the manager. * * @param objId The object instance identifier of the definition * @param definition The object body of the definition * @return True if successful. False if the object instance identifier does * not exist in the manager, in this case, the definition is not added. */ public synchronized boolean updateDef(Long objId, Element definition) { return (this.deleteDef(objId) == true) ? this.addDef(objId, definition) : false; }
public Long getObjectTypeId() { return HelperCOM.generateSubKey(this.objectType); }
/** * Get a List of object bodies of a retrieved List of COM objects from the * Archive * * @param archiveService The Archive * @param objType The object Type of the COM object * @param domain The domain of the COM object * @param objIds The List of object instance identifiers of the COM object * @return The List of object bodies of the retrieved COM objects */ public static ElementList getObjectBodyListFromArchive(Object archiveService, final ObjectType objType, final IdentifierList domain, final LongList objIds) { return (ElementList) getFromArchive(archiveService, objType, domain, objIds, ToBeReturned.OBJECT_BODY); }
public DefinitionsManager(COMServicesProvider comServices) { this.defs = new HashMap<Long, Element>(); if (comServices != null) { this.eventService = comServices.getEventService(); this.archiveService = comServices.getArchiveService(); this.activityTrackingService = comServices.getActivityTrackingService(); this.comServices = comServices; } else { this.eventService = null; this.archiveService = null; this.activityTrackingService = null; this.comServices = null; } }
protected ObjectId storeCOMOperationActivity(final MALInteraction interaction) { if (comServices.getActivityTrackingService() != null) { return comServices.getActivityTrackingService().storeCOMOperationActivity(interaction, null); } else { return null; } }
private Pair findBottom(final Attribute value, final PairList points) { Pair bottom = null; for (Pair point : points) { // Check if the point is NOT after the value if (HelperCOM.evaluateExpression(point.getFirst(), ExpressionOperator.LESS, value)) { if (bottom == null) { bottom = point; continue; } if (HelperCOM.evaluateExpression(point.getFirst(), ExpressionOperator.GREATER, bottom.getFirst())) { bottom = point; } } } return bottom; }
/** * Retrieves the groupDetails from the given GroupDefinition * * @param domain * @param groupDefId the id of the group-definition * @return */ protected GroupDetails retrieveGroupDetailsOfDefinitionFromArchive(IdentifierList domain, Long groupDefId) { if (archiveService == null) { // If there's no archive... return null; } //get the group-definitions-body //requirement: 3.9.4.g instances of a group will be referenced by the id of the GroupDefinition-object return (GroupDetails) HelperArchive.getObjectBodyFromArchive(archiveService, GroupHelper.GROUPDEFINITION_OBJECT_TYPE, domain, groupDefId); }
/** * Lists the object instance identifier for a parameter name identifier. * * @param input The name identifier of the Definition * @return The object instance identifier of the Definition. Null if not * found. */ public synchronized Long list(Identifier input) { final LongList objIds = this.listAll(); for (Long objId : objIds) { if (compareName(objId, input)) { return objId; } } return null; // Not found! }
/** * Stores the COM Operation Activity object in the Archive * * @param interaction The MALInteraction object for the operation * @return The link to the stored COM Operation Activity. Null if not * stored. */ public ObjectId storeCOMOperationActivity(final MALInteraction interaction) { if (getActivityTrackingService() != null) { return getActivityTrackingService().storeCOMOperationActivity(interaction, null); } else { return null; } }
public synchronized ObjectType getObjectType(final Integer id) throws Exception { final Long objectType = this.fastIDreverse.get(id); if (objectType == null) { throw new Exception(); } return HelperCOM.objectTypeId2objectType(objectType); }
/** * Get all the definition objects available. * * @return The Definitions. */ public synchronized ElementList getAllDefs() { ElementList list = this.newDefinitionList(); list.addAll(defs.values()); return list; }
public static Object getNestedObject(Object in, String fieldName) throws NoSuchFieldException { Object obj = in; String[] parts = fieldName.split("\\."); try { for (String part : parts) { if (!part.equals("")) { obj = HelperCOM.getObjectInsideObject(part, obj); } else { // Then it is a Enumeration // obj = ((Enumeration) obj).getNumericValue(); } } } catch (IllegalArgumentException ex) { throw new NoSuchFieldException(); } catch (IllegalAccessException ex) { throw new NoSuchFieldException(); } return obj; }
private Pair findTop(final Attribute value, final PairList points) { Pair top = null; for (Pair point : points) { // Check if the point is after the value if (HelperCOM.evaluateExpression(point.getFirst(), ExpressionOperator.GREATER, value)) { if (top == null) { top = point; continue; } if (HelperCOM.evaluateExpression(point.getFirst(), ExpressionOperator.LESS, top.getFirst())) { top = point; } } } return top; }
/** * Retrieves the groupDetails of the latest group-definition of the given * group-identity * * @param domain * @param groupIdentityId the id of the group-identity * @return */ protected GroupDetails retrieveGroupDetailsFromArchive(IdentifierList domain, Long groupIdentityId) { if (archiveService == null) { // If there's no archive... return null; } Long latestGroupDefId = retrieveLatestGroupDefinitionIdForIdentityFromArchive(domain, groupIdentityId); if (latestGroupDefId == null) { return null; } //get the group-definitions-body //requirement: 3.9.4.g instances of a group will be referenced by the id of the GroupDefinition-object return (GroupDetails) HelperArchive.getObjectBodyFromArchive(archiveService, GroupHelper.GROUPDEFINITION_OBJECT_TYPE, domain, latestGroupDefId); }
/** * Get the ArchiveDetails object of a retrieved COM object from the Archive * * @param archiveService The Archive * @param objType The object Type of the COM object * @param domain The domain of the COM object * @param objIds The List of object instance identifiers of the COM objects * @return The list of ArchiveDetails objects of the retrieved COM objects */ public static ArchiveDetailsList getArchiveDetailsListFromArchive(Object archiveService, final ObjectType objType, final IdentifierList domain, final LongList objIds) { return (ArchiveDetailsList) getFromArchive( archiveService, objType, domain, objIds, ToBeReturned.ARCHIVE_DETAILS); }
public synchronized Integer getObjectTypeId(final ObjectType objectType) { final Long longObjType = HelperCOM.generateSubKey(objectType); final Integer id = this.fastID.get(longObjType); return (id == null) ? this.addNew(longObjType) : id; }
private Attribute applyRangeConversion(final RangeConversionDetails conversionDetails, final Attribute value) { //requirement: 3.8.3.f => no entry in the points-list returns null // Do we have a direct hit? final PairList points = conversionDetails.getPoints(); for (Pair point : points) { if (HelperCOM.evaluateExpression(point.getFirst(), ExpressionOperator.EQUAL, value)) { // If we get a hit, then return it right away return point.getSecond(); } } Pair bottom = findBottom(value, points); if (bottom == null) { return null; } return bottom.getSecond(); }
/** * Retrieve a list of COM objects from the Archive * * @param archiveService The Archive * @param objType The object Type of the COM object * @param domain The domain of the COM object * @param objIds The List of object instance identifiers of the COM objects * to be retrieved * @return The list of COM objects */ public static List<ArchivePersistenceObject> getArchiveCOMObjectList(Object archiveService, final ObjectType objType, final IdentifierList domain, final LongList objIds) { return (List<ArchivePersistenceObject>) getFromArchive( archiveService, objType, domain, objIds, ToBeReturned.COM_OBJECT ); }
/** * Retrieved a COM object from the Archive * * @param archiveService The Archive * @param objType The object Type of the COM object * @param domain The domain of the COM object * @param objId The object instance identifier of the COM object to be * retrieved * @return The COM object */ public static ArchivePersistenceObject getArchiveCOMObject(Object archiveService, final ObjectType objType, final IdentifierList domain, final Long objId) { LongList objIds = new LongList(); objIds.add(objId); List<ArchivePersistenceObject> archiveCOMobjectList = (List<ArchivePersistenceObject>) getFromArchive( archiveService, objType, domain, objIds, ToBeReturned.COM_OBJECT ); if (archiveCOMobjectList == null) { return null; } return archiveCOMobjectList.get(0); }
/** * Get the ArchiveDetails object of a retrieved COM object from the Archive * * @param archiveService The Archive * @param objType The object Type of the COM object * @param domain The domain of the COM object * @param objId The object instance identifier of the COM object * @return The ArchiveDetails object of the retrieved COM objects */ public static ArchiveDetails getArchiveDetailsFromArchive(Object archiveService, final ObjectType objType, final IdentifierList domain, final Long objId) { final LongList objIds = new LongList(); objIds.add(objId); final ArchiveDetailsList archiveDetailsList = (ArchiveDetailsList) getFromArchive(archiveService, objType, domain, objIds, ToBeReturned.ARCHIVE_DETAILS); return archiveDetailsList.get(0); }