Package org.apache.commons.collections

Examples of org.apache.commons.collections.SequencedHashMap$Entry


    private void ensureReferencedFKs(ModelDef modelDef, CollectionDescriptorDef collDef) throws ConstraintException
    {
        ClassDescriptorDef elementClassDef = modelDef.getClass(collDef.getProperty(PropertyHelper.OJB_PROPERTY_ELEMENT_CLASS_REF));
        String             fkFieldNames    = collDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);
        ArrayList          missingFields   = new ArrayList();
        SequencedHashMap   fkFields        = new SequencedHashMap();

        // first we gather all field names
        for (CommaListIterator it = new CommaListIterator(fkFieldNames); it.hasNext();)
        {
            String             fieldName = (String)it.next();
            FieldDescriptorDef fieldDef  = elementClassDef.getField(fieldName);

            if (fieldDef == null)
            {
                missingFields.add(fieldName);
            }
            fkFields.put(fieldName, fieldDef);
        }

        // next we traverse all sub types and gather fields as we go
        for (Iterator it = elementClassDef.getAllExtentClasses(); it.hasNext() && !missingFields.isEmpty();)
        {
            ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next();

            for (int idx = 0; idx < missingFields.size();)
            {
                FieldDescriptorDef fieldDef = subTypeDef.getField((String)missingFields.get(idx));

                if (fieldDef != null)
                {
                    fkFields.put(fieldDef.getName(), fieldDef);
                    missingFields.remove(idx);
                }
                else
                {
                    idx++;
                }
            }
        }
        if (!missingFields.isEmpty())
        {
            throw new ConstraintException("Cannot find field "+missingFields.get(0).toString()+" in the hierarchy with root type "+
                                          elementClassDef.getName()+" which is used as foreignkey in collection "+
                                          collDef.getName()+" in "+collDef.getOwner().getName());
        }

        // copy the found fields into the element class
        ensureFields(elementClassDef, fkFields.values());
    }
View Full Code Here


     * @param classDef The root of the hierarchy
     * @throws ConstraintException If there is a conflict between the pk fields
     */
    private void ensurePKsFromHierarchy(ClassDescriptorDef classDef) throws ConstraintException
    {
        SequencedHashMap pks = new SequencedHashMap();

        for (Iterator it = classDef.getAllExtentClasses(); it.hasNext();)
        {
            ClassDescriptorDef subTypeDef = (ClassDescriptorDef)it.next();

            ArrayList subPKs = subTypeDef.getPrimaryKeys();

            // check against already present PKs
            for (Iterator pkIt = subPKs.iterator(); pkIt.hasNext();)
            {
                FieldDescriptorDef fieldDef   = (FieldDescriptorDef)pkIt.next();
                FieldDescriptorDef foundPKDef = (FieldDescriptorDef)pks.get(fieldDef.getName());

                if (foundPKDef != null)
                {
                    if (!isEqual(fieldDef, foundPKDef))
                    {
                        throw new ConstraintException("Cannot pull up the declaration of the required primary key "+fieldDef.getName()+
                                                      " because its definitions in "+fieldDef.getOwner().getName()+" and "+
                                                      foundPKDef.getOwner().getName()+" differ");
                    }
                }
                else
                {
                    pks.put(fieldDef.getName(), fieldDef);
                }
            }
        }

        ensureFields(classDef, pks.values());
    }
View Full Code Here

     * Returns the participant definitions for a process definition ID in a map.
     * @param processDefId
     * @return
     */
    public Map<String, WorkflowParticipant> getParticipantMap(String processDefId) {
        Map<String, WorkflowParticipant> participantMap = new SequencedHashMap();

        SharkConnection sc = null;

        try {
            sc = connect();

            Shark shark = Shark.getInstance();
            XPDLBrowser xpdlBrowser = shark.getXPDLBrowser();
            AdminMisc admin = shark.getAdminMisc();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            PackageAdministration pa = getSharkPackageAdmin(sessionHandle);

            // get package participants
            WMEntity ent = admin.getProcessDefinitionInfoByUniqueProcessDefinitionName(sessionHandle, processDefId);
            WMEntity packageEntity = pa.getPackageEntity(sessionHandle, ent.getPkgId(), ent.getPkgVer());
            WMEntity[] pParticipants = WMEntityUtilities.getAllParticipants(sessionHandle, xpdlBrowser, packageEntity);
            Map<String, WorkflowParticipant> tempParticipantMap = new SequencedHashMap();
            for (int i = 0; i < pParticipants.length; i++) {
                WMEntity entity = pParticipants[i];
                WMEntity entityType = WMEntityUtilities.getSubEntity(sessionHandle, xpdlBrowser, entity, "ParticipantType");
                String entityTypeValue = WMEntityUtilities.getAttributeValue(sessionHandle, xpdlBrowser, entityType, "Type");
                if ("ROLE".equals(entityTypeValue)) {
                    WorkflowParticipant participant = new WorkflowParticipant();
                    participant.setId(entity.getId());
                    participant.setName(entity.getName());
                    participant.setPackageLevel(false);
                    tempParticipantMap.put(participant.getId(), participant);
                }
            }

            String participantIdsInProcess = WMEntityUtilities.findEAAndGetValue(sessionHandle, xpdlBrowser, ent, "JaWE_GRAPH_WORKFLOW_PARTICIPANT_ORDER");
            String ids[] = participantIdsInProcess.split(";");
            if (ids.length > 0) {
                for (String id : ids) {
                    if (tempParticipantMap.get(id) != null) {
                        participantMap.put(id, tempParticipantMap.get(id));
                    }
                }
            }

        } catch (Exception ex) {
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                outputData.getEntry().add(outputEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                Entry durationEntry = new Entry();
                                durationEntry.setKey(DURATION);
                                durationEntry.setValue(testRecord.get(DURATION).toString());
                                outputData.getEntry().add(outputEntry);
                                outputData.getEntry().add(durationEntry);
                                if(testRecord.get(TEST_STATUS) != null){
                                    Entry statusEntry = new Entry();
                                    statusEntry.setKey(TEST_STATUS);
                                    statusEntry.setValue(testRecord.get(TEST_STATUS).toString());
                                    outputData.getEntry().add(statusEntry);
                                }
                               
                               
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
                        }
                        if (outputDataAdded) {
                            break;
                        }
                    }
                }else{
                    //Method did not return any data. So only write the duration as output
                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry durationEntry = new Entry();
                                durationEntry.setKey(DURATION);
                                durationEntry.setValue(testRecord.get(DURATION).toString());
                                outputData.getEntry().add(durationEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.SequencedHashMap$Entry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.