All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.anotheria.anosite.gen.shared.service.AnositeLanguageUtils Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/**
 ********************************************************************************
 *** AnositeLanguageUtils.java                                                ***
 *** generated by AnoSiteGenerator (ASG), Version: 3.2.2                      ***
 *** Copyright (C) 2005 - 2023 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.shared.service;

import java.util.List;
import java.util.Arrays;
import net.anotheria.anosite.gen.aswebdata.service.ASWebDataServiceFactory;
import net.anotheria.anosite.gen.assitedata.service.ASSiteDataServiceFactory;
import net.anotheria.anosite.gen.images.service.ImagesServiceFactory;
import net.anotheria.anosite.gen.asresourcedata.service.ASResourceDataServiceFactory;

public class AnositeLanguageUtils{


	private static final List supportedLanguages = Arrays.asList(new String[]{
		"EN",
		"DE",
	});

	public static List getSupportedLanguages(){
		return supportedLanguages;
	}

	public static void copyAttributesFromLanguage2Language(String sourceLang, String targetLanguage){
	}

	public static void main(String[] a) throws Exception{
		String sourceLang, targetLang;
		if (a.length!=2)
			throw new RuntimeException("Wrong number of arguments, please use AnositeLanguageUtils sourcelanguage targetlanguage");
		sourceLang = a[0].toUpperCase();
		checkParameter(sourceLang);
		targetLang = a[1].toUpperCase();
		checkParameter(targetLang);

		copy(sourceLang, targetLang);
	}

	private static void checkParameter(String lang){
		if (supportedLanguages.indexOf(lang)==-1)
			throw new RuntimeException("Language "+lang+"not supported");
	}

	private static void copy(String sourceLanguage, String targetLanguage) throws Exception {
		//initialize and copy
		System.out.println("Working on ASWebDataService");
		ASWebDataServiceFactory.createASWebDataService().copyMultilingualAttributesInAllObjects(sourceLanguage, targetLanguage);
		System.out.println("Working on ASSiteDataService");
		ASSiteDataServiceFactory.createASSiteDataService().copyMultilingualAttributesInAllObjects(sourceLanguage, targetLanguage);
		System.out.println("Working on ImagesService");
		ImagesServiceFactory.createImagesService().copyMultilingualAttributesInAllObjects(sourceLanguage, targetLanguage);
		System.out.println("Working on ASResourceDataService");
		ASResourceDataServiceFactory.createASResourceDataService().copyMultilingualAttributesInAllObjects(sourceLanguage, targetLanguage);

	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy