Package org.criticalfailure.torchlight.core.domain.entity.object

Examples of org.criticalfailure.torchlight.core.domain.entity.object.ObjectProperty


                // create or set object data
                ObjectData datum = encounter.getObjectInstance().getData().get("name");
                logger.trace("datum: " + datum);
                if(datum == null) {
                    ObjectProperty op = encounter.getObjectInstance().getObjectTemplate().getProperty("name");
                    logger.trace("op: " + op);
                    if(op == null) {
                        logger.error("Object property 'name' couldn't be found in template: "
                                + encounter.getObjectInstance().getObjectTemplate());

                        // alert service
                        alertService.addAlert(new Alert(Alert.Type.ERROR, EncounterBuilderEditor.class.getSimpleName(),
                                "Object property 'name' couldn't be found in template: "
                                        + encounter.getObjectInstance().getObjectTemplate().getName()));

                        return;
                    }

                    datum = objectDataFactory.createObjectData(op, false);
                    logger.trace("datum: " + datum);
                    if(datum != null) {
                        datum.setName("name");

                        encounter.getObjectInstance().addData(datum);
                    }
                    else {
                        logger.error("Object data couldn't be created for 'name' from object property: " + op);

                        // alert service
                        alertService.addAlert(new Alert(Alert.Type.ERROR, EncounterBuilderEditor.class.getSimpleName(),
                                "Object data couldn't be created for 'name' from object property: " + op.getName()));

                        return;
                    }
                }
                datum.setValue(name);
