if(engines!=null && !engines.isEmpty()){
o.setEngine(engines.get(0));
}
}
Domain objType = DAOFactory.getDomainDAO().loadDomainByCodeAndValue(SpagoBIConstants.BIOBJ_TYPE, type);
Integer biObjectTypeID = objType.getValueId();
o.setBiObjectTypeID(biObjectTypeID);
o.setBiObjectTypeCode(objType.getValueCd());
UserProfile userProfile = (UserProfile) this.getUserProfile();
String creationUser = userProfile.getUserId().toString();
o.setCreationUser(creationUser);
if(dataSourceId!=null && dataSourceId!=""){
o.setDataSourceId(new Integer(dataSourceId));
}
List<Integer> functionalities = new ArrayList<Integer>();
for(int i=0; i< functsArrayJSon.length(); i++){
String funcIdStr = functsArrayJSon.getString(i);
Integer funcId = new Integer(funcIdStr);
if (funcId.intValue() == -1) {
// -1 stands for personal folder: check is it exists
boolean exists = UserUtilities.userFunctionalityRootExists(userProfile);
if (!exists) {
// create personal folder if it doesn't exist
UserUtilities.createUserFunctionalityRoot(userProfile);
}
// load personal folder to get its id
LowFunctionality lf = UserUtilities.loadUserFunctionalityRoot(userProfile);
funcId = lf.getId();
}
functionalities.add(funcId);
}
o.setFunctionalities(functionalities);
Domain objState = DAOFactory.getDomainDAO().loadDomainByCodeAndValue(SpagoBIConstants.DOC_STATE, SpagoBIConstants.DOC_STATE_REL);
Integer stateID = objState.getValueId();
o.setStateID(stateID);
o.setStateCode(objState.getValueCd());
BIObject orig_obj = objDao.loadBIObjectById(new Integer(orig_biobj_id));
ObjTemplate objTemp = new ObjTemplate();
byte[] content = null;
if(template != null && template != ""){