Search in sources :

Example 21 with SchemaHolder

use of org.motechproject.mds.dto.SchemaHolder in project motech by motech.

the class MdsDummyDataGeneratorImpl method generateDummyEntities.

@Override
public void generateDummyEntities(int numberOfEntities, int fieldsPerEntity, int lookupsPerEntity, boolean regenerateBundle) throws IOException {
    for (int i = 0; i < numberOfEntities; i++) {
        prepareDummyEntity(i, fieldsPerEntity, lookupsPerEntity);
    }
    if (regenerateBundle) {
        SchemaHolder schemaHolder = entityService.getSchema();
        jarGeneratorService.regenerateMdsDataBundle(schemaHolder);
    }
}
Also used : SchemaHolder(org.motechproject.mds.dto.SchemaHolder)

Example 22 with SchemaHolder

use of org.motechproject.mds.dto.SchemaHolder in project motech by motech.

the class MdsBundleWatcher method handleBundleEvent.

private void handleBundleEvent(final Bundle bundle, final int eventType) {
    if (eventType == BundleEvent.INSTALLED || eventType == BundleEvent.UPDATED) {
        if (processingSuspended) {
            awaitingBundles.add(new AwaitingBundle(bundle, eventType));
        } else {
            processSingleBundle(bundle);
        }
    } else if (eventType == BundleEvent.UNRESOLVED && !skipBundle(bundle)) {
        LOGGER.info("Unregistering JDO classes for Bundle: {}", bundle.getSymbolicName());
        MdsBundleHelper.unregisterBundleJDOClasses(bundle);
    } else if (eventType == BundleEvent.UNINSTALLED && !skipBundle(bundle)) {
        SchemaHolder schemaHolder = lockAndGetSchema();
        refreshBundle(bundle, schemaHolder);
    }
}
Also used : SchemaHolder(org.motechproject.mds.dto.SchemaHolder)

Example 23 with SchemaHolder

use of org.motechproject.mds.dto.SchemaHolder in project motech by motech.

the class MdsBundleRegenerationServiceImpl method regenerateMdsDataBundleAfterDdeEnhancement.

@Override
public void regenerateMdsDataBundleAfterDdeEnhancement(String... moduleNames) {
    Map<String, Object> params = new HashMap<>();
    params.put(MODULE_NAMES_EVENT_PARAM, moduleNames);
    broadcast(REGENERATE_MDS_DATA_BUNDLE_AFTER_DDE_ENHANCEMENT, params);
    SchemaHolder schemaHolder = entityService.getSchema();
    jarGeneratorService.regenerateMdsDataBundleAfterDdeEnhancement(schemaHolder, moduleNames);
}
Also used : HashMap(java.util.HashMap) SchemaHolder(org.motechproject.mds.dto.SchemaHolder)

Example 24 with SchemaHolder

use of org.motechproject.mds.dto.SchemaHolder in project motech by motech.

the class MdsBundleRegenerationServiceImpl method handleMdsDataBundleRegenerationAfterDdeEnhancement.

private void handleMdsDataBundleRegenerationAfterDdeEnhancement(Event event) {
    if (!isBroadcastFromThisInstance(event)) {
        SchemaHolder schemaHolder = entityService.getSchema();
        String[] moduleNames = (String[]) event.getProperty(MODULE_NAMES_EVENT_PARAM);
        jarGeneratorService.regenerateMdsDataBundleAfterDdeEnhancement(schemaHolder, moduleNames);
    }
}
Also used : SchemaHolder(org.motechproject.mds.dto.SchemaHolder)

Aggregations

SchemaHolder (org.motechproject.mds.dto.SchemaHolder)24 EntityDto (org.motechproject.mds.dto.EntityDto)7 FieldDto (org.motechproject.mds.dto.FieldDto)5 LookupFieldDto (org.motechproject.mds.dto.LookupFieldDto)5 Test (org.junit.Test)4 StopWatch (org.apache.commons.lang.time.StopWatch)3 FieldBasicDto (org.motechproject.mds.dto.FieldBasicDto)3 TransactionStatus (org.springframework.transaction.TransactionStatus)3 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 Before (org.junit.Before)2 MDSProcessorOutput (org.motechproject.mds.annotations.internal.MDSProcessorOutput)2 AdvancedSettingsDto (org.motechproject.mds.dto.AdvancedSettingsDto)2 DraftData (org.motechproject.mds.dto.DraftData)2 LookupDto (org.motechproject.mds.dto.LookupDto)2 SettingDto (org.motechproject.mds.dto.SettingDto)2