1 /*
2 * Copyright 2012-2025 CodeLibs Project and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.codelibs.fess.mylasta.direction.sponsor;
17
18 import java.util.Locale;
19
20 import org.dbflute.jdbc.ClassificationMeta;
21 import org.dbflute.optional.OptionalObject;
22 import org.dbflute.optional.OptionalThing;
23 import org.lastaflute.db.dbflute.classification.ListedClassificationProvider;
24 import org.lastaflute.db.dbflute.exception.ProvidedClassificationNotFoundException;
25
26 /**
27 * The provider of listed classification.
28 *
29 * @author jflute
30 */
31 public class FessListedClassificationProvider implements ListedClassificationProvider {
32
33 @Override
34 public ClassificationMeta provide(final String classificationName) throws ProvidedClassificationNotFoundException {
35 final ClassificationMeta onMainSchema = findOnMainSchema(classificationName);
36 if (onMainSchema == null) {
37 final String msg = "Not found the classification: " + classificationName;
38 throw new ProvidedClassificationNotFoundException(msg);
39 }
40 return onMainSchema;
41 }
42
43 protected ClassificationMeta findOnMainSchema(final String classificationName) throws ProvidedClassificationNotFoundException {
44 // *no use DBFlute classification
45 return null;
46 //String searchName = classificationName;
47 //if (classificationName.contains(".")) {
48 // final String dbName = Srl.substringFirstFront(classificationName, ".");
49 // if (dbName.equals(DBCurrent.getInstance().projectName())) {
50 // searchName = Srl.substringFirstRear(classificationName, ".");
51 // } else {
52 // return null;
53 // }
54 //}
55 //try {
56 // return CDef.DefMeta.valueOf(searchName);
57 //} catch (IllegalArgumentException ignored) { // not found
58 // return null; // handled later
59 //}
60 }
61
62 @Override
63 public OptionalThing<String> determineAlias(final Locale locale) {
64 return OptionalObject.empty();
65 }
66 }