public ElementList getObjects() { ElementList bodies; try { bodies = HelperMisc.element2elementList(object); bodies.add(object); } catch (Exception ex) { bodies = null; } return bodies; }
/** * Changes the current set of definitions available by the provided set. * * @param objIds Object instance identifiers * @param definitions The object body of the definitions * @return True if the configuration was successfully changed. False * otherwise. */ public synchronized Boolean reconfigureDefinitions(LongList objIds, ElementList definitions) { if (objIds == null || definitions == null) { return false; } if (objIds.size() != definitions.size()) { return false; } defs.clear(); for (int i = 0; i < objIds.size(); i++) { defs.put(objIds.get(i), (Element) definitions.get(i)); } return true; }
/** * Get all the definition objects available. * * @return The Definitions. */ public synchronized ElementList getAllDefs() { ElementList list = this.newDefinitionList(); list.addAll(defs.values()); return list; }
/** * Get the object body 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 object body of the retrieved COM object */ public static Element getObjectBodyFromArchive(final Object archiveService, final ObjectType objType, final IdentifierList domain, final Long objId) { final LongList objIds = new LongList(); objIds.add(objId); final ElementList objs = (ElementList) getFromArchive( archiveService, objType, domain, objIds, ToBeReturned.OBJECT_BODY ); return (objs != null) ? (Element) objs.get(0) : null; /* if (objs != null) { return (Element) objs.get(0); } else { return null; } */ }
if (lArchiveDetailsList.size() != lElementList.size()) { // requirement: ------ (proposed, does not exist yet) UIntegerList error = new UIntegerList(); int size1 = (lArchiveDetailsList.size() < lElementList.size()) ? lArchiveDetailsList.size() : lElementList.size(); int size2 = (lArchiveDetailsList.size() > lElementList.size()) ? lArchiveDetailsList.size() : lElementList.size();
/** * Generates the corresponding MAL Element from a certain MAL Element List * * @param obj The MAL Element List * @return The MAL Element * @throws java.lang.Exception */ public static Element elementList2element(ElementList obj) throws Exception { if (obj == null) { return null; } long l = obj.getShortForm(); long ll = (-((l) & 0xFFFFFFL)) & 0xFFFFFFL + (l & 0xFFFFFFFFFF000000L); MALElementFactory eleFact = MALContextFactory.getElementFactoryRegistry().lookupElementFactory(ll); if (eleFact == null) { Logger.getLogger(HelperMisc.class.getName()).log(Level.SEVERE, "The element could not be found in the MAL ElementFactory! The object type is: '" + obj.getClass().getSimpleName() + "'. Maybe the service Helper for this object was not initialized. " + "Try initializing the Service Helper of this object."); } return (Element) eleFact.createElement(); }
if (lArchiveDetailsList.size() != lElementList.size()) { // requirement: 3.4.6.2.8 UIntegerList error = new UIntegerList(); int size1 = (lArchiveDetailsList.size() < lElementList.size()) ? lArchiveDetailsList.size() : lElementList.size(); int size2 = (lArchiveDetailsList.size() > lElementList.size()) ? lArchiveDetailsList.size() : lElementList.size();
/** * Changes the current set of definitions available by the provided set. * * @param identityIds the identityIds of the parameters to be set * @param names the names of the parameters to be set * @param defIds the definitionsIds of the parameters to be set * @param definitions The object body of the definitions to be set * @return True if the configuration was successfully changed. False * otherwise. */ public synchronized Boolean reconfigureDefinitions(final LongList identityIds, final IdentifierList names, final LongList defIds, final ElementList definitions) { if (identityIds == null || names == null || defIds == null || definitions == null) { return false; } if (identityIds.size() != names.size() && defIds.size() != definitions.size() && identityIds.size() != defIds.size()) { return false; } this.identitiesToNamesMap.clear(); this.namesToPairsMap.clear(); this.objIdToDefMap.clear(); for (int i = 0; i < identityIds.size(); i++) { this.identitiesToNamesMap.put(identityIds.get(i), names.get(i)); this.namesToPairsMap.put(names.get(i), new ObjectInstancePair(identityIds.get(i), defIds.get(i))); this.objIdToDefMap.put(defIds.get(i), (Element) definitions.get(i)); } return true; }
events.add(eventObjBody);
protected void updateEntries(final ObjectType objType, final IdentifierList domain, final ArchiveDetailsList lArchiveDetails, final ElementList objects, final MALInteraction interaction) { final int domainId = this.fastDomain.getDomainId(domain); final Integer objTypeId = this.fastObjectType.getObjectTypeId(objType); final ArrayList<COMObjectEntity> newObjs = new ArrayList<COMObjectEntity>(); final LongList objIds = new LongList(); // Generate the object Ids if needed and the persistence objects to be stored for (int i = 0; i < lArchiveDetails.size(); i++) { final Integer providerURIId = this.fastProviderURI.getProviderURIId(lArchiveDetails.get(i).getProvider()); final Integer networkId = this.fastNetwork.getNetworkId(lArchiveDetails.get(i).getNetwork()); // If there are no objects in the list, inject null... Object objBody = (objects == null) ? null : ((objects.get(i) == null) ? null : objects.get(i)); SourceLinkContainer sourceLink = this.createSourceContainerFromObjectId(lArchiveDetails.get(i).getDetails().getSource()); final COMObjectEntity newObj = new COMObjectEntity( objTypeId, domainId, lArchiveDetails.get(i).getInstId(), lArchiveDetails.get(i).getTimestamp().getValue(), providerURIId, networkId, sourceLink, lArchiveDetails.get(i).getDetails().getRelated(), objBody); // 0.170 ms newObjs.add(newObj); objIds.add(lArchiveDetails.get(i).getInstId()); } Runnable publishEvents = this.generatePublishEventsThread(ArchiveHelper.OBJECTUPDATED_OBJECT_TYPE, objType, domain, objIds, interaction); this.dbProcessor.update(newObjs, publishEvents); }
/** * Decodes a single part of the message body. * * @param meel The encoded element list. * @return The decoded chunk. * @throws MALException if any error detected. */ protected Object decodeEncodedElementListBodyPart(final MALEncodedElementList meel) throws MALException { long sf = (Long) meel.getShortForm(); final MALElementFactory ef = MALContextFactory.getElementFactoryRegistry().lookupElementFactory(sf); if (null == ef) { throw new MALException("GEN transport unable to find element factory for short type: " + sf); } // create list of correct type long lsf = (-((sf) & 0xFFFFFFL)) & 0xFFFFFFL + (sf & 0xFFFFFFFFFF000000L); ElementList rv = (ElementList) MALContextFactory.getElementFactoryRegistry().lookupElementFactory(lsf).createElement(); for (MALEncodedElement ele : meel) { final ByteArrayInputStream lbais = new ByteArrayInputStream(ele.getEncodedElement().getValue()); MALElementInputStream lenc = encFactory.createInputStream(lbais); rv.add(lenc.readElement(ef.createElement(), ctx)); } return rv; }