Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
********************************************************************************
*** ASResourceDataServiceImpl.java ***
*** The implementation of the IASResourceDataService. ***
*** generated by AnoSiteGenerator (ASG), Version: 2.6.3 ***
*** Copyright (C) 2005 - 2010 Anotheria.net, www.anotheria.net ***
*** All Rights Reserved. ***
********************************************************************************
*** Don't edit this code, if you aren't sure ***
*** that you do exactly know what you are doing! ***
*** It's better to invest time in the generator, as into the generated code. ***
********************************************************************************
*/
package net.anotheria.anosite.gen.asresourcedata.service;
import java.nio.charset.Charset;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import net.anotheria.anodoc.data.Module;
import net.anotheria.anodoc.data.Property;
import net.anotheria.anodoc.data.NoSuchPropertyException;
import net.anotheria.util.sorter.SortType;
import net.anotheria.util.sorter.StaticQuickSorter;
import net.anotheria.util.slicer.Segment;
import net.anotheria.util.slicer.Slicer;
import net.anotheria.anosite.gen.asresourcedata.data.ModuleASResourceData;
import net.anotheria.anosite.gen.shared.service.BasicCMSService;
import net.anotheria.anodoc.query2.DocumentQuery;
import net.anotheria.anodoc.query2.QueryResult;
import net.anotheria.anodoc.query2.QueryResultEntry;
import net.anotheria.anodoc.query2.QueryProperty;
import net.anotheria.util.StringUtils;
import net.anotheria.util.xml.XMLNode;
import net.anotheria.util.xml.XMLAttribute;
import net.anotheria.asg.util.listener.IModuleListener;
import org.codehaus.jettison.json.JSONObject;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import net.anotheria.anodoc.util.mapper.ObjectMapperUtil;
import net.anotheria.anosite.gen.shared.util.DocumentName;
import net.anotheria.anosite.gen.asresourcedata.data.TextResource;
import net.anotheria.anosite.gen.asresourcedata.data.TextResourceXMLHelper;
import net.anotheria.anosite.gen.asresourcedata.data.TextResourceDocument;
import net.anotheria.anosite.gen.asresourcedata.data.LocalizationBundle;
import net.anotheria.anosite.gen.asresourcedata.data.LocalizationBundleXMLHelper;
import net.anotheria.anosite.gen.asresourcedata.data.LocalizationBundleDocument;
import net.anotheria.anosite.gen.asresourcedata.data.MailTemplate;
import net.anotheria.anosite.gen.asresourcedata.data.MailTemplateXMLHelper;
import net.anotheria.anosite.gen.asresourcedata.data.MailTemplateDocument;
import net.anotheria.anosite.gen.asresourcedata.service.ASResourceDataServiceException;
import net.anotheria.anosite.gen.asresourcedata.data.Image;
import net.anotheria.anosite.gen.asresourcedata.data.ImageXMLHelper;
import net.anotheria.anosite.gen.asresourcedata.data.ImageDocument;
import net.anotheria.anosite.gen.asresourcedata.data.FileLink;
import net.anotheria.anosite.gen.asresourcedata.data.FileLinkXMLHelper;
import net.anotheria.anosite.gen.asresourcedata.data.FileLinkDocument;
public class ASResourceDataServiceImpl extends BasicCMSService implements IASResourceDataService, IModuleListener{
// Generated by: class net.anotheria.asg.generator.model.docs.CMSBasedServiceGenerator.generateImplementation
private static ASResourceDataServiceImpl instance;
private ASResourceDataServiceImpl(){
addServiceListener(new net.anotheria.anosite.cms.listener.CRUDLogListener());
addServiceListener(new net.anotheria.anosite.cms.listener.AsResourceListener());
addModuleListener(ModuleASResourceData.MODULE_ID, this);
}
static final ASResourceDataServiceImpl getInstance(){
if (instance==null){
instance = new ASResourceDataServiceImpl();
}
return instance;
}
private ModuleASResourceData _getModuleASResourceData(){
return (ModuleASResourceData) getModule(ModuleASResourceData.MODULE_ID);
}
@Override
public void moduleLoaded(Module module){
firePersistenceChangedEvent();
}
@SuppressWarnings("unchecked")
public List getTextResources(){
List textresources = new ArrayList();
textresources.addAll(_getModuleASResourceData().getTextResources());
return textresources;
}
public List getTextResources(SortType sortType){
return StaticQuickSorter.sort(getTextResources(), sortType);
}
/**
* Returns the TextResource objects with the specified ids.
*/
public List getTextResources(List ids){;
if (ids==null || ids.size()==0)
return new ArrayList(0);
List all = getTextResources();
List ret = new ArrayList();
for (TextResource textresource : all){
if(ids.contains(textresource.getId())){
ret.add(textresource);
}
}
return ret;
}
/**
* Returns the TextResource objects with the specified ids, sorted by given sorttype.
*/
public List getTextResources(List ids, SortType sortType){;
return StaticQuickSorter.sort(getTextResources(ids), sortType);
}
public void deleteTextResource(TextResource textresource){
deleteTextResource(textresource.getId());
if (hasServiceListeners()){
fireObjectDeletedEvent(textresource);
}
}
public void deleteTextResource(String id){
ModuleASResourceData module = _getModuleASResourceData();
TextResource varValue = hasServiceListeners()?module.getTextResource(id):null;
module.deleteTextResource(id);
updateModule(module);
if(varValue!=null){
fireObjectDeletedEvent(varValue);
}
}
public void deleteTextResources(List list){
ModuleASResourceData module = _getModuleASResourceData();
for (TextResource textresource : list){
module.deleteTextResource(textresource.getId());
}
updateModule(module);
if (hasServiceListeners()){
for (int t=0; t importTextResources(List list){
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (TextResource textresource : list){
TextResource imported = module.importTextResource((TextResourceDocument)textresource);
ret.add(imported);
}
updateModule(module);
if (hasServiceListeners()){
for (TextResource textresource : ret)
fireObjectImportedEvent(textresource);
}
return ret;
}
public TextResource createTextResource(TextResource textresource){
ModuleASResourceData module = _getModuleASResourceData();
module.createTextResource((TextResourceDocument)textresource);
updateModule(module);
fireObjectCreatedEvent(textresource);
return textresource;
}
/**
* Creates multiple new TextResource objects.
* Returns the created versions.
*/
public List createTextResources(List list){;
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (TextResource textresource : list){
TextResource created = module.createTextResource((TextResourceDocument)textresource);
ret.add(created);
}
updateModule(module);
if (hasServiceListeners()){
for (TextResource textresource : ret)
fireObjectCreatedEvent(textresource);
}
return ret;
}
public TextResource updateTextResource(TextResource textresource){
TextResource oldVersion = null;
ModuleASResourceData module = _getModuleASResourceData();
if (hasServiceListeners())
oldVersion = module.getTextResource(textresource.getId());
module.updateTextResource((TextResourceDocument)textresource);
updateModule(module);
if (oldVersion != null){
fireObjectUpdatedEvent(oldVersion, textresource);
}
return textresource;
}
public List updateTextResources(List list){
List oldList = null;
if (hasServiceListeners())
oldList = new ArrayList(list.size());
ModuleASResourceData module = _getModuleASResourceData();
for (TextResource textresource : list){
if (oldList!=null)
oldList.add(module.getTextResource(textresource.getId()));
module.updateTextResource((TextResourceDocument)textresource);
}
updateModule(module);
if (oldList!=null){
for (int t=0; t getTextResourcesByProperty(String propertyName, Object value){
List allTextResources = getTextResources();
List ret = new ArrayList();
for (int i=0; i getTextResourcesByProperty(String propertyName, Object value, SortType sortType){
return StaticQuickSorter.sort(getTextResourcesByProperty(propertyName, value), sortType);
}
/**
* Executes a query on TextResources
*/
public QueryResult executeQueryOnTextResources(DocumentQuery query){
List allTextResources = getTextResources();
QueryResult result = new QueryResult();
for (int i=0; i partialResult = query.match(allTextResources.get(i));
result.add(partialResult);
}
return result;
}
/**
* Returns all TextResource objects, where property matches.
*/
public List getTextResourcesByProperty(QueryProperty... property){
//first the slow version, the fast version is a todo.
List ret = new ArrayList();
List src = getTextResources();
for ( TextResource textresource : src){;
boolean mayPass = true;
for (QueryProperty qp : property){;
mayPass = mayPass && qp.doesMatch(textresource.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(textresource);
}
return ret;
}
/**
* Returns all TextResource objects, where property matches, sorted
*/
public List getTextResourcesByProperty(SortType sortType, QueryProperty... property){
return StaticQuickSorter.sort(getTextResourcesByProperty(property), sortType);
}
/**
* Returns TextResource objects count.
*/
public int getTextResourcesCount() {
return _getModuleASResourceData().getTextResources().size();
}
/**
* Returns TextResource objects segment.
*/
public List getTextResources(Segment aSegment) {
return Slicer.slice(aSegment, getTextResources()).getSliceData();
}
/**
* Returns TextResource objects segment, where property matched.
*/
public List getTextResourcesByProperty(Segment aSegment, QueryProperty... property) {
int pLimit = aSegment.getElementsPerSlice();
int pOffset = aSegment.getSliceNumber() * aSegment.getElementsPerSlice() - aSegment.getElementsPerSlice();
List ret = new ArrayList();
List src = getTextResources();
for (TextResource textresource : src) {;
boolean mayPass = true;
for (QueryProperty qp : property) {;
mayPass = mayPass && qp.doesMatch(textresource.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(textresource);
if (ret.size() > pOffset + pLimit)
break;
}
return Slicer.slice(aSegment, ret).getSliceData();
}
/**
* Returns TextResource objects segment, where property matched, sorted.
*/
public List getTextResourcesByProperty(Segment aSegment, SortType aSortType, QueryProperty... aProperty){
return StaticQuickSorter.sort(getTextResourcesByProperty(aSegment, aProperty), aSortType);
}
@Override
public void fetchTextResource(final String id, Set addedDocuments, JSONArray data) throws ASResourceDataServiceException {
if (id.isEmpty() || addedDocuments.contains("TextResource" + id))
return;
try {
final TextResourceDocument textresource = _getModuleASResourceData().getTextResource(id);
addedDocuments.add("TextResource" + id);
JSONObject dataObject = new JSONObject();
String jsonObject = ObjectMapperUtil.getMapperInstance().writeValueAsString(textresource);
dataObject.put("object", jsonObject);
dataObject.put("service", "ASResourceData");
dataObject.put("document", "ASResourceData_TextResource");
data.put(dataObject);
} catch (JsonProcessingException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this TextResource instance object:" + e.getMessage());
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this TextResource instance in json :" + e.getMessage());
}
}
private void saveTransferredTextResource(final JSONObject data) throws ASResourceDataServiceException {
try {
String objectData = data.getString("object");
TextResource textresource = ObjectMapperUtil.getMapperInstance().readValue(objectData.getBytes(Charset.forName("UTF-8")), TextResourceDocument.class);
try {
updateTextResource(textresource);
} catch (Exception e) {
importTextResource(textresource);
}
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with getting data from json TextResource instance :" + e.getMessage());
} catch (IOException e) {
throw new ASResourceDataServiceException ("Problem with parsing data for this TextResource instance :" + e.getMessage());
}
}
// This method is not very fast, since it makes an update (eff. save) after each doc.
public void copyMultilingualAttributesInAllTextResources(String sourceLanguage, String targetLanguage){
List allDocumentsSrc = getTextResources();
List allDocuments = new ArrayList(allDocumentsSrc.size());
allDocuments.addAll(allDocumentsSrc);
for (TextResource document : allDocuments){
document.copyLANG2LANG(sourceLanguage, targetLanguage);
}
updateTextResources(allDocuments);
}
@SuppressWarnings("unchecked")
public List getLocalizationBundles(){
List localizationbundles = new ArrayList();
localizationbundles.addAll(_getModuleASResourceData().getLocalizationBundles());
return localizationbundles;
}
public List getLocalizationBundles(SortType sortType){
return StaticQuickSorter.sort(getLocalizationBundles(), sortType);
}
/**
* Returns the LocalizationBundle objects with the specified ids.
*/
public List getLocalizationBundles(List ids){;
if (ids==null || ids.size()==0)
return new ArrayList(0);
List all = getLocalizationBundles();
List ret = new ArrayList();
for (LocalizationBundle localizationbundle : all){
if(ids.contains(localizationbundle.getId())){
ret.add(localizationbundle);
}
}
return ret;
}
/**
* Returns the LocalizationBundle objects with the specified ids, sorted by given sorttype.
*/
public List getLocalizationBundles(List ids, SortType sortType){;
return StaticQuickSorter.sort(getLocalizationBundles(ids), sortType);
}
public void deleteLocalizationBundle(LocalizationBundle localizationbundle){
deleteLocalizationBundle(localizationbundle.getId());
if (hasServiceListeners()){
fireObjectDeletedEvent(localizationbundle);
}
}
public void deleteLocalizationBundle(String id){
ModuleASResourceData module = _getModuleASResourceData();
LocalizationBundle varValue = hasServiceListeners()?module.getLocalizationBundle(id):null;
module.deleteLocalizationBundle(id);
updateModule(module);
if(varValue!=null){
fireObjectDeletedEvent(varValue);
}
}
public void deleteLocalizationBundles(List list){
ModuleASResourceData module = _getModuleASResourceData();
for (LocalizationBundle localizationbundle : list){
module.deleteLocalizationBundle(localizationbundle.getId());
}
updateModule(module);
if (hasServiceListeners()){
for (int t=0; t importLocalizationBundles(List list){
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (LocalizationBundle localizationbundle : list){
LocalizationBundle imported = module.importLocalizationBundle((LocalizationBundleDocument)localizationbundle);
ret.add(imported);
}
updateModule(module);
if (hasServiceListeners()){
for (LocalizationBundle localizationbundle : ret)
fireObjectImportedEvent(localizationbundle);
}
return ret;
}
public LocalizationBundle createLocalizationBundle(LocalizationBundle localizationbundle){
ModuleASResourceData module = _getModuleASResourceData();
module.createLocalizationBundle((LocalizationBundleDocument)localizationbundle);
updateModule(module);
fireObjectCreatedEvent(localizationbundle);
return localizationbundle;
}
/**
* Creates multiple new LocalizationBundle objects.
* Returns the created versions.
*/
public List createLocalizationBundles(List list){;
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (LocalizationBundle localizationbundle : list){
LocalizationBundle created = module.createLocalizationBundle((LocalizationBundleDocument)localizationbundle);
ret.add(created);
}
updateModule(module);
if (hasServiceListeners()){
for (LocalizationBundle localizationbundle : ret)
fireObjectCreatedEvent(localizationbundle);
}
return ret;
}
public LocalizationBundle updateLocalizationBundle(LocalizationBundle localizationbundle){
LocalizationBundle oldVersion = null;
ModuleASResourceData module = _getModuleASResourceData();
if (hasServiceListeners())
oldVersion = module.getLocalizationBundle(localizationbundle.getId());
module.updateLocalizationBundle((LocalizationBundleDocument)localizationbundle);
updateModule(module);
if (oldVersion != null){
fireObjectUpdatedEvent(oldVersion, localizationbundle);
}
return localizationbundle;
}
public List updateLocalizationBundles(List list){
List oldList = null;
if (hasServiceListeners())
oldList = new ArrayList(list.size());
ModuleASResourceData module = _getModuleASResourceData();
for (LocalizationBundle localizationbundle : list){
if (oldList!=null)
oldList.add(module.getLocalizationBundle(localizationbundle.getId()));
module.updateLocalizationBundle((LocalizationBundleDocument)localizationbundle);
}
updateModule(module);
if (oldList!=null){
for (int t=0; t getLocalizationBundlesByProperty(String propertyName, Object value){
List allLocalizationBundles = getLocalizationBundles();
List ret = new ArrayList();
for (int i=0; i getLocalizationBundlesByProperty(String propertyName, Object value, SortType sortType){
return StaticQuickSorter.sort(getLocalizationBundlesByProperty(propertyName, value), sortType);
}
/**
* Executes a query on LocalizationBundles
*/
public QueryResult executeQueryOnLocalizationBundles(DocumentQuery query){
List allLocalizationBundles = getLocalizationBundles();
QueryResult result = new QueryResult();
for (int i=0; i partialResult = query.match(allLocalizationBundles.get(i));
result.add(partialResult);
}
return result;
}
/**
* Returns all LocalizationBundle objects, where property matches.
*/
public List getLocalizationBundlesByProperty(QueryProperty... property){
//first the slow version, the fast version is a todo.
List ret = new ArrayList();
List src = getLocalizationBundles();
for ( LocalizationBundle localizationbundle : src){;
boolean mayPass = true;
for (QueryProperty qp : property){;
mayPass = mayPass && qp.doesMatch(localizationbundle.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(localizationbundle);
}
return ret;
}
/**
* Returns all LocalizationBundle objects, where property matches, sorted
*/
public List getLocalizationBundlesByProperty(SortType sortType, QueryProperty... property){
return StaticQuickSorter.sort(getLocalizationBundlesByProperty(property), sortType);
}
/**
* Returns LocalizationBundle objects count.
*/
public int getLocalizationBundlesCount() {
return _getModuleASResourceData().getLocalizationBundles().size();
}
/**
* Returns LocalizationBundle objects segment.
*/
public List getLocalizationBundles(Segment aSegment) {
return Slicer.slice(aSegment, getLocalizationBundles()).getSliceData();
}
/**
* Returns LocalizationBundle objects segment, where property matched.
*/
public List getLocalizationBundlesByProperty(Segment aSegment, QueryProperty... property) {
int pLimit = aSegment.getElementsPerSlice();
int pOffset = aSegment.getSliceNumber() * aSegment.getElementsPerSlice() - aSegment.getElementsPerSlice();
List ret = new ArrayList();
List src = getLocalizationBundles();
for (LocalizationBundle localizationbundle : src) {;
boolean mayPass = true;
for (QueryProperty qp : property) {;
mayPass = mayPass && qp.doesMatch(localizationbundle.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(localizationbundle);
if (ret.size() > pOffset + pLimit)
break;
}
return Slicer.slice(aSegment, ret).getSliceData();
}
/**
* Returns LocalizationBundle objects segment, where property matched, sorted.
*/
public List getLocalizationBundlesByProperty(Segment aSegment, SortType aSortType, QueryProperty... aProperty){
return StaticQuickSorter.sort(getLocalizationBundlesByProperty(aSegment, aProperty), aSortType);
}
@Override
public void fetchLocalizationBundle(final String id, Set addedDocuments, JSONArray data) throws ASResourceDataServiceException {
if (id.isEmpty() || addedDocuments.contains("LocalizationBundle" + id))
return;
try {
final LocalizationBundleDocument localizationbundle = _getModuleASResourceData().getLocalizationBundle(id);
addedDocuments.add("LocalizationBundle" + id);
JSONObject dataObject = new JSONObject();
String jsonObject = ObjectMapperUtil.getMapperInstance().writeValueAsString(localizationbundle);
dataObject.put("object", jsonObject);
dataObject.put("service", "ASResourceData");
dataObject.put("document", "ASResourceData_LocalizationBundle");
data.put(dataObject);
} catch (JsonProcessingException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this LocalizationBundle instance object:" + e.getMessage());
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this LocalizationBundle instance in json :" + e.getMessage());
}
}
private void saveTransferredLocalizationBundle(final JSONObject data) throws ASResourceDataServiceException {
try {
String objectData = data.getString("object");
LocalizationBundle localizationbundle = ObjectMapperUtil.getMapperInstance().readValue(objectData.getBytes(Charset.forName("UTF-8")), LocalizationBundleDocument.class);
try {
updateLocalizationBundle(localizationbundle);
} catch (Exception e) {
importLocalizationBundle(localizationbundle);
}
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with getting data from json LocalizationBundle instance :" + e.getMessage());
} catch (IOException e) {
throw new ASResourceDataServiceException ("Problem with parsing data for this LocalizationBundle instance :" + e.getMessage());
}
}
// This method is not very fast, since it makes an update (eff. save) after each doc.
public void copyMultilingualAttributesInAllLocalizationBundles(String sourceLanguage, String targetLanguage){
List allDocumentsSrc = getLocalizationBundles();
List allDocuments = new ArrayList(allDocumentsSrc.size());
allDocuments.addAll(allDocumentsSrc);
for (LocalizationBundle document : allDocuments){
document.copyLANG2LANG(sourceLanguage, targetLanguage);
}
updateLocalizationBundles(allDocuments);
}
@SuppressWarnings("unchecked")
public List getMailTemplates(){
List mailtemplates = new ArrayList();
mailtemplates.addAll(_getModuleASResourceData().getMailTemplates());
return mailtemplates;
}
public List getMailTemplates(SortType sortType){
return StaticQuickSorter.sort(getMailTemplates(), sortType);
}
/**
* Returns the MailTemplate objects with the specified ids.
*/
public List getMailTemplates(List ids){;
if (ids==null || ids.size()==0)
return new ArrayList(0);
List all = getMailTemplates();
List ret = new ArrayList();
for (MailTemplate mailtemplate : all){
if(ids.contains(mailtemplate.getId())){
ret.add(mailtemplate);
}
}
return ret;
}
/**
* Returns the MailTemplate objects with the specified ids, sorted by given sorttype.
*/
public List getMailTemplates(List ids, SortType sortType){;
return StaticQuickSorter.sort(getMailTemplates(ids), sortType);
}
public void deleteMailTemplate(MailTemplate mailtemplate){
deleteMailTemplate(mailtemplate.getId());
if (hasServiceListeners()){
fireObjectDeletedEvent(mailtemplate);
}
}
public void deleteMailTemplate(String id){
ModuleASResourceData module = _getModuleASResourceData();
MailTemplate varValue = hasServiceListeners()?module.getMailTemplate(id):null;
module.deleteMailTemplate(id);
updateModule(module);
if(varValue!=null){
fireObjectDeletedEvent(varValue);
}
}
public void deleteMailTemplates(List list){
ModuleASResourceData module = _getModuleASResourceData();
for (MailTemplate mailtemplate : list){
module.deleteMailTemplate(mailtemplate.getId());
}
updateModule(module);
if (hasServiceListeners()){
for (int t=0; t importMailTemplates(List list){
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (MailTemplate mailtemplate : list){
MailTemplate imported = module.importMailTemplate((MailTemplateDocument)mailtemplate);
ret.add(imported);
}
updateModule(module);
if (hasServiceListeners()){
for (MailTemplate mailtemplate : ret)
fireObjectImportedEvent(mailtemplate);
}
return ret;
}
public MailTemplate createMailTemplate(MailTemplate mailtemplate){
ModuleASResourceData module = _getModuleASResourceData();
module.createMailTemplate((MailTemplateDocument)mailtemplate);
updateModule(module);
fireObjectCreatedEvent(mailtemplate);
return mailtemplate;
}
/**
* Creates multiple new MailTemplate objects.
* Returns the created versions.
*/
public List createMailTemplates(List list){;
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (MailTemplate mailtemplate : list){
MailTemplate created = module.createMailTemplate((MailTemplateDocument)mailtemplate);
ret.add(created);
}
updateModule(module);
if (hasServiceListeners()){
for (MailTemplate mailtemplate : ret)
fireObjectCreatedEvent(mailtemplate);
}
return ret;
}
public MailTemplate updateMailTemplate(MailTemplate mailtemplate){
MailTemplate oldVersion = null;
ModuleASResourceData module = _getModuleASResourceData();
if (hasServiceListeners())
oldVersion = module.getMailTemplate(mailtemplate.getId());
module.updateMailTemplate((MailTemplateDocument)mailtemplate);
updateModule(module);
if (oldVersion != null){
fireObjectUpdatedEvent(oldVersion, mailtemplate);
}
return mailtemplate;
}
public List updateMailTemplates(List list){
List oldList = null;
if (hasServiceListeners())
oldList = new ArrayList(list.size());
ModuleASResourceData module = _getModuleASResourceData();
for (MailTemplate mailtemplate : list){
if (oldList!=null)
oldList.add(module.getMailTemplate(mailtemplate.getId()));
module.updateMailTemplate((MailTemplateDocument)mailtemplate);
}
updateModule(module);
if (oldList!=null){
for (int t=0; t getMailTemplatesByProperty(String propertyName, Object value){
List allMailTemplates = getMailTemplates();
List ret = new ArrayList();
for (int i=0; i getMailTemplatesByProperty(String propertyName, Object value, SortType sortType){
return StaticQuickSorter.sort(getMailTemplatesByProperty(propertyName, value), sortType);
}
/**
* Executes a query on MailTemplates
*/
public QueryResult executeQueryOnMailTemplates(DocumentQuery query){
List allMailTemplates = getMailTemplates();
QueryResult result = new QueryResult();
for (int i=0; i partialResult = query.match(allMailTemplates.get(i));
result.add(partialResult);
}
return result;
}
/**
* Returns all MailTemplate objects, where property matches.
*/
public List getMailTemplatesByProperty(QueryProperty... property){
//first the slow version, the fast version is a todo.
List ret = new ArrayList();
List src = getMailTemplates();
for ( MailTemplate mailtemplate : src){;
boolean mayPass = true;
for (QueryProperty qp : property){;
mayPass = mayPass && qp.doesMatch(mailtemplate.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(mailtemplate);
}
return ret;
}
/**
* Returns all MailTemplate objects, where property matches, sorted
*/
public List getMailTemplatesByProperty(SortType sortType, QueryProperty... property){
return StaticQuickSorter.sort(getMailTemplatesByProperty(property), sortType);
}
/**
* Returns MailTemplate objects count.
*/
public int getMailTemplatesCount() {
return _getModuleASResourceData().getMailTemplates().size();
}
/**
* Returns MailTemplate objects segment.
*/
public List getMailTemplates(Segment aSegment) {
return Slicer.slice(aSegment, getMailTemplates()).getSliceData();
}
/**
* Returns MailTemplate objects segment, where property matched.
*/
public List getMailTemplatesByProperty(Segment aSegment, QueryProperty... property) {
int pLimit = aSegment.getElementsPerSlice();
int pOffset = aSegment.getSliceNumber() * aSegment.getElementsPerSlice() - aSegment.getElementsPerSlice();
List ret = new ArrayList();
List src = getMailTemplates();
for (MailTemplate mailtemplate : src) {;
boolean mayPass = true;
for (QueryProperty qp : property) {;
mayPass = mayPass && qp.doesMatch(mailtemplate.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(mailtemplate);
if (ret.size() > pOffset + pLimit)
break;
}
return Slicer.slice(aSegment, ret).getSliceData();
}
/**
* Returns MailTemplate objects segment, where property matched, sorted.
*/
public List getMailTemplatesByProperty(Segment aSegment, SortType aSortType, QueryProperty... aProperty){
return StaticQuickSorter.sort(getMailTemplatesByProperty(aSegment, aProperty), aSortType);
}
@Override
public void fetchMailTemplate(final String id, Set addedDocuments, JSONArray data) throws ASResourceDataServiceException {
if (id.isEmpty() || addedDocuments.contains("MailTemplate" + id))
return;
try {
final MailTemplateDocument mailtemplate = _getModuleASResourceData().getMailTemplate(id);
addedDocuments.add("MailTemplate" + id);
if (!mailtemplate.getLocalizations().isEmpty()) {
for (String aLocalizationsId: mailtemplate.getLocalizations()) {
getASResourceDataService().fetchLocalizationBundle(aLocalizationsId, addedDocuments, data);
}
}
JSONObject dataObject = new JSONObject();
String jsonObject = ObjectMapperUtil.getMapperInstance().writeValueAsString(mailtemplate);
dataObject.put("object", jsonObject);
dataObject.put("service", "ASResourceData");
dataObject.put("document", "ASResourceData_MailTemplate");
data.put(dataObject);
} catch (ASResourceDataServiceException e) {
throw new ASResourceDataServiceException("Problem with getting document from ASResourceData" + e.getMessage());
} catch (JsonProcessingException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this MailTemplate instance object:" + e.getMessage());
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this MailTemplate instance in json :" + e.getMessage());
}
}
private void saveTransferredMailTemplate(final JSONObject data) throws ASResourceDataServiceException {
try {
String objectData = data.getString("object");
MailTemplate mailtemplate = ObjectMapperUtil.getMapperInstance().readValue(objectData.getBytes(Charset.forName("UTF-8")), MailTemplateDocument.class);
try {
updateMailTemplate(mailtemplate);
} catch (Exception e) {
importMailTemplate(mailtemplate);
}
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with getting data from json MailTemplate instance :" + e.getMessage());
} catch (IOException e) {
throw new ASResourceDataServiceException ("Problem with parsing data for this MailTemplate instance :" + e.getMessage());
}
}
// This method is not very fast, since it makes an update (eff. save) after each doc.
public void copyMultilingualAttributesInAllMailTemplates(String sourceLanguage, String targetLanguage){
List allDocumentsSrc = getMailTemplates();
List allDocuments = new ArrayList(allDocumentsSrc.size());
allDocuments.addAll(allDocumentsSrc);
for (MailTemplate document : allDocuments){
document.copyLANG2LANG(sourceLanguage, targetLanguage);
}
updateMailTemplates(allDocuments);
}
@SuppressWarnings("unchecked")
public List getImages(){
List images = new ArrayList();
images.addAll(_getModuleASResourceData().getImages());
return images;
}
public List getImages(SortType sortType){
return StaticQuickSorter.sort(getImages(), sortType);
}
/**
* Returns the Image objects with the specified ids.
*/
public List getImages(List ids){;
if (ids==null || ids.size()==0)
return new ArrayList(0);
List all = getImages();
List ret = new ArrayList();
for (Image image : all){
if(ids.contains(image.getId())){
ret.add(image);
}
}
return ret;
}
/**
* Returns the Image objects with the specified ids, sorted by given sorttype.
*/
public List getImages(List ids, SortType sortType){;
return StaticQuickSorter.sort(getImages(ids), sortType);
}
public void deleteImage(Image image){
deleteImage(image.getId());
if (hasServiceListeners()){
fireObjectDeletedEvent(image);
}
}
public void deleteImage(String id){
ModuleASResourceData module = _getModuleASResourceData();
Image varValue = hasServiceListeners()?module.getImage(id):null;
module.deleteImage(id);
updateModule(module);
if(varValue!=null){
fireObjectDeletedEvent(varValue);
}
}
public void deleteImages(List list){
ModuleASResourceData module = _getModuleASResourceData();
for (Image image : list){
module.deleteImage(image.getId());
}
updateModule(module);
if (hasServiceListeners()){
for (int t=0; t importImages(List list){
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (Image image : list){
Image imported = module.importImage((ImageDocument)image);
ret.add(imported);
}
updateModule(module);
if (hasServiceListeners()){
for (Image image : ret)
fireObjectImportedEvent(image);
}
return ret;
}
public Image createImage(Image image){
ModuleASResourceData module = _getModuleASResourceData();
module.createImage((ImageDocument)image);
updateModule(module);
fireObjectCreatedEvent(image);
return image;
}
/**
* Creates multiple new Image objects.
* Returns the created versions.
*/
public List createImages(List list){;
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (Image image : list){
Image created = module.createImage((ImageDocument)image);
ret.add(created);
}
updateModule(module);
if (hasServiceListeners()){
for (Image image : ret)
fireObjectCreatedEvent(image);
}
return ret;
}
public Image updateImage(Image image){
Image oldVersion = null;
ModuleASResourceData module = _getModuleASResourceData();
if (hasServiceListeners())
oldVersion = module.getImage(image.getId());
module.updateImage((ImageDocument)image);
updateModule(module);
if (oldVersion != null){
fireObjectUpdatedEvent(oldVersion, image);
}
return image;
}
public List updateImages(List list){
List oldList = null;
if (hasServiceListeners())
oldList = new ArrayList(list.size());
ModuleASResourceData module = _getModuleASResourceData();
for (Image image : list){
if (oldList!=null)
oldList.add(module.getImage(image.getId()));
module.updateImage((ImageDocument)image);
}
updateModule(module);
if (oldList!=null){
for (int t=0; t getImagesByProperty(String propertyName, Object value){
List allImages = getImages();
List ret = new ArrayList();
for (int i=0; i getImagesByProperty(String propertyName, Object value, SortType sortType){
return StaticQuickSorter.sort(getImagesByProperty(propertyName, value), sortType);
}
/**
* Executes a query on Images
*/
public QueryResult executeQueryOnImages(DocumentQuery query){
List allImages = getImages();
QueryResult result = new QueryResult();
for (int i=0; i partialResult = query.match(allImages.get(i));
result.add(partialResult);
}
return result;
}
/**
* Returns all Image objects, where property matches.
*/
public List getImagesByProperty(QueryProperty... property){
//first the slow version, the fast version is a todo.
List ret = new ArrayList();
List src = getImages();
for ( Image image : src){;
boolean mayPass = true;
for (QueryProperty qp : property){;
mayPass = mayPass && qp.doesMatch(image.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(image);
}
return ret;
}
/**
* Returns all Image objects, where property matches, sorted
*/
public List getImagesByProperty(SortType sortType, QueryProperty... property){
return StaticQuickSorter.sort(getImagesByProperty(property), sortType);
}
/**
* Returns Image objects count.
*/
public int getImagesCount() {
return _getModuleASResourceData().getImages().size();
}
/**
* Returns Image objects segment.
*/
public List getImages(Segment aSegment) {
return Slicer.slice(aSegment, getImages()).getSliceData();
}
/**
* Returns Image objects segment, where property matched.
*/
public List getImagesByProperty(Segment aSegment, QueryProperty... property) {
int pLimit = aSegment.getElementsPerSlice();
int pOffset = aSegment.getSliceNumber() * aSegment.getElementsPerSlice() - aSegment.getElementsPerSlice();
List ret = new ArrayList();
List src = getImages();
for (Image image : src) {;
boolean mayPass = true;
for (QueryProperty qp : property) {;
mayPass = mayPass && qp.doesMatch(image.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(image);
if (ret.size() > pOffset + pLimit)
break;
}
return Slicer.slice(aSegment, ret).getSliceData();
}
/**
* Returns Image objects segment, where property matched, sorted.
*/
public List getImagesByProperty(Segment aSegment, SortType aSortType, QueryProperty... aProperty){
return StaticQuickSorter.sort(getImagesByProperty(aSegment, aProperty), aSortType);
}
@Override
public void fetchImage(final String id, Set addedDocuments, JSONArray data) throws ASResourceDataServiceException {
if (id.isEmpty() || addedDocuments.contains("Image" + id))
return;
try {
final ImageDocument image = _getModuleASResourceData().getImage(id);
addedDocuments.add("Image" + id);
JSONObject dataObject = new JSONObject();
String jsonObject = ObjectMapperUtil.getMapperInstance().writeValueAsString(image);
dataObject.put("object", jsonObject);
dataObject.put("service", "ASResourceData");
dataObject.put("document", "ASResourceData_Image");
data.put(dataObject);
} catch (JsonProcessingException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this Image instance object:" + e.getMessage());
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this Image instance in json :" + e.getMessage());
}
}
private void saveTransferredImage(final JSONObject data) throws ASResourceDataServiceException {
try {
String objectData = data.getString("object");
Image image = ObjectMapperUtil.getMapperInstance().readValue(objectData.getBytes(Charset.forName("UTF-8")), ImageDocument.class);
try {
updateImage(image);
} catch (Exception e) {
importImage(image);
}
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with getting data from json Image instance :" + e.getMessage());
} catch (IOException e) {
throw new ASResourceDataServiceException ("Problem with parsing data for this Image instance :" + e.getMessage());
}
}
// This method is not very fast, since it makes an update (eff. save) after each doc.
public void copyMultilingualAttributesInAllImages(String sourceLanguage, String targetLanguage){
List allDocumentsSrc = getImages();
List allDocuments = new ArrayList(allDocumentsSrc.size());
allDocuments.addAll(allDocumentsSrc);
for (Image document : allDocuments){
document.copyLANG2LANG(sourceLanguage, targetLanguage);
}
updateImages(allDocuments);
}
@SuppressWarnings("unchecked")
public List getFileLinks(){
List filelinks = new ArrayList();
filelinks.addAll(_getModuleASResourceData().getFileLinks());
return filelinks;
}
public List getFileLinks(SortType sortType){
return StaticQuickSorter.sort(getFileLinks(), sortType);
}
/**
* Returns the FileLink objects with the specified ids.
*/
public List getFileLinks(List ids){;
if (ids==null || ids.size()==0)
return new ArrayList(0);
List all = getFileLinks();
List ret = new ArrayList();
for (FileLink filelink : all){
if(ids.contains(filelink.getId())){
ret.add(filelink);
}
}
return ret;
}
/**
* Returns the FileLink objects with the specified ids, sorted by given sorttype.
*/
public List getFileLinks(List ids, SortType sortType){;
return StaticQuickSorter.sort(getFileLinks(ids), sortType);
}
public void deleteFileLink(FileLink filelink){
deleteFileLink(filelink.getId());
if (hasServiceListeners()){
fireObjectDeletedEvent(filelink);
}
}
public void deleteFileLink(String id){
ModuleASResourceData module = _getModuleASResourceData();
FileLink varValue = hasServiceListeners()?module.getFileLink(id):null;
module.deleteFileLink(id);
updateModule(module);
if(varValue!=null){
fireObjectDeletedEvent(varValue);
}
}
public void deleteFileLinks(List list){
ModuleASResourceData module = _getModuleASResourceData();
for (FileLink filelink : list){
module.deleteFileLink(filelink.getId());
}
updateModule(module);
if (hasServiceListeners()){
for (int t=0; t importFileLinks(List list){
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (FileLink filelink : list){
FileLink imported = module.importFileLink((FileLinkDocument)filelink);
ret.add(imported);
}
updateModule(module);
if (hasServiceListeners()){
for (FileLink filelink : ret)
fireObjectImportedEvent(filelink);
}
return ret;
}
public FileLink createFileLink(FileLink filelink){
ModuleASResourceData module = _getModuleASResourceData();
module.createFileLink((FileLinkDocument)filelink);
updateModule(module);
fireObjectCreatedEvent(filelink);
return filelink;
}
/**
* Creates multiple new FileLink objects.
* Returns the created versions.
*/
public List createFileLinks(List list){;
ModuleASResourceData module = _getModuleASResourceData();
List ret = new ArrayList();
for (FileLink filelink : list){
FileLink created = module.createFileLink((FileLinkDocument)filelink);
ret.add(created);
}
updateModule(module);
if (hasServiceListeners()){
for (FileLink filelink : ret)
fireObjectCreatedEvent(filelink);
}
return ret;
}
public FileLink updateFileLink(FileLink filelink){
FileLink oldVersion = null;
ModuleASResourceData module = _getModuleASResourceData();
if (hasServiceListeners())
oldVersion = module.getFileLink(filelink.getId());
module.updateFileLink((FileLinkDocument)filelink);
updateModule(module);
if (oldVersion != null){
fireObjectUpdatedEvent(oldVersion, filelink);
}
return filelink;
}
public List updateFileLinks(List list){
List oldList = null;
if (hasServiceListeners())
oldList = new ArrayList(list.size());
ModuleASResourceData module = _getModuleASResourceData();
for (FileLink filelink : list){
if (oldList!=null)
oldList.add(module.getFileLink(filelink.getId()));
module.updateFileLink((FileLinkDocument)filelink);
}
updateModule(module);
if (oldList!=null){
for (int t=0; t getFileLinksByProperty(String propertyName, Object value){
List allFileLinks = getFileLinks();
List ret = new ArrayList();
for (int i=0; i getFileLinksByProperty(String propertyName, Object value, SortType sortType){
return StaticQuickSorter.sort(getFileLinksByProperty(propertyName, value), sortType);
}
/**
* Executes a query on FileLinks
*/
public QueryResult executeQueryOnFileLinks(DocumentQuery query){
List allFileLinks = getFileLinks();
QueryResult result = new QueryResult();
for (int i=0; i partialResult = query.match(allFileLinks.get(i));
result.add(partialResult);
}
return result;
}
/**
* Returns all FileLink objects, where property matches.
*/
public List getFileLinksByProperty(QueryProperty... property){
//first the slow version, the fast version is a todo.
List ret = new ArrayList();
List src = getFileLinks();
for ( FileLink filelink : src){;
boolean mayPass = true;
for (QueryProperty qp : property){;
mayPass = mayPass && qp.doesMatch(filelink.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(filelink);
}
return ret;
}
/**
* Returns all FileLink objects, where property matches, sorted
*/
public List getFileLinksByProperty(SortType sortType, QueryProperty... property){
return StaticQuickSorter.sort(getFileLinksByProperty(property), sortType);
}
/**
* Returns FileLink objects count.
*/
public int getFileLinksCount() {
return _getModuleASResourceData().getFileLinks().size();
}
/**
* Returns FileLink objects segment.
*/
public List getFileLinks(Segment aSegment) {
return Slicer.slice(aSegment, getFileLinks()).getSliceData();
}
/**
* Returns FileLink objects segment, where property matched.
*/
public List getFileLinksByProperty(Segment aSegment, QueryProperty... property) {
int pLimit = aSegment.getElementsPerSlice();
int pOffset = aSegment.getSliceNumber() * aSegment.getElementsPerSlice() - aSegment.getElementsPerSlice();
List ret = new ArrayList();
List src = getFileLinks();
for (FileLink filelink : src) {;
boolean mayPass = true;
for (QueryProperty qp : property) {;
mayPass = mayPass && qp.doesMatch(filelink.getPropertyValue(qp.getName()));
}
if (mayPass)
ret.add(filelink);
if (ret.size() > pOffset + pLimit)
break;
}
return Slicer.slice(aSegment, ret).getSliceData();
}
/**
* Returns FileLink objects segment, where property matched, sorted.
*/
public List getFileLinksByProperty(Segment aSegment, SortType aSortType, QueryProperty... aProperty){
return StaticQuickSorter.sort(getFileLinksByProperty(aSegment, aProperty), aSortType);
}
@Override
public void fetchFileLink(final String id, Set addedDocuments, JSONArray data) throws ASResourceDataServiceException {
if (id.isEmpty() || addedDocuments.contains("FileLink" + id))
return;
try {
final FileLinkDocument filelink = _getModuleASResourceData().getFileLink(id);
addedDocuments.add("FileLink" + id);
JSONObject dataObject = new JSONObject();
String jsonObject = ObjectMapperUtil.getMapperInstance().writeValueAsString(filelink);
dataObject.put("object", jsonObject);
dataObject.put("service", "ASResourceData");
dataObject.put("document", "ASResourceData_FileLink");
data.put(dataObject);
} catch (JsonProcessingException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this FileLink instance object:" + e.getMessage());
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with fetching data for this FileLink instance in json :" + e.getMessage());
}
}
private void saveTransferredFileLink(final JSONObject data) throws ASResourceDataServiceException {
try {
String objectData = data.getString("object");
FileLink filelink = ObjectMapperUtil.getMapperInstance().readValue(objectData.getBytes(Charset.forName("UTF-8")), FileLinkDocument.class);
try {
updateFileLink(filelink);
} catch (Exception e) {
importFileLink(filelink);
}
} catch (JSONException e) {
throw new ASResourceDataServiceException ("Problem with getting data from json FileLink instance :" + e.getMessage());
} catch (IOException e) {
throw new ASResourceDataServiceException ("Problem with parsing data for this FileLink instance :" + e.getMessage());
}
}
public void executeParsingForDocument (final DocumentName documentName, final JSONObject data) throws ASResourceDataServiceException {
switch(documentName) {
case DOCUMENT_ASRESOURCEDATA_TEXTRESOURCE:
saveTransferredTextResource(data);
break;
case DOCUMENT_ASRESOURCEDATA_LOCALIZATIONBUNDLE:
saveTransferredLocalizationBundle(data);
break;
case DOCUMENT_ASRESOURCEDATA_MAILTEMPLATE:
saveTransferredMailTemplate(data);
break;
case DOCUMENT_ASRESOURCEDATA_IMAGE:
saveTransferredImage(data);
break;
case DOCUMENT_ASRESOURCEDATA_FILELINK:
saveTransferredFileLink(data);
break;
default:
log.info("There is no correct document: " + documentName + "in this service");
throw new ASResourceDataServiceException("No such document");
}
}
/**
* Copies all multilingual fields from sourceLanguage to targetLanguage in all data objects (documents, vo) which are part of this module and managed by this service
*/
public void copyMultilingualAttributesInAllObjects(String sourceLanguage, String targetLanguage){
copyMultilingualAttributesInAllTextResources(sourceLanguage, targetLanguage);
copyMultilingualAttributesInAllLocalizationBundles(sourceLanguage, targetLanguage);
copyMultilingualAttributesInAllMailTemplates(sourceLanguage, targetLanguage);
copyMultilingualAttributesInAllImages(sourceLanguage, targetLanguage);
}
/**
* Executes a query on all data objects (documents, vo) which are part of this module and managed by this service
*/
public QueryResult executeQueryOnAllObjects(DocumentQuery query){
QueryResult ret = new QueryResult();
ret.add(executeQueryOnTextResources(query).getEntries());
ret.add(executeQueryOnLocalizationBundles(query).getEntries());
ret.add(executeQueryOnMailTemplates(query).getEntries());
ret.add(executeQueryOnImages(query).getEntries());
ret.add(executeQueryOnFileLinks(query).getEntries());
return ret;
} //executeQueryOnAllObjects
public XMLNode exportTextResourcesToXML(){;
XMLNode ret = new XMLNode("TextResources");
List list = getTextResources();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (TextResource object : list)
ret.addChildNode(TextResourceXMLHelper.toXML(object));
return ret;
}
public XMLNode exportTextResourcesToXML(List list){;
XMLNode ret = new XMLNode("TextResources");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (TextResource object : list)
ret.addChildNode(TextResourceXMLHelper.toXML(object));
return ret;
}
public XMLNode exportTextResourcesToXML(String[] languages){;
XMLNode ret = new XMLNode("TextResources");
List list = getTextResources();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (TextResource object : list)
ret.addChildNode(TextResourceXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportTextResourcesToXML(String[] languages, List list){;
XMLNode ret = new XMLNode("TextResources");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (TextResource object : list)
ret.addChildNode(TextResourceXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportLocalizationBundlesToXML(){;
XMLNode ret = new XMLNode("LocalizationBundles");
List list = getLocalizationBundles();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (LocalizationBundle object : list)
ret.addChildNode(LocalizationBundleXMLHelper.toXML(object));
return ret;
}
public XMLNode exportLocalizationBundlesToXML(List list){;
XMLNode ret = new XMLNode("LocalizationBundles");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (LocalizationBundle object : list)
ret.addChildNode(LocalizationBundleXMLHelper.toXML(object));
return ret;
}
public XMLNode exportLocalizationBundlesToXML(String[] languages){;
XMLNode ret = new XMLNode("LocalizationBundles");
List list = getLocalizationBundles();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (LocalizationBundle object : list)
ret.addChildNode(LocalizationBundleXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportLocalizationBundlesToXML(String[] languages, List list){;
XMLNode ret = new XMLNode("LocalizationBundles");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (LocalizationBundle object : list)
ret.addChildNode(LocalizationBundleXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportMailTemplatesToXML(){;
XMLNode ret = new XMLNode("MailTemplates");
List list = getMailTemplates();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (MailTemplate object : list)
ret.addChildNode(MailTemplateXMLHelper.toXML(object));
return ret;
}
public XMLNode exportMailTemplatesToXML(List list){;
XMLNode ret = new XMLNode("MailTemplates");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (MailTemplate object : list)
ret.addChildNode(MailTemplateXMLHelper.toXML(object));
return ret;
}
public XMLNode exportMailTemplatesToXML(String[] languages){;
XMLNode ret = new XMLNode("MailTemplates");
List list = getMailTemplates();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (MailTemplate object : list)
ret.addChildNode(MailTemplateXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportMailTemplatesToXML(String[] languages, List list){;
XMLNode ret = new XMLNode("MailTemplates");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (MailTemplate object : list)
ret.addChildNode(MailTemplateXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportImagesToXML(){;
XMLNode ret = new XMLNode("Images");
List list = getImages();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (Image object : list)
ret.addChildNode(ImageXMLHelper.toXML(object));
return ret;
}
public XMLNode exportImagesToXML(List list){;
XMLNode ret = new XMLNode("Images");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (Image object : list)
ret.addChildNode(ImageXMLHelper.toXML(object));
return ret;
}
public XMLNode exportImagesToXML(String[] languages){;
XMLNode ret = new XMLNode("Images");
List list = getImages();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (Image object : list)
ret.addChildNode(ImageXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportImagesToXML(String[] languages, List list){;
XMLNode ret = new XMLNode("Images");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (Image object : list)
ret.addChildNode(ImageXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportFileLinksToXML(){;
XMLNode ret = new XMLNode("FileLinks");
List list = getFileLinks();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (FileLink object : list)
ret.addChildNode(FileLinkXMLHelper.toXML(object));
return ret;
}
public XMLNode exportFileLinksToXML(List list){;
XMLNode ret = new XMLNode("FileLinks");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (FileLink object : list)
ret.addChildNode(FileLinkXMLHelper.toXML(object));
return ret;
}
public XMLNode exportFileLinksToXML(String[] languages){;
XMLNode ret = new XMLNode("FileLinks");
List list = getFileLinks();
ret.addAttribute(new XMLAttribute("count", list.size()));
for (FileLink object : list)
ret.addChildNode(FileLinkXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportFileLinksToXML(String[] languages, List list){;
XMLNode ret = new XMLNode("FileLinks");
ret.addAttribute(new XMLAttribute("count", list.size()));
for (FileLink object : list)
ret.addChildNode(FileLinkXMLHelper.toXML(object, languages));
return ret;
}
public XMLNode exportToXML(){
XMLNode ret = new XMLNode("ASResourceData");
ret.addChildNode(exportTextResourcesToXML());
ret.addChildNode(exportLocalizationBundlesToXML());
ret.addChildNode(exportMailTemplatesToXML());
ret.addChildNode(exportImagesToXML());
ret.addChildNode(exportFileLinksToXML());
return ret;
}
public XMLNode exportToXML(String[] languages){
XMLNode ret = new XMLNode("ASResourceData");
ret.addChildNode(exportTextResourcesToXML(languages));
ret.addChildNode(exportLocalizationBundlesToXML(languages));
ret.addChildNode(exportMailTemplatesToXML(languages));
ret.addChildNode(exportImagesToXML(languages));
ret.addChildNode(exportFileLinksToXML(languages));
return ret;
}
}