View Full Code Here


            // update object instance
            ObjectData od = encounter.getObjectInstance().getData().get("participants");
            logger.trace("od: " + od);
            if(od == null) {
                ObjectProperty op = encounter.getObjectInstance().getObjectTemplate().getProperty("participants");
                if(op != null) {
                    od = objectDataFactory.createObjectData(op, false);
                    // od.setName("participants");

                    encounter.getObjectInstance().addData(od);
View Full Code Here

     */
    public ObjectProperty createObjectProperty(AbstractCampaign campaign, boolean empty) {

        logger.info("Creating new object property.");

        ObjectProperty op = (ObjectProperty)appContext.getBean("objectProperty");

        op.setCampaign(campaign);

        if(!empty) {
            // TODO
        }

View Full Code Here

     */
    public ObjectProperty createObjectProperty(ObjectProperty template) {

        logger.info("Creating new object property from template: " + template);

        ObjectProperty op = (ObjectProperty)appContext.getBean("objectProperty");

        op.setId(template.getId());
        op.setCampaign(template.getCampaign());
        op.setName(template.getName());
        op.setTemplate(template.isTemplate());
        // op.setSequence(template.getSequence());
        op.setInstanceValueLimit(template.getInstanceValueLimit());
        op.setCalculatorType(template.getCalculatorType());
        op.setCalculatorInputs(template.getCalculatorInputs());
        op.setCalculatorBody(template.getCalculatorBody());
        op.setFormatterType(template.getFormatterType());
        op.setFormatterBody(template.getFormatterBody());
        op.setValidatorType(template.getValidatorType());
        op.setValidatorBody(template.getValidatorBody());

        logger.info("Object property created: " + op);
        return op;
    }
View Full Code Here

        catch(Exception e) {
            logger.error("Exception while trying to create object template from template: " + e.getLocalizedMessage(),
                    e);
        }
        for(ObjectProperty origProp : template.getProperties()) {
            ObjectProperty op = objectPropertyFactory.createObjectProperty(origProp);
            logger.trace("op: " + op);

            ot.addProperty(op);
            op.setObjectTemplate(ot);
        }

        logger.info("Object template created: " + ot);
        return ot;
    }
View Full Code Here

            protected boolean canEdit(Object element) {
                logger.trace("can edit: element: " + element);

                boolean canEdit = true;
                if(element instanceof ObjectData) {
                    ObjectProperty op = ((ObjectData)element).getObjectProperty();
                    logger.trace("op: " + op);

                    if(op != null) {
                        canEdit = (StringUtils.stripToNull(op.getCalculatorType()) == null);
                    }
                }

                logger.trace("canEdit: " + canEdit);
                return canEdit;
View Full Code Here

                if(StringUtils.stripToNull(objectPropertyId) != null) {
                    ObjectPropertySO opVO = csm.loadObjectProperty(objectPropertyId);
                    logger.trace("opVO: " + opVO);

                    ObjectProperty op = objectPropertyStorageObjectTranslator.translateFrom(opVO, csm);
                    logger.trace("op: " + op);

                    ot.addProperty(op);
                    op.setObjectTemplate(ot);
                    op.setCampaign(ot.getCampaign());
                }
            }
        }
        catch(Exception e) {
            logger.error("Exception caught while translating object template storage object: "
View Full Code Here

        logger.info("Executing 'create object property from data' action: " + event);

        if(selectedObject != null) {
            // make sure there isn't a property for this already
            ObjectProperty o = selectedObject.getObjectProperty();
            logger.trace("o: " + o);

            if(o == null) {
                ObjectProperty op = objectPropertyFactory.createObjectProperty(objectInstance.getCampaign(), true);
                logger.trace("op: " + op);

                op.setName(selectedObject.getName());

                ObjectTemplate ot = objectInstance.getObjectTemplate();
                logger.trace("ot: " + ot);

                ot.addProperty(op);
                op.setObjectTemplate(ot);
                op.setCampaign(ot.getCampaign());

                try {
                    ot.save();
                }
                catch(Exception e) {
View Full Code Here

        try {
            ObjectPropertySO opVO = csm.loadObjectProperty(so.getObjectPropertyId());
            logger.trace("opVO: " + opVO);

            ObjectProperty op = objectPropertyStorageObjectTranslator.translateFrom(opVO, csm);
            logger.trace("op: " + op);

            od.setObjectProperty(op);
        }
        catch(Exception e) {
View Full Code Here

    @Override
    public void runWithEvent(Event event) {

        logger.info("Executing 'create object property' action: " + event);

        ObjectProperty op = objectPropertyFactory.createObjectProperty(objectTemplate.getCampaign(), false);
        logger.trace("ot: " + op);

        // give the property a name that isn't being used
        String proposedName = "";
        boolean inUse = false;
        do {
            proposedName = "property-" + sequence;
            logger.trace("proposedName: " + proposedName);

            inUse = false;
            for(ObjectProperty prop : objectTemplate.getProperties()) {
                logger.trace("prop: " + prop);
                if(proposedName.equals(prop.getName())) {
                    logger.debug("name is in use: " + proposedName);
                    inUse = true;
                    break;
                }
            }

            logger.debug("increment sequence");
            sequence++;
        } while(inUse);

        op.setName(proposedName);

        // try {
        // // create a dialog to get information from the user
        // IObjectTemplateBuilderDialog dialog = (IObjectTemplateBuilderDialog)appContext.getBean(
        // "objectTemplateBuilderDialog", new Object[] {
        // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ot });
        //
        // objectTemplateBuilder.setDialog(dialog);
        //
        // if(!objectTemplateBuilder.buildObjectTemplate(ot)) {
        // logger.info("Object template build was incomplete; see previous log entries for details.");
        //
        // // TODO: alert service
        //
        // return;
        // }
        // }
        // catch(ObjectBuilderException e) {
        // logger.error("Exception while trying to build object property: " + e.getLocalizedMessage(), e);
        //
        // // TODO: alert service
        //
        // return;
        // }

        objectTemplate.addProperty(op);
        op.setObjectTemplate(objectTemplate);

        // save the object property and the object template
        try {
            objectTemplate.save();
        }
View Full Code Here

TOP

Related Classes of org.criticalfailure.torchlight.core.domain.entity.object.ObjectProperty

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.